CMS 3D CMS Logo

GlobalRecHitsProducer.cc
Go to the documentation of this file.
1 
13 
15  : fName(""),
16  verbosity(0),
17  frequency(0),
18  label(""),
19  getAllProvenances(false),
20  printProvenanceInfo(false),
21  trackerHitAssociatorConfig_(iPSet, consumesCollector()),
22  caloGeomToken_(esConsumes()),
23  tTopoToken_(esConsumes()),
24  tGeomToken_(esConsumes()),
25  dtGeomToken_(esConsumes()),
26  cscGeomToken_(esConsumes()),
27  rpcGeomToken_(esConsumes()),
28  count(0) {
29  std::string MsgLoggerCat = "GlobalRecHitsProducer_GlobalRecHitsProducer";
30 
31  // get information from parameter set
32  fName = iPSet.getUntrackedParameter<std::string>("Name");
33  verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
34  frequency = iPSet.getUntrackedParameter<int>("Frequency");
35  label = iPSet.getParameter<std::string>("Label");
36  edm::ParameterSet m_Prov = iPSet.getParameter<edm::ParameterSet>("ProvenanceLookup");
37  getAllProvenances = m_Prov.getUntrackedParameter<bool>("GetAllProvenances");
38  printProvenanceInfo = m_Prov.getUntrackedParameter<bool>("PrintProvenanceInfo");
39 
40  //get Labels to use to extract information
41  ECalEBSrc_ = iPSet.getParameter<edm::InputTag>("ECalEBSrc");
42  ECalUncalEBSrc_ = iPSet.getParameter<edm::InputTag>("ECalUncalEBSrc");
43  ECalEESrc_ = iPSet.getParameter<edm::InputTag>("ECalEESrc");
44  ECalUncalEESrc_ = iPSet.getParameter<edm::InputTag>("ECalUncalEESrc");
45  ECalESSrc_ = iPSet.getParameter<edm::InputTag>("ECalESSrc");
46  HCalSrc_ = iPSet.getParameter<edm::InputTag>("HCalSrc");
47  SiStripSrc_ = iPSet.getParameter<edm::InputTag>("SiStripSrc");
48  SiPxlSrc_ = iPSet.getParameter<edm::InputTag>("SiPxlSrc");
49  MuDTSrc_ = iPSet.getParameter<edm::InputTag>("MuDTSrc");
50  MuDTSimSrc_ = iPSet.getParameter<edm::InputTag>("MuDTSimSrc");
51  MuCSCSrc_ = iPSet.getParameter<edm::InputTag>("MuCSCSrc");
52  MuRPCSrc_ = iPSet.getParameter<edm::InputTag>("MuRPCSrc");
53  MuRPCSimSrc_ = iPSet.getParameter<edm::InputTag>("MuRPCSimSrc");
54 
55  // fix for consumes
56  ECalUncalEBSrc_Token_ = consumes<EBUncalibratedRecHitCollection>(iPSet.getParameter<edm::InputTag>("ECalUncalEBSrc"));
57  ECalUncalEESrc_Token_ = consumes<EEUncalibratedRecHitCollection>(iPSet.getParameter<edm::InputTag>("ECalUncalEESrc"));
58  ECalEBSrc_Token_ = consumes<EBRecHitCollection>(iPSet.getParameter<edm::InputTag>("ECalEBSrc"));
59  ECalEESrc_Token_ = consumes<EERecHitCollection>(iPSet.getParameter<edm::InputTag>("ECalEESrc"));
60  ECalESSrc_Token_ = consumes<ESRecHitCollection>(iPSet.getParameter<edm::InputTag>("ECalESSrc"));
61  HCalSrc_Token_ = consumes<edm::PCaloHitContainer>(iPSet.getParameter<edm::InputTag>("HCalSrc"));
62  SiStripSrc_Token_ = consumes<SiStripMatchedRecHit2DCollection>(iPSet.getParameter<edm::InputTag>("SiStripSrc"));
63  SiPxlSrc_Token_ = consumes<SiPixelRecHitCollection>(iPSet.getParameter<edm::InputTag>("SiPxlSrc"));
64 
65  MuDTSrc_Token_ = consumes<DTRecHitCollection>(iPSet.getParameter<edm::InputTag>("MuDTSrc"));
66  MuDTSimSrc_Token_ = consumes<edm::PSimHitContainer>(iPSet.getParameter<edm::InputTag>("MuDTSimSrc"));
67 
68  MuCSCSrc_Token_ = consumes<CSCRecHit2DCollection>(iPSet.getParameter<edm::InputTag>("MuCSCSrc"));
69  MuCSCHits_Token_ = consumes<CrossingFrame<PSimHit>>(
70  edm::InputTag(std::string("mix"), iPSet.getParameter<std::string>("hitsProducer") + std::string("MuonCSCHits")));
71 
72  MuRPCSrc_Token_ = consumes<RPCRecHitCollection>(iPSet.getParameter<edm::InputTag>("MuRPCSrc"));
73  MuRPCSimSrc_Token_ = consumes<edm::PSimHitContainer>(iPSet.getParameter<edm::InputTag>("MuRPCSimSrc"));
74 
75  EBHits_Token_ = consumes<CrossingFrame<PCaloHit>>(
76  edm::InputTag(std::string("mix"), iPSet.getParameter<std::string>("hitsProducer") + std::string("EcalHitsEB")));
78  consumes<CrossingFrame<PCaloHit>>(edm::InputTag(std::string("mix"), iPSet.getParameter<std::string>("hitsProduc\
79 er") + std::string("EcalHitsEE")));
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  << " Label = " << label << "\n"
96  << " GetProv = " << getAllProvenances << "\n"
97  << " PrintProv = " << printProvenanceInfo << "\n"
98  << " ECalEBSrc = " << ECalEBSrc_.label() << ":" << ECalEBSrc_.instance() << "\n"
99  << " ECalUncalEBSrc = " << ECalUncalEBSrc_.label() << ":"
100  << ECalUncalEBSrc_.instance() << "\n"
101  << " ECalEESrc = " << ECalEESrc_.label() << ":" << ECalUncalEESrc_.instance()
102  << "\n"
103  << " ECalUncalEESrc = " << ECalUncalEESrc_.label() << ":" << ECalEESrc_.instance()
104  << "\n"
105  << " ECalESSrc = " << ECalESSrc_.label() << ":" << ECalESSrc_.instance() << "\n"
106  << " HCalSrc = " << HCalSrc_.label() << ":" << HCalSrc_.instance() << "\n"
107  << " SiStripSrc = " << SiStripSrc_.label() << ":" << SiStripSrc_.instance()
108  << "\n"
109  << " SiPixelSrc = " << SiPxlSrc_.label() << ":" << SiPxlSrc_.instance() << "\n"
110  << " MuDTSrc = " << MuDTSrc_.label() << ":" << MuDTSrc_.instance() << "\n"
111  << " MuDTSimSrc = " << MuDTSimSrc_.label() << ":" << MuDTSimSrc_.instance()
112  << "\n"
113  << " MuCSCSrc = " << MuCSCSrc_.label() << ":" << MuCSCSrc_.instance() << "\n"
114  << " MuRPCSrc = " << MuRPCSrc_.label() << ":" << MuRPCSrc_.instance() << "\n"
115  << " MuRPCSimSrc = " << MuRPCSimSrc_.label() << ":" << MuRPCSimSrc_.instance()
116  << "\n"
117  << "===============================\n";
118  }
119 }
120 
122 
124  std::string MsgLoggerCat = "GlobalRecHitsProducer_beginJob";
125 
126  // clear storage vectors
127  clear();
128  return;
129 }
130 
132  std::string MsgLoggerCat = "GlobalRecHitsProducer_endJob";
133  if (verbosity >= 0)
134  edm::LogInfo(MsgLoggerCat) << "Terminating having processed " << count << " events.";
135  return;
136 }
137 
139  std::string MsgLoggerCat = "GlobalRecHitsProducer_produce";
140 
141  // keep track of number of events processed
142  ++count;
143 
144  // get event id information
145  edm::RunNumber_t nrun = iEvent.id().run();
146  edm::EventNumber_t nevt = iEvent.id().event();
147 
148  if (verbosity > 0) {
149  edm::LogInfo(MsgLoggerCat) << "Processing run " << nrun << ", event " << nevt << " (" << count << " events total)";
150  } else if (verbosity == 0) {
151  if (nevt % frequency == 0 || nevt == 1) {
152  edm::LogInfo(MsgLoggerCat) << "Processing run " << nrun << ", event " << nevt << " (" << count
153  << " events total)";
154  }
155  }
156 
157  // clear event holders
158  clear();
159 
160  // look at information available in the event
161  if (getAllProvenances) {
162  std::vector<const edm::StableProvenance*> AllProv;
163  iEvent.getAllStableProvenance(AllProv);
164 
165  if (verbosity >= 0)
166  edm::LogInfo(MsgLoggerCat) << "Number of Provenances = " << AllProv.size();
167 
168  if (printProvenanceInfo && (verbosity >= 0)) {
169  TString eventout("\nProvenance info:\n");
170 
171  for (unsigned int i = 0; i < AllProv.size(); ++i) {
172  eventout += "\n ******************************";
173  eventout += "\n Module : ";
174  //eventout += (AllProv[i]->product).moduleLabel();
175  eventout += AllProv[i]->moduleLabel();
176  eventout += "\n ProductID : ";
177  //eventout += (AllProv[i]->product).productID_.id_;
178  eventout += AllProv[i]->productID().id();
179  eventout += "\n ClassName : ";
180  //eventout += (AllProv[i]->product).fullClassName_;
181  eventout += AllProv[i]->className();
182  eventout += "\n InstanceName : ";
183  //eventout += (AllProv[i]->product).productInstanceName_;
184  eventout += AllProv[i]->productInstanceName();
185  eventout += "\n BranchName : ";
186  //eventout += (AllProv[i]->product).branchName_;
187  eventout += AllProv[i]->branchName();
188  }
189  eventout += "\n ******************************\n";
190  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
191  printProvenanceInfo = false;
192  }
193  getAllProvenances = false;
194  }
195 
196  // call fill functions
197  // gather Ecal information from event
198  fillECal(iEvent, iSetup);
199  // gather Hcal information from event
200  fillHCal(iEvent, iSetup);
201  // gather Track information from event
202  fillTrk(iEvent, iSetup);
203  // gather Muon information from event
204  fillMuon(iEvent, iSetup);
205 
206  if (verbosity > 0)
207  edm::LogInfo(MsgLoggerCat) << "Done gathering data from event.";
208 
209  // produce object to put into event
210  std::unique_ptr<PGlobalRecHit> pOut(new PGlobalRecHit);
211 
212  if (verbosity > 2)
213  edm::LogInfo(MsgLoggerCat) << "Saving event contents:";
214 
215  // call store functions
216  // store ECal information in produce
217  storeECal(*pOut);
218  // store HCal information in produce
219  storeHCal(*pOut);
220  // store Track information in produce
221  storeTrk(*pOut);
222  // store Muon information in produce
223  storeMuon(*pOut);
224 
225  // store information in event
226  iEvent.put(std::move(pOut), label);
227 
228  return;
229 }
230 
232  std::string MsgLoggerCat = "GlobalRecHitsProducer_fillECal";
233 
234  TString eventout;
235  if (verbosity > 0)
236  eventout = "\nGathering info:";
237 
238  // extract crossing frame from event
239  //edm::Handle<CrossingFrame> crossingFrame;
241  //iEvent.getByType(crossingFrame);
242  //if (!crossingFrame.isValid()) {
243  // edm::LogWarning(MsgLoggerCat)
244  // << "Unable to find crossingFrame in event!";
245  // return;
246  //}
247 
249  //extract EB information
252  iEvent.getByToken(ECalUncalEBSrc_Token_, EcalUncalibRecHitEB);
253  if (!EcalUncalibRecHitEB.isValid()) {
254  edm::LogWarning(MsgLoggerCat) << "Unable to find EcalUncalRecHitEB in event!";
255  return;
256  }
257 
258  edm::Handle<EBRecHitCollection> EcalRecHitEB;
259  iEvent.getByToken(ECalEBSrc_Token_, EcalRecHitEB);
260  if (!EcalRecHitEB.isValid()) {
261  edm::LogWarning(MsgLoggerCat) << "Unable to find EcalRecHitEB in event!";
262  return;
263  }
264 
265  // loop over simhits
266  iEvent.getByToken(EBHits_Token_, crossingFrame);
267  if (!crossingFrame.isValid()) {
268  edm::LogWarning(MsgLoggerCat) << "Unable to find cal barrel crossingFrame in event!";
269  return;
270  }
271  //std::unique_ptr<MixCollection<PCaloHit> >
272  // barrelHits(new MixCollection<PCaloHit>
273  // (crossingFrame.product(), barrelHitsName));
274  std::unique_ptr<MixCollection<PCaloHit>> barrelHits(new MixCollection<PCaloHit>(crossingFrame.product()));
275 
276  // keep track of sum of simhit energy in each crystal
277  MapType ebSimMap;
278  for (MixCollection<PCaloHit>::MixItr hitItr = barrelHits->begin(); hitItr != barrelHits->end(); ++hitItr) {
279  EBDetId ebid = EBDetId(hitItr->id());
280 
281  uint32_t crystid = ebid.rawId();
282  ebSimMap[crystid] += hitItr->energy();
283  }
284 
285  int nEBRecHits = 0;
286  // loop over RecHits
287  const EBUncalibratedRecHitCollection* EBUncalibRecHit = EcalUncalibRecHitEB.product();
288  const EBRecHitCollection* EBRecHit = EcalRecHitEB.product();
289 
291  uncalibRecHit != EBUncalibRecHit->end();
292  ++uncalibRecHit) {
293  EBDetId EBid = EBDetId(uncalibRecHit->id());
294 
295  EcalRecHitCollection::const_iterator myRecHit = EBRecHit->find(EBid);
296 
297  if (myRecHit != EBRecHit->end()) {
298  ++nEBRecHits;
299  EBRE.push_back(myRecHit->energy());
300  EBSHE.push_back(ebSimMap[EBid.rawId()]);
301  }
302  }
303 
304  if (verbosity > 1) {
305  eventout += "\n Number of EBRecHits collected:............ ";
306  eventout += nEBRecHits;
307  }
308 
310  //extract EE information
313  iEvent.getByToken(ECalUncalEESrc_Token_, EcalUncalibRecHitEE);
314  if (!EcalUncalibRecHitEE.isValid()) {
315  edm::LogWarning(MsgLoggerCat) << "Unable to find EcalUncalRecHitEE in event!";
316  return;
317  }
318 
319  edm::Handle<EERecHitCollection> EcalRecHitEE;
320  iEvent.getByToken(ECalEESrc_Token_, EcalRecHitEE);
321  if (!EcalRecHitEE.isValid()) {
322  edm::LogWarning(MsgLoggerCat) << "Unable to find EcalRecHitEE in event!";
323  return;
324  }
325 
326  // loop over simhits
327  iEvent.getByToken(EEHits_Token_, crossingFrame);
328  if (!crossingFrame.isValid()) {
329  edm::LogWarning(MsgLoggerCat) << "Unable to find cal endcap crossingFrame in event!";
330  return;
331  }
332  //std::unique_ptr<MixCollection<PCaloHit> >
333  // endcapHits(new MixCollection<PCaloHit>
334  // (crossingFrame.product(), endcapHitsName));
335  std::unique_ptr<MixCollection<PCaloHit>> endcapHits(new MixCollection<PCaloHit>(crossingFrame.product()));
336 
337  // keep track of sum of simhit energy in each crystal
338  MapType eeSimMap;
339  for (MixCollection<PCaloHit>::MixItr hitItr = endcapHits->begin(); hitItr != endcapHits->end(); ++hitItr) {
340  EEDetId eeid = EEDetId(hitItr->id());
341 
342  uint32_t crystid = eeid.rawId();
343  eeSimMap[crystid] += hitItr->energy();
344  }
345 
346  int nEERecHits = 0;
347  // loop over RecHits
348  const EEUncalibratedRecHitCollection* EEUncalibRecHit = EcalUncalibRecHitEE.product();
349  const EERecHitCollection* EERecHit = EcalRecHitEE.product();
350 
352  uncalibRecHit != EEUncalibRecHit->end();
353  ++uncalibRecHit) {
354  EEDetId EEid = EEDetId(uncalibRecHit->id());
355 
356  EcalRecHitCollection::const_iterator myRecHit = EERecHit->find(EEid);
357 
358  if (myRecHit != EERecHit->end()) {
359  ++nEERecHits;
360  EERE.push_back(myRecHit->energy());
361  EESHE.push_back(eeSimMap[EEid.rawId()]);
362  }
363  }
364 
365  if (verbosity > 1) {
366  eventout += "\n Number of EERecHits collected:............ ";
367  eventout += nEERecHits;
368  }
369 
371  //extract ES information
373  edm::Handle<ESRecHitCollection> EcalRecHitES;
374  iEvent.getByToken(ECalESSrc_Token_, EcalRecHitES);
375  if (!EcalRecHitES.isValid()) {
376  edm::LogWarning(MsgLoggerCat) << "Unable to find EcalRecHitES in event!";
377  return;
378  }
379 
380  // loop over simhits
381  iEvent.getByToken(ESHits_Token_, crossingFrame);
382  if (!crossingFrame.isValid()) {
383  edm::LogWarning(MsgLoggerCat) << "Unable to find cal preshower crossingFrame in event!";
384  return;
385  }
386  //std::unique_ptr<MixCollection<PCaloHit> >
387  // preshowerHits(new MixCollection<PCaloHit>
388  // (crossingFrame.product(), preshowerHitsName));
389  std::unique_ptr<MixCollection<PCaloHit>> preshowerHits(new MixCollection<PCaloHit>(crossingFrame.product()));
390 
391  // keep track of sum of simhit energy in each crystal
392  MapType esSimMap;
393  for (MixCollection<PCaloHit>::MixItr hitItr = preshowerHits->begin(); hitItr != preshowerHits->end(); ++hitItr) {
394  ESDetId esid = ESDetId(hitItr->id());
395 
396  uint32_t crystid = esid.rawId();
397  esSimMap[crystid] += hitItr->energy();
398  }
399 
400  int nESRecHits = 0;
401  // loop over RecHits
402  const ESRecHitCollection* ESRecHit = EcalRecHitES.product();
403  for (EcalRecHitCollection::const_iterator recHit = ESRecHit->begin(); recHit != ESRecHit->end(); ++recHit) {
404  ESDetId ESid = ESDetId(recHit->id());
405 
406  ++nESRecHits;
407  ESRE.push_back(recHit->energy());
408  ESSHE.push_back(esSimMap[ESid.rawId()]);
409  }
410 
411  if (verbosity > 1) {
412  eventout += "\n Number of ESRecHits collected:............ ";
413  eventout += nESRecHits;
414  }
415 
416  if (verbosity > 0)
417  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
418 
419  return;
420 }
421 
423  std::string MsgLoggerCat = "GlobalRecHitsProducer_storeECal";
424 
425  if (verbosity > 2) {
426  TString eventout("\n nEBRecHits = ");
427  eventout += EBRE.size();
428  for (unsigned int i = 0; i < EBRE.size(); ++i) {
429  eventout += "\n (RE, SHE) = (";
430  eventout += EBRE[i];
431  eventout += ", ";
432  eventout += EBSHE[i];
433  eventout += ")";
434  }
435  eventout += "\n nEERecHits = ";
436  eventout += EERE.size();
437  for (unsigned int i = 0; i < EERE.size(); ++i) {
438  eventout += "\n (RE, SHE) = (";
439  eventout += EERE[i];
440  eventout += ", ";
441  eventout += EESHE[i];
442  eventout += ")";
443  }
444  eventout += "\n nESRecHits = ";
445  eventout += ESRE.size();
446  for (unsigned int i = 0; i < ESRE.size(); ++i) {
447  eventout += "\n (RE, SHE) = (";
448  eventout += ESRE[i];
449  eventout += ", ";
450  eventout += ESSHE[i];
451  eventout += ")";
452  }
453  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
454  }
455 
456  product.putEBCalRecHits(EBRE, EBSHE);
457  product.putEECalRecHits(EERE, EESHE);
458  product.putESCalRecHits(ESRE, ESSHE);
459 
460  return;
461 }
462 
464  std::string MsgLoggerCat = "GlobalRecHitsProducer_fillHCal";
465 
466  TString eventout;
467  if (verbosity > 0)
468  eventout = "\nGathering info:";
469 
470  // get geometry
471  const auto& geometry = iSetup.getHandle(caloGeomToken_);
472  if (!geometry.isValid()) {
473  edm::LogWarning(MsgLoggerCat) << "Unable to find CaloGeometry in event!";
474  return;
475  }
476 
478  // extract simhit info
481  iEvent.getByToken(HCalSrc_Token_, hcalHits);
482  if (!hcalHits.isValid()) {
483  edm::LogWarning(MsgLoggerCat) << "Unable to find hcalHits in event!";
484  return;
485  }
486  const edm::PCaloHitContainer* simhitResult = hcalHits.product();
487 
488  MapType fHBEnergySimHits;
489  MapType fHEEnergySimHits;
490  MapType fHOEnergySimHits;
491  MapType fHFEnergySimHits;
492  for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin(); simhits != simhitResult->end();
493  ++simhits) {
494  HcalDetId detId(simhits->id());
495  uint32_t cellid = detId.rawId();
496 
497  if (detId.subdet() == sdHcalBrl) {
498  fHBEnergySimHits[cellid] += simhits->energy();
499  }
500  if (detId.subdet() == sdHcalEC) {
501  fHEEnergySimHits[cellid] += simhits->energy();
502  }
503  if (detId.subdet() == sdHcalOut) {
504  fHOEnergySimHits[cellid] += simhits->energy();
505  }
506  if (detId.subdet() == sdHcalFwd) {
507  fHFEnergySimHits[cellid] += simhits->energy();
508  }
509  }
510 
511  // max values to be used (HO is found in HB)
512  Double_t maxHBEnergy = 0.;
513  Double_t maxHEEnergy = 0.;
514  Double_t maxHFEnergy = 0.;
515 
516  Double_t maxHBPhi = -1000.;
517  Double_t maxHEPhi = -1000.;
518  Double_t maxHOPhi = -1000.;
519  Double_t maxHFPhi = -1000.;
520 
521  Double_t maxHBEta = -1000.;
522  Double_t maxHEEta = -1000.;
523  Double_t maxHOEta = -1000.;
524  Double_t maxHFEta = -1000.;
525 
526  Double_t PI = 3.141592653589;
527 
529  // get HBHE information
531  std::vector<edm::Handle<HBHERecHitCollection>> hbhe;
532  iEvent.getManyByType(hbhe);
533  if (!hbhe[0].isValid()) {
534  edm::LogWarning(MsgLoggerCat) << "Unable to find any HBHERecHitCollections in event!";
535  return;
536  }
537  std::vector<edm::Handle<HBHERecHitCollection>>::iterator ihbhe;
538  const CaloGeometry* geo = geometry.product();
539 
540  int iHB = 0;
541  int iHE = 0;
542  for (ihbhe = hbhe.begin(); ihbhe != hbhe.end(); ++ihbhe) {
543  // find max values
544  for (HBHERecHitCollection::const_iterator jhbhe = (*ihbhe)->begin(); jhbhe != (*ihbhe)->end(); ++jhbhe) {
545  HcalDetId cell(jhbhe->id());
546 
547  if (cell.subdet() == sdHcalBrl) {
548  const HcalGeometry* cellGeometry =
549  dynamic_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal, cell.subdet()));
550  double fEta = cellGeometry->getPosition(cell).eta();
551  double fPhi = cellGeometry->getPosition(cell).phi();
552  if ((jhbhe->energy()) > maxHBEnergy) {
553  maxHBEnergy = jhbhe->energy();
554  maxHBPhi = fPhi;
555  maxHOPhi = maxHBPhi;
556  maxHBEta = fEta;
557  maxHOEta = maxHBEta;
558  }
559  }
560 
561  if (cell.subdet() == sdHcalEC) {
562  const HcalGeometry* cellGeometry =
563  dynamic_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal, cell.subdet()));
564  double fEta = cellGeometry->getPosition(cell).eta();
565  double fPhi = cellGeometry->getPosition(cell).phi();
566  if ((jhbhe->energy()) > maxHEEnergy) {
567  maxHEEnergy = jhbhe->energy();
568  maxHEPhi = fPhi;
569  maxHEEta = fEta;
570  }
571  }
572  } // end find max values
573 
574  for (HBHERecHitCollection::const_iterator jhbhe = (*ihbhe)->begin(); jhbhe != (*ihbhe)->end(); ++jhbhe) {
575  HcalDetId cell(jhbhe->id());
576 
577  if (cell.subdet() == sdHcalBrl) {
578  ++iHB;
579 
580  const HcalGeometry* cellGeometry =
581  dynamic_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal, cell.subdet()));
582  double fEta = cellGeometry->getPosition(cell).eta();
583  double fPhi = cellGeometry->getPosition(cell).phi();
584 
585  float deltaphi = maxHBPhi - fPhi;
586  if (fPhi > maxHBPhi) {
587  deltaphi = fPhi - maxHBPhi;
588  }
589  if (deltaphi > PI) {
590  deltaphi = 2.0 * PI - deltaphi;
591  }
592  float deltaeta = fEta - maxHBEta;
593  Double_t r = sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
594 
595  HBCalREC.push_back(jhbhe->energy());
596  HBCalR.push_back(r);
597  HBCalSHE.push_back(fHBEnergySimHits[cell.rawId()]);
598  }
599 
600  if (cell.subdet() == sdHcalEC) {
601  ++iHE;
602 
603  const HcalGeometry* cellGeometry =
604  dynamic_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal, cell.subdet()));
605  double fEta = cellGeometry->getPosition(cell).eta();
606  double fPhi = cellGeometry->getPosition(cell).phi();
607 
608  float deltaphi = maxHEPhi - fPhi;
609  if (fPhi > maxHEPhi) {
610  deltaphi = fPhi - maxHEPhi;
611  }
612  if (deltaphi > PI) {
613  deltaphi = 2.0 * PI - deltaphi;
614  }
615  float deltaeta = fEta - maxHEEta;
616  Double_t r = sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
617 
618  HECalREC.push_back(jhbhe->energy());
619  HECalR.push_back(r);
620  HECalSHE.push_back(fHEEnergySimHits[cell.rawId()]);
621  }
622  }
623  } // end loop through collection
624 
625  if (verbosity > 1) {
626  eventout += "\n Number of HBRecHits collected:............ ";
627  eventout += iHB;
628  }
629 
630  if (verbosity > 1) {
631  eventout += "\n Number of HERecHits collected:............ ";
632  eventout += iHE;
633  }
634 
636  // get HF information
638  std::vector<edm::Handle<HFRecHitCollection>> hf;
639  iEvent.getManyByType(hf);
640  if (!hf[0].isValid()) {
641  edm::LogWarning(MsgLoggerCat) << "Unable to find any HFRecHitCollections in event!";
642  return;
643  }
644  std::vector<edm::Handle<HFRecHitCollection>>::iterator ihf;
645 
646  int iHF = 0;
647  for (ihf = hf.begin(); ihf != hf.end(); ++ihf) {
648  // find max values
649  for (HFRecHitCollection::const_iterator jhf = (*ihf)->begin(); jhf != (*ihf)->end(); ++jhf) {
650  HcalDetId cell(jhf->id());
651 
652  if (cell.subdet() == sdHcalFwd) {
653  auto cellGeometry = geometry->getSubdetectorGeometry(cell)->getGeometry(cell);
654  double fEta = cellGeometry->getPosition().eta();
655  double fPhi = cellGeometry->getPosition().phi();
656  if ((jhf->energy()) > maxHFEnergy) {
657  maxHFEnergy = jhf->energy();
658  maxHFPhi = fPhi;
659  maxHFEta = fEta;
660  }
661  }
662  } // end find max values
663 
664  for (HFRecHitCollection::const_iterator jhf = (*ihf)->begin(); jhf != (*ihf)->end(); ++jhf) {
665  HcalDetId cell(jhf->id());
666 
667  if (cell.subdet() == sdHcalFwd) {
668  ++iHF;
669 
670  auto cellGeometry = geometry->getSubdetectorGeometry(cell)->getGeometry(cell);
671  double fEta = cellGeometry->getPosition().eta();
672  double fPhi = cellGeometry->getPosition().phi();
673 
674  float deltaphi = maxHBPhi - fPhi;
675  if (fPhi > maxHFPhi) {
676  deltaphi = fPhi - maxHFPhi;
677  }
678  if (deltaphi > PI) {
679  deltaphi = 2.0 * PI - deltaphi;
680  }
681  float deltaeta = fEta - maxHFEta;
682  Double_t r = sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
683 
684  HFCalREC.push_back(jhf->energy());
685  HFCalR.push_back(r);
686  HFCalSHE.push_back(fHFEnergySimHits[cell.rawId()]);
687  }
688  }
689  } // end loop through collection
690 
691  if (verbosity > 1) {
692  eventout += "\n Number of HFDigis collected:.............. ";
693  eventout += iHF;
694  }
695 
697  // get HO information
699  std::vector<edm::Handle<HORecHitCollection>> ho;
700  iEvent.getManyByType(ho);
701  if (!ho[0].isValid()) {
702  edm::LogWarning(MsgLoggerCat) << "Unable to find any HORecHitCollections in event!";
703  return;
704  }
705  std::vector<edm::Handle<HORecHitCollection>>::iterator iho;
706 
707  int iHO = 0;
708  for (iho = ho.begin(); iho != ho.end(); ++iho) {
709  for (HORecHitCollection::const_iterator jho = (*iho)->begin(); jho != (*iho)->end(); ++jho) {
710  HcalDetId cell(jho->id());
711 
712  if (cell.subdet() == sdHcalOut) {
713  ++iHO;
714 
715  auto cellGeometry = geometry->getSubdetectorGeometry(cell)->getGeometry(cell);
716  double fEta = cellGeometry->getPosition().eta();
717  double fPhi = cellGeometry->getPosition().phi();
718 
719  float deltaphi = maxHOPhi - fPhi;
720  if (fPhi > maxHOPhi) {
721  deltaphi = fPhi - maxHOPhi;
722  }
723  if (deltaphi > PI) {
724  deltaphi = 2.0 * PI - deltaphi;
725  }
726  float deltaeta = fEta - maxHOEta;
727  Double_t r = sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
728 
729  HOCalREC.push_back(jho->energy());
730  HOCalR.push_back(r);
731  HOCalSHE.push_back(fHOEnergySimHits[cell.rawId()]);
732  }
733  }
734  } // end loop through collection
735 
736  if (verbosity > 1) {
737  eventout += "\n Number of HODigis collected:.............. ";
738  eventout += iHO;
739  }
740 
741  if (verbosity > 0)
742  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
743 
744  return;
745 }
746 
748  std::string MsgLoggerCat = "GlobalRecHitsProducer_storeHCal";
749 
750  if (verbosity > 2) {
751  TString eventout("\n nHBRecHits = ");
752  eventout += HBCalREC.size();
753  for (unsigned int i = 0; i < HBCalREC.size(); ++i) {
754  eventout += "\n (REC, R, SHE) = (";
755  eventout += HBCalREC[i];
756  eventout += ", ";
757  eventout += HBCalR[i];
758  eventout += ", ";
759  eventout += HBCalSHE[i];
760  eventout += ")";
761  }
762  eventout += "\n nHERecHits = ";
763  eventout += HECalREC.size();
764  for (unsigned int i = 0; i < HECalREC.size(); ++i) {
765  eventout += "\n (REC, R, SHE) = (";
766  eventout += HECalREC[i];
767  eventout += ", ";
768  eventout += HECalR[i];
769  eventout += ", ";
770  eventout += HECalSHE[i];
771  eventout += ")";
772  }
773  eventout += "\n nHFRecHits = ";
774  eventout += HFCalREC.size();
775  for (unsigned int i = 0; i < HFCalREC.size(); ++i) {
776  eventout += "\n (REC, R, SHE) = (";
777  eventout += HFCalREC[i];
778  eventout += ", ";
779  eventout += HFCalR[i];
780  eventout += ", ";
781  eventout += HFCalSHE[i];
782  eventout += ")";
783  }
784  eventout += "\n nHORecHits = ";
785  eventout += HOCalREC.size();
786  for (unsigned int i = 0; i < HOCalREC.size(); ++i) {
787  eventout += "\n (REC, R, SHE) = (";
788  eventout += HOCalREC[i];
789  eventout += ", ";
790  eventout += HOCalR[i];
791  eventout += ", ";
792  eventout += HOCalSHE[i];
793  eventout += ")";
794  }
795 
796  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
797  }
798 
803 
804  return;
805 }
806 
808  //Retrieve tracker topology from geometry
809  const TrackerTopology* const tTopo = &iSetup.getData(tTopoToken_);
810  ;
811  std::string MsgLoggerCat = "GlobalRecHitsProducer_fillTrk";
812  TString eventout;
813  if (verbosity > 0)
814  eventout = "\nGathering info:";
815 
816  // get strip information
818  iEvent.getByToken(SiStripSrc_Token_, rechitsmatched);
819  if (!rechitsmatched.isValid()) {
820  edm::LogWarning(MsgLoggerCat) << "Unable to find stripmatchedrechits in event!";
821  return;
822  }
823 
825 
826  const auto& tGeomHandle = iSetup.getHandle(tGeomToken_);
827  if (!tGeomHandle.isValid()) {
828  edm::LogWarning(MsgLoggerCat) << "Unable to find TrackerDigiGeometry in event!";
829  return;
830  }
831  const TrackerGeometry& tracker(*tGeomHandle);
832 
833  int nStripBrl = 0, nStripFwd = 0;
834 
835  // loop over det units
836  for (TrackerGeometry::DetContainer::const_iterator it = tGeomHandle->dets().begin(); it != tGeomHandle->dets().end();
837  ++it) {
838  uint32_t myid = ((*it)->geographicalId()).rawId();
839  DetId detid = ((*it)->geographicalId());
840 
841  //loop over rechits-matched in the same subdetector
842  SiStripMatchedRecHit2DCollection::const_iterator rechitmatchedMatch = rechitsmatched->find(detid);
843 
844  if (rechitmatchedMatch != rechitsmatched->end()) {
845  SiStripMatchedRecHit2DCollection::DetSet rechitmatchedRange = *rechitmatchedMatch;
846  SiStripMatchedRecHit2DCollection::DetSet::const_iterator rechitmatchedRangeIteratorBegin =
847  rechitmatchedRange.begin();
848  SiStripMatchedRecHit2DCollection::DetSet::const_iterator rechitmatchedRangeIteratorEnd = rechitmatchedRange.end();
850 
851  for (itermatched = rechitmatchedRangeIteratorBegin; itermatched != rechitmatchedRangeIteratorEnd; ++itermatched) {
852  SiStripMatchedRecHit2D const rechit = *itermatched;
853  LocalPoint position = rechit.localPosition();
854 
855  float mindist = 999999.;
856  float distx = 999999.;
857  float disty = 999999.;
858  float dist = 999999.;
859  std::pair<LocalPoint, LocalVector> closestPair;
860  matched.clear();
861 
862  float rechitmatchedx = position.x();
863  float rechitmatchedy = position.y();
864 
865  matched = associate.associateHit(rechit);
866 
867  if (!matched.empty()) {
868  //project simhit;
869  const GluedGeomDet* gluedDet = (const GluedGeomDet*)tracker.idToDet(rechit.geographicalId());
870  const StripGeomDetUnit* partnerstripdet = (StripGeomDetUnit*)gluedDet->stereoDet();
871  std::pair<LocalPoint, LocalVector> hitPair;
872 
873  for (std::vector<PSimHit>::const_iterator m = matched.begin(); m != matched.end(); m++) {
874  //project simhit;
875  hitPair = projectHit((*m), partnerstripdet, gluedDet->surface());
876  distx = fabs(rechitmatchedx - hitPair.first.x());
877  disty = fabs(rechitmatchedy - hitPair.first.y());
878  dist = sqrt(distx * distx + disty * disty);
879 
880  if (dist < mindist) {
881  mindist = dist;
882  closestPair = hitPair;
883  }
884  }
885 
886  // get TIB
887  if (detid.subdetId() == sdSiTIB) {
888  ++nStripBrl;
889 
890  if (tTopo->tibLayer(myid) == 1) {
891  TIBL1RX.push_back(rechitmatchedx);
892  TIBL1RY.push_back(rechitmatchedy);
893  TIBL1SX.push_back(closestPair.first.x());
894  TIBL1SY.push_back(closestPair.first.y());
895  }
896  if (tTopo->tibLayer(myid) == 2) {
897  TIBL2RX.push_back(rechitmatchedx);
898  TIBL2RY.push_back(rechitmatchedy);
899  TIBL2SX.push_back(closestPair.first.x());
900  TIBL2SY.push_back(closestPair.first.y());
901  }
902  if (tTopo->tibLayer(myid) == 3) {
903  TIBL3RX.push_back(rechitmatchedx);
904  TIBL3RY.push_back(rechitmatchedy);
905  TIBL3SX.push_back(closestPair.first.x());
906  TIBL3SY.push_back(closestPair.first.y());
907  }
908  if (tTopo->tibLayer(myid) == 4) {
909  TIBL4RX.push_back(rechitmatchedx);
910  TIBL4RY.push_back(rechitmatchedy);
911  TIBL4SX.push_back(closestPair.first.x());
912  TIBL4SY.push_back(closestPair.first.y());
913  }
914  }
915 
916  // get TOB
917  if (detid.subdetId() == sdSiTOB) {
918  ++nStripBrl;
919 
920  if (tTopo->tobLayer(myid) == 1) {
921  TOBL1RX.push_back(rechitmatchedx);
922  TOBL1RY.push_back(rechitmatchedy);
923  TOBL1SX.push_back(closestPair.first.x());
924  TOBL1SY.push_back(closestPair.first.y());
925  }
926  if (tTopo->tobLayer(myid) == 2) {
927  TOBL2RX.push_back(rechitmatchedx);
928  TOBL2RY.push_back(rechitmatchedy);
929  TOBL2SX.push_back(closestPair.first.x());
930  TOBL2SY.push_back(closestPair.first.y());
931  }
932  if (tTopo->tobLayer(myid) == 3) {
933  TOBL3RX.push_back(rechitmatchedx);
934  TOBL3RY.push_back(rechitmatchedy);
935  TOBL3SX.push_back(closestPair.first.x());
936  TOBL3SY.push_back(closestPair.first.y());
937  }
938  if (tTopo->tobLayer(myid) == 4) {
939  TOBL4RX.push_back(rechitmatchedx);
940  TOBL4RY.push_back(rechitmatchedy);
941  TOBL4SX.push_back(closestPair.first.x());
942  TOBL4SY.push_back(closestPair.first.y());
943  }
944  }
945 
946  // get TID
947  if (detid.subdetId() == sdSiTID) {
948  ++nStripFwd;
949 
950  if (tTopo->tidWheel(myid) == 1) {
951  TIDW1RX.push_back(rechitmatchedx);
952  TIDW1RY.push_back(rechitmatchedy);
953  TIDW1SX.push_back(closestPair.first.x());
954  TIDW1SY.push_back(closestPair.first.y());
955  }
956  if (tTopo->tidWheel(myid) == 2) {
957  TIDW2RX.push_back(rechitmatchedx);
958  TIDW2RY.push_back(rechitmatchedy);
959  TIDW2SX.push_back(closestPair.first.x());
960  TIDW2SY.push_back(closestPair.first.y());
961  }
962  if (tTopo->tidWheel(myid) == 3) {
963  TIDW3RX.push_back(rechitmatchedx);
964  TIDW3RY.push_back(rechitmatchedy);
965  TIDW3SX.push_back(closestPair.first.x());
966  TIDW3SY.push_back(closestPair.first.y());
967  }
968  }
969 
970  // get TEC
971  if (detid.subdetId() == sdSiTEC) {
972  ++nStripFwd;
973 
974  if (tTopo->tecWheel(myid) == 1) {
975  TECW1RX.push_back(rechitmatchedx);
976  TECW1RY.push_back(rechitmatchedy);
977  TECW1SX.push_back(closestPair.first.x());
978  TECW1SY.push_back(closestPair.first.y());
979  }
980  if (tTopo->tecWheel(myid) == 2) {
981  TECW2RX.push_back(rechitmatchedx);
982  TECW2RY.push_back(rechitmatchedy);
983  TECW2SX.push_back(closestPair.first.x());
984  TECW2SY.push_back(closestPair.first.y());
985  }
986  if (tTopo->tecWheel(myid) == 3) {
987  TECW3RX.push_back(rechitmatchedx);
988  TECW3RY.push_back(rechitmatchedy);
989  TECW3SX.push_back(closestPair.first.x());
990  TECW3SY.push_back(closestPair.first.y());
991  }
992  if (tTopo->tecWheel(myid) == 4) {
993  TECW4RX.push_back(rechitmatchedx);
994  TECW4RY.push_back(rechitmatchedy);
995  TECW4SX.push_back(closestPair.first.x());
996  TECW4SY.push_back(closestPair.first.y());
997  }
998  if (tTopo->tecWheel(myid) == 5) {
999  TECW5RX.push_back(rechitmatchedx);
1000  TECW5RY.push_back(rechitmatchedy);
1001  TECW5SX.push_back(closestPair.first.x());
1002  TECW5SY.push_back(closestPair.first.y());
1003  }
1004  if (tTopo->tecWheel(myid) == 6) {
1005  TECW6RX.push_back(rechitmatchedx);
1006  TECW6RY.push_back(rechitmatchedy);
1007  TECW6SX.push_back(closestPair.first.x());
1008  TECW6SY.push_back(closestPair.first.y());
1009  }
1010  if (tTopo->tecWheel(myid) == 7) {
1011  TECW7RX.push_back(rechitmatchedx);
1012  TECW7RY.push_back(rechitmatchedy);
1013  TECW7SX.push_back(closestPair.first.x());
1014  TECW7SY.push_back(closestPair.first.y());
1015  }
1016  if (tTopo->tecWheel(myid) == 8) {
1017  TECW8RX.push_back(rechitmatchedx);
1018  TECW8RY.push_back(rechitmatchedy);
1019  TECW8SX.push_back(closestPair.first.x());
1020  TECW8SY.push_back(closestPair.first.y());
1021  }
1022  }
1023 
1024  } // end if matched empty
1025  }
1026  }
1027  } // end loop over det units
1028 
1029  if (verbosity > 1) {
1030  eventout += "\n Number of BrlStripRecHits collected:...... ";
1031  eventout += nStripBrl;
1032  }
1033 
1034  if (verbosity > 1) {
1035  eventout += "\n Number of FrwdStripRecHits collected:..... ";
1036  eventout += nStripFwd;
1037  }
1038 
1039  // get pixel information
1040  //Get RecHits
1042  iEvent.getByToken(SiPxlSrc_Token_, recHitColl);
1043  if (!recHitColl.isValid()) {
1044  edm::LogWarning(MsgLoggerCat) << "Unable to find SiPixelRecHitCollection in event!";
1045  return;
1046  }
1047 
1048  int nPxlBrl = 0, nPxlFwd = 0;
1049  //iterate over detunits
1050  for (TrackerGeometry::DetContainer::const_iterator it = tGeomHandle->dets().begin(); it != tGeomHandle->dets().end();
1051  ++it) {
1052  uint32_t myid = ((*it)->geographicalId()).rawId();
1053  DetId detId = ((*it)->geographicalId());
1054  int subid = detId.subdetId();
1055 
1056  if (!((subid == sdPxlBrl) || (subid == sdPxlFwd)))
1057  continue;
1058 
1059  //const PixelGeomDetUnit * theGeomDet =
1060  // dynamic_cast<const PixelGeomDetUnit*>(theTracker.idToDet(detId) );
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  std::vector<PSimHit> matched;
1070 
1071  //----Loop over rechits for this detId
1072  for (; pixeliter != pixelrechitRangeIteratorEnd; ++pixeliter) {
1073  matched.clear();
1074  matched = associate.associateHit(*pixeliter);
1075 
1076  if (!matched.empty()) {
1077  float closest = 9999.9;
1078  //std::vector<PSimHit>::const_iterator closestit = matched.begin();
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
1109  if (subid == sdPxlBrl) {
1110  ++nPxlBrl;
1111 
1112  if (tTopo->pxbLayer(myid) == 1) {
1113  BRL1RX.push_back(rechit_x);
1114  BRL1RY.push_back(rechit_y);
1115  BRL1SX.push_back(sim_x);
1116  BRL1SY.push_back(sim_y);
1117  }
1118  if (tTopo->pxbLayer(myid) == 2) {
1119  BRL2RX.push_back(rechit_x);
1120  BRL2RY.push_back(rechit_y);
1121  BRL2SX.push_back(sim_x);
1122  BRL2SY.push_back(sim_y);
1123  }
1124  if (tTopo->pxbLayer(myid) == 3) {
1125  BRL3RX.push_back(rechit_x);
1126  BRL3RY.push_back(rechit_y);
1127  BRL3SX.push_back(sim_x);
1128  BRL3SY.push_back(sim_y);
1129  }
1130  }
1131 
1132  // get Forward pixels
1133  if (subid == sdPxlFwd) {
1134  ++nPxlFwd;
1135 
1136  if (tTopo->pxfDisk(myid) == 1) {
1137  if (tTopo->pxfSide(myid) == 1) {
1138  FWD1nRX.push_back(rechit_x);
1139  FWD1nRY.push_back(rechit_y);
1140  FWD1nSX.push_back(sim_x);
1141  FWD1nSY.push_back(sim_y);
1142  }
1143  if (tTopo->pxfSide(myid) == 2) {
1144  FWD1pRX.push_back(rechit_x);
1145  FWD1pRY.push_back(rechit_y);
1146  FWD1pSX.push_back(sim_x);
1147  FWD1pSY.push_back(sim_y);
1148  }
1149  }
1150  if (tTopo->pxfDisk(myid) == 2) {
1151  if (tTopo->pxfSide(myid) == 1) {
1152  FWD2nRX.push_back(rechit_x);
1153  FWD2nRY.push_back(rechit_y);
1154  FWD2nSX.push_back(sim_x);
1155  FWD2nSY.push_back(sim_y);
1156  }
1157  if (tTopo->pxfSide(myid) == 2) {
1158  FWD2pRX.push_back(rechit_x);
1159  FWD2pRY.push_back(rechit_y);
1160  FWD2pSX.push_back(sim_x);
1161  FWD2pSY.push_back(sim_y);
1162  }
1163  }
1164  }
1165  } // end matched emtpy
1166  } // <-----end rechit loop
1167  } // <------ end detunit loop
1168 
1169  if (verbosity > 1) {
1170  eventout += "\n Number of BrlPixelRecHits collected:...... ";
1171  eventout += nPxlBrl;
1172  }
1173 
1174  if (verbosity > 1) {
1175  eventout += "\n Number of FrwdPixelRecHits collected:..... ";
1176  eventout += nPxlFwd;
1177  }
1178 
1179  if (verbosity > 0)
1180  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1181 
1182  return;
1183 }
1184 
1186  std::string MsgLoggerCat = "GlobalRecHitsProducer_storeTrk";
1187 
1188  if (verbosity > 2) {
1189  // strip output
1190  TString eventout("\n nTIBL1 = ");
1191  eventout += TIBL1RX.size();
1192  for (unsigned int i = 0; i < TIBL1RX.size(); ++i) {
1193  eventout += "\n (RX, RY, SX, SY) = (";
1194  eventout += TIBL1RX[i];
1195  eventout += ", ";
1196  eventout += TIBL1RY[i];
1197  eventout += ", ";
1198  eventout += TIBL1SX[i];
1199  eventout += ", ";
1200  eventout += TIBL1SY[i];
1201  eventout += ")";
1202  }
1203  eventout += "\n nTIBL2 = ";
1204  eventout += TIBL2RX.size();
1205  for (unsigned int i = 0; i < TIBL2RX.size(); ++i) {
1206  eventout += "\n (RX, RY, SX, SY) = (";
1207  eventout += TIBL2RX[i];
1208  eventout += ", ";
1209  eventout += TIBL2RY[i];
1210  eventout += ", ";
1211  eventout += TIBL2SX[i];
1212  eventout += ", ";
1213  eventout += TIBL2SY[i];
1214  eventout += ")";
1215  }
1216  eventout += "\n nTIBL3 = ";
1217  eventout += TIBL3RX.size();
1218  for (unsigned int i = 0; i < TIBL3RX.size(); ++i) {
1219  eventout += "\n (RX, RY, SX, SY) = (";
1220  eventout += TIBL3RX[i];
1221  eventout += ", ";
1222  eventout += TIBL3RY[i];
1223  eventout += ", ";
1224  eventout += TIBL3SX[i];
1225  eventout += ", ";
1226  eventout += TIBL3SY[i];
1227  eventout += ")";
1228  }
1229  eventout += "\n nTIBL4 = ";
1230  eventout += TIBL4RX.size();
1231  for (unsigned int i = 0; i < TIBL4RX.size(); ++i) {
1232  eventout += "\n (RX, RY, SX, SY) = (";
1233  eventout += TIBL4RX[i];
1234  eventout += ", ";
1235  eventout += TIBL4RY[i];
1236  eventout += ", ";
1237  eventout += TIBL4SX[i];
1238  eventout += ", ";
1239  eventout += TIBL4SY[i];
1240  eventout += ")";
1241  }
1242  eventout += "\n nTOBL1 = ";
1243  eventout += TOBL1RX.size();
1244  for (unsigned int i = 0; i < TOBL1RX.size(); ++i) {
1245  eventout += "\n (RX, RY, SX, SY) = (";
1246  eventout += TOBL1RX[i];
1247  eventout += ", ";
1248  eventout += TOBL1RY[i];
1249  eventout += ", ";
1250  eventout += TOBL1SX[i];
1251  eventout += ", ";
1252  eventout += TOBL1SY[i];
1253  eventout += ")";
1254  }
1255  eventout += "\n nTOBL2 = ";
1256  eventout += TOBL2RX.size();
1257  for (unsigned int i = 0; i < TOBL2RX.size(); ++i) {
1258  eventout += "\n (RX, RY, SX, SY) = (";
1259  eventout += TOBL2RX[i];
1260  eventout += ", ";
1261  eventout += TOBL2RY[i];
1262  eventout += ", ";
1263  eventout += TOBL2SX[i];
1264  eventout += ", ";
1265  eventout += TOBL2SY[i];
1266  eventout += ")";
1267  }
1268  eventout += "\n nTOBL3 = ";
1269  eventout += TOBL3RX.size();
1270  for (unsigned int i = 0; i < TOBL3RX.size(); ++i) {
1271  eventout += "\n (RX, RY, SX, SY) = (";
1272  eventout += TOBL3RX[i];
1273  eventout += ", ";
1274  eventout += TOBL3RY[i];
1275  eventout += ", ";
1276  eventout += TOBL3SX[i];
1277  eventout += ", ";
1278  eventout += TOBL3SY[i];
1279  eventout += ")";
1280  }
1281  eventout += "\n nTOBL4 = ";
1282  eventout += TOBL4RX.size();
1283  for (unsigned int i = 0; i < TOBL4RX.size(); ++i) {
1284  eventout += "\n (RX, RY, SX, SY) = (";
1285  eventout += TOBL4RX[i];
1286  eventout += ", ";
1287  eventout += TOBL4RY[i];
1288  eventout += ", ";
1289  eventout += TOBL4SX[i];
1290  eventout += ", ";
1291  eventout += TOBL4SY[i];
1292  eventout += ")";
1293  }
1294  eventout += "\n nTIDW1 = ";
1295  eventout += TIDW1RX.size();
1296  for (unsigned int i = 0; i < TIDW1RX.size(); ++i) {
1297  eventout += "\n (RX, RY, SX, SY) = (";
1298  eventout += TIDW1RX[i];
1299  eventout += ", ";
1300  eventout += TIDW1RY[i];
1301  eventout += ", ";
1302  eventout += TIDW1SX[i];
1303  eventout += ", ";
1304  eventout += TIDW1SY[i];
1305  eventout += ")";
1306  }
1307  eventout += "\n nTIDW2 = ";
1308  eventout += TIDW2RX.size();
1309  for (unsigned int i = 0; i < TIDW2RX.size(); ++i) {
1310  eventout += "\n (RX, RY, SX, SY) = (";
1311  eventout += TIDW2RX[i];
1312  eventout += ", ";
1313  eventout += TIDW2RY[i];
1314  eventout += ", ";
1315  eventout += TIDW2SX[i];
1316  eventout += ", ";
1317  eventout += TIDW2SY[i];
1318  eventout += ")";
1319  }
1320  eventout += "\n nTIDW3 = ";
1321  eventout += TIDW3RX.size();
1322  for (unsigned int i = 0; i < TIDW3RX.size(); ++i) {
1323  eventout += "\n (RX, RY, SX, SY) = (";
1324  eventout += TIDW3RX[i];
1325  eventout += ", ";
1326  eventout += TIDW3RY[i];
1327  eventout += ", ";
1328  eventout += TIDW3SX[i];
1329  eventout += ", ";
1330  eventout += TIDW3SY[i];
1331  eventout += ")";
1332  }
1333  eventout += "\n nTECW1 = ";
1334  eventout += TECW1RX.size();
1335  for (unsigned int i = 0; i < TECW1RX.size(); ++i) {
1336  eventout += "\n (RX, RY, SX, SY) = (";
1337  eventout += TECW1RX[i];
1338  eventout += ", ";
1339  eventout += TECW1RY[i];
1340  eventout += ", ";
1341  eventout += TECW1SX[i];
1342  eventout += ", ";
1343  eventout += TECW1SY[i];
1344  eventout += ")";
1345  }
1346  eventout += "\n nTECW2 = ";
1347  eventout += TECW2RX.size();
1348  for (unsigned int i = 0; i < TECW2RX.size(); ++i) {
1349  eventout += "\n (RX, RY, SX, SY) = (";
1350  eventout += TECW2RX[i];
1351  eventout += ", ";
1352  eventout += TECW2RY[i];
1353  eventout += ", ";
1354  eventout += TECW2SX[i];
1355  eventout += ", ";
1356  eventout += TECW2SY[i];
1357  eventout += ")";
1358  }
1359  eventout += "\n nTECW3 = ";
1360  eventout += TECW3RX.size();
1361  for (unsigned int i = 0; i < TECW3RX.size(); ++i) {
1362  eventout += "\n (RX, RY, SX, SY) = (";
1363  eventout += TECW3RX[i];
1364  eventout += ", ";
1365  eventout += TECW3RY[i];
1366  eventout += ", ";
1367  eventout += TECW3SX[i];
1368  eventout += ", ";
1369  eventout += TECW3SY[i];
1370  eventout += ")";
1371  }
1372  eventout += "\n nTECW4 = ";
1373  eventout += TECW4RX.size();
1374  for (unsigned int i = 0; i < TECW4RX.size(); ++i) {
1375  eventout += "\n (RX, RY, SX, SY) = (";
1376  eventout += TECW4RX[i];
1377  eventout += ", ";
1378  eventout += TECW4RY[i];
1379  eventout += ", ";
1380  eventout += TECW4SX[i];
1381  eventout += ", ";
1382  eventout += TECW4SY[i];
1383  eventout += ")";
1384  }
1385  eventout += "\n nTECW5 = ";
1386  eventout += TECW5RX.size();
1387  for (unsigned int i = 0; i < TECW5RX.size(); ++i) {
1388  eventout += "\n (RX, RY, SX, SY) = (";
1389  eventout += TECW5RX[i];
1390  eventout += ", ";
1391  eventout += TECW5RY[i];
1392  eventout += ", ";
1393  eventout += TECW5SX[i];
1394  eventout += ", ";
1395  eventout += TECW5SY[i];
1396  eventout += ")";
1397  }
1398  eventout += "\n nTECW6 = ";
1399  eventout += TECW6RX.size();
1400  for (unsigned int i = 0; i < TECW6RX.size(); ++i) {
1401  eventout += "\n (RX, RY, SX, SY) = (";
1402  eventout += TECW6RX[i];
1403  eventout += ", ";
1404  eventout += TECW6RY[i];
1405  eventout += ", ";
1406  eventout += TECW6SX[i];
1407  eventout += ", ";
1408  eventout += TECW6SY[i];
1409  eventout += ")";
1410  }
1411  eventout += "\n nTECW7 = ";
1412  eventout += TECW7RX.size();
1413  for (unsigned int i = 0; i < TECW7RX.size(); ++i) {
1414  eventout += "\n (RX, RY, SX, SY) = (";
1415  eventout += TECW7RX[i];
1416  eventout += ", ";
1417  eventout += TECW7RY[i];
1418  eventout += ", ";
1419  eventout += TECW7SX[i];
1420  eventout += ", ";
1421  eventout += TECW7SY[i];
1422  eventout += ")";
1423  }
1424  eventout += "\n nTECW8 = ";
1425  eventout += TECW8RX.size();
1426  for (unsigned int i = 0; i < TECW8RX.size(); ++i) {
1427  eventout += "\n (RX, RY, SX, SY) = (";
1428  eventout += TECW8RX[i];
1429  eventout += ", ";
1430  eventout += TECW8RY[i];
1431  eventout += ", ";
1432  eventout += TECW8SX[i];
1433  eventout += ", ";
1434  eventout += TECW8SY[i];
1435  eventout += ")";
1436  }
1437 
1438  // pixel output
1439  eventout += "\n nBRL1 = ";
1440  eventout += BRL1RX.size();
1441  for (unsigned int i = 0; i < BRL1RX.size(); ++i) {
1442  eventout += "\n (RX, RY, SX, SY) = (";
1443  eventout += BRL1RX[i];
1444  eventout += ", ";
1445  eventout += BRL1RY[i];
1446  eventout += ", ";
1447  eventout += BRL1SX[i];
1448  eventout += ", ";
1449  eventout += BRL1SY[i];
1450  eventout += ")";
1451  }
1452  eventout += "\n nBRL2 = ";
1453  eventout += BRL2RX.size();
1454  for (unsigned int i = 0; i < BRL2RX.size(); ++i) {
1455  eventout += "\n (RX, RY, SX, SY) = (";
1456  eventout += BRL2RX[i];
1457  eventout += ", ";
1458  eventout += BRL2RY[i];
1459  eventout += ", ";
1460  eventout += BRL2SX[i];
1461  eventout += ", ";
1462  eventout += BRL2SY[i];
1463  eventout += ")";
1464  }
1465  eventout += "\n nBRL3 = ";
1466  eventout += BRL3RX.size();
1467  for (unsigned int i = 0; i < BRL3RX.size(); ++i) {
1468  eventout += "\n (RX, RY, SX, SY) = (";
1469  eventout += BRL3RX[i];
1470  eventout += ", ";
1471  eventout += BRL3RY[i];
1472  eventout += ", ";
1473  eventout += BRL3SX[i];
1474  eventout += ", ";
1475  eventout += BRL3SY[i];
1476  eventout += ")";
1477  }
1478  eventout += "\n nFWD1p = ";
1479  eventout += FWD1pRX.size();
1480  for (unsigned int i = 0; i < FWD1pRX.size(); ++i) {
1481  eventout += "\n (RX, RY, SX, SY) = (";
1482  eventout += FWD1pRX[i];
1483  eventout += ", ";
1484  eventout += FWD1pRY[i];
1485  eventout += ", ";
1486  eventout += FWD1pSX[i];
1487  eventout += ", ";
1488  eventout += FWD1pSY[i];
1489  eventout += ")";
1490  }
1491  eventout += "\n nFWD1n = ";
1492  eventout += FWD1nRX.size();
1493  for (unsigned int i = 0; i < FWD1nRX.size(); ++i) {
1494  eventout += "\n (RX, RY, SX, SY) = (";
1495  eventout += FWD1nRX[i];
1496  eventout += ", ";
1497  eventout += FWD1nRY[i];
1498  eventout += ", ";
1499  eventout += FWD1nSX[i];
1500  eventout += ", ";
1501  eventout += FWD1nSY[i];
1502  eventout += ")";
1503  }
1504  eventout += "\n nFWD2p = ";
1505  eventout += FWD2pRX.size();
1506  for (unsigned int i = 0; i < FWD2pRX.size(); ++i) {
1507  eventout += "\n (RX, RY, SX, SY) = (";
1508  eventout += FWD2pRX[i];
1509  eventout += ", ";
1510  eventout += FWD2pRY[i];
1511  eventout += ", ";
1512  eventout += FWD2pSX[i];
1513  eventout += ", ";
1514  eventout += FWD2pSY[i];
1515  eventout += ")";
1516  }
1517  eventout += "\n nFWD2p = ";
1518  eventout += FWD2nRX.size();
1519  for (unsigned int i = 0; i < FWD2nRX.size(); ++i) {
1520  eventout += "\n (RX, RY, SX, SY) = (";
1521  eventout += FWD2nRX[i];
1522  eventout += ", ";
1523  eventout += FWD2nRY[i];
1524  eventout += ", ";
1525  eventout += FWD2nSX[i];
1526  eventout += ", ";
1527  eventout += FWD2nSY[i];
1528  eventout += ")";
1529  }
1530 
1531  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1532  }
1533 
1534  // strip output
1554 
1555  // pixel output
1563 
1564  return;
1565 }
1566 
1568  std::string MsgLoggerCat = "GlobalRecHitsProducer_fillMuon";
1569 
1570  TString eventout;
1571  if (verbosity > 0)
1572  eventout = "\nGathering info:";
1573 
1574  // get DT information
1575  const auto& dtGeom = iSetup.getHandle(dtGeomToken_);
1576  if (!dtGeom.isValid()) {
1577  edm::LogWarning(MsgLoggerCat) << "Unable to find DTMuonGeometryRecord in event!";
1578  return;
1579  }
1580 
1582  iEvent.getByToken(MuDTSimSrc_Token_, dtsimHits);
1583  if (!dtsimHits.isValid()) {
1584  edm::LogWarning(MsgLoggerCat) << "Unable to find dtsimHits in event!";
1585  return;
1586  }
1587 
1588  std::map<DTWireId, edm::PSimHitContainer> simHitsPerWire =
1590 
1592  iEvent.getByToken(MuDTSrc_Token_, dtRecHits);
1593  if (!dtRecHits.isValid()) {
1594  edm::LogWarning(MsgLoggerCat) << "Unable to find dtRecHits in event!";
1595  return;
1596  }
1597 
1598  std::map<DTWireId, std::vector<DTRecHit1DPair>> recHitsPerWire = map1DRecHitsPerWire(dtRecHits.product());
1599 
1600  int nDt = compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 1);
1601 
1602  if (verbosity > 1) {
1603  eventout += "\n Number of DtMuonRecHits collected:........ ";
1604  eventout += nDt;
1605  }
1606 
1607  // get CSC Strip information
1608  // get map of sim hits
1609  theMap.clear();
1610  //edm::Handle<CrossingFrame> cf;
1612  //iEvent.getByType(cf);
1613  //if (!cf.isValid()) {
1614  // edm::LogWarning(MsgLoggerCat)
1615  // << "Unable to find CrossingFrame in event!";
1616  // return;
1617  //}
1618  //MixCollection<PSimHit> simHits(cf.product(), "MuonCSCHits");
1619  iEvent.getByToken(MuCSCHits_Token_, cf);
1620  if (!cf.isValid()) {
1621  edm::LogWarning(MsgLoggerCat) << "Unable to find muo CSC crossingFrame in event!";
1622  return;
1623  }
1625 
1626  // arrange the hits by detUnit
1627  for (MixCollection<PSimHit>::MixItr hitItr = simHits.begin(); hitItr != simHits.end(); ++hitItr) {
1628  theMap[hitItr->detUnitId()].push_back(*hitItr);
1629  }
1630 
1631  // get geometry
1632  const auto& hGeom = iSetup.getHandle(cscGeomToken_);
1633  if (!hGeom.isValid()) {
1634  edm::LogWarning(MsgLoggerCat) << "Unable to find CSCMuonGeometryRecord in event!";
1635  return;
1636  }
1637  const CSCGeometry* theCSCGeometry = &*hGeom;
1638 
1639  // get rechits
1641  iEvent.getByToken(MuCSCSrc_Token_, hRecHits);
1642  if (!hRecHits.isValid()) {
1643  edm::LogWarning(MsgLoggerCat) << "Unable to find CSC RecHits in event!";
1644  return;
1645  }
1646  const CSCRecHit2DCollection* cscRecHits = hRecHits.product();
1647 
1648  int nCSC = 0;
1649  for (CSCRecHit2DCollection::const_iterator recHitItr = cscRecHits->begin(); recHitItr != cscRecHits->end();
1650  ++recHitItr) {
1651  int detId = (*recHitItr).cscDetId().rawId();
1652 
1654  std::map<int, edm::PSimHitContainer>::const_iterator mapItr = theMap.find(detId);
1655  if (mapItr != theMap.end()) {
1656  simHits = mapItr->second;
1657  }
1658 
1659  if (simHits.size() == 1) {
1660  ++nCSC;
1661 
1662  const GeomDetUnit* detUnit = theCSCGeometry->idToDetUnit(CSCDetId(detId));
1663  const CSCLayer* layer = dynamic_cast<const CSCLayer*>(detUnit);
1664 
1665  int chamberType = layer->chamber()->specs()->chamberType();
1666  plotResolution(simHits[0], *recHitItr, layer, chamberType);
1667  }
1668  }
1669 
1670  if (verbosity > 1) {
1671  eventout += "\n Number of CSCRecHits collected:........... ";
1672  eventout += nCSC;
1673  }
1674 
1675  // get RPC information
1676  std::map<double, int> mapsim, maprec;
1677  std::map<int, double> nmapsim, nmaprec;
1678 
1679  const auto& rpcGeom = iSetup.getHandle(rpcGeomToken_);
1680  if (!rpcGeom.isValid()) {
1681  edm::LogWarning(MsgLoggerCat) << "Unable to find RPCMuonGeometryRecord in event!";
1682  return;
1683  }
1684 
1686  iEvent.getByToken(MuRPCSimSrc_Token_, simHit);
1687  if (!simHit.isValid()) {
1688  edm::LogWarning(MsgLoggerCat) << "Unable to find RPCSimHit in event!";
1689  return;
1690  }
1691 
1693  iEvent.getByToken(MuRPCSrc_Token_, recHit);
1694  if (!simHit.isValid()) {
1695  edm::LogWarning(MsgLoggerCat) << "Unable to find RPCRecHit in event!";
1696  return;
1697  }
1698 
1699  int nRPC = 0;
1701  int nrec = 0;
1702  for (recIt = recHit->begin(); recIt != recHit->end(); ++recIt) {
1703  RPCDetId Rid = (RPCDetId)(*recIt).rpcId();
1704  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(Rid));
1705  if (roll->isForward()) {
1706  if (verbosity > 1) {
1707  eventout += "\n Number of RPCRecHits collected:........... ";
1708  eventout += nRPC;
1709  }
1710 
1711  if (verbosity > 0)
1712  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1713  return;
1714  }
1715  nrec = nrec + 1;
1716  LocalPoint rhitlocal = (*recIt).localPosition();
1717  double rhitlocalx = rhitlocal.x();
1718  maprec[rhitlocalx] = nrec;
1719  }
1720 
1721  int i = 0;
1722  for (std::map<double, int>::iterator iter = maprec.begin(); iter != maprec.end(); ++iter) {
1723  i = i + 1;
1724  nmaprec[i] = (*iter).first;
1725  }
1726 
1727  edm::PSimHitContainer::const_iterator simIt;
1728  int nsim = 0;
1729  for (simIt = simHit->begin(); simIt != simHit->end(); simIt++) {
1730  int ptype = (*simIt).particleType();
1731  //RPCDetId Rsid = (RPCDetId)(*simIt).detUnitId();
1732  if (ptype == 13 || ptype == -13) {
1733  nsim = nsim + 1;
1734  LocalPoint shitlocal = (*simIt).localPosition();
1735  double shitlocalx = shitlocal.x();
1736  mapsim[shitlocalx] = nsim;
1737  }
1738  }
1739 
1740  i = 0;
1741  for (std::map<double, int>::iterator iter = mapsim.begin(); iter != mapsim.end(); ++iter) {
1742  i = i + 1;
1743  nmapsim[i] = (*iter).first;
1744  }
1745 
1746  if (nsim == nrec) {
1747  for (int r = 0; r < nsim; r++) {
1748  ++nRPC;
1749  RPCRHX.push_back(nmaprec[r + 1]);
1750  RPCSHX.push_back(nmapsim[r + 1]);
1751  }
1752  }
1753 
1754  if (verbosity > 1) {
1755  eventout += "\n Number of RPCRecHits collected:........... ";
1756  eventout += nRPC;
1757  }
1758 
1759  if (verbosity > 0)
1760  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1761 
1762  return;
1763 }
1764 
1766  std::string MsgLoggerCat = "GlobalRecHitsProducer_storeMuon";
1767 
1768  if (verbosity > 2) {
1769  // dt output
1770  TString eventout("\n nDT = ");
1771  eventout += DTRHD.size();
1772  for (unsigned int i = 0; i < DTRHD.size(); ++i) {
1773  eventout += "\n (RHD, SHD) = (";
1774  eventout += DTRHD[i];
1775  eventout += ", ";
1776  eventout += DTSHD[i];
1777  eventout += ")";
1778  }
1779 
1780  // CSC Strip
1781  eventout += "\n nCSC = ";
1782  eventout += CSCRHPHI.size();
1783  for (unsigned int i = 0; i < CSCRHPHI.size(); ++i) {
1784  eventout += "\n (rhphi, rhperp, shphi) = (";
1785  eventout += CSCRHPHI[i];
1786  eventout += ", ";
1787  eventout += CSCRHPERP[i];
1788  eventout += ", ";
1789  eventout += CSCSHPHI[i];
1790  eventout += ")";
1791  }
1792 
1793  // RPC
1794  eventout += "\n nRPC = ";
1795  eventout += RPCRHX.size();
1796  for (unsigned int i = 0; i < RPCRHX.size(); ++i) {
1797  eventout += "\n (rhx, shx) = (";
1798  eventout += RPCRHX[i];
1799  eventout += ", ";
1800  eventout += RPCSHX[i];
1801  eventout += ")";
1802  }
1803 
1804  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1805  }
1806 
1807  product.putDTRecHits(DTRHD, DTSHD);
1808 
1810 
1811  product.putRPCRecHits(RPCRHX, RPCSHX);
1812 
1813  return;
1814 }
1815 
1817  std::string MsgLoggerCat = "GlobalRecHitsProducer_clear";
1818 
1819  if (verbosity > 0)
1820  edm::LogInfo(MsgLoggerCat) << "Clearing event holders";
1821 
1822  // reset electromagnetic info
1823  // EE info
1824  EERE.clear();
1825  EESHE.clear();
1826  // EB info
1827  EBRE.clear();
1828  EBSHE.clear();
1829  // ES info
1830  ESRE.clear();
1831  ESSHE.clear();
1832 
1833  // reset HCal Info
1834  HBCalREC.clear();
1835  HBCalR.clear();
1836  HBCalSHE.clear();
1837  HECalREC.clear();
1838  HECalR.clear();
1839  HECalSHE.clear();
1840  HOCalREC.clear();
1841  HOCalR.clear();
1842  HOCalSHE.clear();
1843  HFCalREC.clear();
1844  HFCalR.clear();
1845  HFCalSHE.clear();
1846 
1847  // reset Track Info
1848  TIBL1RX.clear();
1849  TIBL2RX.clear();
1850  TIBL3RX.clear();
1851  TIBL4RX.clear();
1852  TIBL1RY.clear();
1853  TIBL2RY.clear();
1854  TIBL3RY.clear();
1855  TIBL4RY.clear();
1856  TIBL1SX.clear();
1857  TIBL2SX.clear();
1858  TIBL3SX.clear();
1859  TIBL4SX.clear();
1860  TIBL1SY.clear();
1861  TIBL2SY.clear();
1862  TIBL3SY.clear();
1863  TIBL4SY.clear();
1864 
1865  TOBL1RX.clear();
1866  TOBL2RX.clear();
1867  TOBL3RX.clear();
1868  TOBL4RX.clear();
1869  TOBL1RY.clear();
1870  TOBL2RY.clear();
1871  TOBL3RY.clear();
1872  TOBL4RY.clear();
1873  TOBL1SX.clear();
1874  TOBL2SX.clear();
1875  TOBL3SX.clear();
1876  TOBL4SX.clear();
1877  TOBL1SY.clear();
1878  TOBL2SY.clear();
1879  TOBL3SY.clear();
1880  TOBL4SY.clear();
1881 
1882  TIDW1RX.clear();
1883  TIDW2RX.clear();
1884  TIDW3RX.clear();
1885  TIDW1RY.clear();
1886  TIDW2RY.clear();
1887  TIDW3RY.clear();
1888  TIDW1SX.clear();
1889  TIDW2SX.clear();
1890  TIDW3SX.clear();
1891  TIDW1SY.clear();
1892  TIDW2SY.clear();
1893  TIDW3SY.clear();
1894 
1895  TECW1RX.clear();
1896  TECW2RX.clear();
1897  TECW3RX.clear();
1898  TECW4RX.clear();
1899  TECW5RX.clear();
1900  TECW6RX.clear();
1901  TECW7RX.clear();
1902  TECW8RX.clear();
1903  TECW1RY.clear();
1904  TECW2RY.clear();
1905  TECW3RY.clear();
1906  TECW4RY.clear();
1907  TECW5RY.clear();
1908  TECW6RY.clear();
1909  TECW7RY.clear();
1910  TECW8RY.clear();
1911  TECW1SX.clear();
1912  TECW2SX.clear();
1913  TECW3SX.clear();
1914  TECW4SX.clear();
1915  TECW5SX.clear();
1916  TECW6SX.clear();
1917  TECW7SX.clear();
1918  TECW8SX.clear();
1919  TECW1SY.clear();
1920  TECW2SY.clear();
1921  TECW3SY.clear();
1922  TECW4SY.clear();
1923  TECW5SY.clear();
1924  TECW6SY.clear();
1925  TECW7SY.clear();
1926  TECW8SY.clear();
1927 
1928  BRL1RX.clear();
1929  BRL1RY.clear();
1930  BRL1SX.clear();
1931  BRL1SY.clear();
1932  BRL2RX.clear();
1933  BRL2RY.clear();
1934  BRL2SX.clear();
1935  BRL2SY.clear();
1936  BRL3RX.clear();
1937  BRL3RY.clear();
1938  BRL3SX.clear();
1939  BRL3SY.clear();
1940 
1941  FWD1pRX.clear();
1942  FWD1pRY.clear();
1943  FWD1pSX.clear();
1944  FWD1pSY.clear();
1945  FWD1nRX.clear();
1946  FWD1nRY.clear();
1947  FWD1nSX.clear();
1948  FWD1nSY.clear();
1949  FWD2pRX.clear();
1950  FWD2pRY.clear();
1951  FWD2pSX.clear();
1952  FWD2pSY.clear();
1953  FWD2nRX.clear();
1954  FWD2nRY.clear();
1955  FWD2nSX.clear();
1956  FWD2nSY.clear();
1957 
1958  //muon clear
1959  DTRHD.clear();
1960  DTSHD.clear();
1961 
1962  CSCRHPHI.clear();
1963  CSCRHPERP.clear();
1964  CSCSHPHI.clear();
1965 
1966  RPCRHX.clear();
1967  RPCSHX.clear();
1968 
1969  return;
1970 }
1971 
1972 //needed by to do the residual for matched hits in SiStrip
1973 std::pair<LocalPoint, LocalVector> GlobalRecHitsProducer::projectHit(const PSimHit& hit,
1974  const StripGeomDetUnit* stripDet,
1975  const BoundPlane& plane) {
1976  const StripTopology& topol = stripDet->specificTopology();
1977  GlobalPoint globalpos = stripDet->surface().toGlobal(hit.localPosition());
1978  LocalPoint localHit = plane.toLocal(globalpos);
1979  //track direction
1980  LocalVector locdir = hit.localDirection();
1981  //rotate track in new frame
1982 
1983  GlobalVector globaldir = stripDet->surface().toGlobal(locdir);
1984  LocalVector dir = plane.toLocal(globaldir);
1985  float scale = -localHit.z() / dir.z();
1986 
1987  LocalPoint projectedPos = localHit + scale * dir;
1988 
1989  float selfAngle = topol.stripAngle(topol.strip(hit.localPosition()));
1990 
1991  // vector along strip in hit frame
1992  LocalVector stripDir(sin(selfAngle), cos(selfAngle), 0);
1993 
1994  LocalVector localStripDir(plane.toLocal(stripDet->surface().toGlobal(stripDir)));
1995 
1996  return std::pair<LocalPoint, LocalVector>(projectedPos, localStripDir);
1997 }
1998 
1999 // Return a map between DTRecHit1DPair and wireId
2000 std::map<DTWireId, std::vector<DTRecHit1DPair>> GlobalRecHitsProducer::map1DRecHitsPerWire(
2001  const DTRecHitCollection* dt1DRecHitPairs) {
2002  std::map<DTWireId, std::vector<DTRecHit1DPair>> ret;
2003 
2004  for (DTRecHitCollection::const_iterator rechit = dt1DRecHitPairs->begin(); rechit != dt1DRecHitPairs->end();
2005  rechit++) {
2006  ret[(*rechit).wireId()].push_back(*rechit);
2007  }
2008 
2009  return ret;
2010 }
2011 
2012 // Compute SimHit distance from wire (cm)
2014  float xwire = layer->specificTopology().wirePosition(wireId.wire());
2015  LocalPoint entryP = hit.entryPoint();
2016  LocalPoint exitP = hit.exitPoint();
2017  float xEntry = entryP.x() - xwire;
2018  float xExit = exitP.x() - xwire;
2019 
2020  //FIXME: check...
2021  return fabs(xEntry - (entryP.z() * (xExit - xEntry)) / (exitP.z() - entryP.z()));
2022 }
2023 
2024 // Find the RecHit closest to the muon SimHit
2025 template <typename type>
2027  DTWireId wireId,
2028  const std::vector<type>& recHits,
2029  const float simHitDist) {
2030  float res = 99999;
2031  const type* theBestRecHit = nullptr;
2032  // Loop over RecHits within the cell
2033  for (typename std::vector<type>::const_iterator recHit = recHits.begin(); recHit != recHits.end(); recHit++) {
2034  float distTmp = recHitDistFromWire(*recHit, layer);
2035  if (fabs(distTmp - simHitDist) < res) {
2036  res = fabs(distTmp - simHitDist);
2037  theBestRecHit = &(*recHit);
2038  }
2039  } // End of loop over RecHits within the cell
2040 
2041  return theBestRecHit;
2042 }
2043 
2044 // Compute the distance from wire (cm) of a hits in a DTRecHit1DPair
2046  // Compute the rechit distance from wire
2047  return fabs(hitPair.localPosition(DTEnums::Left).x() - hitPair.localPosition(DTEnums::Right).x()) / 2.;
2048 }
2049 
2050 // Compute the distance from wire (cm) of a hits in a DTRecHit1D
2052  return fabs(recHit.localPosition().x() - layer->specificTopology().wirePosition(recHit.wireId().wire()));
2053 }
2054 
2055 template <typename type>
2057  const std::map<DTWireId, std::vector<PSimHit>>& _simHitsPerWire,
2058  const std::map<DTWireId, std::vector<type>>& _recHitsPerWire,
2059  int step) {
2060  std::map<DTWireId, std::vector<PSimHit>> simHitsPerWire = _simHitsPerWire;
2061  std::map<DTWireId, std::vector<type>> recHitsPerWire = _recHitsPerWire;
2062  int nDt = 0;
2063  // Loop over cells with a muon SimHit
2064  for (std::map<DTWireId, std::vector<PSimHit>>::const_iterator wireAndSHits = simHitsPerWire.begin();
2065  wireAndSHits != simHitsPerWire.end();
2066  wireAndSHits++) {
2067  DTWireId wireId = (*wireAndSHits).first;
2068  std::vector<PSimHit> simHitsInCell = (*wireAndSHits).second;
2069 
2070  // Get the layer
2071  const DTLayer* layer = dtGeom->layer(wireId);
2072 
2073  // Look for a mu hit in the cell
2074  const PSimHit* muSimHit = DTHitQualityUtils::findMuSimHit(simHitsInCell);
2075  if (muSimHit == nullptr) {
2076  continue; // Skip this cell
2077  }
2078 
2079  // Find the distance of the simhit from the wire
2080  float simHitWireDist = simHitDistFromWire(layer, wireId, *muSimHit);
2081  // Skip simhits out of the cell
2082  if (simHitWireDist > 2.1) {
2083  continue; // Skip this cell
2084  }
2085  //GlobalPoint simHitGlobalPos = layer->toGlobal(muSimHit->localPosition());
2086 
2087  // Look for RecHits in the same cell
2088  if (recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
2089  continue; // No RecHit found in this cell
2090  } else {
2091  // vector<type> recHits = (*wireAndRecHits).second;
2092  std::vector<type> recHits = recHitsPerWire[wireId];
2093 
2094  // Find the best RecHit
2095  const type* theBestRecHit = findBestRecHit(layer, wireId, recHits, simHitWireDist);
2096 
2097  float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
2098 
2099  ++nDt;
2100 
2101  DTRHD.push_back(recHitWireDist);
2102  DTSHD.push_back(simHitWireDist);
2103 
2104  } // find rechits
2105  } // loop over simhits
2106 
2107  return nDt;
2108 }
2109 
2111  const CSCRecHit2D& recHit,
2112  const CSCLayer* layer,
2113  int chamberType) {
2114  GlobalPoint simHitPos = layer->toGlobal(simHit.localPosition());
2115  GlobalPoint recHitPos = layer->toGlobal(recHit.localPosition());
2116 
2117  CSCRHPHI.push_back(recHitPos.phi());
2118  CSCRHPERP.push_back(recHitPos.perp());
2119  CSCSHPHI.push_back(simHitPos.phi());
2120 }
2121 
2122 //define this as a plug-in
2123 //DEFINE_FWK_MODULE(GlobalRecHitsProducer);
void putTIBL1RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
GlobalRecHitsProducer(const edm::ParameterSet &)
edm::EDGetTokenT< edm::PSimHitContainer > MuDTSimSrc_Token_
edm::EDGetTokenT< edm::PCaloHitContainer > HCalSrc_Token_
const type * findBestRecHit(const DTLayer *layer, DTWireId wireId, const std::vector< type > &recHits, const float simHitDist)
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
float simHitDistFromWire(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
unsigned int tobLayer(const DetId &id) const
std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
unsigned int pxbLayer(const DetId &id) const
void putHFCalRecHits(const std::vector< float > &rec, const std::vector< float > &r, const std::vector< float > &she)
std::vector< PCaloHit > PCaloHitContainer
T perp() const
Definition: PV3DBase.h:69
TrackerHitAssociator::Config trackerHitAssociatorConfig_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > EEHits_Token_
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
void putHECalRecHits(const std::vector< float > &rec, const std::vector< float > &r, const std::vector< float > &she)
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
virtual float stripAngle(float strip) const =0
void putFWD1nRecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void putTOBL4RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
static const int sdHcalOut
edm::EDGetTokenT< EBUncalibratedRecHitCollection > ECalUncalEBSrc_Token_
int wire() const
Return the wire number.
Definition: DTWireId.h:42
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
int compute(const DTGeometry *dtGeom, const std::map< DTWireId, std::vector< PSimHit >> &simHitsPerWire, const std::map< DTWireId, std::vector< type >> &recHitsPerWire, int step)
void putHBCalRecHits(const std::vector< float > &rec, const std::vector< float > &r, const std::vector< float > &she)
std::pair< LocalPoint, LocalVector > projectHit(const PSimHit &hit, const StripGeomDetUnit *stripDet, const BoundPlane &plane)
T z() const
Definition: PV3DBase.h:61
bool isForward() const
Definition: RPCRoll.cc:43
ret
prodAgent to be discontinued
std::vector< PSimHit > matched
std::string const & instance() const
Definition: InputTag.h:37
void putTECW6RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void putBRL1RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void putTECW8RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void fillHCal(edm::Event &, const edm::EventSetup &)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
edm::EDGetTokenT< EEUncalibratedRecHitCollection > ECalUncalEESrc_Token_
int closest(std::vector< int > const &vec, int value)
void putEECalRecHits(const std::vector< float > &re, const std::vector< float > &she)
unsigned int tidWheel(const DetId &id) const
static const int sdSiTID
void putTECW5RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
unsigned int tecWheel(const DetId &id) const
edm::EDGetTokenT< EERecHitCollection > ECalEESrc_Token_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T eta() const
Definition: PV3DBase.h:73
void putTECW7RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscGeomToken_
T const * product() const
Definition: Handle.h:70
void putCSCRecHits(const std::vector< float > &rhphi, const std::vector< float > &rhperp, const std::vector< float > &shphi)
void putTECW2RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
std::vector< T >::const_iterator const_iterator
void putTIDW1RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
unsigned long long EventNumber_t
void putRPCRecHits(const std::vector< float > &rhx, const std::vector< float > &shx)
void putTECW1RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
LocalPoint localPosition() const override
void storeMuon(PGlobalRecHit &)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tGeomToken_
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< CrossingFrame< PCaloHit > > EBHits_Token_
Definition: Electron.h:6
void produce(edm::Event &, const edm::EventSetup &) override
void storeECal(PGlobalRecHit &)
std::map< int, edm::PSimHitContainer > theMap
constexpr std::array< uint8_t, layerIndexSize > layer
void putBRL2RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
const_iterator end(bool update=false) const
virtual float strip(const LocalPoint &) const =0
T getUntrackedParameter(std::string const &, T const &) const
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
edm::EDGetTokenT< CrossingFrame< PSimHit > > MuCSCHits_Token_
char const * label
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
int iEvent
Definition: GenABIO.cc:224
void putTOBL1RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void putTIDW2RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void putFWD2nRecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
static const int sdSiTIB
static const int sdPxlBrl
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > SiStripSrc_Token_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > ESHits_Token_
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
void putHOCalRecHits(const std::vector< float > &rec, const std::vector< float > &r, const std::vector< float > &she)
void putTECW3RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void putTOBL3RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
T sqrt(T t)
Definition: SSEVec.h:19
void putTIBL2RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
unsigned int pxfDisk(const DetId &id) const
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
void plotResolution(const PSimHit &simHit, const CSCRecHit2D &recHit, const CSCLayer *layer, int chamberType)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static const int sdSiTOB
bool getData(T &iHolder) const
Definition: EventSetup.h:122
const_iterator begin() const
const PSimHit * findMuSimHit(const edm::PSimHitContainer &hits)
Select the SimHit from a muon in a vector of SimHits.
void putEBCalRecHits(const std::vector< float > &re, const std::vector< float > &she)
void putBRL3RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
edm::EDGetTokenT< CSCRecHit2DCollection > MuCSCSrc_Token_
edm::EDGetTokenT< ESRecHitCollection > ECalESSrc_Token_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
edm::EDGetTokenT< DTRecHitCollection > MuDTSrc_Token_
void storeTrk(PGlobalRecHit &)
edm::EDGetTokenT< RPCRecHitCollection > MuRPCSrc_Token_
const int verbosity
const_iterator end() const
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
void putTIBL4RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void putESCalRecHits(const std::vector< float > &re, const std::vector< float > &she)
Log< level::Info, false > LogInfo
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetId.h:17
unsigned int pxfSide(const DetId &id) const
void putFWD1pRecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void fillMuon(edm::Event &, const edm::EventSetup &)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
DetId geographicalId() const
void putDTRecHits(const std::vector< float > &rhd, const std::vector< float > &shd)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::map< uint32_t, float, std::less< uint32_t > > MapType
static const int sdHcalFwd
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:20
static const int sdHcalBrl
bool isValid() const
Definition: HandleBase.h:70
void storeHCal(PGlobalRecHit &)
void putTOBL2RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
static const int sdSiTEC
iterator end()
Definition: DetSetNew.h:56
const_iterator find(id_type i, bool update=false) const
edm::EDGetTokenT< SiPixelRecHitCollection > SiPxlSrc_Token_
LocalPoint localPosition() const override
GlobalPoint getPosition(const DetId &id) const
static int position[264][3]
Definition: ReadPGInfo.cc:289
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeomToken_
std::vector< PSimHit > PSimHitContainer
unsigned int RunNumber_t
unsigned int tibLayer(const DetId &id) const
step
Definition: StallMonitor.cc:98
static const int sdPxlFwd
Log< level::Warning, false > LogWarning
void fillTrk(edm::Event &, const edm::EventSetup &)
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
edm::EDGetTokenT< edm::PSimHitContainer > MuRPCSimSrc_Token_
void putTECW4RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
static const int sdHcalEC
edm::EDGetTokenT< EBRecHitCollection > ECalEBSrc_Token_
void fillECal(edm::Event &, const edm::EventSetup &)
void putFWD2pRecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
def move(src, dest)
Definition: eostools.py:511
void putTIDW3RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
void putTIBL3RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
std::map< DTWireId, std::vector< DTRecHit1DPair > > map1DRecHitsPerWire(const DTRecHitCollection *dt1DRecHitPairs)
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: CSCGeometry.cc:89
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96
iterator begin()
Definition: DetSetNew.h:54