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.5 by konec, Tue Oct 23 16:14:05 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")),
38 +    theL1ObjMaker(cfg.getParameter<edm::ParameterSet>("l1ObjMaker")),
39      theMenuInspector(edm::ParameterSet())
40   { }
41  
# Line 63 | Line 62 | void L1RpcTreeMaker::beginJob()
62    theTree->Branch("detsCrossedByMuonDeepInside",&detsCrossedByMuonDeepInside);
63    theTree->Branch("detsHitsCompatibleWithMuon",&detsHitsCompatibleWithMuon);
64    theTree->Branch("detsSIMU",&detsSIMU);
66  theTree->Branch("nDigisCompDets",&nDigisCompDets);
67  theTree->Branch("clSizeCompDets",&clSizeCompDets);
65  
66 <  theTree->Branch("l1RpcColl","L1ObjColl",&l1RpcColl,32000,99);
70 <  theTree->Branch("l1RpcCollEmu","L1ObjColl",&l1RpcCollEmu,32000,99);
71 <  theTree->Branch("l1OtherColl","L1ObjColl",&l1OtherColl,32000,99);
66 >  theTree->Branch("l1ObjColl","L1ObjColl",&l1ObjColl,32000,99);
67  
68    theHelper.SetOwner();
69    theBestMuonFinder.initHistos(theHelper);
# Line 94 | Line 89 | L1RpcTreeMaker::~L1RpcTreeMaker()
89  
90   void L1RpcTreeMaker::analyze(const edm::Event &ev, const edm::EventSetup &es)
91   {
97
98
92    //
93    // check reference muon
94    //
# Line 123 | Line 116 | void L1RpcTreeMaker::analyze(const edm::
116    bitsL1 = new TriggerMenuResultObj();
117    bitsHLT = new TriggerMenuResultObj();
118  
126 //  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>();
134 <  l1RpcColl = new L1ObjColl;
135 <  l1OtherColl = new L1ObjColl;
136 <  l1RpcCollEmu = new L1ObjColl;
124 >
125 >  l1ObjColl = new L1ObjColl;
126  
127    //
128    // fill muon info
# Line 166 | Line 155 | void L1RpcTreeMaker::analyze(const edm::
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);
173    nDigisCompDets = theDetHitCollector.nDigisCompDets(detsHitsCompatibleWithMuon, ev, es);
174    clSizeCompDets = theDetHitCollector.clSizeCompDets(detsHitsCompatibleWithMuon, ev, es);
175
176    for (uint32_t i=0; i< nDigisCompDets.size(); i++) {
177      if (clSizeCompDets[i] > nDigisCompDets[i]) std::cout <<" PROBLEM, event: "<<theCounter<<" cl:"<<clSizeCompDets[i]<<" nDigis:"<<nDigisCompDets[i]<<std::endl;
178    }
162    }
163  
164    
# Line 188 | Line 171 | void L1RpcTreeMaker::analyze(const edm::
171    
172  
173    //
174 <  // fill L1 RPCemu
174 >  // fill L1 info
175    //
176 <  if (theConfig.exists("l1RpcEmu") ) {
177 <    TrackToL1ObjMatcher matcher(theConfig.getParameter<edm::ParameterSet>("matcherPSet"));
178 <    L1ObjMakerRpcEmu l1RpcsFromEmu( theConfig.getParameter<edm::InputTag>("l1RpcEmu"), ev);
179 <    std::vector<L1Obj> l1RpcsEmu = l1RpcsFromEmu();
197 <    std::vector<bool> l1RpcsEmuMatching(l1RpcsEmu.size(), false);
198 <    for(unsigned int i=0; i< l1RpcsEmu.size(); ++i) if (matcher(l1RpcsEmu[i].eta, l1RpcsEmu[i].phi, theMuon, ev,es)) l1RpcsEmuMatching[i]=true;
199 <    l1RpcCollEmu->set(l1RpcsEmu);
200 <    l1RpcCollEmu->set(l1RpcsEmuMatching);
201 <  }
202 <
203 <  //
204 <  // fill L1 objects (Rpc,Oth)
205 <  //
206 <  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);
217 <  l1OtherColl->set(l1OthersMatching);
218 <
219 < //  std::cout <<"RPCColl:"<<std::endl; l1RpcColl->print();
220 < //  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 229 | 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;
233 <  delete l1OtherColl; l1OtherColl = 0;
234 <  delete l1RpcCollEmu; l1RpcCollEmu = 0;
201 >  delete l1ObjColl; l1ObjColl = 0;
202   }
203                                  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines