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.13 by konec, Tue Apr 23 09:27:55 2013 UTC

# Line 16 | Line 16
16   #include "UserCode/L1RpcTriggerAnalysis/interface/BestMuonFinder.h"
17   #include "UserCode/L1RpcTriggerAnalysis/interface/DetHitCompatibleCollector.h"
18   #include "UserCode/L1RpcTriggerAnalysis/interface/L1ObjMaker.h"
19 #include "UserCode/L1RpcTriggerAnalysis/interface/L1ObjMakerRpcEmu.h"
19   #include "UserCode/L1RpcTriggerAnalysis/interface/TrackToL1ObjMatcher.h"
20   #include "DataFormats/RPCDigi/interface/RPCRawSynchro.h"
21   #include "UserCode/L1RpcTriggerAnalysis/interface/ConverterRPCRawSynchroSynchroCountsObj.h"
# Line 27 | Line 26
26  
27   template <class T> T sqr( T t) {return t*t;}
28  
30
29   L1RpcTreeMaker::L1RpcTreeMaker(const edm::ParameterSet& cfg)
30    : theConfig(cfg), theTree(0), event(0), muon(0), track(0),
31      bitsL1(0), bitsHLT(0),
32      counts(0),
33 <    l1RpcColl(0) , l1OtherColl(0), l1RpcCollEmu(0),
33 >    l1ObjColl(0),
34      theCounter(0),
35      theBestMuonFinder(cfg.getParameter<edm::ParameterSet>("bestMuonFinder")),
36      theDetHitCollector(cfg.getParameter<edm::ParameterSet>("detHitCollector")),
37 <    theSynchroGrabber(cfg.getParameter<edm::ParameterSet>("linkSynchroGrabber"))
37 >    theSynchroGrabber(cfg.getParameter<edm::ParameterSet>("linkSynchroGrabber")),
38 >    theL1ObjMaker(cfg.getParameter<edm::ParameterSet>("l1ObjMaker")),
39 >    theMenuInspector(edm::ParameterSet())
40   { }
41  
42 < void L1RpcTreeMaker::beginRun( const edm::Run &ru, const edm::EventSetup &es)
42 > void L1RpcTreeMaker::beginRun(const edm::Run &ru, const edm::EventSetup &es)
43   {
44 +  std::cout <<" L1RpcTreeMaker::beginRun CALLED" << std::endl;
45 +  theMenuInspector.checkRun(ru,es);
46   }
47  
48   void L1RpcTreeMaker::beginJob()
# Line 60 | Line 62 | void L1RpcTreeMaker::beginJob()
62    theTree->Branch("detsCrossedByMuonDeepInside",&detsCrossedByMuonDeepInside);
63    theTree->Branch("detsHitsCompatibleWithMuon",&detsHitsCompatibleWithMuon);
64    theTree->Branch("detsSIMU",&detsSIMU);
63  theTree->Branch("nDigisCompDets",&nDigisCompDets);
64  theTree->Branch("clSizeCompDets",&clSizeCompDets);
65  
66 <  theTree->Branch("l1RpcColl","L1ObjColl",&l1RpcColl,32000,99);
67 <  theTree->Branch("l1RpcCollEmu","L1ObjColl",&l1RpcCollEmu,32000,99);
68 <  theTree->Branch("l1OtherColl","L1ObjColl",&l1OtherColl,32000,99);
66 >  theTree->Branch("l1ObjColl","L1ObjColl",&l1ObjColl,32000,99);
67  
68    theHelper.SetOwner();
69    theBestMuonFinder.initHistos(theHelper);
# Line 91 | Line 89 | L1RpcTreeMaker::~L1RpcTreeMaker()
89  
90   void L1RpcTreeMaker::analyze(const edm::Event &ev, const edm::EventSetup &es)
91   {
94
95
92    //
93    // check reference muon
94    //
# Line 120 | Line 116 | void L1RpcTreeMaker::analyze(const edm::
116    bitsL1 = new TriggerMenuResultObj();
117    bitsHLT = new TriggerMenuResultObj();
118  
123 //  counts = new SynchroCountsObjVect;
119    counts = std::vector<SynchroCountsObj>();
120    detsCrossedByMuon = std::vector<uint32_t>();
121    detsCrossedByMuonDeepInside = std::vector<uint32_t>();
122 <  detsHitsCompatibleWithMuon = std::vector<uint32_t>();
122 >  detsHitsCompatibleWithMuon = std::vector<DetCluDigiObj>();
123    detsSIMU = std::vector<uint32_t>();
124 <  nDigisCompDets = std::vector<uint32_t>();
125 <  clSizeCompDets = std::vector<uint32_t>();
131 <  l1RpcColl = new L1ObjColl;
132 <  l1OtherColl = new L1ObjColl;
133 <  l1RpcCollEmu = new L1ObjColl;
124 >
125 >  l1ObjColl = new L1ObjColl;
126  
127    //
128    // fill muon info
# Line 146 | Line 138 | void L1RpcTreeMaker::analyze(const edm::
138    } else  muon->nRPCHits = muon->nDTHits = muon->nCSCHits = 0;
139    muon->nTrackerHits = theMuon->isTrackerMuon() ? (theMuon->innerTrack())->hitPattern().numberOfValidTrackerHits() : 0;
140  
141 +  //
142 +  // fill algoBits info
143 +  //
144 +  static edm::RunNumber_t lastRun = 0;
145 +  if (ev.run() != lastRun) {
146 +    lastRun = ev.run();
147 +    bitsL1->names  = theMenuInspector.namesAlgoL1();
148 +    bitsHLT->names = theMenuInspector.namesAlgoHLT();
149 +  }
150 +  bitsL1->firedAlgos = theMenuInspector.firedAlgosL1(ev,es);
151 +  bitsHLT->firedAlgos = theMenuInspector.firedAlgosHLT(ev,es);
152 +  
153  
154    //
155    // hits and detectors compatible with muon track
156    //
157    if ( muon->pt() > 10.) {
158 <    detsHitsCompatibleWithMuon = theDetHitCollector.compatibleHits( theMuon, ev, es);
158 >    detsHitsCompatibleWithMuon = theDetHitCollector.compatibleHits( theMuon, ev, es);
159      detsCrossedByMuon = theDetHitCollector.compatibleDets( theMuon, ev, es, false);
160      detsCrossedByMuonDeepInside = theDetHitCollector.compatibleDets( theMuon, ev, es, true);
161      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    }
162    }
163  
164    
# Line 173 | Line 171 | void L1RpcTreeMaker::analyze(const edm::
171    
172  
173    //
174 <  // fill L1 RPCemu
177 <  //
178 <  if (theConfig.exists("l1RpcEmu") ) {
179 <    TrackToL1ObjMatcher matcher(theConfig.getParameter<edm::ParameterSet>("matcherPSet"));
180 <    L1ObjMakerRpcEmu l1RpcsFromEmu( theConfig.getParameter<edm::InputTag>("l1RpcEmu"), ev);
181 <    std::vector<L1Obj> l1RpcsEmu = l1RpcsFromEmu();
182 <    std::vector<bool> l1RpcsEmuMatching(l1RpcsEmu.size(), false);
183 <    for(unsigned int i=0; i< l1RpcsEmu.size(); ++i) if (matcher(l1RpcsEmu[i].eta, l1RpcsEmu[i].phi, theMuon, ev,es)) l1RpcsEmuMatching[i]=true;
184 <    l1RpcCollEmu->set(l1RpcsEmu);
185 <    l1RpcCollEmu->set(l1RpcsEmuMatching);
186 <  }
187 <
174 >  // fill L1 info
175    //
176 <  // fill L1 objects (Rpc,Oth)
177 <  //
178 <  L1ObjMaker l1( theConfig.getParameter<edm::InputTag>("l1MuReadout"), ev);
176 >  std::vector<L1Obj> l1Obj = theL1ObjMaker(ev);
177 >  l1ObjColl->set( l1Obj);
178 >  std::vector<bool> matching(l1Obj.size(), false);
179 >  std::vector<double> deltaR(l1Obj.size(), 0.);
180    TrackToL1ObjMatcher matcher(theConfig.getParameter<edm::ParameterSet>("matcherPSet"));
181 <  std::vector<L1Obj> l1Rpcs = l1(L1ObjMaker::RPCB,L1ObjMaker::RPCF);
182 <  std::vector<L1Obj> l1Others = l1(L1ObjMaker::DT,L1ObjMaker::CSC);
183 <  std::vector<bool> l1RpcsMatching(l1Rpcs.size(), false);
184 <  std::vector<bool> l1OthersMatching(l1Others.size(), false);
185 <  for(unsigned int i=0; i< l1Rpcs.size(); ++i) if (matcher(l1Rpcs[i].eta, l1Rpcs[i].phi, theMuon, ev,es)) l1RpcsMatching[i]=true;
186 <  for(unsigned int i=0; i< l1Others.size(); ++i) if (matcher(l1Others[i].eta, l1Others[i].phi, theMuon, ev,es)) l1OthersMatching[i]=true;
187 <  l1RpcColl->set(l1Rpcs);
188 <  l1RpcColl->set(l1RpcsMatching);
189 <  l1OtherColl->set(l1Others);
202 <  l1OtherColl->set(l1OthersMatching);
203 <
204 < //  std::cout <<"RPCColl:"<<std::endl; l1RpcColl->print();
205 < //  std::cout <<"RPCCollEmu:"<<std::endl; l1RpcCollEmu->print();
181 >  for(unsigned int i=0; i< l1Obj.size(); ++i) {
182 >    if (matcher(l1Obj[i].eta, l1Obj[i].phi, theMuon, ev,es)) matching[i]=true;
183 >    TrackToL1ObjMatcher::LastResult result = matcher.lastResult();
184 >    deltaR[i] = sqrt( sqr(result.deltaEta) + sqr(result.deltaPhi) );
185 >  }
186 >  l1ObjColl->set( matching );
187 >  l1ObjColl->set( deltaR );
188 >  std::cout <<"----------"<<std::endl;
189 >  std::cout <<*l1ObjColl << std::endl;
190  
191    //
192    // fill ntuple + cleanup
# Line 214 | Line 198 | void L1RpcTreeMaker::analyze(const edm::
198    delete track; track = 0;
199    delete bitsL1;  bitsL1= 0;
200    delete bitsHLT;  bitsHLT= 0;
201 <  delete l1RpcColl; l1RpcColl = 0;
218 <  delete l1OtherColl; l1OtherColl = 0;
219 <  delete l1RpcCollEmu; l1RpcCollEmu = 0;
201 >  delete l1ObjColl; l1ObjColl = 0;
202   }
203                                  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines