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.4 by konec, Tue Oct 23 11:12:48 2012 UTC vs.
Revision 1.9 by konec, Mon Oct 29 18:00:21 2012 UTC

# Line 25 | Line 25
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  
# Line 32 | Line 37 | L1RpcTreeMaker::L1RpcTreeMaker(const edm
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),
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()
# Line 60 | Line 68 | void L1RpcTreeMaker::beginJob()
68    theTree->Branch("detsCrossedByMuonDeepInside",&detsCrossedByMuonDeepInside);
69    theTree->Branch("detsHitsCompatibleWithMuon",&detsHitsCompatibleWithMuon);
70    theTree->Branch("detsSIMU",&detsSIMU);
63  theTree->Branch("nDigisCompDets",&nDigisCompDets);
64  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);
# Line 91 | Line 98 | L1RpcTreeMaker::~L1RpcTreeMaker()
98  
99   void L1RpcTreeMaker::analyze(const edm::Event &ev, const edm::EventSetup &es)
100   {
94
95
101    //
102    // check reference muon
103    //
# Line 120 | Line 125 | void L1RpcTreeMaker::analyze(const edm::
125    bitsL1 = new TriggerMenuResultObj();
126    bitsHLT = new TriggerMenuResultObj();
127  
123 //  counts = new SynchroCountsObjVect;
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>();
130 <  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
# Line 146 | Line 150 | void L1RpcTreeMaker::analyze(const edm::
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);
158    nDigisCompDets = theDetHitCollector.nDigisCompDets(detsHitsCompatibleWithMuon, ev, es);
159    clSizeCompDets = theDetHitCollector.clSizeCompDets(detsHitsCompatibleWithMuon, ev, es);
160
161    for (uint32_t i=0; i< nDigisCompDets.size(); i++) {
162      if (clSizeCompDets[i] > nDigisCompDets[i]) std::cout <<" PROBLEM, event: "<<theCounter<<" cl:"<<clSizeCompDets[i]<<" nDigis:"<<nDigisCompDets[i]<<std::endl;
163    }
174    }
175  
176    
# Line 175 | Line 185 | void L1RpcTreeMaker::analyze(const edm::
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();
# Line 190 | Line 200 | void L1RpcTreeMaker::analyze(const edm::
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 < //  std::cout <<"RPCColl:"<<std::endl; l1RpcColl->print();
220 < //  std::cout <<"RPCCollEmu:"<<std::endl; l1RpcCollEmu->print();
219 >
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
# Line 217 | Line 246 | void L1RpcTreeMaker::analyze(const edm::
246    delete l1RpcColl; l1RpcColl = 0;
247    delete l1OtherColl; l1OtherColl = 0;
248    delete l1RpcCollEmu; l1RpcCollEmu = 0;
249 +  delete l1GmtColl; l1GmtColl = 0;
250   }
251                                  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines