CMS 3D CMS Logo

GlobalRecHitsAnalyzer.cc
Go to the documentation of this file.
1 
15 using namespace std;
16 
18  fName(""), verbosity(0), frequency(0), label(""), getAllProvenances(false),
19  printProvenanceInfo(false), trackerHitAssociatorConfig_(iPSet, consumesCollector()), count(0)
20 {
21  consumesMany<edm::SortedCollection<HBHERecHit, edm::StrictWeakOrdering<HBHERecHit> > >();
22  consumesMany<edm::SortedCollection<HFRecHit, edm::StrictWeakOrdering<HFRecHit> > >();
23  consumesMany<edm::SortedCollection<HORecHit, edm::StrictWeakOrdering<HORecHit> > >();
24  std::string MsgLoggerCat = "GlobalRecHitsAnalyzer_GlobalRecHitsAnalyzer";
25 
26  // get information from parameter set
27  fName = iPSet.getUntrackedParameter<std::string>("Name");
28  verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
29  frequency = iPSet.getUntrackedParameter<int>("Frequency");
30  edm::ParameterSet m_Prov =
31  iPSet.getParameter<edm::ParameterSet>("ProvenanceLookup");
33  m_Prov.getUntrackedParameter<bool>("GetAllProvenances");
35  m_Prov.getUntrackedParameter<bool>("PrintProvenanceInfo");
36  hitsProducer = iPSet.getParameter<std::string>("hitsProducer");
37 
38  //get Labels to use to extract information
39  ECalEBSrc_ = iPSet.getParameter<edm::InputTag>("ECalEBSrc");
40  ECalUncalEBSrc_ = iPSet.getParameter<edm::InputTag>("ECalUncalEBSrc");
41  ECalEESrc_ = iPSet.getParameter<edm::InputTag>("ECalEESrc");
42  ECalUncalEESrc_ = iPSet.getParameter<edm::InputTag>("ECalUncalEESrc");
43  ECalESSrc_ = iPSet.getParameter<edm::InputTag>("ECalESSrc");
44  HCalSrc_ = iPSet.getParameter<edm::InputTag>("HCalSrc");
45  SiStripSrc_ = iPSet.getParameter<edm::InputTag>("SiStripSrc");
46  SiPxlSrc_ = iPSet.getParameter<edm::InputTag>("SiPxlSrc");
47  MuDTSrc_ = iPSet.getParameter<edm::InputTag>("MuDTSrc");
48  MuDTSimSrc_ = iPSet.getParameter<edm::InputTag>("MuDTSimSrc");
49  MuCSCSrc_ = iPSet.getParameter<edm::InputTag>("MuCSCSrc");
50  MuRPCSrc_ = iPSet.getParameter<edm::InputTag>("MuRPCSrc");
51  MuRPCSimSrc_ = iPSet.getParameter<edm::InputTag>("MuRPCSimSrc");
52 
53  // fix for consumes
54  ECalUncalEBSrc_Token_ = consumes<EBUncalibratedRecHitCollection>(iPSet.getParameter<edm::InputTag>("ECalUncalEBSrc"));
55  ECalUncalEESrc_Token_ = consumes<EEUncalibratedRecHitCollection>(iPSet.getParameter<edm::InputTag>("ECalUncalEESrc"));
56  ECalEBSrc_Token_ = consumes<EBRecHitCollection>(iPSet.getParameter<edm::InputTag>("ECalEBSrc"));
57  ECalEESrc_Token_ = consumes<EERecHitCollection>(iPSet.getParameter<edm::InputTag>("ECalEESrc"));
58  ECalESSrc_Token_ = consumes<ESRecHitCollection>(iPSet.getParameter<edm::InputTag>("ECalESSrc"));
59  HCalSrc_Token_ = consumes<edm::PCaloHitContainer>(iPSet.getParameter<edm::InputTag>("HCalSrc"));
60  SiStripSrc_Token_ = consumes<SiStripMatchedRecHit2DCollection>(iPSet.getParameter<edm::InputTag>("SiStripSrc"));
61  SiPxlSrc_Token_ = consumes<SiPixelRecHitCollection>(iPSet.getParameter<edm::InputTag>("SiPxlSrc"));
62 
63  MuDTSrc_Token_ = consumes<DTRecHitCollection>(iPSet.getParameter<edm::InputTag>("MuDTSrc"));
64  MuDTSimSrc_Token_ = consumes<edm::PSimHitContainer>(iPSet.getParameter<edm::InputTag>("MuDTSimSrc"));
65 
66  MuCSCSrc_Token_ = consumes<CSCRecHit2DCollection>(iPSet.getParameter<edm::InputTag>("MuCSCSrc"));
67  MuCSCHits_Token_ = consumes<CrossingFrame<PSimHit>>(edm::InputTag(std::string("mix"), iPSet.getParameter<std::string>("hitsProducer") + std::string("MuonCSCHits")));
68 
69  MuRPCSrc_Token_ = consumes<RPCRecHitCollection>(iPSet.getParameter<edm::InputTag>("MuRPCSrc"));
70  MuRPCSimSrc_Token_ = consumes<edm::PSimHitContainer>(iPSet.getParameter<edm::InputTag>("MuRPCSimSrc"));
71 
72  EBHits_Token_ = consumes<CrossingFrame<PCaloHit> >(edm::InputTag(std::string("mix"), iPSet.getParameter<std::string>("hitsProducer") + std::string("EcalHitsEB")));
73  EEHits_Token_ = consumes<CrossingFrame<PCaloHit> >(edm::InputTag(std::string("mix"), iPSet.getParameter<std::string>("hitsProducer") + std::string("EcalHitsEE")));
74  ESHits_Token_ = consumes<CrossingFrame<PCaloHit> >(edm::InputTag(std::string("mix"), iPSet.getParameter<std::string>("hitsProducer") + std::string("EcalHitsES")));
75 
76  // use value of first digit to determine default output level (inclusive)
77  // 0 is none, 1 is basic, 2 is fill output, 3 is gather output
78  verbosity %= 10;
79 
80  // create persistent object
81  // produces<PGlobalRecHit>(label);
82 
83  // print out Parameter Set information being used
84  if (verbosity >= 0) {
85  edm::LogInfo(MsgLoggerCat)
86  << "\n===============================\n"
87  << "Initialized as EDProducer with parameter values:\n"
88  << " Name = " << fName << "\n"
89  << " Verbosity = " << verbosity << "\n"
90  << " Frequency = " << frequency << "\n"
91  << " GetProv = " << getAllProvenances << "\n"
92  << " PrintProv = " << printProvenanceInfo << "\n"
93  << " ECalEBSrc = " << ECalEBSrc_.label()
94  << ":" << ECalEBSrc_.instance() << "\n"
95  << " ECalUncalEBSrc = " << ECalUncalEBSrc_.label()
96  << ":" << ECalUncalEBSrc_.instance() << "\n"
97  << " ECalEESrc = " << ECalEESrc_.label()
98  << ":" << ECalUncalEESrc_.instance() << "\n"
99  << " ECalUncalEESrc = " << ECalUncalEESrc_.label()
100  << ":" << ECalEESrc_.instance() << "\n"
101  << " ECalESSrc = " << ECalESSrc_.label()
102  << ":" << ECalESSrc_.instance() << "\n"
103  << " HCalSrc = " << HCalSrc_.label()
104  << ":" << HCalSrc_.instance() << "\n"
105  << " SiStripSrc = " << SiStripSrc_.label()
106  << ":" << SiStripSrc_.instance() << "\n"
107  << " SiPixelSrc = " << SiPxlSrc_.label()
108  << ":" << SiPxlSrc_.instance() << "\n"
109  << " MuDTSrc = " << MuDTSrc_.label()
110  << ":" << MuDTSrc_.instance() << "\n"
111  << " MuDTSimSrc = " << MuDTSimSrc_.label()
112  << ":" << MuDTSimSrc_.instance() << "\n"
113  << " MuCSCSrc = " << MuCSCSrc_.label()
114  << ":" << MuCSCSrc_.instance() << "\n"
115  << " MuRPCSrc = " << MuRPCSrc_.label()
116  << ":" << MuRPCSrc_.instance() << "\n"
117  << " MuRPCSimSrc = " << MuRPCSimSrc_.label()
118  << ":" << MuRPCSimSrc_.instance() << "\n"
119  << "===============================\n";
120  }
121 }
122 
124 
126  // Si Strip
127  string SiStripString[19] = {"TECW1", "TECW2", "TECW3", "TECW4", "TECW5",
128  "TECW6", "TECW7", "TECW8", "TIBL1", "TIBL2",
129  "TIBL3", "TIBL4", "TIDW1", "TIDW2", "TIDW3",
130  "TOBL1", "TOBL2", "TOBL3", "TOBL4"};
131  for(int i = 0; i<19; ++i) {
132  mehSiStripn[i]=nullptr;
133  mehSiStripResX[i]=nullptr;
134  mehSiStripResY[i]=nullptr;
135  }
136  string hcharname, hchartitle;
137  iBooker.setCurrentFolder("GlobalRecHitsV/SiStrips");
138  for(int amend = 0; amend < 19; ++amend) {
139  hcharname = "hSiStripn_"+SiStripString[amend];
140  hchartitle= SiStripString[amend]+" rechits";
141  mehSiStripn[amend] = iBooker.book1D(hcharname,hchartitle,200,0.,200.);
142  mehSiStripn[amend]->setAxisTitle("Number of hits in "+
143  SiStripString[amend],1);
144  mehSiStripn[amend]->setAxisTitle("Count",2);
145  hcharname = "hSiStripResX_"+SiStripString[amend];
146  hchartitle= SiStripString[amend]+" rechit x resolution";
147  mehSiStripResX[amend] = iBooker.book1D(hcharname,hchartitle,200,-0.02,.02);
148  mehSiStripResX[amend]->setAxisTitle("X-resolution in "
149  +SiStripString[amend],1);
150  mehSiStripResX[amend]->setAxisTitle("Count",2);
151  hcharname = "hSiStripResY_"+SiStripString[amend];
152  hchartitle= SiStripString[amend]+" rechit y resolution";
153  mehSiStripResY[amend] = iBooker.book1D(hcharname,hchartitle,200,-0.02,.02);
154  mehSiStripResY[amend]->setAxisTitle("Y-resolution in "+
155  SiStripString[amend],1);
156  mehSiStripResY[amend]->setAxisTitle("Count",2);
157  }
158 
159 
160  //HCal
161  //string hcharname, hchartitle;
162  string HCalString[4]={"HB", "HE", "HF", "HO"};
163  float HCalnUpper[4]={3000.,3000.,3000.,3000.};
164  float HCalnLower[4]={0.,0.,0.,0.};
165  for(int j =0; j <4; ++j) {
166  mehHcaln[j]=nullptr;
167  mehHcalRes[j]=nullptr;
168  }
169 
170  iBooker.setCurrentFolder("GlobalRecHitsV/HCals");
171  for(int amend = 0; amend < 4; ++amend) {
172  hcharname = "hHcaln_"+HCalString[amend];
173  hchartitle= HCalString[amend]+" rechits";
174  mehHcaln[amend] = iBooker.book1D(hcharname,hchartitle, 1000, HCalnLower[amend],
175  HCalnUpper[amend]);
176  mehHcaln[amend]->setAxisTitle("Number of RecHits",1);
177  mehHcaln[amend]->setAxisTitle("Count",2);
178  hcharname = "hHcalRes_"+HCalString[amend];
179  hchartitle= HCalString[amend]+" rechit resolution";
180  mehHcalRes[amend] = iBooker.book1D(hcharname,hchartitle, 25, -2., 2.);
181  mehHcalRes[amend]->setAxisTitle("RecHit E - SimHit E",1);
182  mehHcalRes[amend]->setAxisTitle("Count",2);
183  }
184 
185 
186  //Ecal
187  string ECalString[3] = {"EB","EE", "ES"};
188  int ECalnBins[3] = {1000,3000,150};
189  float ECalnUpper[3] = {20000., 62000., 3000.};
190  float ECalnLower[3] = {0., 0., 0.};
191  int ECalResBins[3] = {200,200,200};
192  float ECalResUpper[3] = {1., 0.3, .0002};
193  float ECalResLower[3] = {-1., -0.3, -.0002};
194  for(int i =0; i<3; ++i) {
195  mehEcaln[i]=nullptr;
196  mehEcalRes[i]=nullptr;
197  }
198  iBooker.setCurrentFolder("GlobalRecHitsV/ECals");
199 
200  for(int amend = 0; amend < 3; ++amend) {
201  hcharname = "hEcaln_"+ECalString[amend];
202  hchartitle= ECalString[amend]+" rechits";
203  mehEcaln[amend] = iBooker.book1D(hcharname,hchartitle, ECalnBins[amend],
204  ECalnLower[amend], ECalnUpper[amend]);
205  mehEcaln[amend]->setAxisTitle("Number of RecHits",1);
206  mehEcaln[amend]->setAxisTitle("Count",2);
207  hcharname = "hEcalRes_"+ECalString[amend];
208  hchartitle= ECalString[amend]+" rechit resolution";
209  mehEcalRes[amend] = iBooker.book1D(hcharname,hchartitle,ECalResBins[amend],
210  ECalResLower[amend],
211  ECalResUpper[amend]);
212  mehEcalRes[amend]->setAxisTitle("RecHit E - SimHit E",1);
213  mehEcalRes[amend]->setAxisTitle("Count",2);
214  }
215 
216  //Si Pixels
217  string SiPixelString[7] = {"BRL1", "BRL2", "BRL3", "FWD1n", "FWD1p",
218  "FWD2n", "FWD2p"};
219  for(int j =0; j<7; ++j) {
220  mehSiPixeln[j]=nullptr;
221  mehSiPixelResX[j]=nullptr;
222  mehSiPixelResY[j]=nullptr;
223  }
224 
225  iBooker.setCurrentFolder("GlobalRecHitsV/SiPixels");
226  for(int amend = 0; amend < 7; ++amend) {
227  hcharname = "hSiPixeln_"+SiPixelString[amend];
228  hchartitle= SiPixelString[amend]+" rechits";
229  mehSiPixeln[amend] = iBooker.book1D(hcharname,hchartitle,200,0.,200.);
230  mehSiPixeln[amend]->setAxisTitle("Number of hits in "+
231  SiPixelString[amend],1);
232  mehSiPixeln[amend]->setAxisTitle("Count",2);
233  hcharname = "hSiPixelResX_"+SiPixelString[amend];
234  hchartitle= SiPixelString[amend]+" rechit x resolution";
235  mehSiPixelResX[amend] = iBooker.book1D(hcharname,hchartitle,200,-0.02,.02);
236  mehSiPixelResX[amend]->setAxisTitle("X-resolution in "+
237  SiPixelString[amend],1);
238  mehSiPixelResX[amend]->setAxisTitle("Count",2);
239  hcharname = "hSiPixelResY_"+SiPixelString[amend];
240  hchartitle= SiPixelString[amend]+" rechit y resolution";
241 
242  mehSiPixelResY[amend] = iBooker.book1D(hcharname,hchartitle,200,-0.02,.02);
243  mehSiPixelResY[amend]->setAxisTitle("Y-resolution in "+
244  SiPixelString[amend],1);
245  mehSiPixelResY[amend]->setAxisTitle("Count",2);
246  }
247 
248  //Muons
249  iBooker.setCurrentFolder("GlobalRecHitsV/Muons");
250 
251  mehDtMuonn = nullptr;
252  mehCSCn = nullptr;
253  mehRPCn = nullptr;
254 
255  string n_List[3] = {"hDtMuonn", "hCSCn", "hRPCn"};
256  string hist_string[3] = {"Dt", "CSC", "RPC"};
257 
258  for(int amend=0; amend<3; ++amend) {
259  hchartitle = hist_string[amend]+" rechits";
260  if(amend==0) {
261  mehDtMuonn=iBooker.book1D(n_List[amend],hchartitle,50, 0., 500.);
262  mehDtMuonn->setAxisTitle("Number of Rechits",1);
263  mehDtMuonn->setAxisTitle("Count",2);
264  }
265  if(amend==1) {
266  mehCSCn=iBooker.book1D(n_List[amend],hchartitle,50, 0., 500.);
267  mehCSCn->setAxisTitle("Number of Rechits",1);
268  mehCSCn->setAxisTitle("Count",2);
269  }
270  if(amend==2){
271  mehRPCn=iBooker.book1D(n_List[amend],hchartitle,50, 0., 500.);
272  mehRPCn->setAxisTitle("Number of Rechits",1);
273  mehRPCn->setAxisTitle("Count",2);
274  }
275  }
276 
277  mehDtMuonRes=nullptr;
278  mehCSCResRDPhi=nullptr;
279  mehRPCResX=nullptr;
280 
281  hcharname = "hDtMuonRes";
282  hchartitle = "DT wire distance resolution";
283  mehDtMuonRes = iBooker.book1D(hcharname, hchartitle, 200, -0.2, 0.2);
284  hcharname = "CSCResRDPhi";
285  hchartitle = "CSC perp*dphi resolution";
286  mehCSCResRDPhi = iBooker.book1D(hcharname, hchartitle, 200, -0.2, 0.2);
287  hcharname = "hRPCResX";
288  hchartitle = "RPC rechits x resolution";
289  mehRPCResX = iBooker.book1D(hcharname, hchartitle, 50, -5., 5.);
290 }
291 
292 
294  const edm::EventSetup& iSetup)
295 {
296  std::string MsgLoggerCat = "GlobalRecHitsAnalyzer_analyze";
297 
298  // keep track of number of events processed
299  ++count;
300 
301  // get event id information
302  edm::RunNumber_t nrun = iEvent.id().run();
303  edm::EventNumber_t nevt = iEvent.id().event();
304 
305  if (verbosity > 0) {
306  edm::LogInfo(MsgLoggerCat)
307  << "Processing run " << nrun << ", event " << nevt
308  << " (" << count << " events total)";
309  } else if (verbosity == 0) {
310  if (nevt%frequency == 0 || nevt == 1) {
311  edm::LogInfo(MsgLoggerCat)
312  << "Processing run " << nrun << ", event " << nevt
313  << " (" << count << " events total)";
314  }
315  }
316 
317  // look at information available in the event
318  if (getAllProvenances) {
319 
320  std::vector<const edm::StableProvenance*> AllProv;
321  iEvent.getAllStableProvenance(AllProv);
322 
323  if (verbosity >= 0)
324  edm::LogInfo(MsgLoggerCat)
325  << "Number of Provenances = " << AllProv.size();
326 
327  if (printProvenanceInfo && (verbosity >= 0)) {
328  TString eventout("\nProvenance info:\n");
329 
330  for (unsigned int i = 0; i < AllProv.size(); ++i) {
331  eventout += "\n ******************************";
332  eventout += "\n Module : ";
333  eventout += AllProv[i]->moduleLabel();
334  eventout += "\n ProductID : ";
335  eventout += AllProv[i]->productID().id();
336  eventout += "\n ClassName : ";
337  eventout += AllProv[i]->className();
338  eventout += "\n InstanceName : ";
339  eventout += AllProv[i]->productInstanceName();
340  eventout += "\n BranchName : ";
341  eventout += AllProv[i]->branchName();
342  }
343  eventout += "\n ******************************\n";
344  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
345  printProvenanceInfo = false;
346  }
347  getAllProvenances = false;
348  }
349 
350  // call fill functions
351  // gather Ecal information from event
352  fillECal(iEvent, iSetup);
353  // gather Hcal information from event
354  fillHCal(iEvent, iSetup);
355  // gather Track information from event
356  fillTrk(iEvent, iSetup);
357  // gather Muon information from event
358  fillMuon(iEvent, iSetup);
359 
360  if (verbosity > 0)
361  edm::LogInfo (MsgLoggerCat)
362  << "Done gathering data from event.";
363 
364  return;
365 }
366 
368  const edm::EventSetup& iSetup)
369 {
370  std::string MsgLoggerCat = "GlobalRecHitsAnalyzer_fillECal";
371 
372  TString eventout;
373  if (verbosity > 0)
374  eventout = "\nGathering info:";
375 
376  // extract crossing frame from event
377  edm::Handle<CrossingFrame<PCaloHit> > crossingFrame;
378 
380  //extract EB information
383  iEvent.getByToken(ECalUncalEBSrc_Token_, EcalUncalibRecHitEB);
384  bool validUncalibRecHitEB = true;
385  if (!EcalUncalibRecHitEB.isValid()) {
386  LogDebug(MsgLoggerCat)
387  << "Unable to find EcalUncalRecHitEB in event!";
388  validUncalibRecHitEB = false;
389  }
390 
391  edm::Handle<EBRecHitCollection> EcalRecHitEB;
392  iEvent.getByToken(ECalEBSrc_Token_, EcalRecHitEB);
393  bool validRecHitEB = true;
394  if (!EcalRecHitEB.isValid()) {
395  LogDebug(MsgLoggerCat)
396  << "Unable to find EcalRecHitEB in event!";
397  validRecHitEB = false;
398  }
399 
400  // loop over simhits
401  iEvent.getByToken(EBHits_Token_,crossingFrame);
402  bool validXFrame = true;
403  if (!crossingFrame.isValid()) {
404  LogDebug(MsgLoggerCat)
405  << "Unable to find cal barrel crossingFrame in event!";
406  validXFrame = false;
407  }
408 
409  MapType ebSimMap;
410  if (validXFrame) {
411  const MixCollection<PCaloHit> barrelHits(crossingFrame.product());
412  // keep track of sum of simhit energy in each crystal
413  for ( auto const & iHit : barrelHits ) {
414 
415  EBDetId ebid = EBDetId(iHit.id());
416 
417  uint32_t crystid = ebid.rawId();
418  ebSimMap[crystid] += iHit.energy();
419  }
420  }
421 
422  int nEBRecHits = 0;
423  // loop over RecHits
424  if (validUncalibRecHitEB && validRecHitEB) {
425  const EBUncalibratedRecHitCollection *EBUncalibRecHit =
426  EcalUncalibRecHitEB.product();
427  const EBRecHitCollection *EBRecHit = EcalRecHitEB.product();
428 
430  EBUncalibRecHit->begin();
431  uncalibRecHit != EBUncalibRecHit->end();
432  ++uncalibRecHit) {
433 
434  EBDetId EBid = EBDetId(uncalibRecHit->id());
435 
436  EcalRecHitCollection::const_iterator myRecHit = EBRecHit->find(EBid);
437 
438  if (myRecHit != EBRecHit->end()) {
439  ++nEBRecHits;
440  mehEcalRes[1]->Fill(myRecHit->energy()-ebSimMap[EBid.rawId()]);
441  }
442  }
443 
444  if (verbosity > 1) {
445  eventout += "\n Number of EBRecHits collected:............ ";
446  eventout += nEBRecHits;
447  }
448  mehEcaln[1]->Fill((float)nEBRecHits);
449  }
450 
452  //extract EE information
455  iEvent.getByToken(ECalUncalEESrc_Token_, EcalUncalibRecHitEE);
456  bool validuncalibRecHitEE = true;
457  if (!EcalUncalibRecHitEE.isValid()) {
458  LogDebug(MsgLoggerCat)
459  << "Unable to find EcalUncalRecHitEE in event!";
460  validuncalibRecHitEE = false;
461  }
462 
463  edm::Handle<EERecHitCollection> EcalRecHitEE;
464  iEvent.getByToken(ECalEESrc_Token_, EcalRecHitEE);
465  bool validRecHitEE = true;
466  if (!EcalRecHitEE.isValid()) {
467  LogDebug(MsgLoggerCat)
468  << "Unable to find EcalRecHitEE in event!";
469  validRecHitEE = false;
470  }
471 
472  // loop over simhits
473  iEvent.getByToken(EEHits_Token_,crossingFrame);
474  validXFrame = true;
475  if (!crossingFrame.isValid()) {
476  LogDebug(MsgLoggerCat)
477  << "Unable to find cal endcap crossingFrame in event!";
478  validXFrame = false;
479  }
480 
481  MapType eeSimMap;
482  if (validXFrame) {
483  const MixCollection<PCaloHit> endcapHits(crossingFrame.product());
484  // keep track of sum of simhit energy in each crystal
485  for ( auto const & iHit: endcapHits ) {
486 
487  EEDetId eeid = EEDetId(iHit.id());
488 
489  uint32_t crystid = eeid.rawId();
490  eeSimMap[crystid] += iHit.energy();
491  }
492  }
493 
494  int nEERecHits = 0;
495  if (validuncalibRecHitEE && validRecHitEE) {
496  // loop over RecHits
497  const EEUncalibratedRecHitCollection *EEUncalibRecHit =
498  EcalUncalibRecHitEE.product();
499  const EERecHitCollection *EERecHit = EcalRecHitEE.product();
500 
502  EEUncalibRecHit->begin();
503  uncalibRecHit != EEUncalibRecHit->end();
504  ++uncalibRecHit) {
505 
506  EEDetId EEid = EEDetId(uncalibRecHit->id());
507 
508  EcalRecHitCollection::const_iterator myRecHit = EERecHit->find(EEid);
509 
510  if (myRecHit != EERecHit->end()) {
511  ++nEERecHits;
512  mehEcalRes[0]->Fill(myRecHit->energy()-eeSimMap[EEid.rawId()]);
513  }
514  }
515 
516  if (verbosity > 1) {
517  eventout += "\n Number of EERecHits collected:............ ";
518  eventout += nEERecHits;
519  }
520  mehEcaln[0]->Fill((float)nEERecHits);
521  }
522 
524  //extract ES information
526  edm::Handle<ESRecHitCollection> EcalRecHitES;
527  iEvent.getByToken(ECalESSrc_Token_, EcalRecHitES);
528  bool validRecHitES = true;
529  if (!EcalRecHitES.isValid()) {
530  LogDebug(MsgLoggerCat)
531  << "Unable to find EcalRecHitES in event!";
532  validRecHitES = false;
533  }
534 
535  // loop over simhits
536  iEvent.getByToken(ESHits_Token_,crossingFrame);
537  validXFrame = true;
538  if (!crossingFrame.isValid()) {
539  LogDebug(MsgLoggerCat)
540  << "Unable to find cal preshower crossingFrame in event!";
541  validXFrame = false;
542  }
543 
544  MapType esSimMap;
545  if (validXFrame) {
546  const MixCollection<PCaloHit> preshowerHits(crossingFrame.product());
547  // keep track of sum of simhit energy in each crystal
548  for ( auto const & iHit : preshowerHits ) {
549 
550  ESDetId esid = ESDetId(iHit.id());
551 
552  uint32_t crystid = esid.rawId();
553  esSimMap[crystid] += iHit.energy();
554  }
555  }
556 
557  int nESRecHits = 0;
558  if (validRecHitES) {
559  // loop over RecHits
560  const ESRecHitCollection *ESRecHit = EcalRecHitES.product();
562  ESRecHit->begin();
563  recHit != ESRecHit->end();
564  ++recHit) {
565 
566  ESDetId ESid = ESDetId(recHit->id());
567 
568  ++nESRecHits;
569  mehEcalRes[2]->Fill(recHit->energy()-esSimMap[ESid.rawId()]);
570  }
571 
572  if (verbosity > 1) {
573  eventout += "\n Number of ESRecHits collected:............ ";
574  eventout += nESRecHits;
575  }
576  mehEcaln[2]->Fill(float(nESRecHits));
577  }
578 
579  if (verbosity > 0)
580  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
581 
582  return;
583 }
584 
586  const edm::EventSetup& iSetup)
587 {
588  std::string MsgLoggerCat = "GlobalRecHitsAnalyzer_fillHCal";
589 
590  TString eventout;
591  if (verbosity > 0)
592  eventout = "\nGathering info:";
593 
594  // get geometry
596  iSetup.get<CaloGeometryRecord>().get(geometry);
597  if (!geometry.isValid()) {
598  edm::LogWarning(MsgLoggerCat)
599  << "Unable to find CaloGeometry in event!";
600  return;
601  }
602 
604  // extract simhit info
607  iEvent.getByToken(HCalSrc_Token_,hcalHits);
608  bool validhcalHits = true;
609  if (!hcalHits.isValid()) {
610  LogDebug(MsgLoggerCat)
611  << "Unable to find hcalHits in event!";
612  validhcalHits = false;
613  }
614 
615  std::map<HcalDetId,float> fHBEnergySimHits;
616  std::map<HcalDetId,float> fHEEnergySimHits;
617  std::map<HcalDetId,float> fHOEnergySimHits;
618  std::map<HcalDetId,float> fHFEnergySimHits;
619  if (validhcalHits) {
620  const edm::PCaloHitContainer *simhitResult = hcalHits.product();
621 
622  for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin();
623  simhits != simhitResult->end();
624  ++simhits) {
625 
626  HcalDetId detId(simhits->id());
627 
628  if (detId.subdet() == sdHcalBrl){
629  fHBEnergySimHits[detId] += simhits->energy();
630  }
631  if (detId.subdet() == sdHcalEC){
632  fHEEnergySimHits[detId] += simhits->energy();
633  }
634  if (detId.subdet() == sdHcalOut){
635  fHOEnergySimHits[detId] += simhits->energy();
636  }
637  if (detId.subdet() == sdHcalFwd){
638  fHFEnergySimHits[detId] += simhits->energy();
639  }
640  }
641  }
642 
643  // max values to be used (HO is found in HB)
644  Double_t maxHBEnergy = 0.;
645  Double_t maxHEEnergy = 0.;
646  Double_t maxHFEnergy = 0.;
647 
648  Double_t maxHBPhi = -1000.;
649  Double_t maxHEPhi = -1000.;
650  Double_t maxHOPhi = -1000.;
651  Double_t maxHFPhi = -1000.;
652 
653 
654  Double_t PI = 3.141592653589;
655 
657  // get HBHE information
659  std::vector<edm::Handle<HBHERecHitCollection> > hbhe;
660  iEvent.getManyByType(hbhe);
661  bool validHBHE = true;
662  if (!hbhe[0].isValid()) {
663  LogDebug(MsgLoggerCat)
664  << "Unable to find any HBHERecHitCollections in event!";
665  validHBHE = false;
666  }
667 
668  if (validHBHE) {
669  std::vector<edm::Handle<HBHERecHitCollection> >::iterator ihbhe;
670  const CaloGeometry* geo = geometry.product();
671 
672  int iHB = 0;
673  int iHE = 0;
674  for (ihbhe = hbhe.begin(); ihbhe != hbhe.end(); ++ihbhe) {
675 
676  // find max values
677  for (HBHERecHitCollection::const_iterator jhbhe = (*ihbhe)->begin();
678  jhbhe != (*ihbhe)->end(); ++jhbhe) {
679 
680  HcalDetId cell(jhbhe->id());
681 
682  if (cell.subdet() == sdHcalBrl) {
683 
684  const HcalGeometry* cellGeometry =
685  dynamic_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal,cell.subdet()));
686  double fPhi = cellGeometry->getPosition(cell).phi () ;
687  if ( (jhbhe->energy()) > maxHBEnergy ) {
688  maxHBEnergy = jhbhe->energy();
689  maxHBPhi = fPhi;
690  maxHOPhi = maxHBPhi;
691  }
692  }
693 
694  if (cell.subdet() == sdHcalEC) {
695 
696  const HcalGeometry* cellGeometry =
697  dynamic_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal,cell.subdet()));
698  double fPhi = cellGeometry->getPosition(cell).phi () ;
699  if ( (jhbhe->energy()) > maxHEEnergy ) {
700  maxHEEnergy = jhbhe->energy();
701  maxHEPhi = fPhi;
702  }
703  }
704  } // end find max values
705 
706  for (HBHERecHitCollection::const_iterator jhbhe = (*ihbhe)->begin();
707  jhbhe != (*ihbhe)->end(); ++jhbhe) {
708 
709  HcalDetId cell(jhbhe->id());
710 
711  if (cell.subdet() == sdHcalBrl) {
712 
713  ++iHB;
714 
715  const HcalGeometry* cellGeometry =
716  dynamic_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal,cell.subdet()));
717  double fPhi = cellGeometry->getPosition(cell).phi () ;
718 
719  float deltaphi = maxHBPhi - fPhi;
720  if (fPhi > maxHBPhi) { deltaphi = fPhi - maxHBPhi;}
721  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
722 
723  mehHcalRes[0]->Fill(jhbhe->energy() -
724  fHBEnergySimHits[cell]);
725  }
726 
727  if (cell.subdet() == sdHcalEC) {
728 
729  ++iHE;
730 
731  const HcalGeometry* cellGeometry =
732  dynamic_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal,cell.subdet()));
733  double fPhi = cellGeometry->getPosition(cell).phi () ;
734 
735  float deltaphi = maxHEPhi - fPhi;
736  if (fPhi > maxHEPhi) { deltaphi = fPhi - maxHEPhi;}
737  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
738  mehHcalRes[1]->Fill(jhbhe->energy() -
739  fHEEnergySimHits[cell]);
740  }
741  }
742  } // end loop through collection
743 
744 
745  if (verbosity > 1) {
746  eventout += "\n Number of HBRecHits collected:............ ";
747  eventout += iHB;
748  }
749 
750  if (verbosity > 1) {
751  eventout += "\n Number of HERecHits collected:............ ";
752  eventout += iHE;
753  }
754  mehHcaln[0]->Fill((float)iHB);
755  mehHcaln[1]->Fill((float)iHE);
756  }
757 
759  // get HF information
761  std::vector<edm::Handle<HFRecHitCollection> > hf;
762  iEvent.getManyByType(hf);
763  bool validHF = true;
764  if (!hf[0].isValid()) {
765  LogDebug(MsgLoggerCat)
766  << "Unable to find any HFRecHitCollections in event!";
767  validHF = false;
768  }
769  if (validHF) {
770  std::vector<edm::Handle<HFRecHitCollection> >::iterator ihf;
771 
772  int iHF = 0;
773  for (ihf = hf.begin(); ihf != hf.end(); ++ihf) {
774 
775  // find max values
776  for (HFRecHitCollection::const_iterator jhf = (*ihf)->begin();
777  jhf != (*ihf)->end(); ++jhf) {
778 
779  HcalDetId cell(jhf->id());
780 
781  if (cell.subdet() == sdHcalFwd) {
782 
783  auto cellGeometry = geometry->getSubdetectorGeometry(cell)->getGeometry(cell) ;
784  double fPhi = cellGeometry->getPosition().phi () ;
785  if ( (jhf->energy()) > maxHFEnergy ) {
786  maxHFEnergy = jhf->energy();
787  maxHFPhi = fPhi;
788  }
789  }
790  } // end find max values
791 
792  for (HFRecHitCollection::const_iterator jhf = (*ihf)->begin();
793  jhf != (*ihf)->end(); ++jhf) {
794 
795  HcalDetId cell(jhf->id());
796 
797  if (cell.subdet() == sdHcalFwd) {
798 
799  ++iHF;
800 
801  auto cellGeometry = geometry->getSubdetectorGeometry(cell)->getGeometry (cell) ;
802  double fPhi = cellGeometry->getPosition().phi () ;
803 
804  float deltaphi = maxHBPhi - fPhi;
805  if (fPhi > maxHFPhi) { deltaphi = fPhi - maxHFPhi;}
806  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
807 
808  mehHcalRes[2]->Fill(jhf->energy()-fHFEnergySimHits[cell]);
809  }
810  }
811  } // end loop through collection
812 
813  if (verbosity > 1) {
814  eventout += "\n Number of HFDigis collected:.............. ";
815  eventout += iHF;
816  }
817  mehHcaln[2]->Fill((float)iHF);
818  }
819 
821  // get HO information
823  std::vector<edm::Handle<HORecHitCollection> > ho;
824  iEvent.getManyByType(ho);
825  bool validHO = true;
826  if (!ho[0].isValid()) {
827  LogDebug(MsgLoggerCat)
828  << "Unable to find any HORecHitCollections in event!";
829  validHO = false;
830  }
831 
832  if (validHO) {
833  std::vector<edm::Handle<HORecHitCollection> >::iterator iho;
834 
835  int iHO = 0;
836  for (iho = ho.begin(); iho != ho.end(); ++iho) {
837 
838  for (HORecHitCollection::const_iterator jho = (*iho)->begin();
839  jho != (*iho)->end(); ++jho) {
840 
841  HcalDetId cell(jho->id());
842 
843  if (cell.subdet() == sdHcalOut) {
844 
845  ++iHO;
846 
847  auto cellGeometry = geometry->getSubdetectorGeometry(cell)->getGeometry (cell) ;
848  double fPhi = cellGeometry->getPosition().phi () ;
849 
850  float deltaphi = maxHOPhi - fPhi;
851  if (fPhi > maxHOPhi) { deltaphi = fPhi - maxHOPhi;}
852  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
853  mehHcalRes[3]->Fill(jho->energy()-fHOEnergySimHits[cell]);
854  }
855  }
856  } // end loop through collection
857 
858  if (verbosity > 1) {
859  eventout += "\n Number of HODigis collected:.............. ";
860  eventout += iHO;
861  }
862  mehHcaln[3]->Fill((float)iHO);
863  }
864 
865  if (verbosity > 0)
866  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
867 
868  return;
869 }
870 
872  const edm::EventSetup& iSetup)
873 {
874  //Retrieve tracker topology from geometry
875  edm::ESHandle<TrackerTopology> tTopoHandle;
876  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
877  const TrackerTopology* const tTopo = tTopoHandle.product();
878 
879 
880  std::string MsgLoggerCat = "GlobalRecHitsAnalyzer_fillTrk";
881 
882  TString eventout;
883  if (verbosity > 0)
884  eventout = "\nGathering info:";
885 
886  // get strip information
888  iEvent.getByToken(SiStripSrc_Token_, rechitsmatched);
889  bool validstrip = true;
890  if (!rechitsmatched.isValid()) {
891  LogDebug(MsgLoggerCat)
892  << "Unable to find stripmatchedrechits in event!";
893  validstrip = false;
894  }
895 
897 
899  iSetup.get<TrackerDigiGeometryRecord>().get(pDD);
900  if (!pDD.isValid()) {
901  edm::LogWarning(MsgLoggerCat)
902  << "Unable to find TrackerDigiGeometry in event!";
903  return;
904  }
905  const TrackerGeometry &tracker(*pDD);
906 
907  if (validstrip) {
908  int nStripBrl = 0, nStripFwd = 0;
909 
910  // loop over det units
911  for (TrackerGeometry::DetContainer::const_iterator it =
912  pDD->dets().begin();
913  it != pDD->dets().end(); ++it) {
914 
915  uint32_t myid = ((*it)->geographicalId()).rawId();
916  DetId detid = ((*it)->geographicalId());
917 
918  //loop over rechits-matched in the same subdetector
919  SiStripMatchedRecHit2DCollection::const_iterator rechitmatchedMatch = rechitsmatched->find(detid);
920 
921  if (rechitmatchedMatch != rechitsmatched->end()) {
922  SiStripMatchedRecHit2DCollection::DetSet rechitmatchedRange = *rechitmatchedMatch;
923  SiStripMatchedRecHit2DCollection::DetSet::const_iterator rechitmatchedRangeIteratorBegin = rechitmatchedRange.begin();
924  SiStripMatchedRecHit2DCollection::DetSet::const_iterator rechitmatchedRangeIteratorEnd = rechitmatchedRange.end();
925  SiStripMatchedRecHit2DCollection::DetSet::const_iterator itermatched = rechitmatchedRangeIteratorBegin;
926 
927  for ( itermatched = rechitmatchedRangeIteratorBegin;
928  itermatched != rechitmatchedRangeIteratorEnd;
929  ++itermatched) {
930 
931  SiStripMatchedRecHit2D const rechit = *itermatched;
932  LocalPoint position = rechit.localPosition();
933 
934  float mindist = 999999.;
935  float distx = 999999.;
936  float disty = 999999.;
937  float dist = 999999.;
938  std::pair<LocalPoint,LocalVector> closestPair;
939  matched.clear();
940 
941  float rechitmatchedx = position.x();
942  float rechitmatchedy = position.y();
943 
944  matched = associate.associateHit(rechit);
945 
946  if (!matched.empty()) {
947  //project simhit;
948  const GluedGeomDet* gluedDet =
949  (const GluedGeomDet*)tracker.idToDet(rechit.geographicalId());
950  const StripGeomDetUnit* partnerstripdet =
951  (StripGeomDetUnit*) gluedDet->stereoDet();
952  std::pair<LocalPoint,LocalVector> hitPair;
953 
954  for(std::vector<PSimHit>::const_iterator m = matched.begin();
955  m != matched.end(); m++){
956  //project simhit;
957  hitPair = projectHit((*m),partnerstripdet,gluedDet->surface());
958  distx = fabs(rechitmatchedx - hitPair.first.x());
959  disty = fabs(rechitmatchedy - hitPair.first.y());
960  dist = sqrt(distx*distx+disty*disty);
961 
962  if(dist < mindist){
963  mindist = dist;
964  closestPair = hitPair;
965  }
966  }
967 
968  // get TIB
969  if (detid.subdetId() == sdSiTIB) {
970 
971 
972  ++nStripBrl;
973 
974  if (tTopo->tibLayer(myid) == 1) {
975  mehSiStripResX[8]->Fill(rechitmatchedx-closestPair.first.x());
976  mehSiStripResY[8]->Fill(rechitmatchedy-closestPair.first.y());
977  }
978  if (tTopo->tibLayer(myid) == 2) {
979  mehSiStripResX[9]->Fill(rechitmatchedx-closestPair.first.x());
980  mehSiStripResY[9]->Fill(rechitmatchedy-closestPair.first.y());
981  }
982  if (tTopo->tibLayer(myid) == 3) {
983  mehSiStripResX[10]->Fill(rechitmatchedx-closestPair.first.x());
984  mehSiStripResY[10]->Fill(rechitmatchedy-closestPair.first.y());
985 
986  }
987  if (tTopo->tibLayer(myid) == 4) {
988  mehSiStripResX[11]->Fill(rechitmatchedx-closestPair.first.x());
989  mehSiStripResY[11]->Fill(rechitmatchedy-closestPair.first.y());
990  }
991  }
992 
993  // get TOB
994  if (detid.subdetId() == sdSiTOB) {
995 
996 
997  ++nStripBrl;
998 
999  if (tTopo->tobLayer(myid) == 1) {
1000  mehSiStripResX[15]->Fill(rechitmatchedx-closestPair.first.x());
1001  mehSiStripResY[15]->Fill(rechitmatchedy-closestPair.first.y());
1002  }
1003  if (tTopo->tobLayer(myid) == 2) {
1004  mehSiStripResX[16]->Fill(rechitmatchedx-closestPair.first.x());
1005  mehSiStripResY[16]->Fill(rechitmatchedy-closestPair.first.y());
1006  }
1007  if (tTopo->tobLayer(myid) == 3) {
1008  mehSiStripResX[17]->Fill(rechitmatchedx-closestPair.first.x());
1009  mehSiStripResY[17]->Fill(rechitmatchedy-closestPair.first.y());
1010  }
1011  if (tTopo->tobLayer(myid) == 4) {
1012  mehSiStripResX[18]->Fill(rechitmatchedx-closestPair.first.x());
1013  mehSiStripResY[18]->Fill(rechitmatchedy-closestPair.first.y());
1014  }
1015  }
1016 
1017  // get TID
1018  if (detid.subdetId() == sdSiTID) {
1019 
1020 
1021  ++nStripFwd;
1022 
1023  if (tTopo->tidWheel(myid) == 1) {
1024  mehSiStripResX[12]->Fill(rechitmatchedx-closestPair.first.x());
1025  mehSiStripResY[12]->Fill(rechitmatchedy-closestPair.first.y());
1026  }
1027  if (tTopo->tidWheel(myid) == 2) {
1028  mehSiStripResX[13]->Fill(rechitmatchedx-closestPair.first.x());
1029  mehSiStripResY[13]->Fill(rechitmatchedy-closestPair.first.y());
1030  }
1031  if (tTopo->tidWheel(myid) == 3) {
1032  mehSiStripResX[14]->Fill(rechitmatchedx-closestPair.first.x());
1033  mehSiStripResY[14]->Fill(rechitmatchedy-closestPair.first.y());
1034  }
1035  }
1036 
1037  // get TEC
1038  if (detid.subdetId() == sdSiTEC) {
1039 
1040 
1041  ++nStripFwd;
1042 
1043  if (tTopo->tecWheel(myid) == 1) {
1044  mehSiStripResX[0]->Fill(rechitmatchedx-closestPair.first.x());
1045  mehSiStripResY[0]->Fill(rechitmatchedy-closestPair.first.y());
1046  }
1047  if (tTopo->tecWheel(myid) == 2) {
1048  mehSiStripResX[1]->Fill(rechitmatchedx-closestPair.first.x());
1049  mehSiStripResY[1]->Fill(rechitmatchedy-closestPair.first.y());
1050  }
1051  if (tTopo->tecWheel(myid) == 3) {
1052  mehSiStripResX[2]->Fill(rechitmatchedx-closestPair.first.x());
1053  mehSiStripResY[2]->Fill(rechitmatchedy-closestPair.first.y());
1054  }
1055  if (tTopo->tecWheel(myid) == 4) {
1056  mehSiStripResX[3]->Fill(rechitmatchedx-closestPair.first.x());
1057  mehSiStripResY[3]->Fill(rechitmatchedy-closestPair.first.y());
1058 
1059  }
1060  if (tTopo->tecWheel(myid) == 5) {
1061  mehSiStripResX[4]->Fill(rechitmatchedx-closestPair.first.x());
1062  mehSiStripResY[4]->Fill(rechitmatchedy-closestPair.first.y());
1063  }
1064  if (tTopo->tecWheel(myid) == 6) {
1065  mehSiStripResX[5]->Fill(rechitmatchedx-closestPair.first.x());
1066  mehSiStripResY[5]->Fill(rechitmatchedy-closestPair.first.y());
1067  }
1068  if (tTopo->tecWheel(myid) == 7) {
1069  mehSiStripResX[6]->Fill(rechitmatchedx-closestPair.first.x());
1070  mehSiStripResY[6]->Fill(rechitmatchedy-closestPair.first.y());
1071  }
1072  if (tTopo->tecWheel(myid) == 8) {
1073  mehSiStripResX[7]->Fill(rechitmatchedx-closestPair.first.x());
1074  mehSiStripResY[7]->Fill(rechitmatchedy-closestPair.first.y());
1075  }
1076  }
1077 
1078  } // end if matched empty
1079  }
1080  }
1081  } // end loop over det units
1082 
1083  if (verbosity > 1) {
1084  eventout += "\n Number of BrlStripRecHits collected:...... ";
1085  eventout += nStripBrl;
1086  }
1087 
1088  for(int i =8; i<12; ++i)
1089  {mehSiStripn[i]->Fill((float)nStripBrl);}
1090  for(int i =16; i<19; ++i)
1091  {mehSiStripn[i]->Fill((float)nStripBrl);}
1092 
1093  if (verbosity > 1) {
1094  eventout += "\n Number of FrwdStripRecHits collected:..... ";
1095  eventout += nStripFwd;
1096  }
1097  for(int i =0; i<8; ++i)
1098  {mehSiStripn[i]->Fill((float)nStripFwd);}
1099  for(int i =12; i<16; ++i)
1100  {mehSiStripn[i]->Fill((float)nStripFwd);}
1101  }
1102 
1103  // get pixel information
1104  //Get RecHits
1106  iEvent.getByToken(SiPxlSrc_Token_, recHitColl);
1107  bool validpixel = true;
1108  if (!recHitColl.isValid()) {
1109  LogDebug(MsgLoggerCat)
1110  << "Unable to find SiPixelRecHitCollection in event!";
1111  validpixel = false;
1112  }
1113 
1114  //Get event setup
1116  iSetup.get<TrackerDigiGeometryRecord>().get(geom);
1117  if (!geom.isValid()) {
1118  edm::LogWarning(MsgLoggerCat)
1119  << "Unable to find TrackerDigiGeometry in event!";
1120  return;
1121  }
1122 
1123  if (validpixel) {
1124  int nPxlBrl = 0, nPxlFwd = 0;
1125  //iterate over detunits
1126  for (TrackerGeometry::DetContainer::const_iterator it =
1127  geom->dets().begin();
1128  it != geom->dets().end(); ++it) {
1129 
1130  uint32_t myid = ((*it)->geographicalId()).rawId();
1131  DetId detId = ((*it)->geographicalId());
1132  int subid = detId.subdetId();
1133 
1134  if (! ((subid == sdPxlBrl) || (subid == sdPxlFwd))) continue;
1135 
1136  SiPixelRecHitCollection::const_iterator pixeldet = recHitColl->find(detId);
1137  if (pixeldet == recHitColl->end()) continue;
1138  SiPixelRecHitCollection::DetSet pixelrechitRange = *pixeldet;
1139  SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorBegin = pixelrechitRange.begin();
1140  SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorEnd = pixelrechitRange.end();
1141  SiPixelRecHitCollection::DetSet::const_iterator pixeliter = pixelrechitRangeIteratorBegin;
1142 
1143 
1144  std::vector<PSimHit> matched;
1145 
1146  //----Loop over rechits for this detId
1147  for ( ; pixeliter != pixelrechitRangeIteratorEnd; ++pixeliter) {
1148 
1149  matched.clear();
1150  matched = associate.associateHit(*pixeliter);
1151 
1152  if ( !matched.empty() ) {
1153 
1154  float closest = 9999.9;
1155  LocalPoint lp = pixeliter->localPosition();
1156  float rechit_x = lp.x();
1157  float rechit_y = lp.y();
1158 
1159  float sim_x = 0.;
1160  float sim_y = 0.;
1161 
1162  //loop over sim hits and fill closet
1163  for (std::vector<PSimHit>::const_iterator m = matched.begin();
1164  m != matched.end(); ++m) {
1165 
1166  float sim_x1 = (*m).entryPoint().x();
1167  float sim_x2 = (*m).exitPoint().x();
1168  float sim_xpos = 0.5*(sim_x1+sim_x2);
1169 
1170  float sim_y1 = (*m).entryPoint().y();
1171  float sim_y2 = (*m).exitPoint().y();
1172  float sim_ypos = 0.5*(sim_y1+sim_y2);
1173 
1174  float x_res = fabs(sim_xpos - rechit_x);
1175  float y_res = fabs(sim_ypos - rechit_y);
1176 
1177  float dist = sqrt(x_res*x_res + y_res*y_res);
1178 
1179  if ( dist < closest ) {
1180  closest = dist;
1181  sim_x = sim_xpos;
1182  sim_y = sim_ypos;
1183  }
1184  } // end sim hit loop
1185 
1186  // get Barrel pixels ***************Pixel STuff******************
1187  if (subid == sdPxlBrl) {
1188 
1189  ++nPxlBrl;
1190 
1191  if (tTopo->pxbLayer(myid) == 1) {
1192  mehSiPixelResX[0]->Fill(rechit_x-sim_x);
1193  mehSiPixelResY[0]->Fill(rechit_y-sim_y);
1194 
1195  }
1196  if (tTopo->pxbLayer(myid) == 2) {
1197  mehSiPixelResX[1]->Fill(rechit_x-sim_x);
1198  mehSiPixelResY[1]->Fill(rechit_y-sim_y);
1199  }
1200  if (tTopo->pxbLayer(myid) == 3) {
1201  mehSiPixelResX[2]->Fill(rechit_x-sim_x);
1202  mehSiPixelResY[2]->Fill(rechit_y-sim_y);
1203  }
1204  }
1205 
1206  // get Forward pixels
1207  if (subid == sdPxlFwd) {
1208 
1209  ++nPxlFwd;
1210 
1211  if (tTopo->pxfDisk(myid) == 1) {
1212  if (tTopo->pxfSide(myid) == 1) {
1213  mehSiPixelResX[3]->Fill(rechit_x-sim_x);
1214  mehSiPixelResY[3]->Fill(rechit_y-sim_y);
1215  }
1216  if (tTopo->pxfSide(myid) == 2) {
1217  mehSiPixelResX[4]->Fill(rechit_x-sim_x);
1218  mehSiPixelResY[4]->Fill(rechit_y-sim_y);
1219  }
1220  }
1221  if (tTopo->pxfDisk(myid) == 2) {
1222  if (tTopo->pxfSide(myid) == 1) {
1223  mehSiPixelResX[5]->Fill(rechit_x-sim_x);
1224  mehSiPixelResY[5]->Fill(rechit_y-sim_y);
1225  }
1226  if (tTopo->pxfSide(myid) == 2) {
1227  mehSiPixelResX[6]->Fill(rechit_x-sim_x);
1228  mehSiPixelResY[6]->Fill(rechit_y-sim_y);
1229  }
1230  }
1231  }
1232  } // end matched emtpy
1233  } // <-----end rechit loop
1234  } // <------ end detunit loop
1235 
1236 
1237  if (verbosity > 1) {
1238  eventout += "\n Number of BrlPixelRecHits collected:...... ";
1239  eventout += nPxlBrl;
1240  }
1241  for(int i=0; i<3; ++i) {
1242  mehSiPixeln[i]->Fill((float)nPxlBrl);
1243  }
1244 
1245  if (verbosity > 1) {
1246  eventout += "\n Number of FrwdPixelRecHits collected:..... ";
1247  eventout += nPxlFwd;
1248  }
1249 
1250  for(int i=3; i<7; ++i) {
1251  mehSiPixeln[i]->Fill((float)nPxlFwd);
1252  }
1253  }
1254 
1255  if (verbosity > 0)
1256  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1257 
1258  return;
1259 }
1260 
1262  const edm::EventSetup& iSetup)
1263 {
1264  std::string MsgLoggerCat = "GlobalRecHitsAnalyzer_fillMuon";
1265 
1266  TString eventout;
1267  if (verbosity > 0)
1268  eventout = "\nGathering info:";
1269 
1270  // get DT information
1272  iSetup.get<MuonGeometryRecord>().get(dtGeom);
1273  if (!dtGeom.isValid()) {
1274  edm::LogWarning(MsgLoggerCat)
1275  << "Unable to find DTMuonGeometryRecord in event!";
1276  return;
1277  }
1278 
1280  iEvent.getByToken(MuDTSimSrc_Token_, dtsimHits);
1281  bool validdtsim = true;
1282  if (!dtsimHits.isValid()) {
1283  LogDebug(MsgLoggerCat)
1284  << "Unable to find dtsimHits in event!";
1285  validdtsim = false;
1286  }
1287 
1289  iEvent.getByToken(MuDTSrc_Token_, dtRecHits);
1290  bool validdtrec = true;
1291  if (!dtRecHits.isValid()) {
1292  LogDebug(MsgLoggerCat)
1293  << "Unable to find dtRecHits in event!";
1294  validdtrec = false;
1295  }
1296 
1297  if (validdtsim && validdtrec) {
1298 
1299  std::map<DTWireId, edm::PSimHitContainer> simHitsPerWire =
1301 
1302  std::map<DTWireId, std::vector<DTRecHit1DPair> > recHitsPerWire =
1303  map1DRecHitsPerWire(dtRecHits.product());
1304 
1305  int nDt = compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 1);
1306 
1307  if (verbosity > 1) {
1308  eventout += "\n Number of DtMuonRecHits collected:........ ";
1309  eventout += nDt;
1310  }
1311  mehDtMuonn->Fill(float(nDt));
1312  }
1313 
1314  // get CSC Strip information
1315  // get map of sim hits
1316  theMap.clear();
1318 
1319  iEvent.getByToken(MuCSCHits_Token_,cf);
1320  bool validXFrame = true;
1321  if (!cf.isValid()) {
1322  LogDebug(MsgLoggerCat)
1323  << "Unable to find muo CSC crossingFrame in event!";
1324  validXFrame = false;
1325  }
1326  if (validXFrame) {
1328 
1329  // arrange the hits by detUnit
1330  for ( auto const & iHit : simHits ) {
1331  theMap[iHit.detUnitId()].push_back(iHit);
1332  }
1333  }
1334 
1335  // get geometry
1337  iSetup.get<MuonGeometryRecord>().get(hGeom);
1338  if (!hGeom.isValid()) {
1339  edm::LogWarning(MsgLoggerCat)
1340  << "Unable to find CSCMuonGeometryRecord in event!";
1341  return;
1342  }
1343  const CSCGeometry *theCSCGeometry = &*hGeom;
1344 
1345  // get rechits
1347  iEvent.getByToken(MuCSCSrc_Token_, hRecHits);
1348  bool validCSC = true;
1349  if (!hRecHits.isValid()) {
1350  LogDebug(MsgLoggerCat)
1351  << "Unable to find CSC RecHits in event!";
1352  validCSC = false;
1353  }
1354 
1355  if (validCSC) {
1356  const CSCRecHit2DCollection *cscRecHits = hRecHits.product();
1357 
1358  int nCSC = 0;
1359  for (CSCRecHit2DCollection::const_iterator recHitItr = cscRecHits->begin();
1360  recHitItr != cscRecHits->end(); ++recHitItr) {
1361 
1362  int detId = (*recHitItr).cscDetId().rawId();
1363 
1365  std::map<int, edm::PSimHitContainer>::const_iterator mapItr =
1366  theMap.find(detId);
1367  if (mapItr != theMap.end()) {
1368  simHits = mapItr->second;
1369  }
1370 
1371  if (simHits.size() == 1) {
1372  ++nCSC;
1373 
1374  const GeomDetUnit* detUnit =
1375  theCSCGeometry->idToDetUnit(CSCDetId(detId));
1376  const CSCLayer *layer = dynamic_cast<const CSCLayer *>(detUnit);
1377 
1378  int chamberType = layer->chamber()->specs()->chamberType();
1379  plotResolution(simHits[0], *recHitItr, layer, chamberType);
1380  }
1381  }
1382 
1383  if (verbosity > 1) {
1384  eventout += "\n Number of CSCRecHits collected:........... ";
1385  eventout += nCSC;
1386  }
1387  mehCSCn->Fill((float)nCSC);
1388  }
1389 
1390  // get RPC information
1391  std::map<double, int> mapsim, maprec;
1392  std::map<int, double> nmapsim, nmaprec;
1393 
1395  iSetup.get<MuonGeometryRecord>().get(rpcGeom);
1396  if (!rpcGeom.isValid()) {
1397  edm::LogWarning(MsgLoggerCat)
1398  << "Unable to find RPCMuonGeometryRecord in event!";
1399  return;
1400  }
1401 
1403  iEvent.getByToken(MuRPCSimSrc_Token_, simHit);
1404  bool validrpcsim = true;
1405  if (!simHit.isValid()) {
1406  LogDebug(MsgLoggerCat)
1407  << "Unable to find RPCSimHit in event!";
1408  validrpcsim = false;
1409  }
1410 
1412  iEvent.getByToken(MuRPCSrc_Token_, recHit);
1413  bool validrpc = true;
1414  if (!simHit.isValid()) {
1415  LogDebug(MsgLoggerCat)
1416  << "Unable to find RPCRecHit in event!";
1417  validrpc = false;
1418  }
1419 
1420  if (validrpc) {
1421  int nRPC = 0;
1423  int nrec = 0;
1424  for (recIt = recHit->begin(); recIt != recHit->end(); ++recIt) {
1425  RPCDetId Rid = (RPCDetId)(*recIt).rpcId();
1426  const RPCRoll *roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(Rid));
1427  if (roll->isForward()) {
1428 
1429  if (verbosity > 1) {
1430  eventout +=
1431  "\n Number of RPCRecHits collected:........... ";
1432  eventout += nRPC;
1433  }
1434 
1435  if (verbosity > 0)
1436  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1437  return;
1438  }
1439  nrec = nrec + 1;
1440  LocalPoint rhitlocal = (*recIt).localPosition();
1441  double rhitlocalx = rhitlocal.x();
1442  maprec[rhitlocalx] = nrec;
1443  }
1444 
1445  int i = 0;
1446  for (std::map<double,int>::iterator iter = maprec.begin();
1447  iter != maprec.end(); ++iter) {
1448  i = i + 1;
1449  nmaprec[i] = (*iter).first;
1450  }
1451 
1452  int nsim = 0;
1453  if (validrpcsim) {
1454  edm::PSimHitContainer::const_iterator simIt;
1455  for (simIt = simHit->begin(); simIt != simHit->end(); simIt++) {
1456  int ptype = (*simIt).particleType();
1457  if (ptype == 13 || ptype == -13) {
1458  nsim = nsim + 1;
1459  LocalPoint shitlocal = (*simIt).localPosition();
1460  double shitlocalx = shitlocal.x();
1461  mapsim[shitlocalx] = nsim;
1462  }
1463  }
1464 
1465  i = 0;
1466  for (std::map<double,int>::iterator iter = mapsim.begin();
1467  iter != mapsim.end(); ++iter) {
1468  i = i + 1;
1469  nmapsim[i] = (*iter).first;
1470  }
1471  }
1472 
1473  if (nsim == nrec) {
1474  for (int r = 0; r < nsim; r++) {
1475  ++nRPC;
1476  mehRPCResX->Fill(nmaprec[r+1]-nmapsim[r+1]);
1477  }
1478  }
1479 
1480  if (verbosity > 1) {
1481  eventout += "\n Number of RPCRecHits collected:........... ";
1482  eventout += nRPC;
1483  }
1484  mehRPCn->Fill((float)nRPC);
1485  }
1486 
1487  if (verbosity > 0)
1488  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1489 
1490  return;
1491 }
1492 
1493 //needed by to do the residual for matched hits in SiStrip
1494 std::pair<LocalPoint,LocalVector>
1496  const StripGeomDetUnit* stripDet,
1497  const BoundPlane& plane)
1498 {
1499 
1500  const StripTopology& topol = stripDet->specificTopology();
1501  GlobalPoint globalpos= stripDet->surface().toGlobal(hit.localPosition());
1502  LocalPoint localHit = plane.toLocal(globalpos);
1503  //track direction
1504  LocalVector locdir=hit.localDirection();
1505  //rotate track in new frame
1506 
1507  GlobalVector globaldir= stripDet->surface().toGlobal(locdir);
1508  LocalVector dir=plane.toLocal(globaldir);
1509  float scale = -localHit.z() / dir.z();
1510 
1511  LocalPoint projectedPos = localHit + scale*dir;
1512 
1513  float selfAngle = topol.stripAngle( topol.strip( hit.localPosition()));
1514 
1515  // vector along strip in hit frame
1516  LocalVector stripDir( sin(selfAngle), cos(selfAngle), 0);
1517 
1518  LocalVector
1519  localStripDir(plane.toLocal(stripDet->surface().toGlobal(stripDir)));
1520 
1521  return std::pair<LocalPoint,LocalVector>( projectedPos, localStripDir);
1522 }
1523 
1524 // Return a map between DTRecHit1DPair and wireId
1525 std::map<DTWireId, std::vector<DTRecHit1DPair> >
1527  dt1DRecHitPairs) {
1528  std::map<DTWireId, std::vector<DTRecHit1DPair> > ret;
1529 
1530  for(DTRecHitCollection::const_iterator rechit = dt1DRecHitPairs->begin();
1531  rechit != dt1DRecHitPairs->end(); rechit++) {
1532  ret[(*rechit).wireId()].push_back(*rechit);
1533  }
1534 
1535  return ret;
1536 }
1537 
1538 // Compute SimHit distance from wire (cm)
1540  DTWireId wireId,
1541  const PSimHit& hit) {
1542  float xwire = layer->specificTopology().wirePosition(wireId.wire());
1543  LocalPoint entryP = hit.entryPoint();
1544  LocalPoint exitP = hit.exitPoint();
1545  float xEntry = entryP.x()-xwire;
1546  float xExit = exitP.x()-xwire;
1547 
1548  //FIXME: check...
1549  return fabs(xEntry - (entryP.z()*(xExit-xEntry))/(exitP.z()-entryP.z()));
1550 }
1551 
1552 // Find the RecHit closest to the muon SimHit
1553 template <typename type>
1554 const type*
1556  DTWireId wireId,
1557  const std::vector<type>& recHits,
1558  const float simHitDist) {
1559  float res = 99999;
1560  const type* theBestRecHit = nullptr;
1561  // Loop over RecHits within the cell
1562  for(typename std::vector<type>::const_iterator recHit = recHits.begin();
1563  recHit != recHits.end();
1564  recHit++) {
1565  float distTmp = recHitDistFromWire(*recHit, layer);
1566  if(fabs(distTmp-simHitDist) < res) {
1567  res = fabs(distTmp-simHitDist);
1568  theBestRecHit = &(*recHit);
1569  }
1570  } // End of loop over RecHits within the cell
1571 
1572  return theBestRecHit;
1573 }
1574 
1575 // Compute the distance from wire (cm) of a hits in a DTRecHit1DPair
1576 float
1578  const DTLayer* layer) {
1579  // Compute the rechit distance from wire
1580  return fabs(hitPair.localPosition(DTEnums::Left).x() -
1581  hitPair.localPosition(DTEnums::Right).x())/2.;
1582 }
1583 
1584 // Compute the distance from wire (cm) of a hits in a DTRecHit1D
1585 float
1587  const DTLayer* layer) {
1588  return fabs(recHit.localPosition().x() -
1589  layer->specificTopology().wirePosition(recHit.wireId().wire()));
1590 }
1591 
1592 template <typename type>
1594  const std::map<DTWireId, std::vector<PSimHit> >&
1595  _simHitsPerWire,
1596  const std::map<DTWireId, std::vector<type> >&
1597  _recHitsPerWire,
1598  int step) {
1599 
1600 std::map<DTWireId, std::vector<PSimHit> > simHitsPerWire = _simHitsPerWire;
1601 std::map<DTWireId, std::vector<type> > recHitsPerWire = _recHitsPerWire;
1602  int nDt = 0;
1603  // Loop over cells with a muon SimHit
1604  for(std::map<DTWireId, std::vector<PSimHit> >::const_iterator wireAndSHits =
1605  simHitsPerWire.begin();
1606  wireAndSHits != simHitsPerWire.end();
1607  wireAndSHits++) {
1608  DTWireId wireId = (*wireAndSHits).first;
1609  std::vector<PSimHit> simHitsInCell = (*wireAndSHits).second;
1610 
1611  // Get the layer
1612  const DTLayer* layer = dtGeom->layer(wireId);
1613 
1614  // Look for a mu hit in the cell
1615  const PSimHit* muSimHit = DTHitQualityUtils::findMuSimHit(simHitsInCell);
1616  if (muSimHit==nullptr) {
1617  continue; // Skip this cell
1618  }
1619 
1620  // Find the distance of the simhit from the wire
1621  float simHitWireDist = simHitDistFromWire(layer, wireId, *muSimHit);
1622  // Skip simhits out of the cell
1623  if(simHitWireDist>2.1) {
1624  continue; // Skip this cell
1625  }
1626 
1627  // Look for RecHits in the same cell
1628  if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
1629  continue; // No RecHit found in this cell
1630  } else {
1631 
1632  std::vector<type> recHits = recHitsPerWire[wireId];
1633 
1634  // Find the best RecHit
1635  const type* theBestRecHit =
1636  findBestRecHit(layer, wireId, recHits, simHitWireDist);
1637 
1638  float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
1639 
1640  ++nDt;
1641 
1642  mehDtMuonRes->Fill(recHitWireDist-simHitWireDist);
1643 
1644  } // find rechits
1645  } // loop over simhits
1646 
1647  return nDt;
1648 }
1649 
1650 void
1652  const CSCRecHit2D & recHit,
1653  const CSCLayer * layer,
1654  int chamberType) {
1655  GlobalPoint simHitPos = layer->toGlobal(simHit.localPosition());
1656  GlobalPoint recHitPos = layer->toGlobal(recHit.localPosition());
1657 
1658  mehCSCResRDPhi->Fill(recHitPos.phi()-simHitPos.phi());
1659 }
1660 
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:39
edm::EDGetTokenT< SiPixelRecHitCollection > SiPxlSrc_Token_
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:60
type
Definition: HCALResponse.h:21
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
T getParameter(std::string const &) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
EventNumber_t event() const
Definition: EventID.h:41
GlobalRecHitsAnalyzer(const edm::ParameterSet &)
T getUntrackedParameter(std::string const &, T const &) const
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
MonitorElement * mehCSCResRDPhi
std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
std::vector< PCaloHit > PCaloHitContainer
const_iterator end(bool update=false) const
int ihf
unsigned int tibLayer(const DetId &id) const
edm::EDGetTokenT< EBRecHitCollection > ECalEBSrc_Token_
static const int sdHcalOut
std::vector< PSimHit > matched
edm::EDGetTokenT< ESRecHitCollection > ECalESSrc_Token_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< CrossingFrame< PCaloHit > > ESHits_Token_
MonitorElement * mehHcalRes[4]
unsigned int pxfDisk(const DetId &id) const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
static const int sdSiTID
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
edm::EDGetTokenT< CrossingFrame< PSimHit > > MuCSCHits_Token_
void fillMuon(const edm::Event &, const edm::EventSetup &)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
std::vector< T >::const_iterator const_iterator
T y() const
Definition: PV3DBase.h:63
unsigned long long EventNumber_t
edm::EDGetTokenT< CrossingFrame< PCaloHit > > EEHits_Token_
virtual float strip(const LocalPoint &) const =0
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
unsigned int tidWheel(const DetId &id) const
void getManyByType(std::vector< Handle< PROD >> &results) const
Definition: Event.h:508
LocalPoint localPosition() const override
Definition: CSCRecHit2D.h:50
float simHitDistFromWire(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
MonitorElement * mehEcalRes[3]
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
edm::EDGetTokenT< edm::PSimHitContainer > MuDTSimSrc_Token_
MonitorElement * mehSiStripn[19]
Definition: Electron.h:6
void Fill(long long x)
void plotResolution(const PSimHit &simHit, const CSCRecHit2D &recHit, const CSCLayer *layer, int chamberType)
void analyze(const edm::Event &, const edm::EventSetup &) override
std::map< int, edm::PSimHitContainer > theMap
std::map< DTWireId, std::vector< DTRecHit1DPair > > map1DRecHitsPerWire(const DTRecHitCollection *dt1DRecHitPairs)
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
char const * label
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:224
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:46
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
edm::EDGetTokenT< EBUncalibratedRecHitCollection > ECalUncalEBSrc_Token_
static const int sdSiTIB
const CSCChamberSpecs * specs() const
Definition: CSCChamber.h:42
static const int sdPxlBrl
Local3DPoint localPosition() const
Definition: PSimHit.h:52
virtual float stripAngle(float strip) const =0
int compute(const DTGeometry *dtGeom, const std::map< DTWireId, std::vector< PSimHit > > &simHitsPerWire, const std::map< DTWireId, std::vector< type > > &recHitsPerWire, int step)
T sqrt(T t)
Definition: SSEVec.h:18
edm::EDGetTokenT< CSCRecHit2DCollection > MuCSCSrc_Token_
T z() const
Definition: PV3DBase.h:64
MonitorElement * mehSiPixelResX[7]
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
MonitorElement * mehEcaln[3]
const type * findBestRecHit(const DTLayer *layer, DTWireId wireId, const std::vector< type > &recHits, const float simHitDist)
static const int sdSiTOB
const PSimHit * findMuSimHit(const edm::PSimHitContainer &hits)
Select the SimHit from a muon in a vector of SimHits.
MonitorElement * mehSiPixelResY[7]
MonitorElement * mehSiStripResY[19]
bool isValid() const
Definition: HandleBase.h:74
#define PI
Definition: QcdUeDQM.h:36
edm::EDGetTokenT< RPCRecHitCollection > MuRPCSrc_Token_
GlobalPoint getPosition(const DetId &id) const
std::pair< LocalPoint, LocalVector > projectHit(const PSimHit &hit, const StripGeomDetUnit *stripDet, const BoundPlane &plane)
unsigned int pxbLayer(const DetId &id) const
const_iterator end() const
LocalVector localDirection() const
Obsolete. Same as momentumAtEntry().unit(), for backward compatibility.
Definition: PSimHit.h:58
int wire() const
Return the wire number.
Definition: DTWireId.h:56
Definition: DetId.h:18
edm::EDGetTokenT< CrossingFrame< PCaloHit > > EBHits_Token_
T const * product() const
Definition: Handle.h:74
int chamberType() const
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
edm::EDGetTokenT< edm::PCaloHitContainer > HCalSrc_Token_
MonitorElement * mehSiPixeln[7]
static const int sdHcalFwd
std::map< uint32_t, float, std::less< uint32_t > > MapType
static const int sdHcalBrl
void fillTrk(const edm::Event &, const edm::EventSetup &)
std::string const & label() const
Definition: InputTag.h:36
const_iterator find(id_type i, bool update=false) const
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: CSCGeometry.cc:108
ESHandle< TrackerGeometry > geometry
edm::EventID id() const
Definition: EventBase.h:59
edm::EDGetTokenT< DTRecHitCollection > MuDTSrc_Token_
static const int sdSiTEC
iterator find(key_type k)
MonitorElement * mehHcaln[4]
iterator end()
Definition: DetSetNew.h:70
edm::EDGetTokenT< EEUncalibratedRecHitCollection > ECalUncalEESrc_Token_
static int position[264][3]
Definition: ReadPGInfo.cc:509
T get() const
Definition: EventSetup.h:71
const TrackerGeomDet * idToDet(DetId) const override
void fillECal(const edm::Event &, const edm::EventSetup &)
unsigned int pxfSide(const DetId &id) const
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
LocalPoint localPosition() const final
LocalPoint localPosition() const override
std::vector< PSimHit > PSimHitContainer
unsigned int RunNumber_t
step
Definition: StallMonitor.cc:94
static const int sdPxlFwd
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:127
TrackerHitAssociator::Config trackerHitAssociatorConfig_
DetId geographicalId() const
dbl *** dir
Definition: mlp_gen.cc:35
bool isValid() const
Definition: ESHandle.h:44
bool isForward() const
Definition: RPCRoll.cc:98
T x() const
Definition: PV3DBase.h:62
unsigned int tecWheel(const DetId &id) const
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
T const * product() const
Definition: ESHandle.h:86
edm::EDGetTokenT< edm::PSimHitContainer > MuRPCSimSrc_Token_
MonitorElement * mehSiStripResX[19]
std::string const & instance() const
Definition: InputTag.h:37
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:43
static const int sdHcalEC
const CSCChamber * chamber() const
Definition: CSCLayer.h:52
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:75
const_iterator begin() const
unsigned int tobLayer(const DetId &id) const
Definition: Run.h:45
void fillHCal(const edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< EERecHitCollection > ECalEESrc_Token_
void getAllStableProvenance(std::vector< StableProvenance const * > &provenances) const
Definition: Event.cc:117
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:107
iterator begin()
Definition: DetSetNew.h:67
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > SiStripSrc_Token_