CMS 3D CMS Logo

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