16 |
|
|
17 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/L1Obj.h" |
18 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/EventObj.h" |
19 |
+ |
#include "UserCode/L1RpcTriggerAnalysis/interface/EventObjBXExtra.h" |
20 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/TrackObj.h" |
21 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/MuonObj.h" |
22 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/L1ObjColl.h" |
23 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/SynchroCountsObj.h" |
24 |
+ |
#include "UserCode/L1RpcTriggerAnalysis/interface/DetCluDigiObj.h" |
25 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/TriggerMenuResultObj.h" |
26 |
+ |
#include "UserCode/L1RpcTriggerAnalysis/interface/HitSpecObj.h" |
27 |
+ |
|
28 |
|
|
29 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/ConverterRPCRawSynchroSynchroCountsObj.h" |
30 |
|
|
31 |
+ |
L1RpcTreeAnalysis::L1RpcTreeAnalysis(const edm::ParameterSet & cfg) |
32 |
+ |
: theConfig(cfg), |
33 |
+ |
theAnaMuonDistribution(0), |
34 |
+ |
theAnaRpcVsOth(0), |
35 |
+ |
theAnaRpcMisc(0), |
36 |
+ |
theAnaEff(0), |
37 |
+ |
theAnaDet(0), |
38 |
+ |
theAnaEmu(0), |
39 |
+ |
theAnaSynch(0), |
40 |
+ |
theAnaClu(0), |
41 |
+ |
theAnaTimingL1(0), |
42 |
+ |
theAnaMenu(0), |
43 |
+ |
theAnaEvent(0), |
44 |
+ |
theAnaDigiSpec(0), |
45 |
+ |
theAnaHitSpec(0), |
46 |
+ |
thePatternProducer(0), |
47 |
+ |
thePatternProvider(0), |
48 |
+ |
theAnaSiMuDistribution(0), |
49 |
+ |
theAnaOtf(0) |
50 |
+ |
{ |
51 |
+ |
if (theConfig.exists("anaMuonDistribution")) theAnaMuonDistribution = new AnaMuonDistribution( cfg.getParameter<edm::ParameterSet>("anaMuonDistribution")); |
52 |
+ |
if (theConfig.exists("anaMenu")) theAnaMenu = new AnaMenu(theConfig.getParameter<edm::ParameterSet>("anaMenu")); |
53 |
+ |
if (theConfig.exists("anaTimingL1")) theAnaTimingL1 = new AnaTimingL1( theConfig.getParameter<edm::ParameterSet>("anaTimingL1") ); |
54 |
+ |
if (theConfig.exists("anaEvent")) theAnaEvent = new AnaEvent(cfg.getParameter<edm::ParameterSet>("anaEvent") ); |
55 |
+ |
if (theConfig.exists("anaDigiSpec")) theAnaDigiSpec = new AnaDigiSpec(cfg.getParameter<edm::ParameterSet>("anaDigiSpec")); |
56 |
+ |
if (theConfig.exists("anaHitSpec")) theAnaHitSpec = new AnaHitSpec(cfg.getParameter<edm::ParameterSet>("anaHitSpec")); |
57 |
+ |
if (theConfig.exists("patternProducer")) thePatternProducer = new PatternManager(cfg.getParameter<edm::ParameterSet>("patternProducer")); |
58 |
+ |
if (theConfig.exists("patternProvider")) thePatternProvider = new PatternManager(cfg.getParameter<edm::ParameterSet>("patternProvider")); |
59 |
+ |
if (theConfig.exists("anaSiMuDistribution")) theAnaSiMuDistribution = new AnaSiMuDistribution( cfg.getParameter<edm::ParameterSet>("anaSiMuDistribution")); |
60 |
+ |
if (theConfig.exists("anaOtf")) theAnaOtf = new AnaOtf( cfg.getParameter<edm::ParameterSet>("anaOtf")); |
61 |
+ |
|
62 |
+ |
} |
63 |
|
|
64 |
|
void L1RpcTreeAnalysis::beginJob() |
65 |
|
{ |
66 |
|
theHistos.SetOwner(); |
67 |
|
|
68 |
< |
theAnaMuonDistribution.init(theHistos); |
69 |
< |
theAnaRpcVsOth.init(theHistos); |
70 |
< |
theAnaRpcMisc.init(theHistos); |
71 |
< |
theAnaEff.init(theHistos); |
72 |
< |
theAnaDet.init(theHistos); |
73 |
< |
theAnaEmu.init(theHistos); |
74 |
< |
theAnaSynch.init(theHistos); |
75 |
< |
theAnaClu.init(theHistos); |
76 |
< |
theAnaTimingL1.init(theHistos); |
68 |
> |
if (theAnaMuonDistribution) theAnaMuonDistribution->init(theHistos); |
69 |
> |
if (theAnaRpcVsOth) theAnaRpcVsOth->init(theHistos); |
70 |
> |
if (theAnaRpcMisc) theAnaRpcMisc->init(theHistos); |
71 |
> |
if (theAnaEff) theAnaEff->init(theHistos); |
72 |
> |
if (theAnaDet) theAnaDet->init(theHistos); |
73 |
> |
if (theAnaEmu) theAnaEmu->init(theHistos); |
74 |
> |
if (theAnaSynch) theAnaSynch->init(theHistos); |
75 |
> |
if (theAnaClu) theAnaClu->init(theHistos); |
76 |
> |
if (theAnaTimingL1) theAnaTimingL1->init(theHistos); |
77 |
> |
if (theAnaEvent) theAnaEvent->init(theHistos); |
78 |
> |
if (theAnaMenu) theAnaMenu->init(theHistos); |
79 |
> |
if (theAnaDigiSpec) theAnaDigiSpec->init(theHistos); |
80 |
> |
if (theAnaHitSpec) theAnaHitSpec->init(theHistos); |
81 |
> |
if (theAnaSiMuDistribution) theAnaSiMuDistribution->init(theHistos); |
82 |
> |
if (theAnaOtf) theAnaOtf->init(theHistos); |
83 |
|
|
84 |
+ |
if (thePatternProvider) thePatternProvider->beginJob(); |
85 |
|
} |
86 |
|
|
87 |
|
void L1RpcTreeAnalysis::beginRun(const edm::Run& ru, const edm::EventSetup& es) |
88 |
|
{ |
89 |
< |
theAnaSynch.beginRun(ru,es); |
89 |
> |
if (theAnaSynch) theAnaSynch->beginRun(ru,es); |
90 |
|
} |
91 |
|
|
92 |
|
void L1RpcTreeAnalysis::analyze(const edm::Event&, const edm::EventSetup&) |
115 |
|
std::vector<SynchroCountsObj> *counts= 0; |
116 |
|
std::vector<uint32_t> *detsCrossedByMuon = 0; |
117 |
|
std::vector<uint32_t> *detsCrossedByMuonDeepInside = 0; |
118 |
< |
std::vector<uint32_t> *detsHitsCompatibleWithMuon = 0; |
118 |
> |
std::vector<DetCluDigiObj> *detsHitsCompatibleWithMuon = 0; |
119 |
|
std::vector<uint32_t> *detsSIMU = 0; |
120 |
< |
std::vector<uint32_t> *nDigisCompDets = 0; |
78 |
< |
std::vector<uint32_t> *clSizeCompDets = 0; |
120 |
> |
std::vector<std::pair<uint32_t, uint32_t> > *digSpec = 0; |
121 |
|
|
122 |
|
EventObj * event = 0; |
123 |
|
MuonObj * muon = 0; |
124 |
+ |
TrackObj * simu = 0; |
125 |
|
|
126 |
|
TriggerMenuResultObj *bitsL1 = 0; |
127 |
|
TriggerMenuResultObj *bitsHLT = 0; |
131 |
|
TBranch *bdetsCrossedByMuonDeepInside =0; |
132 |
|
TBranch *bdetsHitsCompatibleWithMuon = 0; |
133 |
|
TBranch *bdetsSIMU =0; |
134 |
< |
TBranch *bnDigisCompDets =0; |
92 |
< |
TBranch *bclSizeCompDets =0; |
134 |
> |
TBranch *bdigSpec = 0; |
135 |
|
|
136 |
< |
L1ObjColl* l1RpcColl = 0; |
137 |
< |
L1ObjColl* l1OtherColl = 0; |
138 |
< |
L1ObjColl* l1RpcCollEmu = 0; |
136 |
> |
L1ObjColl* l1ObjColl = 0; |
137 |
> |
HitSpecObj* hitSpec = 0; |
138 |
> |
|
139 |
|
|
140 |
|
chain.SetBranchAddress("event",&event); |
141 |
|
chain.SetBranchAddress("muon",&muon); |
142 |
+ |
chain.SetBranchAddress("simu",&simu); |
143 |
|
|
144 |
|
chain.SetBranchAddress("bitsL1",&bitsL1); |
145 |
|
chain.SetBranchAddress("bitsHLT",&bitsHLT); |
149 |
|
chain.SetBranchAddress("detsCrossedByMuonDeepInside",&detsCrossedByMuonDeepInside,&bdetsCrossedByMuonDeepInside); |
150 |
|
chain.SetBranchAddress("detsHitsCompatibleWithMuon",&detsHitsCompatibleWithMuon,&bdetsHitsCompatibleWithMuon); |
151 |
|
chain.SetBranchAddress("detsSIMU",&detsSIMU,&bdetsSIMU); |
152 |
< |
chain.SetBranchAddress("nDigisCompDets",&nDigisCompDets, &bnDigisCompDets); |
110 |
< |
chain.SetBranchAddress("clSizeCompDets",&clSizeCompDets, &bclSizeCompDets); |
152 |
> |
chain.SetBranchAddress("digSpec",&digSpec,&bdigSpec); |
153 |
|
|
154 |
< |
chain.SetBranchAddress("l1RpcColl",&l1RpcColl); |
155 |
< |
chain.SetBranchAddress("l1OtherColl",&l1OtherColl); |
114 |
< |
chain.SetBranchAddress("l1RpcCollEmu",&l1RpcCollEmu); |
154 |
> |
chain.SetBranchAddress("l1ObjColl",&l1ObjColl); |
155 |
> |
chain.SetBranchAddress("hitSpec",&hitSpec); |
156 |
|
|
157 |
|
|
158 |
|
// |
168 |
|
unsigned int lastRun = 0; |
169 |
|
for (int ev=0; ev<nentries; ev++) { |
170 |
|
chain.GetEntry(ev); |
171 |
+ |
if (theAnaMenu) theAnaMenu->updateMenu(bitsL1->names, bitsHLT->names); |
172 |
|
|
173 |
< |
if (lastRun != (*event).run) { |
173 |
> |
if ( (lastRun != (*event).run) || (ev/10000*10000==ev) ) { |
174 |
> |
// if (true) { |
175 |
> |
// if (! ((*event).run==204601 && (*event).id ==109463402)) { continue; |
176 |
|
lastRun = (*event).run; |
177 |
|
std::cout <<"RUN:" << std::setw(7) << (*event).run |
178 |
|
<<" event:" << std::setw(8) << ev |
179 |
< |
<<" done:" << std::setw(6)<< std::setiosflags(std::ios::fixed) << std::setprecision(2) << ev*100./nentries<<"%"<<std::endl; |
179 |
> |
<<" done:" << std::setw(6)<< std::setiosflags(std::ios::fixed) << std::setprecision(2) << ev*100./nentries<<"%"; |
180 |
> |
std::cout<<std::endl; |
181 |
|
} |
182 |
|
|
183 |
< |
// if (ev > 10) break; |
184 |
< |
|
185 |
< |
// if (event->run != 178854) continue; |
186 |
< |
// if (lastLumi != (*event).lumi) { lastLumi = (*event).lumi; std::cout <<"lumi: " << (*event).lumi<<std::endl; } |
187 |
< |
// theAnaDet.debug = false; |
188 |
< |
// if ((*event).id==60422922)theAnaRpcMisc.debug = true; |
189 |
< |
|
190 |
< |
std::cout <<" Number of bits L1: " << bitsL1->names.size()<<"/"<<bitsL1->firedAlgos.size() |
191 |
< |
<<" HLT: "<< bitsHLT->names.size()<<"/"<<bitsHLT->firedAlgos.size()<<std::endl; |
192 |
< |
|
193 |
< |
theAnaMuonDistribution.run(muon); |
194 |
< |
theAnaRpcVsOth.run(muon,l1RpcColl,l1OtherColl); |
195 |
< |
theAnaEff.run(muon,l1RpcColl,l1OtherColl); |
196 |
< |
theAnaRpcMisc.run(event,muon,l1RpcColl,l1OtherColl); |
197 |
< |
theAnaDet.run( muon, *detsHitsCompatibleWithMuon, *detsCrossedByMuon, *detsCrossedByMuonDeepInside); |
198 |
< |
theAnaEmu.run ( event, muon, l1RpcCollEmu, l1RpcColl); |
199 |
< |
theAnaSynch.run( event, muon, ConverterRPCRawSynchroSynchroCountsObj::toRawSynchro( *counts)); |
200 |
< |
theAnaClu.run( event, muon, l1RpcColl, *detsHitsCompatibleWithMuon, *nDigisCompDets, *clSizeCompDets); |
201 |
< |
theAnaTimingL1.run(event,muon,l1RpcColl,l1OtherColl); |
202 |
< |
|
203 |
< |
// theAnaEmu.debug =theAnaDet.debug; |
204 |
< |
// std::cout <<"----------"<<std::endl; |
205 |
< |
// theAnaDet.debug =theAnaEmu.debug; |
206 |
< |
// if (anaDet.debug) std::cout <<" Event: "<<(*event).id <<" Lumi: "<<(*event).lumi<< std::endl; |
207 |
< |
|
183 |
> |
/* |
184 |
> |
if ( event->id == 597978012 |
185 |
> |
|| event->id == 14791798 |
186 |
> |
|| event->id == 436261807 |
187 |
> |
|| event->id == 873776280 |
188 |
> |
|| event->id == 960307389 |
189 |
> |
|| event->id == 150097556 |
190 |
> |
|| event->id == 42062946 |
191 |
> |
|| event->id == 1064121551 |
192 |
> |
|| event->id == 1499489591 |
193 |
> |
|| event->id == 60161631 |
194 |
> |
|| event->id == 624624695 |
195 |
> |
|| event->id == 727298833 |
196 |
> |
|| event->id == 835600542 |
197 |
> |
|| event->id == 216373776 |
198 |
> |
|| event->id == 1107585611 |
199 |
> |
|| event->id == 197907027 |
200 |
> |
) theAnaMenu.debug = true; else theAnaMenu.debug = false; |
201 |
> |
*/ |
202 |
> |
|
203 |
> |
// EVENT NUMBER, BX structure etc. |
204 |
> |
EventObjBXExtra eventBx(*event); |
205 |
> |
if ( theAnaEvent && !theAnaEvent->filter(&eventBx) && theConfig.getParameter<bool>("filterByAnaEvent") ) continue; |
206 |
> |
// ANALYSE AND FILTER KINEMCTICS |
207 |
> |
if ( theAnaMuonDistribution && !theAnaMuonDistribution->filter(muon) && theConfig.getParameter<bool>("filterByAnaMuonDistribution") ) continue; |
208 |
> |
// ANALYSE AND FILTER TRIGGER MENU |
209 |
> |
if ( theAnaMenu && !theAnaMenu->filter(event, muon, bitsL1, bitsHLT) && theConfig.getParameter<bool>("filterByAnaMenu") ) continue; |
210 |
> |
// ANALYSE AND FILTER SIMU KONEMATICs |
211 |
> |
if ( theAnaSiMuDistribution && !theAnaSiMuDistribution->filter(event, simu, hitSpec) && theConfig.getParameter<bool>("filterByAnaSiMuDistribution") ) continue; |
212 |
> |
|
213 |
> |
// ANALYSES |
214 |
> |
if (theAnaRpcVsOth) theAnaRpcVsOth->run(muon,l1ObjColl); |
215 |
> |
if (theAnaEff) theAnaEff->run(muon, l1ObjColl); |
216 |
> |
if (theAnaRpcMisc) theAnaRpcMisc->run(event,muon,l1ObjColl); |
217 |
> |
if (theAnaDet) theAnaDet->run( muon, *detsHitsCompatibleWithMuon, *detsCrossedByMuon, *detsCrossedByMuonDeepInside); |
218 |
> |
if (theAnaEmu) theAnaEmu->run ( event, muon, l1ObjColl); |
219 |
> |
if (theAnaSynch) theAnaSynch->run( event, muon, ConverterRPCRawSynchroSynchroCountsObj::toRawSynchro( *counts)); |
220 |
> |
if (theAnaClu) theAnaClu->run( event, muon, l1ObjColl, *detsHitsCompatibleWithMuon); |
221 |
> |
if (theAnaTimingL1) theAnaTimingL1->run( &eventBx, muon, l1ObjColl); |
222 |
> |
|
223 |
> |
// HITPATTERN ANALYSES & MC EFFICIENCY |
224 |
> |
if (theAnaHitSpec) theAnaHitSpec->run(event, simu, hitSpec); |
225 |
> |
if (theAnaDigiSpec) theAnaDigiSpec->run(event, simu, hitSpec, *digSpec); |
226 |
> |
if (thePatternProducer) thePatternProducer->run(event, simu, hitSpec, *digSpec); |
227 |
> |
L1Obj l1otf; |
228 |
> |
if (thePatternProvider) l1otf=thePatternProvider->check(event, simu, hitSpec, *digSpec); |
229 |
> |
if (theAnaOtf) theAnaOtf->run(event,simu,l1otf); |
230 |
|
} |
231 |
|
} |
232 |
|
|
233 |
|
void L1RpcTreeAnalysis::endJob() |
234 |
|
{ |
235 |
|
std::cout <<"ENDJOB, summaries:"<<std::endl; |
236 |
< |
TGraph* hGraph_DetEff = theAnaDet.resume(); |
237 |
< |
theAnaRpcMisc.resume(theHistos); |
238 |
< |
TGraph* hGraph_RunClu = theAnaClu.resume(); |
239 |
< |
theAnaTimingL1.resume(theHistos); |
240 |
< |
|
241 |
< |
theAnaSynch.endJob(); |
236 |
> |
TGraph* hGraph_DetEff = (theAnaDet) ? theAnaDet->resume() : 0; |
237 |
> |
TGraph* hGraph_RunClu = (theAnaClu) ? theAnaClu->resume(): 0; |
238 |
> |
if (theAnaRpcMisc) theAnaRpcMisc->resume(theHistos); |
239 |
> |
if (theAnaTimingL1) theAnaTimingL1->resume(theHistos); |
240 |
> |
if (theAnaMenu) theAnaMenu->resume(theHistos); |
241 |
> |
if (theAnaMenu) theAnaEvent->resume(theHistos); |
242 |
> |
if (theAnaHitSpec) theAnaHitSpec->resume(theHistos); |
243 |
> |
if (theAnaDigiSpec) theAnaDigiSpec->resume(theHistos); |
244 |
> |
|
245 |
> |
if (theAnaSynch) theAnaSynch->endJob(); |
246 |
> |
if (thePatternProducer) thePatternProducer->endJob(); |
247 |
> |
if (thePatternProvider) thePatternProvider->endJob(); |
248 |
|
|
249 |
|
std::string histoFile = theConfig.getParameter<std::string>("histoFileName"); |
250 |
|
TFile f(histoFile.c_str(),"RECREATE"); |
251 |
|
theHistos.Write(); |
252 |
< |
hGraph_DetEff->Write("hGraph_DetEff"); |
253 |
< |
hGraph_RunClu->Write("hGraph_RunClu"); |
252 |
> |
if (hGraph_DetEff) hGraph_DetEff->Write("hGraph_DetEff"); |
253 |
> |
if (hGraph_RunClu) hGraph_RunClu->Write("hGraph_RunClu"); |
254 |
|
f.Close(); |
255 |
|
std::cout <<"END"<<std::endl; |
256 |
+ |
|
257 |
+ |
delete theAnaMuonDistribution; |
258 |
+ |
delete theAnaRpcVsOth; |
259 |
+ |
delete theAnaRpcMisc; |
260 |
+ |
delete theAnaEff; |
261 |
+ |
delete theAnaDet; |
262 |
+ |
delete theAnaEmu; |
263 |
+ |
delete theAnaSynch; |
264 |
+ |
delete theAnaClu; |
265 |
+ |
delete theAnaTimingL1; |
266 |
+ |
delete theAnaMenu; |
267 |
+ |
delete theAnaEvent; |
268 |
+ |
delete theAnaDigiSpec; |
269 |
+ |
delete theAnaHitSpec; |
270 |
+ |
delete thePatternProducer; |
271 |
+ |
delete thePatternProvider; |
272 |
|
} |