20 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/TrackToL1ObjMatcher.h" |
21 |
|
#include "DataFormats/RPCDigi/interface/RPCRawSynchro.h" |
22 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/ConverterRPCRawSynchroSynchroCountsObj.h" |
23 |
< |
|
23 |
> |
#include "UserCode/L1RpcTriggerAnalysis/interface/TriggerMenuResultObj.h" |
24 |
|
|
25 |
|
#include "TFile.h" |
26 |
|
#include "TTree.h" |
27 |
|
|
28 |
+ |
#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h" |
29 |
+ |
#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCand.h" |
30 |
+ |
#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTExtendedCand.h" |
31 |
+ |
#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h" |
32 |
+ |
|
33 |
|
template <class T> T sqr( T t) {return t*t;} |
34 |
|
|
35 |
|
|
36 |
|
L1RpcTreeMaker::L1RpcTreeMaker(const edm::ParameterSet& cfg) |
37 |
< |
: theConfig(cfg), theTree(0), event(0), muon(0), track(0), counts(0), |
38 |
< |
l1RpcColl(0) , l1OtherColl(0), l1RpcCollEmu(0), |
37 |
> |
: theConfig(cfg), theTree(0), event(0), muon(0), track(0), |
38 |
> |
bitsL1(0), bitsHLT(0), |
39 |
> |
counts(0), |
40 |
> |
l1RpcColl(0) , l1OtherColl(0), l1RpcCollEmu(0), l1GmtColl(0), |
41 |
|
theCounter(0), |
42 |
|
theBestMuonFinder(cfg.getParameter<edm::ParameterSet>("bestMuonFinder")), |
43 |
|
theDetHitCollector(cfg.getParameter<edm::ParameterSet>("detHitCollector")), |
44 |
< |
theSynchroGrabber(cfg.getParameter<edm::ParameterSet>("linkSynchroGrabber")) |
44 |
> |
theSynchroGrabber(cfg.getParameter<edm::ParameterSet>("linkSynchroGrabber")), |
45 |
> |
theMenuInspector(edm::ParameterSet()) |
46 |
|
{ } |
47 |
|
|
48 |
< |
void L1RpcTreeMaker::beginRun( const edm::Run &ru, const edm::EventSetup &es) |
48 |
> |
void L1RpcTreeMaker::beginRun(const edm::Run &ru, const edm::EventSetup &es) |
49 |
|
{ |
50 |
+ |
std::cout <<" L1RpcTreeMaker::beginRun CALLED" << std::endl; |
51 |
+ |
theMenuInspector.checkRun(ru,es); |
52 |
|
} |
53 |
|
|
54 |
|
void L1RpcTreeMaker::beginJob() |
60 |
|
theTree->Branch("muon","MuonObj",&muon,32000,99); |
61 |
|
theTree->Branch("track", "TrackObj",&track,32000,99); |
62 |
|
|
63 |
+ |
theTree->Branch("bitsL1" ,"TriggerMenuResultObj",&bitsL1 ,32000,99); |
64 |
+ |
theTree->Branch("bitsHLT","TriggerMenuResultObj",&bitsHLT,32000,99); |
65 |
+ |
|
66 |
|
theTree->Branch("counts",&counts); |
67 |
|
theTree->Branch("detsCrossedByMuon",&detsCrossedByMuon); |
68 |
|
theTree->Branch("detsCrossedByMuonDeepInside",&detsCrossedByMuonDeepInside); |
69 |
|
theTree->Branch("detsHitsCompatibleWithMuon",&detsHitsCompatibleWithMuon); |
70 |
|
theTree->Branch("detsSIMU",&detsSIMU); |
58 |
– |
theTree->Branch("nDigisCompDets",&nDigisCompDets); |
59 |
– |
theTree->Branch("clSizeCompDets",&clSizeCompDets); |
71 |
|
|
72 |
|
theTree->Branch("l1RpcColl","L1ObjColl",&l1RpcColl,32000,99); |
73 |
|
theTree->Branch("l1RpcCollEmu","L1ObjColl",&l1RpcCollEmu,32000,99); |
74 |
|
theTree->Branch("l1OtherColl","L1ObjColl",&l1OtherColl,32000,99); |
75 |
+ |
theTree->Branch("l1GmtColl","L1ObjColl",&l1GmtColl,32000,99); |
76 |
|
|
77 |
|
theHelper.SetOwner(); |
78 |
|
theBestMuonFinder.initHistos(theHelper); |
98 |
|
|
99 |
|
void L1RpcTreeMaker::analyze(const edm::Event &ev, const edm::EventSetup &es) |
100 |
|
{ |
89 |
– |
|
90 |
– |
|
101 |
|
// |
102 |
|
// check reference muon |
103 |
|
// |
121 |
|
// |
122 |
|
muon = new MuonObj(); |
123 |
|
track = new TrackObj(); |
124 |
< |
// counts = new SynchroCountsObjVect; |
124 |
> |
|
125 |
> |
bitsL1 = new TriggerMenuResultObj(); |
126 |
> |
bitsHLT = new TriggerMenuResultObj(); |
127 |
> |
|
128 |
|
counts = std::vector<SynchroCountsObj>(); |
129 |
|
detsCrossedByMuon = std::vector<uint32_t>(); |
130 |
|
detsCrossedByMuonDeepInside = std::vector<uint32_t>(); |
131 |
< |
detsHitsCompatibleWithMuon = std::vector<uint32_t>(); |
131 |
> |
detsHitsCompatibleWithMuon = std::vector<DetCluDigiObj>(); |
132 |
|
detsSIMU = std::vector<uint32_t>(); |
133 |
< |
nDigisCompDets = std::vector<uint32_t>(); |
121 |
< |
clSizeCompDets = std::vector<uint32_t>(); |
133 |
> |
|
134 |
|
l1RpcColl = new L1ObjColl; |
135 |
|
l1OtherColl = new L1ObjColl; |
136 |
|
l1RpcCollEmu = new L1ObjColl; |
137 |
+ |
l1GmtColl = new L1ObjColl; |
138 |
|
|
139 |
|
// |
140 |
|
// fill muon info |
150 |
|
} else muon->nRPCHits = muon->nDTHits = muon->nCSCHits = 0; |
151 |
|
muon->nTrackerHits = theMuon->isTrackerMuon() ? (theMuon->innerTrack())->hitPattern().numberOfValidTrackerHits() : 0; |
152 |
|
|
153 |
+ |
// |
154 |
+ |
// fill algoBits info |
155 |
+ |
// |
156 |
+ |
static edm::RunNumber_t lastRun = 0; |
157 |
+ |
if (ev.run() != lastRun) { |
158 |
+ |
lastRun = ev.run(); |
159 |
+ |
bitsL1->names = theMenuInspector.namesAlgoL1(); |
160 |
+ |
bitsHLT->names = theMenuInspector.namesAlgoHLT(); |
161 |
+ |
} |
162 |
+ |
bitsL1->firedAlgos = theMenuInspector.firedAlgosL1(ev,es); |
163 |
+ |
bitsHLT->firedAlgos = theMenuInspector.firedAlgosHLT(ev,es); |
164 |
+ |
|
165 |
|
|
166 |
|
// |
167 |
|
// hits and detectors compatible with muon track |
168 |
|
// |
169 |
|
if ( muon->pt() > 10.) { |
170 |
< |
detsHitsCompatibleWithMuon = theDetHitCollector.compatibleHits( theMuon, ev, es); |
170 |
> |
detsHitsCompatibleWithMuon = theDetHitCollector.compatibleHits( theMuon, ev, es); |
171 |
|
detsCrossedByMuon = theDetHitCollector.compatibleDets( theMuon, ev, es, false); |
172 |
|
detsCrossedByMuonDeepInside = theDetHitCollector.compatibleDets( theMuon, ev, es, true); |
173 |
|
if (theConfig.getParameter<bool>("checkDestSIMU")) detsSIMU = theDetHitCollector.compatibleSIMU( theMuon, ev, es); |
149 |
– |
nDigisCompDets = theDetHitCollector.nDigisCompDets(detsHitsCompatibleWithMuon, ev, es); |
150 |
– |
clSizeCompDets = theDetHitCollector.clSizeCompDets(detsHitsCompatibleWithMuon, ev, es); |
151 |
– |
|
152 |
– |
for (uint32_t i=0; i< nDigisCompDets.size(); i++) { |
153 |
– |
if (clSizeCompDets[i] > nDigisCompDets[i]) std::cout <<" PROBLEM, event: "<<theCounter<<" cl:"<<clSizeCompDets[i]<<" nDigis:"<<nDigisCompDets[i]<<std::endl; |
154 |
– |
} |
174 |
|
} |
175 |
|
|
176 |
|
|
185 |
|
// |
186 |
|
// fill L1 RPCemu |
187 |
|
// |
188 |
< |
if (theConfig.exists("l1RpcEmu") ) { |
188 |
> |
if (theConfig.exists("l1RpcEmu")) { |
189 |
|
TrackToL1ObjMatcher matcher(theConfig.getParameter<edm::ParameterSet>("matcherPSet")); |
190 |
|
L1ObjMakerRpcEmu l1RpcsFromEmu( theConfig.getParameter<edm::InputTag>("l1RpcEmu"), ev); |
191 |
|
std::vector<L1Obj> l1RpcsEmu = l1RpcsFromEmu(); |
200 |
|
// |
201 |
|
L1ObjMaker l1( theConfig.getParameter<edm::InputTag>("l1MuReadout"), ev); |
202 |
|
TrackToL1ObjMatcher matcher(theConfig.getParameter<edm::ParameterSet>("matcherPSet")); |
203 |
< |
std::vector<L1Obj> l1Rpcs = l1(L1ObjMaker::RPCB,L1ObjMaker::RPCF); |
204 |
< |
std::vector<L1Obj> l1Others = l1(L1ObjMaker::DT,L1ObjMaker::CSC); |
203 |
> |
std::vector<L1Obj> l1Rpcs = l1(L1Obj::RPCB,L1Obj::RPCF); |
204 |
> |
std::vector<L1Obj> l1Others = l1(L1Obj::DT,L1Obj::CSC); |
205 |
> |
std::vector<L1Obj> l1Gmts = l1(L1Obj::GMT); |
206 |
|
std::vector<bool> l1RpcsMatching(l1Rpcs.size(), false); |
207 |
|
std::vector<bool> l1OthersMatching(l1Others.size(), false); |
208 |
+ |
std::vector<bool> l1GmtsMatching(l1Gmts.size(), false); |
209 |
|
for(unsigned int i=0; i< l1Rpcs.size(); ++i) if (matcher(l1Rpcs[i].eta, l1Rpcs[i].phi, theMuon, ev,es)) l1RpcsMatching[i]=true; |
210 |
|
for(unsigned int i=0; i< l1Others.size(); ++i) if (matcher(l1Others[i].eta, l1Others[i].phi, theMuon, ev,es)) l1OthersMatching[i]=true; |
211 |
+ |
for(unsigned int i=0; i< l1Gmts.size(); ++i) if (matcher(l1Gmts[i].eta, l1Gmts[i].phi, theMuon, ev,es)) l1GmtsMatching[i]=true; |
212 |
|
l1RpcColl->set(l1Rpcs); |
213 |
|
l1RpcColl->set(l1RpcsMatching); |
214 |
|
l1OtherColl->set(l1Others); |
215 |
|
l1OtherColl->set(l1OthersMatching); |
216 |
+ |
l1GmtColl->set(l1Gmts); |
217 |
+ |
l1GmtColl->set(l1GmtsMatching); |
218 |
+ |
|
219 |
|
|
220 |
< |
// std::cout <<"RPCColl:"<<std::endl; l1RpcColl->print(); |
221 |
< |
// std::cout <<"RPCCollEmu:"<<std::endl; l1RpcCollEmu->print(); |
220 |
> |
std::cout <<"----"<<std::endl; |
221 |
> |
std::cout <<"RPCColl: "<<std::endl; l1RpcColl->print(); |
222 |
> |
std::cout <<"RPCCollEmu:"<<std::endl; l1RpcCollEmu->print(); |
223 |
> |
std::cout <<"GmtColl: "<<std::endl; l1GmtColl->print(); |
224 |
> |
std::cout <<"GmtCollEmu:"<<std::endl; |
225 |
> |
|
226 |
> |
// edm::Handle<L1MuGMTReadoutCollection> pCollection; |
227 |
> |
// ev.getByLabel(l1MuReadout,pCollection); |
228 |
> |
// std::cout <<"IS COLLECTION VALID: "<< pCollection->isValid() << std::endl; |
229 |
> |
L1ObjMaker l1Bis( edm::InputTag("mkGmtDigis"), ev); |
230 |
> |
std::vector<L1Obj> l1GmtsEmu = l1Bis(L1Obj::GMT); |
231 |
> |
for (unsigned int i=0; i<l1GmtsEmu.size(); ++i) { |
232 |
> |
std::cout <<"("<<i<<")";l1GmtsEmu[i].print(); |
233 |
> |
std::cout <<std::endl; |
234 |
> |
} |
235 |
|
|
236 |
|
// |
237 |
|
// fill ntuple + cleanup |
241 |
|
delete event; event = 0; |
242 |
|
delete muon; muon = 0; |
243 |
|
delete track; track = 0; |
244 |
+ |
delete bitsL1; bitsL1= 0; |
245 |
+ |
delete bitsHLT; bitsHLT= 0; |
246 |
|
delete l1RpcColl; l1RpcColl = 0; |
247 |
|
delete l1OtherColl; l1OtherColl = 0; |
248 |
|
delete l1RpcCollEmu; l1RpcCollEmu = 0; |
249 |
+ |
delete l1GmtColl; l1GmtColl = 0; |
250 |
|
} |
251 |
|
|