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" |
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() |
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); |
59 |
– |
theTree->Branch("clSizeCompDets",&clSizeCompDets); |
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); |
93 |
|
|
94 |
|
void L1RpcTreeMaker::analyze(const edm::Event &ev, const edm::EventSetup &es) |
95 |
|
{ |
89 |
– |
|
90 |
– |
|
96 |
|
// |
97 |
|
// check reference muon |
98 |
|
// |
116 |
|
// |
117 |
|
muon = new MuonObj(); |
118 |
|
track = new TrackObj(); |
119 |
< |
// counts = new SynchroCountsObjVect; |
119 |
> |
|
120 |
> |
bitsL1 = new TriggerMenuResultObj(); |
121 |
> |
bitsHLT = new TriggerMenuResultObj(); |
122 |
> |
|
123 |
|
counts = std::vector<SynchroCountsObj>(); |
124 |
|
detsCrossedByMuon = std::vector<uint32_t>(); |
125 |
|
detsCrossedByMuonDeepInside = std::vector<uint32_t>(); |
126 |
< |
detsHitsCompatibleWithMuon = std::vector<uint32_t>(); |
126 |
> |
detsHitsCompatibleWithMuon = std::vector<DetCluDigiObj>(); |
127 |
|
detsSIMU = std::vector<uint32_t>(); |
128 |
< |
nDigisCompDets = std::vector<uint32_t>(); |
121 |
< |
clSizeCompDets = std::vector<uint32_t>(); |
128 |
> |
|
129 |
|
l1RpcColl = new L1ObjColl; |
130 |
|
l1OtherColl = new L1ObjColl; |
131 |
|
l1RpcCollEmu = new L1ObjColl; |
132 |
+ |
l1GmtColl = new L1ObjColl; |
133 |
|
|
134 |
|
// |
135 |
|
// fill muon info |
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 |
|
|
180 |
|
// |
181 |
|
// fill L1 RPCemu |
182 |
|
// |
183 |
< |
if (theConfig.exists("l1RpcEmu") ) { |
183 |
> |
if (theConfig.exists("l1RpcEmu")) { |
184 |
|
TrackToL1ObjMatcher matcher(theConfig.getParameter<edm::ParameterSet>("matcherPSet")); |
185 |
|
L1ObjMakerRpcEmu l1RpcsFromEmu( theConfig.getParameter<edm::InputTag>("l1RpcEmu"), ev); |
186 |
|
std::vector<L1Obj> l1RpcsEmu = l1RpcsFromEmu(); |
195 |
|
// |
196 |
|
L1ObjMaker l1( theConfig.getParameter<edm::InputTag>("l1MuReadout"), ev); |
197 |
|
TrackToL1ObjMatcher matcher(theConfig.getParameter<edm::ParameterSet>("matcherPSet")); |
198 |
< |
std::vector<L1Obj> l1Rpcs = l1(L1ObjMaker::RPCB,L1ObjMaker::RPCF); |
199 |
< |
std::vector<L1Obj> l1Others = l1(L1ObjMaker::DT,L1ObjMaker::CSC); |
198 |
> |
std::vector<L1Obj> l1Rpcs = l1(L1Obj::RPCB,L1Obj::RPCF); |
199 |
> |
std::vector<L1Obj> l1Others = l1(L1Obj::DT,L1Obj::CSC); |
200 |
> |
std::vector<L1Obj> l1Gmts = l1(L1Obj::GMT); |
201 |
|
std::vector<bool> l1RpcsMatching(l1Rpcs.size(), false); |
202 |
|
std::vector<bool> l1OthersMatching(l1Others.size(), false); |
203 |
+ |
std::vector<bool> l1GmtsMatching(l1Gmts.size(), false); |
204 |
|
for(unsigned int i=0; i< l1Rpcs.size(); ++i) if (matcher(l1Rpcs[i].eta, l1Rpcs[i].phi, theMuon, ev,es)) l1RpcsMatching[i]=true; |
205 |
|
for(unsigned int i=0; i< l1Others.size(); ++i) if (matcher(l1Others[i].eta, l1Others[i].phi, theMuon, ev,es)) l1OthersMatching[i]=true; |
206 |
+ |
for(unsigned int i=0; i< l1Gmts.size(); ++i) if (matcher(l1Gmts[i].eta, l1Gmts[i].phi, theMuon, ev,es)) l1GmtsMatching[i]=true; |
207 |
|
l1RpcColl->set(l1Rpcs); |
208 |
|
l1RpcColl->set(l1RpcsMatching); |
209 |
|
l1OtherColl->set(l1Others); |
210 |
|
l1OtherColl->set(l1OthersMatching); |
211 |
+ |
l1GmtColl->set(l1Gmts); |
212 |
+ |
l1GmtColl->set(l1GmtsMatching); |
213 |
+ |
|
214 |
|
|
215 |
< |
// std::cout <<"RPCColl:"<<std::endl; l1RpcColl->print(); |
216 |
< |
// std::cout <<"RPCCollEmu:"<<std::endl; l1RpcCollEmu->print(); |
215 |
> |
std::cout <<"----"<<std::endl; |
216 |
> |
std::cout <<"RPCColl: "<<std::endl; l1RpcColl->print(); |
217 |
> |
std::cout <<"RPCCollEmu:"<<std::endl; l1RpcCollEmu->print(); |
218 |
> |
std::cout <<"GmtColl: "<<std::endl; l1GmtColl->print(); |
219 |
> |
std::cout <<"GmtCollEmu:"<<std::endl; |
220 |
> |
/* |
221 |
> |
L1ObjMaker l1Bis( theConfig.getParameter<edm::InputTag>("mkGtDigis"), ev); |
222 |
> |
std::vector<L1Obj> l1GmtsEmu = l1Bis(L1Obj::GMT); |
223 |
> |
for (unsigned int i=0; i<l1GmtsEmu.size(); ++i) { |
224 |
> |
std::cout <<"("<<i<<")";l1GmtsEmu[i].print(); |
225 |
> |
std::cout <<std::endl; |
226 |
> |
} |
227 |
> |
*/ |
228 |
|
|
229 |
|
// |
230 |
|
// fill ntuple + cleanup |
234 |
|
delete event; event = 0; |
235 |
|
delete muon; muon = 0; |
236 |
|
delete track; track = 0; |
237 |
+ |
delete bitsL1; bitsL1= 0; |
238 |
+ |
delete bitsHLT; bitsHLT= 0; |
239 |
|
delete l1RpcColl; l1RpcColl = 0; |
240 |
|
delete l1OtherColl; l1OtherColl = 0; |
241 |
|
delete l1RpcCollEmu; l1RpcCollEmu = 0; |
242 |
+ |
delete l1GmtColl; l1GmtColl = 0; |
243 |
|
} |
244 |
|
|