CMS 3D CMS Logo

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