ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/plugins/L1RpcTreeAnalysis.cc
(Generate patch)

Comparing UserCode/L1RpcTriggerAnalysis/plugins/L1RpcTreeAnalysis.cc (file contents):
Revision 1.4 by konec, Mon Oct 22 06:28:46 2012 UTC vs.
Revision 1.17 by konec, Fri May 17 13:02:12 2013 UTC

# Line 16 | Line 16
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 + {
49 +  if (theConfig.exists("anaMuonDistribution")) theAnaMuonDistribution = new AnaMuonDistribution( cfg.getParameter<edm::ParameterSet>("anaMuonDistribution") );
50 +  if (theConfig.exists("anaMenu")) theAnaMenu = new AnaMenu(theConfig.getParameter<edm::ParameterSet>("anaMenu"));
51 +  if (theConfig.exists("anaTimingL1")) theAnaTimingL1 = new AnaTimingL1( theConfig.getParameter<edm::ParameterSet>("anaTimingL1") );
52 +  if (theConfig.exists("anaEvent")) theAnaEvent = new   AnaEvent(cfg.getParameter<edm::ParameterSet>("anaEvent") );
53 +  if (theConfig.exists("anaDigiSpec")) theAnaDigiSpec = new AnaDigiSpec(cfg.getParameter<edm::ParameterSet>("anaDigiSpec"));
54 +  if (theConfig.exists("anaHitSpec")) theAnaHitSpec = new AnaHitSpec(cfg.getParameter<edm::ParameterSet>("anaHitSpec"));
55 +  if (theConfig.exists("patternProducer")) thePatternProducer = new PatternManager(cfg.getParameter<edm::ParameterSet>("patternProducer"));
56 +  if (theConfig.exists("patternProvider")) thePatternProvider = new PatternManager(cfg.getParameter<edm::ParameterSet>("patternProvider"));
57 +  
58 + }
59  
60   void L1RpcTreeAnalysis::beginJob()
61   {
62    theHistos.SetOwner();
63  
64 <  theAnaMuonDistribution.init(theHistos);
65 <  theAnaRpcVsOth.init(theHistos);
66 <  theAnaRpcMisc.init(theHistos);
67 <  theAnaEff.init(theHistos);
68 <  theAnaDet.init(theHistos);
69 <  theAnaEmu.init(theHistos);
70 <  theAnaSynch.init(theHistos);
71 <  theAnaClu.init(theHistos);
72 <  theAnaTimingL1.init(theHistos);
64 >  if (theAnaMuonDistribution) theAnaMuonDistribution->init(theHistos);
65 >  if (theAnaRpcVsOth)         theAnaRpcVsOth->init(theHistos);
66 >  if (theAnaRpcMisc)          theAnaRpcMisc->init(theHistos);
67 >  if (theAnaEff)              theAnaEff->init(theHistos);
68 >  if (theAnaDet)              theAnaDet->init(theHistos);
69 >  if (theAnaEmu)              theAnaEmu->init(theHistos);
70 >  if (theAnaSynch)            theAnaSynch->init(theHistos);
71 >  if (theAnaClu)              theAnaClu->init(theHistos);
72 >  if (theAnaTimingL1)         theAnaTimingL1->init(theHistos);
73 >  if (theAnaEvent)            theAnaEvent->init(theHistos);
74 >  if (theAnaMenu)             theAnaMenu->init(theHistos);
75 >  if (theAnaDigiSpec)         theAnaDigiSpec->init(theHistos);
76 >  if (theAnaHitSpec)          theAnaHitSpec->init(theHistos);
77  
78 +  if (thePatternProvider)     thePatternProvider->beginJob();
79   }
80  
81   void L1RpcTreeAnalysis::beginRun(const edm::Run& ru, const edm::EventSetup& es)
82   {
83 <  theAnaSynch.beginRun(ru,es);
83 >  if (theAnaSynch) theAnaSynch->beginRun(ru,es);
84   }
85  
86   void L1RpcTreeAnalysis::analyze(const edm::Event&, const edm::EventSetup&)
# Line 71 | Line 109 | void L1RpcTreeAnalysis::analyze(const ed
109    std::vector<SynchroCountsObj> *counts= 0;
110    std::vector<uint32_t> *detsCrossedByMuon = 0;
111    std::vector<uint32_t> *detsCrossedByMuonDeepInside = 0;
112 <  std::vector<uint32_t> *detsHitsCompatibleWithMuon = 0;
112 >  std::vector<DetCluDigiObj> *detsHitsCompatibleWithMuon = 0;
113    std::vector<uint32_t> *detsSIMU = 0;
114 <  std::vector<uint32_t> *nDigisCompDets = 0;
77 <  std::vector<uint32_t> *clSizeCompDets = 0;
114 >  std::vector<std::pair<uint32_t, uint32_t> > *digSpec = 0;
115  
116    EventObj * event = 0;
117    MuonObj * muon = 0;
118 +  TrackObj * simu = 0;
119 +
120 +  TriggerMenuResultObj *bitsL1  = 0;
121 +  TriggerMenuResultObj *bitsHLT = 0;
122  
123    TBranch *bcounts=0;
124    TBranch *bdetsCrossedByMuon =0;
125    TBranch *bdetsCrossedByMuonDeepInside =0;
126    TBranch *bdetsHitsCompatibleWithMuon = 0;
127    TBranch *bdetsSIMU =0;
128 <  TBranch *bnDigisCompDets =0;
88 <  TBranch *bclSizeCompDets =0;
128 >  TBranch *bdigSpec = 0;
129  
130 <  L1ObjColl* l1RpcColl = 0;
131 <  L1ObjColl* l1OtherColl = 0;
132 <  L1ObjColl* l1RpcCollEmu = 0;
130 >  L1ObjColl* l1ObjColl = 0;
131 >  HitSpecObj* hitSpec = 0;
132 >  
133  
134    chain.SetBranchAddress("event",&event);
135    chain.SetBranchAddress("muon",&muon);
136 +  chain.SetBranchAddress("simu",&simu);
137  
138 +  chain.SetBranchAddress("bitsL1",&bitsL1);
139 +  chain.SetBranchAddress("bitsHLT",&bitsHLT);
140 +  
141    chain.SetBranchAddress("counts",&counts,&bcounts);
142    chain.SetBranchAddress("detsCrossedByMuon",&detsCrossedByMuon,&bdetsCrossedByMuon);
143    chain.SetBranchAddress("detsCrossedByMuonDeepInside",&detsCrossedByMuonDeepInside,&bdetsCrossedByMuonDeepInside);
144    chain.SetBranchAddress("detsHitsCompatibleWithMuon",&detsHitsCompatibleWithMuon,&bdetsHitsCompatibleWithMuon);
145    chain.SetBranchAddress("detsSIMU",&detsSIMU,&bdetsSIMU);
146 <  chain.SetBranchAddress("nDigisCompDets",&nDigisCompDets, &bnDigisCompDets);
103 <  chain.SetBranchAddress("clSizeCompDets",&clSizeCompDets, &bclSizeCompDets);
146 >  chain.SetBranchAddress("digSpec",&digSpec,&bdigSpec);
147  
148 <  chain.SetBranchAddress("l1RpcColl",&l1RpcColl);
149 <  chain.SetBranchAddress("l1OtherColl",&l1OtherColl);
107 <  chain.SetBranchAddress("l1RpcCollEmu",&l1RpcCollEmu);
148 >  chain.SetBranchAddress("l1ObjColl",&l1ObjColl);
149 >  chain.SetBranchAddress("hitSpec",&hitSpec);
150  
151  
152    //
153 <  // number of efents
153 >  // number of events
154    //
155    Int_t nentries = (Int_t) chain.GetEntries();
156    std::cout <<" ENTRIES: " << nentries << std::endl;
# Line 120 | Line 162 | void L1RpcTreeAnalysis::analyze(const ed
162    unsigned int lastRun = 0;
163    for (int ev=0; ev<nentries; ev++) {
164      chain.GetEntry(ev);
165 +    if (theAnaMenu) theAnaMenu->updateMenu(bitsL1->names, bitsHLT->names);
166  
167 <    if (lastRun != (*event).run) {
167 >    if ( (lastRun != (*event).run) || (ev/10000*10000==ev) ) {
168 > //    if (true) {
169 > //    if (! ((*event).run==204601 && (*event).id ==109463402)) { continue;
170        lastRun = (*event).run;
171        std::cout <<"RUN:"    << std::setw(7) << (*event).run
172                  <<" event:" << std::setw(8) << ev
173 <                <<" done:"  << std::setw(6)<< std::setiosflags(std::ios::fixed) << std::setprecision(2) << ev*100./nentries<<"%"<<std::endl;
173 >                <<" done:"  << std::setw(6)<< std::setiosflags(std::ios::fixed) << std::setprecision(2) << ev*100./nentries<<"%";
174 >      std::cout<<std::endl;
175      }
176  
177 < //    if (ev > 10) break;
178 <
179 < //    if (event->run != 178854) continue;
180 < //    if (lastLumi != (*event).lumi) { lastLumi = (*event).lumi; std::cout <<"lumi: " << (*event).lumi<<std::endl; }
181 < //   theAnaDet.debug = false;
182 < //    if ((*event).id==60422922)theAnaRpcMisc.debug = true;
183 <
184 <   theAnaMuonDistribution.run(muon);
185 <   theAnaRpcVsOth.run(muon,l1RpcColl,l1OtherColl);
186 <   theAnaEff.run(muon,l1RpcColl,l1OtherColl);
187 <   theAnaRpcMisc.run(event,muon,l1RpcColl,l1OtherColl);
188 <   theAnaDet.run( muon, *detsHitsCompatibleWithMuon,  *detsCrossedByMuon, *detsCrossedByMuonDeepInside);
189 <   theAnaEmu.run ( event, muon, l1RpcCollEmu, l1RpcColl);
190 <   theAnaSynch.run( event, muon, ConverterRPCRawSynchroSynchroCountsObj::toRawSynchro( *counts));
191 <   theAnaClu.run( event, muon, l1RpcColl, *detsHitsCompatibleWithMuon, *nDigisCompDets, *clSizeCompDets);
192 <   theAnaTimingL1.run(event,muon,l1RpcColl,l1OtherColl);
193 <
194 < //   theAnaEmu.debug =theAnaDet.debug;
195 < //    std::cout <<"----------"<<std::endl;
196 < //   theAnaDet.debug =theAnaEmu.debug;
197 < //    if (anaDet.debug) std::cout <<" Event: "<<(*event).id <<" Lumi: "<<(*event).lumi<< std::endl;
198 <  
177 > /*  
178 >   if (     event->id == 597978012
179 >        ||  event->id == 14791798  
180 >        ||  event->id == 436261807
181 >        ||  event->id == 873776280  
182 >        ||  event->id == 960307389
183 >        ||  event->id == 150097556
184 >        ||  event->id == 42062946
185 >        ||  event->id == 1064121551
186 >        ||  event->id == 1499489591
187 >        ||  event->id == 60161631
188 >        ||  event->id == 624624695
189 >        ||  event->id == 727298833
190 >        ||  event->id == 835600542
191 >        ||  event->id == 216373776
192 >        ||  event->id == 1107585611
193 >        ||  event->id == 197907027
194 >      ) theAnaMenu.debug = true; else theAnaMenu.debug = false;
195 > */
196 >
197 >   // EVENT NUMBER, BX structure etc.
198 >   EventObjBXExtra eventBx(*event);
199 >   if ( theAnaEvent && !theAnaEvent->filter(&eventBx) && theConfig.getParameter<bool>("filterByAnaEvent") ) continue;
200 >   // ANALYSE AND FILTER KINEMCTICS
201 >   if ( theAnaMuonDistribution && !theAnaMuonDistribution->filter(muon) && theConfig.getParameter<bool>("filterByAnaMuonDistribution") ) continue;
202 >   // ANALYSE AND FILTER TRIGGER MENU
203 >   if ( theAnaMenu && !theAnaMenu->filter(event, muon, bitsL1, bitsHLT) && theConfig.getParameter<bool>("filterByAnaMenu") ) continue;
204 >
205 >   // ANALYSES
206 >   if (theAnaRpcVsOth) theAnaRpcVsOth->run(muon,l1ObjColl);
207 >   if (theAnaEff)      theAnaEff->run(muon, l1ObjColl);
208 >   if (theAnaRpcMisc)  theAnaRpcMisc->run(event,muon,l1ObjColl);
209 >   if (theAnaDet)      theAnaDet->run( muon, *detsHitsCompatibleWithMuon,  *detsCrossedByMuon, *detsCrossedByMuonDeepInside);
210 >   if (theAnaEmu)      theAnaEmu->run ( event, muon, l1ObjColl);
211 >   if (theAnaSynch)    theAnaSynch->run( event, muon, ConverterRPCRawSynchroSynchroCountsObj::toRawSynchro( *counts));
212 >   if (theAnaClu)      theAnaClu->run( event, muon, l1ObjColl, *detsHitsCompatibleWithMuon);
213 >   if (theAnaTimingL1) theAnaTimingL1->run( &eventBx, muon, l1ObjColl);
214 >
215 >   // HITPATTERN ANALYSES & MC EFFICIENCY
216 >   if (theAnaHitSpec) theAnaHitSpec->run(event, simu, hitSpec);
217 >   if (theAnaDigiSpec) theAnaDigiSpec->run(event, simu, hitSpec, *digSpec);
218 >   if (thePatternProducer) thePatternProducer->run(event, simu, hitSpec, *digSpec);
219 >   if (thePatternProvider) thePatternProvider->check(event, simu, hitSpec, *digSpec);
220    }
221   }
222  
223   void L1RpcTreeAnalysis::endJob()
224   {
225    std::cout <<"ENDJOB, summaries:"<<std::endl;
226 <  TGraph* hGraph_DetEff = theAnaDet.resume();
227 <  theAnaRpcMisc.resume(theHistos);
228 <  TGraph* hGraph_RunClu = theAnaClu.resume();
229 <  theAnaTimingL1.resume(theHistos);
230 <
231 <  theAnaSynch.endJob();
226 >  TGraph* hGraph_DetEff = (theAnaDet) ? theAnaDet->resume() : 0;
227 >  TGraph* hGraph_RunClu = (theAnaClu) ? theAnaClu->resume(): 0;
228 >  if (theAnaRpcMisc) theAnaRpcMisc->resume(theHistos);
229 >  if (theAnaTimingL1)  theAnaTimingL1->resume(theHistos);
230 >  if (theAnaMenu)     theAnaMenu->resume(theHistos);
231 >  if (theAnaMenu) theAnaEvent->resume(theHistos);
232 >  if (theAnaHitSpec) theAnaHitSpec->resume(theHistos);
233 >  if (theAnaDigiSpec) theAnaDigiSpec->resume(theHistos);
234 >
235 >  if (theAnaSynch) theAnaSynch->endJob();
236 >  if (thePatternProducer) thePatternProducer->endJob();
237 >  if (thePatternProvider) thePatternProvider->endJob();
238  
239    std::string histoFile = theConfig.getParameter<std::string>("histoFileName");
240    TFile f(histoFile.c_str(),"RECREATE");
241    theHistos.Write();
242 <  hGraph_DetEff->Write("hGraph_DetEff");
243 <  hGraph_RunClu->Write("hGraph_RunClu");
242 >  if (hGraph_DetEff) hGraph_DetEff->Write("hGraph_DetEff");
243 >  if (hGraph_RunClu) hGraph_RunClu->Write("hGraph_RunClu");
244    f.Close();
245    std::cout <<"END"<<std::endl;
246 +
247 +  delete theAnaMuonDistribution;
248 +  delete theAnaRpcVsOth;
249 +  delete theAnaRpcMisc;
250 +  delete theAnaEff;
251 +  delete theAnaDet;
252 +  delete theAnaEmu;
253 +  delete theAnaSynch;
254 +  delete theAnaClu;
255 +  delete theAnaTimingL1;
256 +  delete theAnaMenu;
257 +  delete theAnaEvent;
258 +  delete theAnaDigiSpec;
259 +  delete theAnaHitSpec;
260 +  delete thePatternProducer;
261 +  delete thePatternProvider;
262   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines