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 
603  // iterator to access containers
604  edm::PCaloHitContainer::const_iterator itHit;
605 
607  // extract simhit info
610  iEvent.getByToken(HCalSrc_Token_,hcalHits);
611  bool validhcalHits = true;
612  if (!hcalHits.isValid()) {
613  LogDebug(MsgLoggerCat)
614  << "Unable to find hcalHits in event!";
615  validhcalHits = false;
616  }
617 
618  std::map<HcalDetId,float> fHBEnergySimHits;
619  std::map<HcalDetId,float> fHEEnergySimHits;
620  std::map<HcalDetId,float> fHOEnergySimHits;
621  std::map<HcalDetId,float> fHFEnergySimHits;
622  if (validhcalHits) {
623  const edm::PCaloHitContainer *simhitResult = hcalHits.product();
624 
625  for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin();
626  simhits != simhitResult->end();
627  ++simhits) {
628 
629  HcalDetId detId(simhits->id());
630 
631  if (detId.subdet() == sdHcalBrl){
632  fHBEnergySimHits[detId] += simhits->energy();
633  }
634  if (detId.subdet() == sdHcalEC){
635  fHEEnergySimHits[detId] += simhits->energy();
636  }
637  if (detId.subdet() == sdHcalOut){
638  fHOEnergySimHits[detId] += simhits->energy();
639  }
640  if (detId.subdet() == sdHcalFwd){
641  fHFEnergySimHits[detId] += simhits->energy();
642  }
643  }
644  }
645 
646  // max values to be used (HO is found in HB)
647  Double_t maxHBEnergy = 0.;
648  Double_t maxHEEnergy = 0.;
649  Double_t maxHFEnergy = 0.;
650 
651  Double_t maxHBPhi = -1000.;
652  Double_t maxHEPhi = -1000.;
653  Double_t maxHOPhi = -1000.;
654  Double_t maxHFPhi = -1000.;
655 
656 
657  Double_t PI = 3.141592653589;
658 
660  // get HBHE information
662  std::vector<edm::Handle<HBHERecHitCollection> > hbhe;
663  iEvent.getManyByType(hbhe);
664  bool validHBHE = true;
665  if (!hbhe[0].isValid()) {
666  LogDebug(MsgLoggerCat)
667  << "Unable to find any HBHERecHitCollections in event!";
668  validHBHE = false;
669  }
670 
671  if (validHBHE) {
672  std::vector<edm::Handle<HBHERecHitCollection> >::iterator ihbhe;
673  const CaloGeometry* geo = geometry.product();
674 
675  int iHB = 0;
676  int iHE = 0;
677  for (ihbhe = hbhe.begin(); ihbhe != hbhe.end(); ++ihbhe) {
678 
679  // find max values
680  for (HBHERecHitCollection::const_iterator jhbhe = (*ihbhe)->begin();
681  jhbhe != (*ihbhe)->end(); ++jhbhe) {
682 
683  HcalDetId cell(jhbhe->id());
684 
685  if (cell.subdet() == sdHcalBrl) {
686 
687  const HcalGeometry* cellGeometry =
688  dynamic_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal,cell.subdet()));
689  double fPhi = cellGeometry->getPosition(cell).phi () ;
690  if ( (jhbhe->energy()) > maxHBEnergy ) {
691  maxHBEnergy = jhbhe->energy();
692  maxHBPhi = fPhi;
693  maxHOPhi = maxHBPhi;
694  }
695  }
696 
697  if (cell.subdet() == sdHcalEC) {
698 
699  const HcalGeometry* cellGeometry =
700  dynamic_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal,cell.subdet()));
701  double fPhi = cellGeometry->getPosition(cell).phi () ;
702  if ( (jhbhe->energy()) > maxHEEnergy ) {
703  maxHEEnergy = jhbhe->energy();
704  maxHEPhi = fPhi;
705  }
706  }
707  } // end find max values
708 
709  for (HBHERecHitCollection::const_iterator jhbhe = (*ihbhe)->begin();
710  jhbhe != (*ihbhe)->end(); ++jhbhe) {
711 
712  HcalDetId cell(jhbhe->id());
713 
714  if (cell.subdet() == sdHcalBrl) {
715 
716  ++iHB;
717 
718  const HcalGeometry* cellGeometry =
719  dynamic_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal,cell.subdet()));
720  double fPhi = cellGeometry->getPosition(cell).phi () ;
721 
722  float deltaphi = maxHBPhi - fPhi;
723  if (fPhi > maxHBPhi) { deltaphi = fPhi - maxHBPhi;}
724  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
725 
726  mehHcalRes[0]->Fill(jhbhe->energy() -
727  fHBEnergySimHits[cell]);
728  }
729 
730  if (cell.subdet() == sdHcalEC) {
731 
732  ++iHE;
733 
734  const HcalGeometry* cellGeometry =
735  dynamic_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal,cell.subdet()));
736  double fPhi = cellGeometry->getPosition(cell).phi () ;
737 
738  float deltaphi = maxHEPhi - fPhi;
739  if (fPhi > maxHEPhi) { deltaphi = fPhi - maxHEPhi;}
740  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
741  mehHcalRes[1]->Fill(jhbhe->energy() -
742  fHEEnergySimHits[cell]);
743  }
744  }
745  } // end loop through collection
746 
747 
748  if (verbosity > 1) {
749  eventout += "\n Number of HBRecHits collected:............ ";
750  eventout += iHB;
751  }
752 
753  if (verbosity > 1) {
754  eventout += "\n Number of HERecHits collected:............ ";
755  eventout += iHE;
756  }
757  mehHcaln[0]->Fill((float)iHB);
758  mehHcaln[1]->Fill((float)iHE);
759  }
760 
762  // get HF information
764  std::vector<edm::Handle<HFRecHitCollection> > hf;
765  iEvent.getManyByType(hf);
766  bool validHF = true;
767  if (!hf[0].isValid()) {
768  LogDebug(MsgLoggerCat)
769  << "Unable to find any HFRecHitCollections in event!";
770  validHF = false;
771  }
772  if (validHF) {
773  std::vector<edm::Handle<HFRecHitCollection> >::iterator ihf;
774 
775  int iHF = 0;
776  for (ihf = hf.begin(); ihf != hf.end(); ++ihf) {
777 
778  // find max values
779  for (HFRecHitCollection::const_iterator jhf = (*ihf)->begin();
780  jhf != (*ihf)->end(); ++jhf) {
781 
782  HcalDetId cell(jhf->id());
783 
784  if (cell.subdet() == sdHcalFwd) {
785 
786  auto cellGeometry = geometry->getSubdetectorGeometry(cell)->getGeometry(cell) ;
787  double fPhi = cellGeometry->getPosition().phi () ;
788  if ( (jhf->energy()) > maxHFEnergy ) {
789  maxHFEnergy = jhf->energy();
790  maxHFPhi = fPhi;
791  }
792  }
793  } // end find max values
794 
795  for (HFRecHitCollection::const_iterator jhf = (*ihf)->begin();
796  jhf != (*ihf)->end(); ++jhf) {
797 
798  HcalDetId cell(jhf->id());
799 
800  if (cell.subdet() == sdHcalFwd) {
801 
802  ++iHF;
803 
804  auto cellGeometry = geometry->getSubdetectorGeometry(cell)->getGeometry (cell) ;
805  double fPhi = cellGeometry->getPosition().phi () ;
806 
807  float deltaphi = maxHBPhi - fPhi;
808  if (fPhi > maxHFPhi) { deltaphi = fPhi - maxHFPhi;}
809  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
810 
811  mehHcalRes[2]->Fill(jhf->energy()-fHFEnergySimHits[cell]);
812  }
813  }
814  } // end loop through collection
815 
816  if (verbosity > 1) {
817  eventout += "\n Number of HFDigis collected:.............. ";
818  eventout += iHF;
819  }
820  mehHcaln[2]->Fill((float)iHF);
821  }
822 
824  // get HO information
826  std::vector<edm::Handle<HORecHitCollection> > ho;
827  iEvent.getManyByType(ho);
828  bool validHO = true;
829  if (!ho[0].isValid()) {
830  LogDebug(MsgLoggerCat)
831  << "Unable to find any HORecHitCollections in event!";
832  validHO = false;
833  }
834 
835  if (validHO) {
836  std::vector<edm::Handle<HORecHitCollection> >::iterator iho;
837 
838  int iHO = 0;
839  for (iho = ho.begin(); iho != ho.end(); ++iho) {
840 
841  for (HORecHitCollection::const_iterator jho = (*iho)->begin();
842  jho != (*iho)->end(); ++jho) {
843 
844  HcalDetId cell(jho->id());
845 
846  if (cell.subdet() == sdHcalOut) {
847 
848  ++iHO;
849 
850  auto cellGeometry = geometry->getSubdetectorGeometry(cell)->getGeometry (cell) ;
851  double fPhi = cellGeometry->getPosition().phi () ;
852 
853  float deltaphi = maxHOPhi - fPhi;
854  if (fPhi > maxHOPhi) { deltaphi = fPhi - maxHOPhi;}
855  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
856  mehHcalRes[3]->Fill(jho->energy()-fHOEnergySimHits[cell]);
857  }
858  }
859  } // end loop through collection
860 
861  if (verbosity > 1) {
862  eventout += "\n Number of HODigis collected:.............. ";
863  eventout += iHO;
864  }
865  mehHcaln[3]->Fill((float)iHO);
866  }
867 
868  if (verbosity > 0)
869  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
870 
871  return;
872 }
873 
875  const edm::EventSetup& iSetup)
876 {
877  //Retrieve tracker topology from geometry
878  edm::ESHandle<TrackerTopology> tTopoHandle;
879  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
880  const TrackerTopology* const tTopo = tTopoHandle.product();
881 
882 
883  std::string MsgLoggerCat = "GlobalRecHitsAnalyzer_fillTrk";
884 
885  TString eventout;
886  if (verbosity > 0)
887  eventout = "\nGathering info:";
888 
889  // get strip information
891  iEvent.getByToken(SiStripSrc_Token_, rechitsmatched);
892  bool validstrip = true;
893  if (!rechitsmatched.isValid()) {
894  LogDebug(MsgLoggerCat)
895  << "Unable to find stripmatchedrechits in event!";
896  validstrip = false;
897  }
898 
900 
902  iSetup.get<TrackerDigiGeometryRecord>().get(pDD);
903  if (!pDD.isValid()) {
904  edm::LogWarning(MsgLoggerCat)
905  << "Unable to find TrackerDigiGeometry in event!";
906  return;
907  }
908  const TrackerGeometry &tracker(*pDD);
909 
910  if (validstrip) {
911  int nStripBrl = 0, nStripFwd = 0;
912 
913  // loop over det units
914  for (TrackerGeometry::DetContainer::const_iterator it =
915  pDD->dets().begin();
916  it != pDD->dets().end(); ++it) {
917 
918  uint32_t myid = ((*it)->geographicalId()).rawId();
919  DetId detid = ((*it)->geographicalId());
920 
921  //loop over rechits-matched in the same subdetector
922  SiStripMatchedRecHit2DCollection::const_iterator rechitmatchedMatch = rechitsmatched->find(detid);
923 
924  if (rechitmatchedMatch != rechitsmatched->end()) {
925  SiStripMatchedRecHit2DCollection::DetSet rechitmatchedRange = *rechitmatchedMatch;
926  SiStripMatchedRecHit2DCollection::DetSet::const_iterator rechitmatchedRangeIteratorBegin = rechitmatchedRange.begin();
927  SiStripMatchedRecHit2DCollection::DetSet::const_iterator rechitmatchedRangeIteratorEnd = rechitmatchedRange.end();
928  SiStripMatchedRecHit2DCollection::DetSet::const_iterator itermatched = rechitmatchedRangeIteratorBegin;
929 
930  for ( itermatched = rechitmatchedRangeIteratorBegin;
931  itermatched != rechitmatchedRangeIteratorEnd;
932  ++itermatched) {
933 
934  SiStripMatchedRecHit2D const rechit = *itermatched;
935  LocalPoint position = rechit.localPosition();
936 
937  float mindist = 999999.;
938  float distx = 999999.;
939  float disty = 999999.;
940  float dist = 999999.;
941  std::pair<LocalPoint,LocalVector> closestPair;
942  matched.clear();
943 
944  float rechitmatchedx = position.x();
945  float rechitmatchedy = position.y();
946 
947  matched = associate.associateHit(rechit);
948 
949  if (!matched.empty()) {
950  //project simhit;
951  const GluedGeomDet* gluedDet =
952  (const GluedGeomDet*)tracker.idToDet(rechit.geographicalId());
953  const StripGeomDetUnit* partnerstripdet =
954  (StripGeomDetUnit*) gluedDet->stereoDet();
955  std::pair<LocalPoint,LocalVector> hitPair;
956 
957  for(std::vector<PSimHit>::const_iterator m = matched.begin();
958  m != matched.end(); m++){
959  //project simhit;
960  hitPair = projectHit((*m),partnerstripdet,gluedDet->surface());
961  distx = fabs(rechitmatchedx - hitPair.first.x());
962  disty = fabs(rechitmatchedy - hitPair.first.y());
963  dist = sqrt(distx*distx+disty*disty);
964 
965  if(dist < mindist){
966  mindist = dist;
967  closestPair = hitPair;
968  }
969  }
970 
971  // get TIB
972  if (detid.subdetId() == sdSiTIB) {
973 
974 
975  ++nStripBrl;
976 
977  if (tTopo->tibLayer(myid) == 1) {
978  mehSiStripResX[8]->Fill(rechitmatchedx-closestPair.first.x());
979  mehSiStripResY[8]->Fill(rechitmatchedy-closestPair.first.y());
980  }
981  if (tTopo->tibLayer(myid) == 2) {
982  mehSiStripResX[9]->Fill(rechitmatchedx-closestPair.first.x());
983  mehSiStripResY[9]->Fill(rechitmatchedy-closestPair.first.y());
984  }
985  if (tTopo->tibLayer(myid) == 3) {
986  mehSiStripResX[10]->Fill(rechitmatchedx-closestPair.first.x());
987  mehSiStripResY[10]->Fill(rechitmatchedy-closestPair.first.y());
988 
989  }
990  if (tTopo->tibLayer(myid) == 4) {
991  mehSiStripResX[11]->Fill(rechitmatchedx-closestPair.first.x());
992  mehSiStripResY[11]->Fill(rechitmatchedy-closestPair.first.y());
993  }
994  }
995 
996  // get TOB
997  if (detid.subdetId() == sdSiTOB) {
998 
999 
1000  ++nStripBrl;
1001 
1002  if (tTopo->tobLayer(myid) == 1) {
1003  mehSiStripResX[15]->Fill(rechitmatchedx-closestPair.first.x());
1004  mehSiStripResY[15]->Fill(rechitmatchedy-closestPair.first.y());
1005  }
1006  if (tTopo->tobLayer(myid) == 2) {
1007  mehSiStripResX[16]->Fill(rechitmatchedx-closestPair.first.x());
1008  mehSiStripResY[16]->Fill(rechitmatchedy-closestPair.first.y());
1009  }
1010  if (tTopo->tobLayer(myid) == 3) {
1011  mehSiStripResX[17]->Fill(rechitmatchedx-closestPair.first.x());
1012  mehSiStripResY[17]->Fill(rechitmatchedy-closestPair.first.y());
1013  }
1014  if (tTopo->tobLayer(myid) == 4) {
1015  mehSiStripResX[18]->Fill(rechitmatchedx-closestPair.first.x());
1016  mehSiStripResY[18]->Fill(rechitmatchedy-closestPair.first.y());
1017  }
1018  }
1019 
1020  // get TID
1021  if (detid.subdetId() == sdSiTID) {
1022 
1023 
1024  ++nStripFwd;
1025 
1026  if (tTopo->tidWheel(myid) == 1) {
1027  mehSiStripResX[12]->Fill(rechitmatchedx-closestPair.first.x());
1028  mehSiStripResY[12]->Fill(rechitmatchedy-closestPair.first.y());
1029  }
1030  if (tTopo->tidWheel(myid) == 2) {
1031  mehSiStripResX[13]->Fill(rechitmatchedx-closestPair.first.x());
1032  mehSiStripResY[13]->Fill(rechitmatchedy-closestPair.first.y());
1033  }
1034  if (tTopo->tidWheel(myid) == 3) {
1035  mehSiStripResX[14]->Fill(rechitmatchedx-closestPair.first.x());
1036  mehSiStripResY[14]->Fill(rechitmatchedy-closestPair.first.y());
1037  }
1038  }
1039 
1040  // get TEC
1041  if (detid.subdetId() == sdSiTEC) {
1042 
1043 
1044  ++nStripFwd;
1045 
1046  if (tTopo->tecWheel(myid) == 1) {
1047  mehSiStripResX[0]->Fill(rechitmatchedx-closestPair.first.x());
1048  mehSiStripResY[0]->Fill(rechitmatchedy-closestPair.first.y());
1049  }
1050  if (tTopo->tecWheel(myid) == 2) {
1051  mehSiStripResX[1]->Fill(rechitmatchedx-closestPair.first.x());
1052  mehSiStripResY[1]->Fill(rechitmatchedy-closestPair.first.y());
1053  }
1054  if (tTopo->tecWheel(myid) == 3) {
1055  mehSiStripResX[2]->Fill(rechitmatchedx-closestPair.first.x());
1056  mehSiStripResY[2]->Fill(rechitmatchedy-closestPair.first.y());
1057  }
1058  if (tTopo->tecWheel(myid) == 4) {
1059  mehSiStripResX[3]->Fill(rechitmatchedx-closestPair.first.x());
1060  mehSiStripResY[3]->Fill(rechitmatchedy-closestPair.first.y());
1061 
1062  }
1063  if (tTopo->tecWheel(myid) == 5) {
1064  mehSiStripResX[4]->Fill(rechitmatchedx-closestPair.first.x());
1065  mehSiStripResY[4]->Fill(rechitmatchedy-closestPair.first.y());
1066  }
1067  if (tTopo->tecWheel(myid) == 6) {
1068  mehSiStripResX[5]->Fill(rechitmatchedx-closestPair.first.x());
1069  mehSiStripResY[5]->Fill(rechitmatchedy-closestPair.first.y());
1070  }
1071  if (tTopo->tecWheel(myid) == 7) {
1072  mehSiStripResX[6]->Fill(rechitmatchedx-closestPair.first.x());
1073  mehSiStripResY[6]->Fill(rechitmatchedy-closestPair.first.y());
1074  }
1075  if (tTopo->tecWheel(myid) == 8) {
1076  mehSiStripResX[7]->Fill(rechitmatchedx-closestPair.first.x());
1077  mehSiStripResY[7]->Fill(rechitmatchedy-closestPair.first.y());
1078  }
1079  }
1080 
1081  } // end if matched empty
1082  }
1083  }
1084  } // end loop over det units
1085 
1086  if (verbosity > 1) {
1087  eventout += "\n Number of BrlStripRecHits collected:...... ";
1088  eventout += nStripBrl;
1089  }
1090 
1091  for(int i =8; i<12; ++i)
1092  {mehSiStripn[i]->Fill((float)nStripBrl);}
1093  for(int i =16; i<19; ++i)
1094  {mehSiStripn[i]->Fill((float)nStripBrl);}
1095 
1096  if (verbosity > 1) {
1097  eventout += "\n Number of FrwdStripRecHits collected:..... ";
1098  eventout += nStripFwd;
1099  }
1100  for(int i =0; i<8; ++i)
1101  {mehSiStripn[i]->Fill((float)nStripFwd);}
1102  for(int i =12; i<16; ++i)
1103  {mehSiStripn[i]->Fill((float)nStripFwd);}
1104  }
1105 
1106  // get pixel information
1107  //Get RecHits
1109  iEvent.getByToken(SiPxlSrc_Token_, recHitColl);
1110  bool validpixel = true;
1111  if (!recHitColl.isValid()) {
1112  LogDebug(MsgLoggerCat)
1113  << "Unable to find SiPixelRecHitCollection in event!";
1114  validpixel = false;
1115  }
1116 
1117  //Get event setup
1119  iSetup.get<TrackerDigiGeometryRecord>().get(geom);
1120  if (!geom.isValid()) {
1121  edm::LogWarning(MsgLoggerCat)
1122  << "Unable to find TrackerDigiGeometry in event!";
1123  return;
1124  }
1125 
1126  if (validpixel) {
1127  int nPxlBrl = 0, nPxlFwd = 0;
1128  //iterate over detunits
1129  for (TrackerGeometry::DetContainer::const_iterator it =
1130  geom->dets().begin();
1131  it != geom->dets().end(); ++it) {
1132 
1133  uint32_t myid = ((*it)->geographicalId()).rawId();
1134  DetId detId = ((*it)->geographicalId());
1135  int subid = detId.subdetId();
1136 
1137  if (! ((subid == sdPxlBrl) || (subid == sdPxlFwd))) continue;
1138 
1139  SiPixelRecHitCollection::const_iterator pixeldet = recHitColl->find(detId);
1140  if (pixeldet == recHitColl->end()) continue;
1141  SiPixelRecHitCollection::DetSet pixelrechitRange = *pixeldet;
1142  SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorBegin = pixelrechitRange.begin();
1143  SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorEnd = pixelrechitRange.end();
1144  SiPixelRecHitCollection::DetSet::const_iterator pixeliter = pixelrechitRangeIteratorBegin;
1145 
1146 
1147  std::vector<PSimHit> matched;
1148 
1149  //----Loop over rechits for this detId
1150  for ( ; pixeliter != pixelrechitRangeIteratorEnd; ++pixeliter) {
1151 
1152  matched.clear();
1153  matched = associate.associateHit(*pixeliter);
1154 
1155  if ( !matched.empty() ) {
1156 
1157  float closest = 9999.9;
1158  LocalPoint lp = pixeliter->localPosition();
1159  float rechit_x = lp.x();
1160  float rechit_y = lp.y();
1161 
1162  float sim_x = 0.;
1163  float sim_y = 0.;
1164 
1165  //loop over sim hits and fill closet
1166  for (std::vector<PSimHit>::const_iterator m = matched.begin();
1167  m != matched.end(); ++m) {
1168 
1169  float sim_x1 = (*m).entryPoint().x();
1170  float sim_x2 = (*m).exitPoint().x();
1171  float sim_xpos = 0.5*(sim_x1+sim_x2);
1172 
1173  float sim_y1 = (*m).entryPoint().y();
1174  float sim_y2 = (*m).exitPoint().y();
1175  float sim_ypos = 0.5*(sim_y1+sim_y2);
1176 
1177  float x_res = fabs(sim_xpos - rechit_x);
1178  float y_res = fabs(sim_ypos - rechit_y);
1179 
1180  float dist = sqrt(x_res*x_res + y_res*y_res);
1181 
1182  if ( dist < closest ) {
1183  closest = dist;
1184  sim_x = sim_xpos;
1185  sim_y = sim_ypos;
1186  }
1187  } // end sim hit loop
1188 
1189  // get Barrel pixels ***************Pixel STuff******************
1190  if (subid == sdPxlBrl) {
1191 
1192  ++nPxlBrl;
1193 
1194  if (tTopo->pxbLayer(myid) == 1) {
1195  mehSiPixelResX[0]->Fill(rechit_x-sim_x);
1196  mehSiPixelResY[0]->Fill(rechit_y-sim_y);
1197 
1198  }
1199  if (tTopo->pxbLayer(myid) == 2) {
1200  mehSiPixelResX[1]->Fill(rechit_x-sim_x);
1201  mehSiPixelResY[1]->Fill(rechit_y-sim_y);
1202  }
1203  if (tTopo->pxbLayer(myid) == 3) {
1204  mehSiPixelResX[2]->Fill(rechit_x-sim_x);
1205  mehSiPixelResY[2]->Fill(rechit_y-sim_y);
1206  }
1207  }
1208 
1209  // get Forward pixels
1210  if (subid == sdPxlFwd) {
1211 
1212  ++nPxlFwd;
1213 
1214  if (tTopo->pxfDisk(myid) == 1) {
1215  if (tTopo->pxfSide(myid) == 1) {
1216  mehSiPixelResX[3]->Fill(rechit_x-sim_x);
1217  mehSiPixelResY[3]->Fill(rechit_y-sim_y);
1218  }
1219  if (tTopo->pxfSide(myid) == 2) {
1220  mehSiPixelResX[4]->Fill(rechit_x-sim_x);
1221  mehSiPixelResY[4]->Fill(rechit_y-sim_y);
1222  }
1223  }
1224  if (tTopo->pxfDisk(myid) == 2) {
1225  if (tTopo->pxfSide(myid) == 1) {
1226  mehSiPixelResX[5]->Fill(rechit_x-sim_x);
1227  mehSiPixelResY[5]->Fill(rechit_y-sim_y);
1228  }
1229  if (tTopo->pxfSide(myid) == 2) {
1230  mehSiPixelResX[6]->Fill(rechit_x-sim_x);
1231  mehSiPixelResY[6]->Fill(rechit_y-sim_y);
1232  }
1233  }
1234  }
1235  } // end matched emtpy
1236  } // <-----end rechit loop
1237  } // <------ end detunit loop
1238 
1239 
1240  if (verbosity > 1) {
1241  eventout += "\n Number of BrlPixelRecHits collected:...... ";
1242  eventout += nPxlBrl;
1243  }
1244  for(int i=0; i<3; ++i) {
1245  mehSiPixeln[i]->Fill((float)nPxlBrl);
1246  }
1247 
1248  if (verbosity > 1) {
1249  eventout += "\n Number of FrwdPixelRecHits collected:..... ";
1250  eventout += nPxlFwd;
1251  }
1252 
1253  for(int i=3; i<7; ++i) {
1254  mehSiPixeln[i]->Fill((float)nPxlFwd);
1255  }
1256  }
1257 
1258  if (verbosity > 0)
1259  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1260 
1261  return;
1262 }
1263 
1265  const edm::EventSetup& iSetup)
1266 {
1267  std::string MsgLoggerCat = "GlobalRecHitsAnalyzer_fillMuon";
1268 
1269  TString eventout;
1270  if (verbosity > 0)
1271  eventout = "\nGathering info:";
1272 
1273  // get DT information
1275  iSetup.get<MuonGeometryRecord>().get(dtGeom);
1276  if (!dtGeom.isValid()) {
1277  edm::LogWarning(MsgLoggerCat)
1278  << "Unable to find DTMuonGeometryRecord in event!";
1279  return;
1280  }
1281 
1283  iEvent.getByToken(MuDTSimSrc_Token_, dtsimHits);
1284  bool validdtsim = true;
1285  if (!dtsimHits.isValid()) {
1286  LogDebug(MsgLoggerCat)
1287  << "Unable to find dtsimHits in event!";
1288  validdtsim = false;
1289  }
1290 
1292  iEvent.getByToken(MuDTSrc_Token_, dtRecHits);
1293  bool validdtrec = true;
1294  if (!dtRecHits.isValid()) {
1295  LogDebug(MsgLoggerCat)
1296  << "Unable to find dtRecHits in event!";
1297  validdtrec = false;
1298  }
1299 
1300  if (validdtsim && validdtrec) {
1301 
1302  std::map<DTWireId, edm::PSimHitContainer> simHitsPerWire =
1304 
1305  std::map<DTWireId, std::vector<DTRecHit1DPair> > recHitsPerWire =
1306  map1DRecHitsPerWire(dtRecHits.product());
1307 
1308  int nDt = compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 1);
1309 
1310  if (verbosity > 1) {
1311  eventout += "\n Number of DtMuonRecHits collected:........ ";
1312  eventout += nDt;
1313  }
1314  mehDtMuonn->Fill(float(nDt));
1315  }
1316 
1317  // get CSC Strip information
1318  // get map of sim hits
1319  theMap.clear();
1321 
1322  iEvent.getByToken(MuCSCHits_Token_,cf);
1323  bool validXFrame = true;
1324  if (!cf.isValid()) {
1325  LogDebug(MsgLoggerCat)
1326  << "Unable to find muo CSC crossingFrame in event!";
1327  validXFrame = false;
1328  }
1329  if (validXFrame) {
1331 
1332  // arrange the hits by detUnit
1333  for ( auto const & iHit : simHits ) {
1334  theMap[iHit.detUnitId()].push_back(iHit);
1335  }
1336  }
1337 
1338  // get geometry
1340  iSetup.get<MuonGeometryRecord>().get(hGeom);
1341  if (!hGeom.isValid()) {
1342  edm::LogWarning(MsgLoggerCat)
1343  << "Unable to find CSCMuonGeometryRecord in event!";
1344  return;
1345  }
1346  const CSCGeometry *theCSCGeometry = &*hGeom;
1347 
1348  // get rechits
1350  iEvent.getByToken(MuCSCSrc_Token_, hRecHits);
1351  bool validCSC = true;
1352  if (!hRecHits.isValid()) {
1353  LogDebug(MsgLoggerCat)
1354  << "Unable to find CSC RecHits in event!";
1355  validCSC = false;
1356  }
1357 
1358  if (validCSC) {
1359  const CSCRecHit2DCollection *cscRecHits = hRecHits.product();
1360 
1361  int nCSC = 0;
1362  for (CSCRecHit2DCollection::const_iterator recHitItr = cscRecHits->begin();
1363  recHitItr != cscRecHits->end(); ++recHitItr) {
1364 
1365  int detId = (*recHitItr).cscDetId().rawId();
1366 
1368  std::map<int, edm::PSimHitContainer>::const_iterator mapItr =
1369  theMap.find(detId);
1370  if (mapItr != theMap.end()) {
1371  simHits = mapItr->second;
1372  }
1373 
1374  if (simHits.size() == 1) {
1375  ++nCSC;
1376 
1377  const GeomDetUnit* detUnit =
1378  theCSCGeometry->idToDetUnit(CSCDetId(detId));
1379  const CSCLayer *layer = dynamic_cast<const CSCLayer *>(detUnit);
1380 
1381  int chamberType = layer->chamber()->specs()->chamberType();
1382  plotResolution(simHits[0], *recHitItr, layer, chamberType);
1383  }
1384  }
1385 
1386  if (verbosity > 1) {
1387  eventout += "\n Number of CSCRecHits collected:........... ";
1388  eventout += nCSC;
1389  }
1390  mehCSCn->Fill((float)nCSC);
1391  }
1392 
1393  // get RPC information
1394  std::map<double, int> mapsim, maprec;
1395  std::map<int, double> nmapsim, nmaprec;
1396 
1398  iSetup.get<MuonGeometryRecord>().get(rpcGeom);
1399  if (!rpcGeom.isValid()) {
1400  edm::LogWarning(MsgLoggerCat)
1401  << "Unable to find RPCMuonGeometryRecord in event!";
1402  return;
1403  }
1404 
1406  iEvent.getByToken(MuRPCSimSrc_Token_, simHit);
1407  bool validrpcsim = true;
1408  if (!simHit.isValid()) {
1409  LogDebug(MsgLoggerCat)
1410  << "Unable to find RPCSimHit in event!";
1411  validrpcsim = false;
1412  }
1413 
1415  iEvent.getByToken(MuRPCSrc_Token_, recHit);
1416  bool validrpc = true;
1417  if (!simHit.isValid()) {
1418  LogDebug(MsgLoggerCat)
1419  << "Unable to find RPCRecHit in event!";
1420  validrpc = false;
1421  }
1422 
1423  if (validrpc) {
1424  int nRPC = 0;
1426  int nrec = 0;
1427  for (recIt = recHit->begin(); recIt != recHit->end(); ++recIt) {
1428  RPCDetId Rid = (RPCDetId)(*recIt).rpcId();
1429  const RPCRoll *roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(Rid));
1430  if (roll->isForward()) {
1431 
1432  if (verbosity > 1) {
1433  eventout +=
1434  "\n Number of RPCRecHits collected:........... ";
1435  eventout += nRPC;
1436  }
1437 
1438  if (verbosity > 0)
1439  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1440  return;
1441  }
1442  nrec = nrec + 1;
1443  LocalPoint rhitlocal = (*recIt).localPosition();
1444  double rhitlocalx = rhitlocal.x();
1445  maprec[rhitlocalx] = nrec;
1446  }
1447 
1448  int i = 0;
1449  for (std::map<double,int>::iterator iter = maprec.begin();
1450  iter != maprec.end(); ++iter) {
1451  i = i + 1;
1452  nmaprec[i] = (*iter).first;
1453  }
1454 
1455  int nsim = 0;
1456  if (validrpcsim) {
1457  edm::PSimHitContainer::const_iterator simIt;
1458  for (simIt = simHit->begin(); simIt != simHit->end(); simIt++) {
1459  int ptype = (*simIt).particleType();
1460  if (ptype == 13 || ptype == -13) {
1461  nsim = nsim + 1;
1462  LocalPoint shitlocal = (*simIt).localPosition();
1463  double shitlocalx = shitlocal.x();
1464  mapsim[shitlocalx] = nsim;
1465  }
1466  }
1467 
1468  i = 0;
1469  for (std::map<double,int>::iterator iter = mapsim.begin();
1470  iter != mapsim.end(); ++iter) {
1471  i = i + 1;
1472  nmapsim[i] = (*iter).first;
1473  }
1474  }
1475 
1476  if (nsim == nrec) {
1477  for (int r = 0; r < nsim; r++) {
1478  ++nRPC;
1479  mehRPCResX->Fill(nmaprec[r+1]-nmapsim[r+1]);
1480  }
1481  }
1482 
1483  if (verbosity > 1) {
1484  eventout += "\n Number of RPCRecHits collected:........... ";
1485  eventout += nRPC;
1486  }
1487  mehRPCn->Fill((float)nRPC);
1488  }
1489 
1490  if (verbosity > 0)
1491  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1492 
1493  return;
1494 }
1495 
1496 //needed by to do the residual for matched hits in SiStrip
1497 std::pair<LocalPoint,LocalVector>
1499  const StripGeomDetUnit* stripDet,
1500  const BoundPlane& plane)
1501 {
1502 
1503  const StripTopology& topol = stripDet->specificTopology();
1504  GlobalPoint globalpos= stripDet->surface().toGlobal(hit.localPosition());
1505  LocalPoint localHit = plane.toLocal(globalpos);
1506  //track direction
1507  LocalVector locdir=hit.localDirection();
1508  //rotate track in new frame
1509 
1510  GlobalVector globaldir= stripDet->surface().toGlobal(locdir);
1511  LocalVector dir=plane.toLocal(globaldir);
1512  float scale = -localHit.z() / dir.z();
1513 
1514  LocalPoint projectedPos = localHit + scale*dir;
1515 
1516  float selfAngle = topol.stripAngle( topol.strip( hit.localPosition()));
1517 
1518  // vector along strip in hit frame
1519  LocalVector stripDir( sin(selfAngle), cos(selfAngle), 0);
1520 
1521  LocalVector
1522  localStripDir(plane.toLocal(stripDet->surface().toGlobal(stripDir)));
1523 
1524  return std::pair<LocalPoint,LocalVector>( projectedPos, localStripDir);
1525 }
1526 
1527 // Return a map between DTRecHit1DPair and wireId
1528 std::map<DTWireId, std::vector<DTRecHit1DPair> >
1530  dt1DRecHitPairs) {
1531  std::map<DTWireId, std::vector<DTRecHit1DPair> > ret;
1532 
1533  for(DTRecHitCollection::const_iterator rechit = dt1DRecHitPairs->begin();
1534  rechit != dt1DRecHitPairs->end(); rechit++) {
1535  ret[(*rechit).wireId()].push_back(*rechit);
1536  }
1537 
1538  return ret;
1539 }
1540 
1541 // Compute SimHit distance from wire (cm)
1543  DTWireId wireId,
1544  const PSimHit& hit) {
1545  float xwire = layer->specificTopology().wirePosition(wireId.wire());
1546  LocalPoint entryP = hit.entryPoint();
1547  LocalPoint exitP = hit.exitPoint();
1548  float xEntry = entryP.x()-xwire;
1549  float xExit = exitP.x()-xwire;
1550 
1551  //FIXME: check...
1552  return fabs(xEntry - (entryP.z()*(xExit-xEntry))/(exitP.z()-entryP.z()));
1553 }
1554 
1555 // Find the RecHit closest to the muon SimHit
1556 template <typename type>
1557 const type*
1559  DTWireId wireId,
1560  const std::vector<type>& recHits,
1561  const float simHitDist) {
1562  float res = 99999;
1563  const type* theBestRecHit = nullptr;
1564  // Loop over RecHits within the cell
1565  for(typename std::vector<type>::const_iterator recHit = recHits.begin();
1566  recHit != recHits.end();
1567  recHit++) {
1568  float distTmp = recHitDistFromWire(*recHit, layer);
1569  if(fabs(distTmp-simHitDist) < res) {
1570  res = fabs(distTmp-simHitDist);
1571  theBestRecHit = &(*recHit);
1572  }
1573  } // End of loop over RecHits within the cell
1574 
1575  return theBestRecHit;
1576 }
1577 
1578 // Compute the distance from wire (cm) of a hits in a DTRecHit1DPair
1579 float
1581  const DTLayer* layer) {
1582  // Compute the rechit distance from wire
1583  return fabs(hitPair.localPosition(DTEnums::Left).x() -
1584  hitPair.localPosition(DTEnums::Right).x())/2.;
1585 }
1586 
1587 // Compute the distance from wire (cm) of a hits in a DTRecHit1D
1588 float
1590  const DTLayer* layer) {
1591  return fabs(recHit.localPosition().x() -
1592  layer->specificTopology().wirePosition(recHit.wireId().wire()));
1593 }
1594 
1595 template <typename type>
1597  const std::map<DTWireId, std::vector<PSimHit> >&
1598  _simHitsPerWire,
1599  const std::map<DTWireId, std::vector<type> >&
1600  _recHitsPerWire,
1601  int step) {
1602 
1603 std::map<DTWireId, std::vector<PSimHit> > simHitsPerWire = _simHitsPerWire;
1604 std::map<DTWireId, std::vector<type> > recHitsPerWire = _recHitsPerWire;
1605  int nDt = 0;
1606  // Loop over cells with a muon SimHit
1607  for(std::map<DTWireId, std::vector<PSimHit> >::const_iterator wireAndSHits =
1608  simHitsPerWire.begin();
1609  wireAndSHits != simHitsPerWire.end();
1610  wireAndSHits++) {
1611  DTWireId wireId = (*wireAndSHits).first;
1612  std::vector<PSimHit> simHitsInCell = (*wireAndSHits).second;
1613 
1614  // Get the layer
1615  const DTLayer* layer = dtGeom->layer(wireId);
1616 
1617  // Look for a mu hit in the cell
1618  const PSimHit* muSimHit = DTHitQualityUtils::findMuSimHit(simHitsInCell);
1619  if (muSimHit==nullptr) {
1620  continue; // Skip this cell
1621  }
1622 
1623  // Find the distance of the simhit from the wire
1624  float simHitWireDist = simHitDistFromWire(layer, wireId, *muSimHit);
1625  // Skip simhits out of the cell
1626  if(simHitWireDist>2.1) {
1627  continue; // Skip this cell
1628  }
1629 
1630  // Look for RecHits in the same cell
1631  if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
1632  continue; // No RecHit found in this cell
1633  } else {
1634 
1635  std::vector<type> recHits = recHitsPerWire[wireId];
1636 
1637  // Find the best RecHit
1638  const type* theBestRecHit =
1639  findBestRecHit(layer, wireId, recHits, simHitWireDist);
1640 
1641  float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
1642 
1643  ++nDt;
1644 
1645  mehDtMuonRes->Fill(recHitWireDist-simHitWireDist);
1646 
1647  } // find rechits
1648  } // loop over simhits
1649 
1650  return nDt;
1651 }
1652 
1653 void
1655  const CSCRecHit2D & recHit,
1656  const CSCLayer * layer,
1657  int chamberType) {
1658  GlobalPoint simHitPos = layer->toGlobal(simHit.localPosition());
1659  GlobalPoint recHitPos = layer->toGlobal(recHit.localPosition());
1660 
1661  mehCSCResRDPhi->Fill(recHitPos.phi()-simHitPos.phi());
1662 }
1663 
#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
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:569
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
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:579
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:47
std::vector< EcalUncalibratedRecHit >::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
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)
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:230
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
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
std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
static const int sdPxlBrl
Local3DPoint localPosition() const
Definition: PSimHit.h:44
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:52
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:81
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:60
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:62
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
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:47
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:35
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:44
void fillHCal(const edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< EERecHitCollection > ECalEESrc_Token_
void getAllStableProvenance(std::vector< StableProvenance const * > &provenances) const
Definition: Event.cc:144
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:107
iterator begin()
Definition: DetSetNew.h:67
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > SiStripSrc_Token_