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.3 by konec, Mon Oct 8 07:09:24 2012 UTC vs.
Revision 1.10 by konec, Mon Oct 29 21:20:58 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"
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 >    l1ObjColl(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 >    theL1ObjMaker(cfg.getParameter<edm::ParameterSet>("l1ObjMaker")),
46 >    theMenuInspector(edm::ParameterSet())
47   { }
48  
49 < void L1RpcTreeMaker::beginRun( const edm::Run &ru, const edm::EventSetup &es)
49 > void L1RpcTreeMaker::beginRun(const edm::Run &ru, const edm::EventSetup &es)
50   {
51 +  std::cout <<" L1RpcTreeMaker::beginRun CALLED" << std::endl;
52 +  theMenuInspector.checkRun(ru,es);
53   }
54  
55   void L1RpcTreeMaker::beginJob()
# Line 50 | Line 61 | void L1RpcTreeMaker::beginJob()
61    theTree->Branch("muon","MuonObj",&muon,32000,99);
62    theTree->Branch("track", "TrackObj",&track,32000,99);
63  
64 +  theTree->Branch("bitsL1" ,"TriggerMenuResultObj",&bitsL1 ,32000,99);
65 +  theTree->Branch("bitsHLT","TriggerMenuResultObj",&bitsHLT,32000,99);
66 +
67    theTree->Branch("counts",&counts);
68    theTree->Branch("detsCrossedByMuon",&detsCrossedByMuon);
69    theTree->Branch("detsCrossedByMuonDeepInside",&detsCrossedByMuonDeepInside);
70    theTree->Branch("detsHitsCompatibleWithMuon",&detsHitsCompatibleWithMuon);
71    theTree->Branch("detsSIMU",&detsSIMU);
58  theTree->Branch("nDigisCompDets",&nDigisCompDets);
59  theTree->Branch("clSizeCompDets",&clSizeCompDets);
72  
73 <  theTree->Branch("l1RpcColl","L1ObjColl",&l1RpcColl,32000,99);
62 <  theTree->Branch("l1RpcCollEmu","L1ObjColl",&l1RpcCollEmu,32000,99);
63 <  theTree->Branch("l1OtherColl","L1ObjColl",&l1OtherColl,32000,99);
73 >  theTree->Branch("l1ObjColl","L1ObjColl",&l1ObjColl,32000,99);
74  
75    theHelper.SetOwner();
76    theBestMuonFinder.initHistos(theHelper);
# Line 86 | Line 96 | L1RpcTreeMaker::~L1RpcTreeMaker()
96  
97   void L1RpcTreeMaker::analyze(const edm::Event &ev, const edm::EventSetup &es)
98   {
89
90
99    //
100    // check reference muon
101    //
# Line 111 | Line 119 | void L1RpcTreeMaker::analyze(const edm::
119    //
120    muon = new MuonObj();
121    track = new TrackObj();
122 < //  counts = new SynchroCountsObjVect;
122 >
123 >  bitsL1 = new TriggerMenuResultObj();
124 >  bitsHLT = new TriggerMenuResultObj();
125 >
126    counts = std::vector<SynchroCountsObj>();
127    detsCrossedByMuon = std::vector<uint32_t>();
128    detsCrossedByMuonDeepInside = std::vector<uint32_t>();
129 <  detsHitsCompatibleWithMuon = std::vector<uint32_t>();
129 >  detsHitsCompatibleWithMuon = std::vector<DetCluDigiObj>();
130    detsSIMU = std::vector<uint32_t>();
131 <  nDigisCompDets = std::vector<uint32_t>();
132 <  clSizeCompDets = std::vector<uint32_t>();
122 <  l1RpcColl = new L1ObjColl;
123 <  l1OtherColl = new L1ObjColl;
124 <  l1RpcCollEmu = new L1ObjColl;
131 >
132 >  l1ObjColl = new L1ObjColl;
133  
134    //
135    // fill muon info
# Line 137 | Line 145 | void L1RpcTreeMaker::analyze(const edm::
145    } else  muon->nRPCHits = muon->nDTHits = muon->nCSCHits = 0;
146    muon->nTrackerHits = theMuon->isTrackerMuon() ? (theMuon->innerTrack())->hitPattern().numberOfValidTrackerHits() : 0;
147  
148 +  //
149 +  // fill algoBits info
150 +  //
151 +  static edm::RunNumber_t lastRun = 0;
152 +  if (ev.run() != lastRun) {
153 +    lastRun = ev.run();
154 +    bitsL1->names  = theMenuInspector.namesAlgoL1();
155 +    bitsHLT->names = theMenuInspector.namesAlgoHLT();
156 +  }
157 +  bitsL1->firedAlgos = theMenuInspector.firedAlgosL1(ev,es);
158 +  bitsHLT->firedAlgos = theMenuInspector.firedAlgosHLT(ev,es);
159 +  
160  
161    //
162    // hits and detectors compatible with muon track
163    //
164    if ( muon->pt() > 10.) {
165 <    detsHitsCompatibleWithMuon = theDetHitCollector.compatibleHits( theMuon, ev, es);
165 >    detsHitsCompatibleWithMuon = theDetHitCollector.compatibleHits( theMuon, ev, es);
166      detsCrossedByMuon = theDetHitCollector.compatibleDets( theMuon, ev, es, false);
167      detsCrossedByMuonDeepInside = theDetHitCollector.compatibleDets( theMuon, ev, es, true);
168      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    }
169    }
170  
171    
# Line 164 | Line 178 | void L1RpcTreeMaker::analyze(const edm::
178    
179  
180    //
181 +  // fill L1 info
182 +  //
183 +  std::vector<L1Obj> l1Obj = theL1ObjMaker(ev);
184 +  l1ObjColl->set( l1Obj);
185 +  TrackToL1ObjMatcher matcher(theConfig.getParameter<edm::ParameterSet>("matcherPSet"));
186 +  std::vector<bool> matching(l1Obj.size(), false);
187 +  std::vector<double> deltaR(l1Obj.size(), 0.);
188 +  for(unsigned int i=0; i< l1Obj.size(); ++i) {
189 +    if (matcher(l1Obj[i].eta, l1Obj[i].phi, theMuon, ev,es)) matching[i]=true;
190 +    TrackToL1ObjMatcher::LastResult result = matcher.lastResult();
191 +    deltaR[i] = sqrt( sqr(result.deltaEta) + sqr(result.deltaPhi) );
192 +  }
193 +  l1ObjColl->set( matching );
194 +  l1ObjColl->set( deltaR );
195 +  
196 +
197 + /*
198 +  //
199    // fill L1 RPCemu
200    //
201 <  if (theConfig.exists("l1RpcEmu") ) {
201 >  if (theConfig.exists("l1RpcEmu")) {
202      TrackToL1ObjMatcher matcher(theConfig.getParameter<edm::ParameterSet>("matcherPSet"));
203      L1ObjMakerRpcEmu l1RpcsFromEmu( theConfig.getParameter<edm::InputTag>("l1RpcEmu"), ev);
204      std::vector<L1Obj> l1RpcsEmu = l1RpcsFromEmu();
# Line 181 | Line 213 | void L1RpcTreeMaker::analyze(const edm::
213    //
214    L1ObjMaker l1( theConfig.getParameter<edm::InputTag>("l1MuReadout"), ev);
215    TrackToL1ObjMatcher matcher(theConfig.getParameter<edm::ParameterSet>("matcherPSet"));
216 <  std::vector<L1Obj> l1Rpcs = l1(L1ObjMaker::RPCB,L1ObjMaker::RPCF);
217 <  std::vector<L1Obj> l1Others = l1(L1ObjMaker::DT,L1ObjMaker::CSC);
216 >  std::vector<L1Obj> l1Rpcs = l1(L1Obj::RPCB,L1Obj::RPCF);
217 >  std::vector<L1Obj> l1Others = l1(L1Obj::DT,L1Obj::CSC);
218 >  std::vector<L1Obj> l1Gmts =  l1(L1Obj::GMT);
219    std::vector<bool> l1RpcsMatching(l1Rpcs.size(), false);
220    std::vector<bool> l1OthersMatching(l1Others.size(), false);
221 +  std::vector<bool> l1GmtsMatching(l1Gmts.size(), false);
222    for(unsigned int i=0; i< l1Rpcs.size(); ++i) if (matcher(l1Rpcs[i].eta, l1Rpcs[i].phi, theMuon, ev,es)) l1RpcsMatching[i]=true;
223    for(unsigned int i=0; i< l1Others.size(); ++i) if (matcher(l1Others[i].eta, l1Others[i].phi, theMuon, ev,es)) l1OthersMatching[i]=true;
224 +  for(unsigned int i=0; i< l1Gmts.size(); ++i) if (matcher(l1Gmts[i].eta, l1Gmts[i].phi, theMuon, ev,es)) l1GmtsMatching[i]=true;
225    l1RpcColl->set(l1Rpcs);
226    l1RpcColl->set(l1RpcsMatching);
227    l1OtherColl->set(l1Others);
228    l1OtherColl->set(l1OthersMatching);
229 +  l1GmtColl->set(l1Gmts);
230 +  l1GmtColl->set(l1GmtsMatching);
231  
232 < //  std::cout <<"RPCColl:"<<std::endl; l1RpcColl->print();
233 < //  std::cout <<"RPCCollEmu:"<<std::endl; l1RpcCollEmu->print();
232 >
233 >  std::cout <<"----"<<std::endl;
234 >  std::cout <<"RPCColl:   "<<std::endl; l1RpcColl->print();
235 >  std::cout <<"RPCCollEmu:"<<std::endl; l1RpcCollEmu->print();
236 >  std::cout <<"GmtColl:   "<<std::endl; l1GmtColl->print();
237 >  std::cout <<"GmtCollEmu:"<<std::endl;
238 >
239 > // edm::Handle<L1MuGMTReadoutCollection> pCollection;
240 > // ev.getByLabel(l1MuReadout,pCollection);
241 > //  std::cout <<"IS COLLECTION VALID: "<< pCollection->isValid() << std::endl;
242 >  L1ObjMaker l1Bis( edm::InputTag("mkGmtDigis"), ev);
243 >  std::vector<L1Obj> l1GmtsEmu =  l1Bis(L1Obj::GMT);
244 >  for (unsigned int i=0; i<l1GmtsEmu.size(); ++i) {
245 >    std::cout <<"("<<i<<")";l1GmtsEmu[i].print();
246 >    std::cout <<std::endl;
247 >  }
248 > */
249  
250    //
251    // fill ntuple + cleanup
# Line 203 | Line 255 | void L1RpcTreeMaker::analyze(const edm::
255    delete event; event = 0;
256    delete muon;  muon = 0;
257    delete track; track = 0;
258 +  delete bitsL1;  bitsL1= 0;
259 +  delete bitsHLT;  bitsHLT= 0;
260 +  delete l1ObjColl; l1ObjColl = 0;
261 + /*
262    delete l1RpcColl; l1RpcColl = 0;
263    delete l1OtherColl; l1OtherColl = 0;
264    delete l1RpcCollEmu; l1RpcCollEmu = 0;
265 +  delete l1GmtColl; l1GmtColl = 0;
266 + */
267   }
268                                  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines