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

Comparing UserCode/L1RpcTriggerAnalysis/plugins/L1RpcTreeMaker.cc (file contents):
Revision 1.1 by konec, Mon Oct 1 19:21:03 2012 UTC vs.
Revision 1.6 by konec, Tue Oct 23 20:17:44 2012 UTC

# Line 20 | Line 20
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"
# Line 29 | Line 29 | template <class T> T sqr( T t) {return t
29  
30  
31   L1RpcTreeMaker::L1RpcTreeMaker(const edm::ParameterSet& cfg)
32 <  : theConfig(cfg), theTree(0), event(0), muon(0), track(0), counts(0),
33 <    l1RpcColl(0) , l1OtherColl(0), l1RpcCollEmu(0),
32 >  : theConfig(cfg), theTree(0), event(0), muon(0), track(0),
33 >    bitsL1(0), bitsHLT(0),
34 >    counts(0),
35 >    l1RpcColl(0) , l1OtherColl(0), l1RpcCollEmu(0), l1GmtColl(0),
36      theCounter(0),
37      theBestMuonFinder(cfg.getParameter<edm::ParameterSet>("bestMuonFinder")),
38      theDetHitCollector(cfg.getParameter<edm::ParameterSet>("detHitCollector")),
39 <    theSynchroGrabber(cfg.getParameter<edm::ParameterSet>("linkSynchroGrabber"))
39 >    theSynchroGrabber(cfg.getParameter<edm::ParameterSet>("linkSynchroGrabber")),
40 >    theMenuInspector(edm::ParameterSet())
41   { }
42  
43 < void L1RpcTreeMaker::beginRun( const edm::Run &ru, const edm::EventSetup &es)
43 > void L1RpcTreeMaker::beginRun(const edm::Run &ru, const edm::EventSetup &es)
44   {
45 +  std::cout <<" L1RpcTreeMaker::beginRun CALLED" << std::endl;
46 +  theMenuInspector.checkRun(ru,es);
47   }
48  
49   void L1RpcTreeMaker::beginJob()
# Line 50 | Line 55 | void L1RpcTreeMaker::beginJob()
55    theTree->Branch("muon","MuonObj",&muon,32000,99);
56    theTree->Branch("track", "TrackObj",&track,32000,99);
57  
58 +  theTree->Branch("bitsL1" ,"TriggerMenuResultObj",&bitsL1 ,32000,99);
59 +  theTree->Branch("bitsHLT","TriggerMenuResultObj",&bitsHLT,32000,99);
60 +
61    theTree->Branch("counts",&counts);
62    theTree->Branch("detsCrossedByMuon",&detsCrossedByMuon);
63    theTree->Branch("detsCrossedByMuonDeepInside",&detsCrossedByMuonDeepInside);
64    theTree->Branch("detsHitsCompatibleWithMuon",&detsHitsCompatibleWithMuon);
65    theTree->Branch("detsSIMU",&detsSIMU);
58  theTree->Branch("nDigisCompDets",&nDigisCompDets);
66  
67    theTree->Branch("l1RpcColl","L1ObjColl",&l1RpcColl,32000,99);
68    theTree->Branch("l1RpcCollEmu","L1ObjColl",&l1RpcCollEmu,32000,99);
69    theTree->Branch("l1OtherColl","L1ObjColl",&l1OtherColl,32000,99);
70 +  theTree->Branch("l1GmtColl","L1ObjColl",&l1GmtColl,32000,99);
71  
72    theHelper.SetOwner();
73    theBestMuonFinder.initHistos(theHelper);
# Line 110 | Line 118 | void L1RpcTreeMaker::analyze(const edm::
118    //
119    muon = new MuonObj();
120    track = new TrackObj();
121 < //  counts = new SynchroCountsObjVect;
121 >
122 >  bitsL1 = new TriggerMenuResultObj();
123 >  bitsHLT = new TriggerMenuResultObj();
124 >
125    counts = std::vector<SynchroCountsObj>();
126    detsCrossedByMuon = std::vector<uint32_t>();
127    detsCrossedByMuonDeepInside = std::vector<uint32_t>();
128 <  detsHitsCompatibleWithMuon = std::vector<uint32_t>();
128 >  detsHitsCompatibleWithMuon = std::vector<DetCluDigiObj>();
129    detsSIMU = std::vector<uint32_t>();
130 <  nDigisCompDets = std::vector<uint32_t>();
130 >
131    l1RpcColl = new L1ObjColl;
132    l1OtherColl = new L1ObjColl;
133    l1RpcCollEmu = new L1ObjColl;
134 +  l1GmtColl = new L1ObjColl;
135  
136    //
137    // fill muon info
# Line 135 | Line 147 | void L1RpcTreeMaker::analyze(const edm::
147    } else  muon->nRPCHits = muon->nDTHits = muon->nCSCHits = 0;
148    muon->nTrackerHits = theMuon->isTrackerMuon() ? (theMuon->innerTrack())->hitPattern().numberOfValidTrackerHits() : 0;
149  
150 +  //
151 +  // fill algoBits info
152 +  //
153 +  static edm::RunNumber_t lastRun = 0;
154 +  if (ev.run() != lastRun) {
155 +    lastRun = ev.run();
156 +    bitsL1->names  = theMenuInspector.namesAlgoL1();
157 +    bitsHLT->names = theMenuInspector.namesAlgoHLT();
158 +  }
159 +  bitsL1->firedAlgos = theMenuInspector.firedAlgosL1(ev,es);
160 +  bitsHLT->firedAlgos = theMenuInspector.firedAlgosHLT(ev,es);
161 +  
162  
163    //
164    // hits and detectors compatible with muon track
165    //
166    if ( muon->pt() > 10.) {
167 <    detsHitsCompatibleWithMuon = theDetHitCollector.compatibleHits( theMuon, ev, es);
167 > /*
168 >    std::vector<DetHitCompatibleCollector::DetCluDigi> dhcm = theDetHitCollector.compatibleHits( theMuon, ev, es);
169 >    detsHitsCompatibleWithMuon.clear();
170 >    for (std::vector<DetHitCompatibleCollector::DetCluDigi>::const_iterator it= dhcm.begin(); it < dhcm.end(); ++it) {
171 >      DetCluDigiObj obj;
172 >      obj.det = (*it).first;
173 >      obj.clusterSize = (*it).second.first;
174 >      obj.nDigis =  (*it).second.second;
175 >      detsHitsCompatibleWithMuon.push_back(obj);
176 >    }
177 > */
178 >    detsHitsCompatibleWithMuon = theDetHitCollector.compatibleHits( theMuon, ev, es);
179      detsCrossedByMuon = theDetHitCollector.compatibleDets( theMuon, ev, es, false);
180      detsCrossedByMuonDeepInside = theDetHitCollector.compatibleDets( theMuon, ev, es, true);
181      if (theConfig.getParameter<bool>("checkDestSIMU")) detsSIMU = theDetHitCollector.compatibleSIMU( theMuon, ev, es);
182 <    nDigisCompDets = theDetHitCollector.nDigisCompDets(detsHitsCompatibleWithMuon, ev, es);
182 > //    for (uint32_t i=0; i< nDigisCompDets.size(); i++) {
183 > //      if (clSizeCompDets[i] > nDigisCompDets[i]) std::cout <<" PROBLEM, event: "<<theCounter<<" cl:"<<clSizeCompDets[i]<<" nDigis:"<<nDigisCompDets[i]<<std::endl;
184 > //    }
185    }
186  
187    
# Line 174 | Line 211 | void L1RpcTreeMaker::analyze(const edm::
211    //
212    L1ObjMaker l1( theConfig.getParameter<edm::InputTag>("l1MuReadout"), ev);
213    TrackToL1ObjMatcher matcher(theConfig.getParameter<edm::ParameterSet>("matcherPSet"));
214 <  std::vector<L1Obj> l1Rpcs = l1(L1ObjMaker::RPCB,L1ObjMaker::RPCF);
215 <  std::vector<L1Obj> l1Others = l1(L1ObjMaker::DT,L1ObjMaker::CSC);
214 >  std::vector<L1Obj> l1Rpcs = l1(L1Obj::RPCB,L1Obj::RPCF);
215 >  std::vector<L1Obj> l1Others = l1(L1Obj::DT,L1Obj::CSC);
216 >  std::vector<L1Obj> l1Gmts =  l1(L1Obj::GMT);
217    std::vector<bool> l1RpcsMatching(l1Rpcs.size(), false);
218    std::vector<bool> l1OthersMatching(l1Others.size(), false);
219 +  std::vector<bool> l1GmtsMatching(l1Gmts.size(), false);
220    for(unsigned int i=0; i< l1Rpcs.size(); ++i) if (matcher(l1Rpcs[i].eta, l1Rpcs[i].phi, theMuon, ev,es)) l1RpcsMatching[i]=true;
221    for(unsigned int i=0; i< l1Others.size(); ++i) if (matcher(l1Others[i].eta, l1Others[i].phi, theMuon, ev,es)) l1OthersMatching[i]=true;
222 +  for(unsigned int i=0; i< l1Gmts.size(); ++i) if (matcher(l1Gmts[i].eta, l1Gmts[i].phi, theMuon, ev,es)) l1GmtsMatching[i]=true;
223    l1RpcColl->set(l1Rpcs);
224    l1RpcColl->set(l1RpcsMatching);
225    l1OtherColl->set(l1Others);
226    l1OtherColl->set(l1OthersMatching);
227 +  l1GmtColl->set(l1Gmts);
228 +  l1GmtColl->set(l1GmtsMatching);
229 +
230  
231   //  std::cout <<"RPCColl:"<<std::endl; l1RpcColl->print();
232   //  std::cout <<"RPCCollEmu:"<<std::endl; l1RpcCollEmu->print();
# Line 196 | Line 239 | void L1RpcTreeMaker::analyze(const edm::
239    delete event; event = 0;
240    delete muon;  muon = 0;
241    delete track; track = 0;
242 +  delete bitsL1;  bitsL1= 0;
243 +  delete bitsHLT;  bitsHLT= 0;
244    delete l1RpcColl; l1RpcColl = 0;
245    delete l1OtherColl; l1OtherColl = 0;
246    delete l1RpcCollEmu; l1RpcCollEmu = 0;
247 +  delete l1GmtColl; l1GmtColl = 0;
248   }
249                                  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines