CMS 3D CMS Logo

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