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