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  (HcalGeometry*)(geo->getSubdetectorGeometry(DetId::Hcal,cell.subdet()));
609 // const CaloCellGeometry* cellGeometry =
610 // geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
611  double fEta = cellGeometry->getPosition(cell).eta () ;
612  double fPhi = cellGeometry->getPosition(cell).phi () ;
613  if ( (jhbhe->energy()) > maxHBEnergy ) {
614  maxHBEnergy = jhbhe->energy();
615  maxHBPhi = fPhi;
616  maxHOPhi = maxHBPhi;
617  maxHBEta = fEta;
618  maxHOEta = maxHBEta;
619  }
620  }
621 
622  if (cell.subdet() == sdHcalEC) {
623 
624  const HcalGeometry* cellGeometry =
625  (HcalGeometry*)(geo->getSubdetectorGeometry(DetId::Hcal,cell.subdet()));
626 // const CaloCellGeometry* cellGeometry =
627 // geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
628  double fEta = cellGeometry->getPosition(cell).eta () ;
629  double fPhi = cellGeometry->getPosition(cell).phi () ;
630  if ( (jhbhe->energy()) > maxHEEnergy ) {
631  maxHEEnergy = jhbhe->energy();
632  maxHEPhi = fPhi;
633  maxHEEta = fEta;
634  }
635  }
636  } // end find max values
637 
638  for (HBHERecHitCollection::const_iterator jhbhe = (*ihbhe)->begin();
639  jhbhe != (*ihbhe)->end(); ++jhbhe) {
640 
641  HcalDetId cell(jhbhe->id());
642 
643  if (cell.subdet() == sdHcalBrl) {
644 
645  ++iHB;
646 
647  const HcalGeometry* cellGeometry =
648  (HcalGeometry*)(geo->getSubdetectorGeometry(DetId::Hcal,cell.subdet()));
649 // const CaloCellGeometry* cellGeometry =
650 // geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
651  double fEta = cellGeometry->getPosition(cell).eta () ;
652  double fPhi = cellGeometry->getPosition(cell).phi () ;
653 
654  float deltaphi = maxHBPhi - fPhi;
655  if (fPhi > maxHBPhi) { deltaphi = fPhi - maxHBPhi;}
656  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
657  float deltaeta = fEta - maxHBEta;
658  Double_t r = sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
659 
660  HBCalREC.push_back(jhbhe->energy());
661  HBCalR.push_back(r);
662  HBCalSHE.push_back(fHBEnergySimHits[cell.rawId()]);
663  }
664 
665  if (cell.subdet() == sdHcalEC) {
666 
667  ++iHE;
668 
669  const HcalGeometry* cellGeometry =
670  (HcalGeometry*)(geo->getSubdetectorGeometry(DetId::Hcal,cell.subdet()));
671 // const CaloCellGeometry* cellGeometry =
672 // geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
673  double fEta = cellGeometry->getPosition(cell).eta () ;
674  double fPhi = cellGeometry->getPosition(cell).phi () ;
675 
676  float deltaphi = maxHEPhi - fPhi;
677  if (fPhi > maxHEPhi) { deltaphi = fPhi - maxHEPhi;}
678  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
679  float deltaeta = fEta - maxHEEta;
680  Double_t r = sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
681 
682  HECalREC.push_back(jhbhe->energy());
683  HECalR.push_back(r);
684  HECalSHE.push_back(fHEEnergySimHits[cell.rawId()]);
685  }
686  }
687  } // end loop through collection
688 
689 
690  if (verbosity > 1) {
691  eventout += "\n Number of HBRecHits collected:............ ";
692  eventout += iHB;
693  }
694 
695  if (verbosity > 1) {
696  eventout += "\n Number of HERecHits collected:............ ";
697  eventout += iHE;
698  }
699 
701  // get HF information
703  std::vector<edm::Handle<HFRecHitCollection> > hf;
704  iEvent.getManyByType(hf);
705  if (!hf[0].isValid()) {
706  edm::LogWarning(MsgLoggerCat)
707  << "Unable to find any HFRecHitCollections in event!";
708  return;
709  }
710  std::vector<edm::Handle<HFRecHitCollection> >::iterator ihf;
711 
712  int iHF = 0;
713  for (ihf = hf.begin(); ihf != hf.end(); ++ihf) {
714 
715  // find max values
716  for (HFRecHitCollection::const_iterator jhf = (*ihf)->begin();
717  jhf != (*ihf)->end(); ++jhf) {
718 
719  HcalDetId cell(jhf->id());
720 
721  if (cell.subdet() == sdHcalFwd) {
722 
723  const CaloCellGeometry* cellGeometry =
724  geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
725  double fEta = cellGeometry->getPosition().eta () ;
726  double fPhi = cellGeometry->getPosition().phi () ;
727  if ( (jhf->energy()) > maxHFEnergy ) {
728  maxHFEnergy = jhf->energy();
729  maxHFPhi = fPhi;
730  maxHFEta = fEta;
731  }
732  }
733  } // end find max values
734 
735  for (HFRecHitCollection::const_iterator jhf = (*ihf)->begin();
736  jhf != (*ihf)->end(); ++jhf) {
737 
738  HcalDetId cell(jhf->id());
739 
740  if (cell.subdet() == sdHcalFwd) {
741 
742  ++iHF;
743 
744  const CaloCellGeometry* cellGeometry =
745  geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
746  double fEta = cellGeometry->getPosition().eta () ;
747  double fPhi = cellGeometry->getPosition().phi () ;
748 
749  float deltaphi = maxHBPhi - fPhi;
750  if (fPhi > maxHFPhi) { deltaphi = fPhi - maxHFPhi;}
751  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
752  float deltaeta = fEta - maxHFEta;
753  Double_t r = sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
754 
755  HFCalREC.push_back(jhf->energy());
756  HFCalR.push_back(r);
757  HFCalSHE.push_back(fHFEnergySimHits[cell.rawId()]);
758  }
759  }
760  } // end loop through collection
761 
762  if (verbosity > 1) {
763  eventout += "\n Number of HFDigis collected:.............. ";
764  eventout += iHF;
765  }
766 
768  // get HO information
770  std::vector<edm::Handle<HORecHitCollection> > ho;
771  iEvent.getManyByType(ho);
772  if (!ho[0].isValid()) {
773  edm::LogWarning(MsgLoggerCat)
774  << "Unable to find any HORecHitCollections in event!";
775  return;
776  }
777  std::vector<edm::Handle<HORecHitCollection> >::iterator iho;
778 
779  int iHO = 0;
780  for (iho = ho.begin(); iho != ho.end(); ++iho) {
781 
782  for (HORecHitCollection::const_iterator jho = (*iho)->begin();
783  jho != (*iho)->end(); ++jho) {
784 
785  HcalDetId cell(jho->id());
786 
787  if (cell.subdet() == sdHcalOut) {
788 
789  ++iHO;
790 
791  const CaloCellGeometry* cellGeometry =
792  geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
793  double fEta = cellGeometry->getPosition().eta () ;
794  double fPhi = cellGeometry->getPosition().phi () ;
795 
796  float deltaphi = maxHOPhi - fPhi;
797  if (fPhi > maxHOPhi) { deltaphi = fPhi - maxHOPhi;}
798  if (deltaphi > PI) { deltaphi = 2.0 * PI - deltaphi;}
799  float deltaeta = fEta - maxHOEta;
800  Double_t r = sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
801 
802  HOCalREC.push_back(jho->energy());
803  HOCalR.push_back(r);
804  HOCalSHE.push_back(fHOEnergySimHits[cell.rawId()]);
805  }
806  }
807  } // end loop through collection
808 
809  if (verbosity > 1) {
810  eventout += "\n Number of HODigis collected:.............. ";
811  eventout += iHO;
812  }
813 
814  if (verbosity > 0)
815  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
816 
817  return;
818 }
819 
821 {
822  std::string MsgLoggerCat = "GlobalRecHitsProducer_storeHCal";
823 
824  if (verbosity > 2) {
825  TString eventout("\n nHBRecHits = ");
826  eventout += HBCalREC.size();
827  for (unsigned int i = 0; i < HBCalREC.size(); ++i) {
828  eventout += "\n (REC, R, SHE) = (";
829  eventout += HBCalREC[i];
830  eventout += ", ";
831  eventout += HBCalR[i];
832  eventout += ", ";
833  eventout += HBCalSHE[i];
834  eventout += ")";
835  }
836  eventout += "\n nHERecHits = ";
837  eventout += HECalREC.size();
838  for (unsigned int i = 0; i < HECalREC.size(); ++i) {
839  eventout += "\n (REC, R, SHE) = (";
840  eventout += HECalREC[i];
841  eventout += ", ";
842  eventout += HECalR[i];
843  eventout += ", ";
844  eventout += HECalSHE[i];
845  eventout += ")";
846  }
847  eventout += "\n nHFRecHits = ";
848  eventout += HFCalREC.size();
849  for (unsigned int i = 0; i < HFCalREC.size(); ++i) {
850  eventout += "\n (REC, R, SHE) = (";
851  eventout += HFCalREC[i];
852  eventout += ", ";
853  eventout += HFCalR[i];
854  eventout += ", ";
855  eventout += HFCalSHE[i];
856  eventout += ")";
857  }
858  eventout += "\n nHORecHits = ";
859  eventout += HOCalREC.size();
860  for (unsigned int i = 0; i < HOCalREC.size(); ++i) {
861  eventout += "\n (REC, R, SHE) = (";
862  eventout += HOCalREC[i];
863  eventout += ", ";
864  eventout += HOCalR[i];
865  eventout += ", ";
866  eventout += HOCalSHE[i];
867  eventout += ")";
868  }
869 
870  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
871  }
872 
877 
878  return;
879 }
880 
882  const edm::EventSetup& iSetup)
883 {
884  //Retrieve tracker topology from geometry
885  edm::ESHandle<TrackerTopology> tTopoHandle;
886  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
887  const TrackerTopology* const tTopo = tTopoHandle.product();
888 
889 
890  std::string MsgLoggerCat = "GlobalRecHitsProducer_fillTrk";
891 
892  TString eventout;
893  if (verbosity > 0)
894  eventout = "\nGathering info:";
895 
896  // get strip information
898  iEvent.getByToken(SiStripSrc_Token_, rechitsmatched);
899  if (!rechitsmatched.isValid()) {
900  edm::LogWarning(MsgLoggerCat)
901  << "Unable to find stripmatchedrechits in event!";
902  return;
903  }
904 
906 
908  iSetup.get<TrackerDigiGeometryRecord>().get(pDD);
909  if (!pDD.isValid()) {
910  edm::LogWarning(MsgLoggerCat)
911  << "Unable to find TrackerDigiGeometry in event!";
912  return;
913  }
914  const TrackerGeometry &tracker(*pDD);
915 
916  int nStripBrl = 0, nStripFwd = 0;
917 
918  // loop over det units
919  for (TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin();
920  it != pDD->dets().end(); ++it) {
921 
922  uint32_t myid = ((*it)->geographicalId()).rawId();
923  DetId detid = ((*it)->geographicalId());
924 
925  //loop over rechits-matched in the same subdetector
926  SiStripMatchedRecHit2DCollection::const_iterator rechitmatchedMatch = rechitsmatched->find(detid);
927 
928  if (rechitmatchedMatch != rechitsmatched->end()) {
929  SiStripMatchedRecHit2DCollection::DetSet rechitmatchedRange = *rechitmatchedMatch;
930  SiStripMatchedRecHit2DCollection::DetSet::const_iterator rechitmatchedRangeIteratorBegin = rechitmatchedRange.begin();
931  SiStripMatchedRecHit2DCollection::DetSet::const_iterator rechitmatchedRangeIteratorEnd = rechitmatchedRange.end();
932  SiStripMatchedRecHit2DCollection::DetSet::const_iterator itermatched = rechitmatchedRangeIteratorBegin;
933 
934  for ( itermatched = rechitmatchedRangeIteratorBegin;
935  itermatched != rechitmatchedRangeIteratorEnd;
936  ++itermatched) {
937 
938  SiStripMatchedRecHit2D const rechit = *itermatched;
939  LocalPoint position = rechit.localPosition();
940 
941  float mindist = 999999.;
942  float distx = 999999.;
943  float disty = 999999.;
944  float dist = 999999.;
945  std::pair<LocalPoint,LocalVector> closestPair;
946  matched.clear();
947 
948  float rechitmatchedx = position.x();
949  float rechitmatchedy = position.y();
950 
951  matched = associate.associateHit(rechit);
952 
953  if (!matched.empty()) {
954  //project simhit;
955  const GluedGeomDet* gluedDet =
956  (const GluedGeomDet*)tracker.idToDet(rechit.geographicalId());
957  const StripGeomDetUnit* partnerstripdet =
958  (StripGeomDetUnit*) gluedDet->stereoDet();
959  std::pair<LocalPoint,LocalVector> hitPair;
960 
961  for(std::vector<PSimHit>::const_iterator m = matched.begin();
962  m != matched.end(); m++){
963  //project simhit;
964  hitPair = projectHit((*m),partnerstripdet,gluedDet->surface());
965  distx = fabs(rechitmatchedx - hitPair.first.x());
966  disty = fabs(rechitmatchedy - hitPair.first.y());
967  dist = sqrt(distx*distx+disty*disty);
968 
969  if(dist < mindist){
970  mindist = dist;
971  closestPair = hitPair;
972  }
973  }
974 
975  // get TIB
976  if (detid.subdetId() == sdSiTIB) {
977 
978 
979  ++nStripBrl;
980 
981  if (tTopo->tibLayer(myid) == 1) {
982  TIBL1RX.push_back(rechitmatchedx);
983  TIBL1RY.push_back(rechitmatchedy);
984  TIBL1SX.push_back(closestPair.first.x());
985  TIBL1SY.push_back(closestPair.first.y());
986  }
987  if (tTopo->tibLayer(myid) == 2) {
988  TIBL2RX.push_back(rechitmatchedx);
989  TIBL2RY.push_back(rechitmatchedy);
990  TIBL2SX.push_back(closestPair.first.x());
991  TIBL2SY.push_back(closestPair.first.y());
992  }
993  if (tTopo->tibLayer(myid) == 3) {
994  TIBL3RX.push_back(rechitmatchedx);
995  TIBL3RY.push_back(rechitmatchedy);
996  TIBL3SX.push_back(closestPair.first.x());
997  TIBL3SY.push_back(closestPair.first.y());
998  }
999  if (tTopo->tibLayer(myid) == 4) {
1000  TIBL4RX.push_back(rechitmatchedx);
1001  TIBL4RY.push_back(rechitmatchedy);
1002  TIBL4SX.push_back(closestPair.first.x());
1003  TIBL4SY.push_back(closestPair.first.y());
1004  }
1005  }
1006 
1007  // get TOB
1008  if (detid.subdetId() == sdSiTOB) {
1009 
1010 
1011  ++nStripBrl;
1012 
1013  if (tTopo->tobLayer(myid) == 1) {
1014  TOBL1RX.push_back(rechitmatchedx);
1015  TOBL1RY.push_back(rechitmatchedy);
1016  TOBL1SX.push_back(closestPair.first.x());
1017  TOBL1SY.push_back(closestPair.first.y());
1018  }
1019  if (tTopo->tobLayer(myid) == 2) {
1020  TOBL2RX.push_back(rechitmatchedx);
1021  TOBL2RY.push_back(rechitmatchedy);
1022  TOBL2SX.push_back(closestPair.first.x());
1023  TOBL2SY.push_back(closestPair.first.y());
1024  }
1025  if (tTopo->tobLayer(myid) == 3) {
1026  TOBL3RX.push_back(rechitmatchedx);
1027  TOBL3RY.push_back(rechitmatchedy);
1028  TOBL3SX.push_back(closestPair.first.x());
1029  TOBL3SY.push_back(closestPair.first.y());
1030  }
1031  if (tTopo->tobLayer(myid) == 4) {
1032  TOBL4RX.push_back(rechitmatchedx);
1033  TOBL4RY.push_back(rechitmatchedy);
1034  TOBL4SX.push_back(closestPair.first.x());
1035  TOBL4SY.push_back(closestPair.first.y());
1036  }
1037  }
1038 
1039  // get TID
1040  if (detid.subdetId() == sdSiTID) {
1041 
1042 
1043  ++nStripFwd;
1044 
1045  if (tTopo->tidWheel(myid) == 1) {
1046  TIDW1RX.push_back(rechitmatchedx);
1047  TIDW1RY.push_back(rechitmatchedy);
1048  TIDW1SX.push_back(closestPair.first.x());
1049  TIDW1SY.push_back(closestPair.first.y());
1050  }
1051  if (tTopo->tidWheel(myid) == 2) {
1052  TIDW2RX.push_back(rechitmatchedx);
1053  TIDW2RY.push_back(rechitmatchedy);
1054  TIDW2SX.push_back(closestPair.first.x());
1055  TIDW2SY.push_back(closestPair.first.y());
1056  }
1057  if (tTopo->tidWheel(myid) == 3) {
1058  TIDW3RX.push_back(rechitmatchedx);
1059  TIDW3RY.push_back(rechitmatchedy);
1060  TIDW3SX.push_back(closestPair.first.x());
1061  TIDW3SY.push_back(closestPair.first.y());
1062  }
1063  }
1064 
1065  // get TEC
1066  if (detid.subdetId() == sdSiTEC) {
1067 
1068 
1069  ++nStripFwd;
1070 
1071  if (tTopo->tecWheel(myid) == 1) {
1072  TECW1RX.push_back(rechitmatchedx);
1073  TECW1RY.push_back(rechitmatchedy);
1074  TECW1SX.push_back(closestPair.first.x());
1075  TECW1SY.push_back(closestPair.first.y());
1076  }
1077  if (tTopo->tecWheel(myid) == 2) {
1078  TECW2RX.push_back(rechitmatchedx);
1079  TECW2RY.push_back(rechitmatchedy);
1080  TECW2SX.push_back(closestPair.first.x());
1081  TECW2SY.push_back(closestPair.first.y());
1082  }
1083  if (tTopo->tecWheel(myid) == 3) {
1084  TECW3RX.push_back(rechitmatchedx);
1085  TECW3RY.push_back(rechitmatchedy);
1086  TECW3SX.push_back(closestPair.first.x());
1087  TECW3SY.push_back(closestPair.first.y());
1088  }
1089  if (tTopo->tecWheel(myid) == 4) {
1090  TECW4RX.push_back(rechitmatchedx);
1091  TECW4RY.push_back(rechitmatchedy);
1092  TECW4SX.push_back(closestPair.first.x());
1093  TECW4SY.push_back(closestPair.first.y());
1094  }
1095  if (tTopo->tecWheel(myid) == 5) {
1096  TECW5RX.push_back(rechitmatchedx);
1097  TECW5RY.push_back(rechitmatchedy);
1098  TECW5SX.push_back(closestPair.first.x());
1099  TECW5SY.push_back(closestPair.first.y());
1100  }
1101  if (tTopo->tecWheel(myid) == 6) {
1102  TECW6RX.push_back(rechitmatchedx);
1103  TECW6RY.push_back(rechitmatchedy);
1104  TECW6SX.push_back(closestPair.first.x());
1105  TECW6SY.push_back(closestPair.first.y());
1106  }
1107  if (tTopo->tecWheel(myid) == 7) {
1108  TECW7RX.push_back(rechitmatchedx);
1109  TECW7RY.push_back(rechitmatchedy);
1110  TECW7SX.push_back(closestPair.first.x());
1111  TECW7SY.push_back(closestPair.first.y());
1112  }
1113  if (tTopo->tecWheel(myid) == 8) {
1114  TECW8RX.push_back(rechitmatchedx);
1115  TECW8RY.push_back(rechitmatchedy);
1116  TECW8SX.push_back(closestPair.first.x());
1117  TECW8SY.push_back(closestPair.first.y());
1118  }
1119  }
1120 
1121  } // end if matched empty
1122  }
1123  }
1124  } // end loop over det units
1125 
1126  if (verbosity > 1) {
1127  eventout += "\n Number of BrlStripRecHits collected:...... ";
1128  eventout += nStripBrl;
1129  }
1130 
1131  if (verbosity > 1) {
1132  eventout += "\n Number of FrwdStripRecHits collected:..... ";
1133  eventout += nStripFwd;
1134  }
1135 
1136  // get pixel information
1137  //Get RecHits
1139  iEvent.getByToken(SiPxlSrc_Token_, recHitColl);
1140  if (!recHitColl.isValid()) {
1141  edm::LogWarning(MsgLoggerCat)
1142  << "Unable to find SiPixelRecHitCollection in event!";
1143  return;
1144  }
1145 
1146  //Get event setup
1148  iSetup.get<TrackerDigiGeometryRecord>().get(geom);
1149  if (!geom.isValid()) {
1150  edm::LogWarning(MsgLoggerCat)
1151  << "Unable to find TrackerDigiGeometry in event!";
1152  return;
1153  }
1154  //const TrackerGeometry& theTracker(*geom);
1155 
1156  int nPxlBrl = 0, nPxlFwd = 0;
1157  //iterate over detunits
1158  for (TrackerGeometry::DetContainer::const_iterator it = geom->dets().begin();
1159  it != geom->dets().end(); ++it) {
1160 
1161  uint32_t myid = ((*it)->geographicalId()).rawId();
1162  DetId detId = ((*it)->geographicalId());
1163  int subid = detId.subdetId();
1164 
1165  if (! ((subid == sdPxlBrl) || (subid == sdPxlFwd))) continue;
1166 
1167  //const PixelGeomDetUnit * theGeomDet =
1168  // dynamic_cast<const PixelGeomDetUnit*>(theTracker.idToDet(detId) );
1169 
1170  SiPixelRecHitCollection::const_iterator pixeldet = recHitColl->find(detId);
1171  if (pixeldet == recHitColl->end()) continue;
1172  SiPixelRecHitCollection::DetSet pixelrechitRange = *pixeldet;
1173  SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorBegin = pixelrechitRange.begin();
1174  SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorEnd = pixelrechitRange.end();
1175  SiPixelRecHitCollection::DetSet::const_iterator pixeliter = pixelrechitRangeIteratorBegin;
1176  std::vector<PSimHit> matched;
1177 
1178  //----Loop over rechits for this detId
1179  for ( ; pixeliter != pixelrechitRangeIteratorEnd; ++pixeliter) {
1180 
1181  matched.clear();
1182  matched = associate.associateHit(*pixeliter);
1183 
1184  if ( !matched.empty() ) {
1185 
1186  float closest = 9999.9;
1187  //std::vector<PSimHit>::const_iterator closestit = matched.begin();
1188  LocalPoint lp = pixeliter->localPosition();
1189  float rechit_x = lp.x();
1190  float rechit_y = lp.y();
1191 
1192  float sim_x = 0.;
1193  float sim_y = 0.;
1194 
1195  //loop over sim hits and fill closet
1196  for (std::vector<PSimHit>::const_iterator m = matched.begin();
1197  m != matched.end(); ++m) {
1198 
1199  float sim_x1 = (*m).entryPoint().x();
1200  float sim_x2 = (*m).exitPoint().x();
1201  float sim_xpos = 0.5*(sim_x1+sim_x2);
1202 
1203  float sim_y1 = (*m).entryPoint().y();
1204  float sim_y2 = (*m).exitPoint().y();
1205  float sim_ypos = 0.5*(sim_y1+sim_y2);
1206 
1207  float x_res = fabs(sim_xpos - rechit_x);
1208  float y_res = fabs(sim_ypos - rechit_y);
1209 
1210  float dist = sqrt(x_res*x_res + y_res*y_res);
1211 
1212  if ( dist < closest ) {
1213  closest = dist;
1214  sim_x = sim_xpos;
1215  sim_y = sim_ypos;
1216  }
1217  } // end sim hit loop
1218 
1219  // get Barrel pixels
1220  if (subid == sdPxlBrl) {
1221 
1222  ++nPxlBrl;
1223 
1224  if (tTopo->pxbLayer(myid) == 1) {
1225  BRL1RX.push_back(rechit_x);
1226  BRL1RY.push_back(rechit_y);
1227  BRL1SX.push_back(sim_x);
1228  BRL1SY.push_back(sim_y);
1229  }
1230  if (tTopo->pxbLayer(myid) == 2) {
1231  BRL2RX.push_back(rechit_x);
1232  BRL2RY.push_back(rechit_y);
1233  BRL2SX.push_back(sim_x);
1234  BRL2SY.push_back(sim_y);
1235  }
1236  if (tTopo->pxbLayer(myid) == 3) {
1237  BRL3RX.push_back(rechit_x);
1238  BRL3RY.push_back(rechit_y);
1239  BRL3SX.push_back(sim_x);
1240  BRL3SY.push_back(sim_y);
1241  }
1242  }
1243 
1244  // get Forward pixels
1245  if (subid == sdPxlFwd) {
1246 
1247  ++nPxlFwd;
1248 
1249  if (tTopo->pxfDisk(myid) == 1) {
1250  if (tTopo->pxfSide(myid) == 1) {
1251  FWD1nRX.push_back(rechit_x);
1252  FWD1nRY.push_back(rechit_y);
1253  FWD1nSX.push_back(sim_x);
1254  FWD1nSY.push_back(sim_y);
1255  }
1256  if (tTopo->pxfSide(myid) == 2) {
1257  FWD1pRX.push_back(rechit_x);
1258  FWD1pRY.push_back(rechit_y);
1259  FWD1pSX.push_back(sim_x);
1260  FWD1pSY.push_back(sim_y);
1261  }
1262  }
1263  if (tTopo->pxfDisk(myid) == 2) {
1264  if (tTopo->pxfSide(myid) == 1) {
1265  FWD2nRX.push_back(rechit_x);
1266  FWD2nRY.push_back(rechit_y);
1267  FWD2nSX.push_back(sim_x);
1268  FWD2nSY.push_back(sim_y);
1269  }
1270  if (tTopo->pxfSide(myid) == 2) {
1271  FWD2pRX.push_back(rechit_x);
1272  FWD2pRY.push_back(rechit_y);
1273  FWD2pSX.push_back(sim_x);
1274  FWD2pSY.push_back(sim_y);
1275  }
1276  }
1277  }
1278  } // end matched emtpy
1279  } // <-----end rechit loop
1280  } // <------ end detunit loop
1281 
1282 
1283  if (verbosity > 1) {
1284  eventout += "\n Number of BrlPixelRecHits collected:...... ";
1285  eventout += nPxlBrl;
1286  }
1287 
1288  if (verbosity > 1) {
1289  eventout += "\n Number of FrwdPixelRecHits collected:..... ";
1290  eventout += nPxlFwd;
1291  }
1292 
1293  if (verbosity > 0)
1294  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1295 
1296  return;
1297 }
1298 
1300 {
1301  std::string MsgLoggerCat = "GlobalRecHitsProducer_storeTrk";
1302 
1303  if (verbosity > 2) {
1304 
1305  // strip output
1306  TString eventout("\n nTIBL1 = ");
1307  eventout += TIBL1RX.size();
1308  for (unsigned int i = 0; i < TIBL1RX.size(); ++i) {
1309  eventout += "\n (RX, RY, SX, SY) = (";
1310  eventout += TIBL1RX[i];
1311  eventout += ", ";
1312  eventout += TIBL1RY[i];
1313  eventout += ", ";
1314  eventout += TIBL1SX[i];
1315  eventout += ", ";
1316  eventout += TIBL1SY[i];
1317  eventout += ")";
1318  }
1319  eventout += "\n nTIBL2 = ";
1320  eventout += TIBL2RX.size();
1321  for (unsigned int i = 0; i < TIBL2RX.size(); ++i) {
1322  eventout += "\n (RX, RY, SX, SY) = (";
1323  eventout += TIBL2RX[i];
1324  eventout += ", ";
1325  eventout += TIBL2RY[i];
1326  eventout += ", ";
1327  eventout += TIBL2SX[i];
1328  eventout += ", ";
1329  eventout += TIBL2SY[i];
1330  eventout += ")";
1331  }
1332  eventout += "\n nTIBL3 = ";
1333  eventout += TIBL3RX.size();
1334  for (unsigned int i = 0; i < TIBL3RX.size(); ++i) {
1335  eventout += "\n (RX, RY, SX, SY) = (";
1336  eventout += TIBL3RX[i];
1337  eventout += ", ";
1338  eventout += TIBL3RY[i];
1339  eventout += ", ";
1340  eventout += TIBL3SX[i];
1341  eventout += ", ";
1342  eventout += TIBL3SY[i];
1343  eventout += ")";
1344  }
1345  eventout += "\n nTIBL4 = ";
1346  eventout += TIBL4RX.size();
1347  for (unsigned int i = 0; i < TIBL4RX.size(); ++i) {
1348  eventout += "\n (RX, RY, SX, SY) = (";
1349  eventout += TIBL4RX[i];
1350  eventout += ", ";
1351  eventout += TIBL4RY[i];
1352  eventout += ", ";
1353  eventout += TIBL4SX[i];
1354  eventout += ", ";
1355  eventout += TIBL4SY[i];
1356  eventout += ")";
1357  }
1358  eventout += "\n nTOBL1 = ";
1359  eventout += TOBL1RX.size();
1360  for (unsigned int i = 0; i < TOBL1RX.size(); ++i) {
1361  eventout += "\n (RX, RY, SX, SY) = (";
1362  eventout += TOBL1RX[i];
1363  eventout += ", ";
1364  eventout += TOBL1RY[i];
1365  eventout += ", ";
1366  eventout += TOBL1SX[i];
1367  eventout += ", ";
1368  eventout += TOBL1SY[i];
1369  eventout += ")";
1370  }
1371  eventout += "\n nTOBL2 = ";
1372  eventout += TOBL2RX.size();
1373  for (unsigned int i = 0; i < TOBL2RX.size(); ++i) {
1374  eventout += "\n (RX, RY, SX, SY) = (";
1375  eventout += TOBL2RX[i];
1376  eventout += ", ";
1377  eventout += TOBL2RY[i];
1378  eventout += ", ";
1379  eventout += TOBL2SX[i];
1380  eventout += ", ";
1381  eventout += TOBL2SY[i];
1382  eventout += ")";
1383  }
1384  eventout += "\n nTOBL3 = ";
1385  eventout += TOBL3RX.size();
1386  for (unsigned int i = 0; i < TOBL3RX.size(); ++i) {
1387  eventout += "\n (RX, RY, SX, SY) = (";
1388  eventout += TOBL3RX[i];
1389  eventout += ", ";
1390  eventout += TOBL3RY[i];
1391  eventout += ", ";
1392  eventout += TOBL3SX[i];
1393  eventout += ", ";
1394  eventout += TOBL3SY[i];
1395  eventout += ")";
1396  }
1397  eventout += "\n nTOBL4 = ";
1398  eventout += TOBL4RX.size();
1399  for (unsigned int i = 0; i < TOBL4RX.size(); ++i) {
1400  eventout += "\n (RX, RY, SX, SY) = (";
1401  eventout += TOBL4RX[i];
1402  eventout += ", ";
1403  eventout += TOBL4RY[i];
1404  eventout += ", ";
1405  eventout += TOBL4SX[i];
1406  eventout += ", ";
1407  eventout += TOBL4SY[i];
1408  eventout += ")";
1409  }
1410  eventout += "\n nTIDW1 = ";
1411  eventout += TIDW1RX.size();
1412  for (unsigned int i = 0; i < TIDW1RX.size(); ++i) {
1413  eventout += "\n (RX, RY, SX, SY) = (";
1414  eventout += TIDW1RX[i];
1415  eventout += ", ";
1416  eventout += TIDW1RY[i];
1417  eventout += ", ";
1418  eventout += TIDW1SX[i];
1419  eventout += ", ";
1420  eventout += TIDW1SY[i];
1421  eventout += ")";
1422  }
1423  eventout += "\n nTIDW2 = ";
1424  eventout += TIDW2RX.size();
1425  for (unsigned int i = 0; i < TIDW2RX.size(); ++i) {
1426  eventout += "\n (RX, RY, SX, SY) = (";
1427  eventout += TIDW2RX[i];
1428  eventout += ", ";
1429  eventout += TIDW2RY[i];
1430  eventout += ", ";
1431  eventout += TIDW2SX[i];
1432  eventout += ", ";
1433  eventout += TIDW2SY[i];
1434  eventout += ")";
1435  }
1436  eventout += "\n nTIDW3 = ";
1437  eventout += TIDW3RX.size();
1438  for (unsigned int i = 0; i < TIDW3RX.size(); ++i) {
1439  eventout += "\n (RX, RY, SX, SY) = (";
1440  eventout += TIDW3RX[i];
1441  eventout += ", ";
1442  eventout += TIDW3RY[i];
1443  eventout += ", ";
1444  eventout += TIDW3SX[i];
1445  eventout += ", ";
1446  eventout += TIDW3SY[i];
1447  eventout += ")";
1448  }
1449  eventout += "\n nTECW1 = ";
1450  eventout += TECW1RX.size();
1451  for (unsigned int i = 0; i < TECW1RX.size(); ++i) {
1452  eventout += "\n (RX, RY, SX, SY) = (";
1453  eventout += TECW1RX[i];
1454  eventout += ", ";
1455  eventout += TECW1RY[i];
1456  eventout += ", ";
1457  eventout += TECW1SX[i];
1458  eventout += ", ";
1459  eventout += TECW1SY[i];
1460  eventout += ")";
1461  }
1462  eventout += "\n nTECW2 = ";
1463  eventout += TECW2RX.size();
1464  for (unsigned int i = 0; i < TECW2RX.size(); ++i) {
1465  eventout += "\n (RX, RY, SX, SY) = (";
1466  eventout += TECW2RX[i];
1467  eventout += ", ";
1468  eventout += TECW2RY[i];
1469  eventout += ", ";
1470  eventout += TECW2SX[i];
1471  eventout += ", ";
1472  eventout += TECW2SY[i];
1473  eventout += ")";
1474  }
1475  eventout += "\n nTECW3 = ";
1476  eventout += TECW3RX.size();
1477  for (unsigned int i = 0; i < TECW3RX.size(); ++i) {
1478  eventout += "\n (RX, RY, SX, SY) = (";
1479  eventout += TECW3RX[i];
1480  eventout += ", ";
1481  eventout += TECW3RY[i];
1482  eventout += ", ";
1483  eventout += TECW3SX[i];
1484  eventout += ", ";
1485  eventout += TECW3SY[i];
1486  eventout += ")";
1487  }
1488  eventout += "\n nTECW4 = ";
1489  eventout += TECW4RX.size();
1490  for (unsigned int i = 0; i < TECW4RX.size(); ++i) {
1491  eventout += "\n (RX, RY, SX, SY) = (";
1492  eventout += TECW4RX[i];
1493  eventout += ", ";
1494  eventout += TECW4RY[i];
1495  eventout += ", ";
1496  eventout += TECW4SX[i];
1497  eventout += ", ";
1498  eventout += TECW4SY[i];
1499  eventout += ")";
1500  }
1501  eventout += "\n nTECW5 = ";
1502  eventout += TECW5RX.size();
1503  for (unsigned int i = 0; i < TECW5RX.size(); ++i) {
1504  eventout += "\n (RX, RY, SX, SY) = (";
1505  eventout += TECW5RX[i];
1506  eventout += ", ";
1507  eventout += TECW5RY[i];
1508  eventout += ", ";
1509  eventout += TECW5SX[i];
1510  eventout += ", ";
1511  eventout += TECW5SY[i];
1512  eventout += ")";
1513  }
1514  eventout += "\n nTECW6 = ";
1515  eventout += TECW6RX.size();
1516  for (unsigned int i = 0; i < TECW6RX.size(); ++i) {
1517  eventout += "\n (RX, RY, SX, SY) = (";
1518  eventout += TECW6RX[i];
1519  eventout += ", ";
1520  eventout += TECW6RY[i];
1521  eventout += ", ";
1522  eventout += TECW6SX[i];
1523  eventout += ", ";
1524  eventout += TECW6SY[i];
1525  eventout += ")";
1526  }
1527  eventout += "\n nTECW7 = ";
1528  eventout += TECW7RX.size();
1529  for (unsigned int i = 0; i < TECW7RX.size(); ++i) {
1530  eventout += "\n (RX, RY, SX, SY) = (";
1531  eventout += TECW7RX[i];
1532  eventout += ", ";
1533  eventout += TECW7RY[i];
1534  eventout += ", ";
1535  eventout += TECW7SX[i];
1536  eventout += ", ";
1537  eventout += TECW7SY[i];
1538  eventout += ")";
1539  }
1540  eventout += "\n nTECW8 = ";
1541  eventout += TECW8RX.size();
1542  for (unsigned int i = 0; i < TECW8RX.size(); ++i) {
1543  eventout += "\n (RX, RY, SX, SY) = (";
1544  eventout += TECW8RX[i];
1545  eventout += ", ";
1546  eventout += TECW8RY[i];
1547  eventout += ", ";
1548  eventout += TECW8SX[i];
1549  eventout += ", ";
1550  eventout += TECW8SY[i];
1551  eventout += ")";
1552  }
1553 
1554  // pixel output
1555  eventout += "\n nBRL1 = ";
1556  eventout += BRL1RX.size();
1557  for (unsigned int i = 0; i < BRL1RX.size(); ++i) {
1558  eventout += "\n (RX, RY, SX, SY) = (";
1559  eventout += BRL1RX[i];
1560  eventout += ", ";
1561  eventout += BRL1RY[i];
1562  eventout += ", ";
1563  eventout += BRL1SX[i];
1564  eventout += ", ";
1565  eventout += BRL1SY[i];
1566  eventout += ")";
1567  }
1568  eventout += "\n nBRL2 = ";
1569  eventout += BRL2RX.size();
1570  for (unsigned int i = 0; i < BRL2RX.size(); ++i) {
1571  eventout += "\n (RX, RY, SX, SY) = (";
1572  eventout += BRL2RX[i];
1573  eventout += ", ";
1574  eventout += BRL2RY[i];
1575  eventout += ", ";
1576  eventout += BRL2SX[i];
1577  eventout += ", ";
1578  eventout += BRL2SY[i];
1579  eventout += ")";
1580  }
1581  eventout += "\n nBRL3 = ";
1582  eventout += BRL3RX.size();
1583  for (unsigned int i = 0; i < BRL3RX.size(); ++i) {
1584  eventout += "\n (RX, RY, SX, SY) = (";
1585  eventout += BRL3RX[i];
1586  eventout += ", ";
1587  eventout += BRL3RY[i];
1588  eventout += ", ";
1589  eventout += BRL3SX[i];
1590  eventout += ", ";
1591  eventout += BRL3SY[i];
1592  eventout += ")";
1593  }
1594  eventout += "\n nFWD1p = ";
1595  eventout += FWD1pRX.size();
1596  for (unsigned int i = 0; i < FWD1pRX.size(); ++i) {
1597  eventout += "\n (RX, RY, SX, SY) = (";
1598  eventout += FWD1pRX[i];
1599  eventout += ", ";
1600  eventout += FWD1pRY[i];
1601  eventout += ", ";
1602  eventout += FWD1pSX[i];
1603  eventout += ", ";
1604  eventout += FWD1pSY[i];
1605  eventout += ")";
1606  }
1607  eventout += "\n nFWD1n = ";
1608  eventout += FWD1nRX.size();
1609  for (unsigned int i = 0; i < FWD1nRX.size(); ++i) {
1610  eventout += "\n (RX, RY, SX, SY) = (";
1611  eventout += FWD1nRX[i];
1612  eventout += ", ";
1613  eventout += FWD1nRY[i];
1614  eventout += ", ";
1615  eventout += FWD1nSX[i];
1616  eventout += ", ";
1617  eventout += FWD1nSY[i];
1618  eventout += ")";
1619  }
1620  eventout += "\n nFWD2p = ";
1621  eventout += FWD2pRX.size();
1622  for (unsigned int i = 0; i < FWD2pRX.size(); ++i) {
1623  eventout += "\n (RX, RY, SX, SY) = (";
1624  eventout += FWD2pRX[i];
1625  eventout += ", ";
1626  eventout += FWD2pRY[i];
1627  eventout += ", ";
1628  eventout += FWD2pSX[i];
1629  eventout += ", ";
1630  eventout += FWD2pSY[i];
1631  eventout += ")";
1632  }
1633  eventout += "\n nFWD2p = ";
1634  eventout += FWD2nRX.size();
1635  for (unsigned int i = 0; i < FWD2nRX.size(); ++i) {
1636  eventout += "\n (RX, RY, SX, SY) = (";
1637  eventout += FWD2nRX[i];
1638  eventout += ", ";
1639  eventout += FWD2nRY[i];
1640  eventout += ", ";
1641  eventout += FWD2nSX[i];
1642  eventout += ", ";
1643  eventout += FWD2nSY[i];
1644  eventout += ")";
1645  }
1646 
1647  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1648  }
1649 
1650  // strip output
1670 
1671  // pixel output
1679 
1680  return;
1681 }
1682 
1684  const edm::EventSetup& iSetup)
1685 {
1686  std::string MsgLoggerCat = "GlobalRecHitsProducer_fillMuon";
1687 
1688  TString eventout;
1689  if (verbosity > 0)
1690  eventout = "\nGathering info:";
1691 
1692  // get DT information
1694  iSetup.get<MuonGeometryRecord>().get(dtGeom);
1695  if (!dtGeom.isValid()) {
1696  edm::LogWarning(MsgLoggerCat)
1697  << "Unable to find DTMuonGeometryRecord in event!";
1698  return;
1699  }
1700 
1702  iEvent.getByToken(MuDTSimSrc_Token_, dtsimHits);
1703  if (!dtsimHits.isValid()) {
1704  edm::LogWarning(MsgLoggerCat)
1705  << "Unable to find dtsimHits in event!";
1706  return;
1707  }
1708 
1709  std::map<DTWireId, edm::PSimHitContainer> simHitsPerWire =
1711 
1713  iEvent.getByToken(MuDTSrc_Token_, dtRecHits);
1714  if (!dtRecHits.isValid()) {
1715  edm::LogWarning(MsgLoggerCat)
1716  << "Unable to find dtRecHits in event!";
1717  return;
1718  }
1719 
1720  std::map<DTWireId, std::vector<DTRecHit1DPair> > recHitsPerWire =
1721  map1DRecHitsPerWire(dtRecHits.product());
1722 
1723 
1724  int nDt = compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 1);
1725 
1726  if (verbosity > 1) {
1727  eventout += "\n Number of DtMuonRecHits collected:........ ";
1728  eventout += nDt;
1729  }
1730 
1731  // get CSC Strip information
1732  // get map of sim hits
1733  theMap.clear();
1734  //edm::Handle<CrossingFrame> cf;
1736  //iEvent.getByType(cf);
1737  //if (!cf.isValid()) {
1738  // edm::LogWarning(MsgLoggerCat)
1739  // << "Unable to find CrossingFrame in event!";
1740  // return;
1741  //}
1742  //MixCollection<PSimHit> simHits(cf.product(), "MuonCSCHits");
1743  iEvent.getByToken(MuCSCHits_Token_,cf);
1744  if (!cf.isValid()) {
1745  edm::LogWarning(MsgLoggerCat)
1746  << "Unable to find muo CSC crossingFrame in event!";
1747  return;
1748  }
1750 
1751  // arrange the hits by detUnit
1752  for(MixCollection<PSimHit>::MixItr hitItr = simHits.begin();
1753  hitItr != simHits.end(); ++hitItr)
1754  {
1755  theMap[hitItr->detUnitId()].push_back(*hitItr);
1756  }
1757 
1758  // get geometry
1760  iSetup.get<MuonGeometryRecord>().get(hGeom);
1761  if (!hGeom.isValid()) {
1762  edm::LogWarning(MsgLoggerCat)
1763  << "Unable to find CSCMuonGeometryRecord in event!";
1764  return;
1765  }
1766  const CSCGeometry *theCSCGeometry = &*hGeom;
1767 
1768  // get rechits
1770  iEvent.getByToken(MuCSCSrc_Token_, hRecHits);
1771  if (!hRecHits.isValid()) {
1772  edm::LogWarning(MsgLoggerCat)
1773  << "Unable to find CSC RecHits in event!";
1774  return;
1775  }
1776  const CSCRecHit2DCollection *cscRecHits = hRecHits.product();
1777 
1778  int nCSC = 0;
1779  for (CSCRecHit2DCollection::const_iterator recHitItr = cscRecHits->begin();
1780  recHitItr != cscRecHits->end(); ++recHitItr) {
1781 
1782  int detId = (*recHitItr).cscDetId().rawId();
1783 
1785  std::map<int, edm::PSimHitContainer>::const_iterator mapItr =
1786  theMap.find(detId);
1787  if (mapItr != theMap.end()) {
1788  simHits = mapItr->second;
1789  }
1790 
1791  if (simHits.size() == 1) {
1792  ++nCSC;
1793 
1794  const GeomDetUnit* detUnit =
1795  theCSCGeometry->idToDetUnit(CSCDetId(detId));
1796  const CSCLayer *layer = dynamic_cast<const CSCLayer *>(detUnit);
1797 
1798  int chamberType = layer->chamber()->specs()->chamberType();
1799  plotResolution(simHits[0], *recHitItr, layer, chamberType);
1800  }
1801  }
1802 
1803  if (verbosity > 1) {
1804  eventout += "\n Number of CSCRecHits collected:........... ";
1805  eventout += nCSC;
1806  }
1807 
1808  // get RPC information
1809  std::map<double, int> mapsim, maprec;
1810  std::map<int, double> nmapsim, nmaprec;
1811 
1813  iSetup.get<MuonGeometryRecord>().get(rpcGeom);
1814  if (!rpcGeom.isValid()) {
1815  edm::LogWarning(MsgLoggerCat)
1816  << "Unable to find RPCMuonGeometryRecord in event!";
1817  return;
1818  }
1819 
1821  iEvent.getByToken(MuRPCSimSrc_Token_, simHit);
1822  if (!simHit.isValid()) {
1823  edm::LogWarning(MsgLoggerCat)
1824  << "Unable to find RPCSimHit in event!";
1825  return;
1826  }
1827 
1829  iEvent.getByToken(MuRPCSrc_Token_, recHit);
1830  if (!simHit.isValid()) {
1831  edm::LogWarning(MsgLoggerCat)
1832  << "Unable to find RPCRecHit in event!";
1833  return;
1834  }
1835 
1836  int nRPC = 0;
1838  int nrec = 0;
1839  for (recIt = recHit->begin(); recIt != recHit->end(); ++recIt) {
1840  RPCDetId Rid = (RPCDetId)(*recIt).rpcId();
1841  const RPCRoll *roll = dynamic_cast<const RPCRoll*>(rpcGeom->roll(Rid));
1842  if (roll->isForward()) {
1843 
1844  if (verbosity > 1) {
1845  eventout += "\n Number of RPCRecHits collected:........... ";
1846  eventout += nRPC;
1847  }
1848 
1849  if (verbosity > 0)
1850  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1851  return;
1852  }
1853  nrec = nrec + 1;
1854  LocalPoint rhitlocal = (*recIt).localPosition();
1855  double rhitlocalx = rhitlocal.x();
1856  maprec[rhitlocalx] = nrec;
1857  }
1858 
1859  int i = 0;
1860  for (std::map<double,int>::iterator iter = maprec.begin();
1861  iter != maprec.end(); ++iter) {
1862  i = i + 1;
1863  nmaprec[i] = (*iter).first;
1864  }
1865 
1866  edm::PSimHitContainer::const_iterator simIt;
1867  int nsim = 0;
1868  for (simIt = simHit->begin(); simIt != simHit->end(); simIt++) {
1869  int ptype = (*simIt).particleType();
1870  //RPCDetId Rsid = (RPCDetId)(*simIt).detUnitId();
1871  if (ptype == 13 || ptype == -13) {
1872  nsim = nsim + 1;
1873  LocalPoint shitlocal = (*simIt).localPosition();
1874  double shitlocalx = shitlocal.x();
1875  mapsim[shitlocalx] = nsim;
1876  }
1877  }
1878 
1879  i = 0;
1880  for (std::map<double,int>::iterator iter = mapsim.begin();
1881  iter != mapsim.end(); ++iter) {
1882  i = i + 1;
1883  nmapsim[i] = (*iter).first;
1884  }
1885 
1886  if (nsim == nrec) {
1887  for (int r = 0; r < nsim; r++) {
1888  ++nRPC;
1889  RPCRHX.push_back(nmaprec[r+1]);
1890  RPCSHX.push_back(nmapsim[r+1]);
1891  }
1892  }
1893 
1894  if (verbosity > 1) {
1895  eventout += "\n Number of RPCRecHits collected:........... ";
1896  eventout += nRPC;
1897  }
1898 
1899  if (verbosity > 0)
1900  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1901 
1902  return;
1903 }
1904 
1906 {
1907  std::string MsgLoggerCat = "GlobalRecHitsProducer_storeMuon";
1908 
1909  if (verbosity > 2) {
1910 
1911  // dt output
1912  TString eventout("\n nDT = ");
1913  eventout += DTRHD.size();
1914  for (unsigned int i = 0; i < DTRHD.size(); ++i) {
1915  eventout += "\n (RHD, SHD) = (";
1916  eventout += DTRHD[i];
1917  eventout += ", ";
1918  eventout += DTSHD[i];
1919  eventout += ")";
1920  }
1921 
1922  // CSC Strip
1923  eventout += "\n nCSC = ";
1924  eventout += CSCRHPHI.size();
1925  for (unsigned int i = 0; i < CSCRHPHI.size(); ++i) {
1926  eventout += "\n (rhphi, rhperp, shphi) = (";
1927  eventout += CSCRHPHI[i];
1928  eventout += ", ";
1929  eventout += CSCRHPERP[i];
1930  eventout += ", ";
1931  eventout += CSCSHPHI[i];
1932  eventout += ")";
1933  }
1934 
1935  // RPC
1936  eventout += "\n nRPC = ";
1937  eventout += RPCRHX.size();
1938  for (unsigned int i = 0; i < RPCRHX.size(); ++i) {
1939  eventout += "\n (rhx, shx) = (";
1940  eventout += RPCRHX[i];
1941  eventout += ", ";
1942  eventout += RPCSHX[i];
1943  eventout += ")";
1944  }
1945 
1946  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1947  }
1948 
1949  product.putDTRecHits(DTRHD,DTSHD);
1950 
1952 
1953  product.putRPCRecHits(RPCRHX,RPCSHX);
1954 
1955  return;
1956 }
1957 
1959 {
1960  std::string MsgLoggerCat = "GlobalRecHitsProducer_clear";
1961 
1962  if (verbosity > 0)
1963  edm::LogInfo(MsgLoggerCat)
1964  << "Clearing event holders";
1965 
1966  // reset electromagnetic info
1967  // EE info
1968  EERE.clear();
1969  EESHE.clear();
1970  // EB info
1971  EBRE.clear();
1972  EBSHE.clear();
1973  // ES info
1974  ESRE.clear();
1975  ESSHE.clear();
1976 
1977  // reset HCal Info
1978  HBCalREC.clear();
1979  HBCalR.clear();
1980  HBCalSHE.clear();
1981  HECalREC.clear();
1982  HECalR.clear();
1983  HECalSHE.clear();
1984  HOCalREC.clear();
1985  HOCalR.clear();
1986  HOCalSHE.clear();
1987  HFCalREC.clear();
1988  HFCalR.clear();
1989  HFCalSHE.clear();
1990 
1991  // reset Track Info
1992  TIBL1RX.clear();
1993  TIBL2RX.clear();
1994  TIBL3RX.clear();
1995  TIBL4RX.clear();
1996  TIBL1RY.clear();
1997  TIBL2RY.clear();
1998  TIBL3RY.clear();
1999  TIBL4RY.clear();
2000  TIBL1SX.clear();
2001  TIBL2SX.clear();
2002  TIBL3SX.clear();
2003  TIBL4SX.clear();
2004  TIBL1SY.clear();
2005  TIBL2SY.clear();
2006  TIBL3SY.clear();
2007  TIBL4SY.clear();
2008 
2009  TOBL1RX.clear();
2010  TOBL2RX.clear();
2011  TOBL3RX.clear();
2012  TOBL4RX.clear();
2013  TOBL1RY.clear();
2014  TOBL2RY.clear();
2015  TOBL3RY.clear();
2016  TOBL4RY.clear();
2017  TOBL1SX.clear();
2018  TOBL2SX.clear();
2019  TOBL3SX.clear();
2020  TOBL4SX.clear();
2021  TOBL1SY.clear();
2022  TOBL2SY.clear();
2023  TOBL3SY.clear();
2024  TOBL4SY.clear();
2025 
2026  TIDW1RX.clear();
2027  TIDW2RX.clear();
2028  TIDW3RX.clear();
2029  TIDW1RY.clear();
2030  TIDW2RY.clear();
2031  TIDW3RY.clear();
2032  TIDW1SX.clear();
2033  TIDW2SX.clear();
2034  TIDW3SX.clear();
2035  TIDW1SY.clear();
2036  TIDW2SY.clear();
2037  TIDW3SY.clear();
2038 
2039  TECW1RX.clear();
2040  TECW2RX.clear();
2041  TECW3RX.clear();
2042  TECW4RX.clear();
2043  TECW5RX.clear();
2044  TECW6RX.clear();
2045  TECW7RX.clear();
2046  TECW8RX.clear();
2047  TECW1RY.clear();
2048  TECW2RY.clear();
2049  TECW3RY.clear();
2050  TECW4RY.clear();
2051  TECW5RY.clear();
2052  TECW6RY.clear();
2053  TECW7RY.clear();
2054  TECW8RY.clear();
2055  TECW1SX.clear();
2056  TECW2SX.clear();
2057  TECW3SX.clear();
2058  TECW4SX.clear();
2059  TECW5SX.clear();
2060  TECW6SX.clear();
2061  TECW7SX.clear();
2062  TECW8SX.clear();
2063  TECW1SY.clear();
2064  TECW2SY.clear();
2065  TECW3SY.clear();
2066  TECW4SY.clear();
2067  TECW5SY.clear();
2068  TECW6SY.clear();
2069  TECW7SY.clear();
2070  TECW8SY.clear();
2071 
2072  BRL1RX.clear();
2073  BRL1RY.clear();
2074  BRL1SX.clear();
2075  BRL1SY.clear();
2076  BRL2RX.clear();
2077  BRL2RY.clear();
2078  BRL2SX.clear();
2079  BRL2SY.clear();
2080  BRL3RX.clear();
2081  BRL3RY.clear();
2082  BRL3SX.clear();
2083  BRL3SY.clear();
2084 
2085  FWD1pRX.clear();
2086  FWD1pRY.clear();
2087  FWD1pSX.clear();
2088  FWD1pSY.clear();
2089  FWD1nRX.clear();
2090  FWD1nRY.clear();
2091  FWD1nSX.clear();
2092  FWD1nSY.clear();
2093  FWD2pRX.clear();
2094  FWD2pRY.clear();
2095  FWD2pSX.clear();
2096  FWD2pSY.clear();
2097  FWD2nRX.clear();
2098  FWD2nRY.clear();
2099  FWD2nSX.clear();
2100  FWD2nSY.clear();
2101 
2102  //muon clear
2103  DTRHD.clear();
2104  DTSHD.clear();
2105 
2106  CSCRHPHI.clear();
2107  CSCRHPERP.clear();
2108  CSCSHPHI.clear();
2109 
2110  RPCRHX.clear();
2111  RPCSHX.clear();
2112 
2113  return;
2114 }
2115 
2116 //needed by to do the residual for matched hits in SiStrip
2117 std::pair<LocalPoint,LocalVector>
2119  const StripGeomDetUnit* stripDet,
2120  const BoundPlane& plane)
2121 {
2122 
2123  const StripTopology& topol = stripDet->specificTopology();
2124  GlobalPoint globalpos= stripDet->surface().toGlobal(hit.localPosition());
2125  LocalPoint localHit = plane.toLocal(globalpos);
2126  //track direction
2127  LocalVector locdir=hit.localDirection();
2128  //rotate track in new frame
2129 
2130  GlobalVector globaldir= stripDet->surface().toGlobal(locdir);
2131  LocalVector dir=plane.toLocal(globaldir);
2132  float scale = -localHit.z() / dir.z();
2133 
2134  LocalPoint projectedPos = localHit + scale*dir;
2135 
2136  float selfAngle = topol.stripAngle( topol.strip( hit.localPosition()));
2137 
2138  // vector along strip in hit frame
2139  LocalVector stripDir( sin(selfAngle), cos(selfAngle), 0);
2140 
2141  LocalVector
2142  localStripDir(plane.toLocal(stripDet->surface().toGlobal(stripDir)));
2143 
2144  return std::pair<LocalPoint,LocalVector>( projectedPos, localStripDir);
2145 }
2146 
2147 // Return a map between DTRecHit1DPair and wireId
2148 std::map<DTWireId, std::vector<DTRecHit1DPair> >
2150  dt1DRecHitPairs) {
2151  std::map<DTWireId, std::vector<DTRecHit1DPair> > ret;
2152 
2153  for(DTRecHitCollection::const_iterator rechit = dt1DRecHitPairs->begin();
2154  rechit != dt1DRecHitPairs->end(); rechit++) {
2155  ret[(*rechit).wireId()].push_back(*rechit);
2156  }
2157 
2158  return ret;
2159 }
2160 
2161 // Compute SimHit distance from wire (cm)
2163  DTWireId wireId,
2164  const PSimHit& hit) {
2165  float xwire = layer->specificTopology().wirePosition(wireId.wire());
2166  LocalPoint entryP = hit.entryPoint();
2167  LocalPoint exitP = hit.exitPoint();
2168  float xEntry = entryP.x()-xwire;
2169  float xExit = exitP.x()-xwire;
2170 
2171  //FIXME: check...
2172  return fabs(xEntry - (entryP.z()*(xExit-xEntry))/(exitP.z()-entryP.z()));
2173 }
2174 
2175 // Find the RecHit closest to the muon SimHit
2176 template <typename type>
2177 const type*
2179  DTWireId wireId,
2180  const std::vector<type>& recHits,
2181  const float simHitDist) {
2182  float res = 99999;
2183  const type* theBestRecHit = 0;
2184  // Loop over RecHits within the cell
2185  for(typename std::vector<type>::const_iterator recHit = recHits.begin();
2186  recHit != recHits.end();
2187  recHit++) {
2188  float distTmp = recHitDistFromWire(*recHit, layer);
2189  if(fabs(distTmp-simHitDist) < res) {
2190  res = fabs(distTmp-simHitDist);
2191  theBestRecHit = &(*recHit);
2192  }
2193  } // End of loop over RecHits within the cell
2194 
2195  return theBestRecHit;
2196 }
2197 
2198 // Compute the distance from wire (cm) of a hits in a DTRecHit1DPair
2199 float
2201  const DTLayer* layer) {
2202  // Compute the rechit distance from wire
2203  return fabs(hitPair.localPosition(DTEnums::Left).x() -
2204  hitPair.localPosition(DTEnums::Right).x())/2.;
2205 }
2206 
2207 // Compute the distance from wire (cm) of a hits in a DTRecHit1D
2208 float
2210  const DTLayer* layer) {
2211  return fabs(recHit.localPosition().x() -
2212  layer->specificTopology().wirePosition(recHit.wireId().wire()));
2213 }
2214 
2215 template <typename type>
2217  const std::map<DTWireId, std::vector<PSimHit> >&
2218  _simHitsPerWire,
2219  const std::map<DTWireId, std::vector<type> >&
2220  _recHitsPerWire,
2221  int step) {
2222 
2223  std::map<DTWireId, std::vector<PSimHit> > simHitsPerWire = _simHitsPerWire;
2224  std::map<DTWireId, std::vector<type> > recHitsPerWire = _recHitsPerWire;
2225  int nDt = 0;
2226  // Loop over cells with a muon SimHit
2227  for(std::map<DTWireId, std::vector<PSimHit> >::const_iterator wireAndSHits =
2228  simHitsPerWire.begin();
2229  wireAndSHits != simHitsPerWire.end();
2230  wireAndSHits++) {
2231  DTWireId wireId = (*wireAndSHits).first;
2232  std::vector<PSimHit> simHitsInCell = (*wireAndSHits).second;
2233 
2234  // Get the layer
2235  const DTLayer* layer = dtGeom->layer(wireId);
2236 
2237  // Look for a mu hit in the cell
2238  const PSimHit* muSimHit = DTHitQualityUtils::findMuSimHit(simHitsInCell);
2239  if (muSimHit==0) {
2240  continue; // Skip this cell
2241  }
2242 
2243  // Find the distance of the simhit from the wire
2244  float simHitWireDist = simHitDistFromWire(layer, wireId, *muSimHit);
2245  // Skip simhits out of the cell
2246  if(simHitWireDist>2.1) {
2247  continue; // Skip this cell
2248  }
2249  //GlobalPoint simHitGlobalPos = layer->toGlobal(muSimHit->localPosition());
2250 
2251  // Look for RecHits in the same cell
2252  if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
2253  continue; // No RecHit found in this cell
2254  } else {
2255 
2256  // vector<type> recHits = (*wireAndRecHits).second;
2257  std::vector<type> recHits = recHitsPerWire[wireId];
2258 
2259  // Find the best RecHit
2260  const type* theBestRecHit =
2261  findBestRecHit(layer, wireId, recHits, simHitWireDist);
2262 
2263  float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
2264 
2265  ++nDt;
2266 
2267  DTRHD.push_back(recHitWireDist);
2268  DTSHD.push_back(simHitWireDist);
2269 
2270  } // find rechits
2271  } // loop over simhits
2272 
2273  return nDt;
2274 }
2275 
2276 void
2278  const CSCRecHit2D & recHit,
2279  const CSCLayer * layer,
2280  int chamberType) {
2281  GlobalPoint simHitPos = layer->toGlobal(simHit.localPosition());
2282  GlobalPoint recHitPos = layer->toGlobal(recHit.localPosition());
2283 
2284  CSCRHPHI.push_back(recHitPos.phi());
2285  CSCRHPERP.push_back(recHitPos.perp());
2286  CSCSHPHI.push_back(simHitPos.phi());
2287 }
2288 
2289 //define this as a plug-in
2290 //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 &)
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:450
type
Definition: HCALResponse.h:21
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
T getParameter(std::string const &) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
EventNumber_t event() const
Definition: EventID.h:41
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:122
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:460
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 &)
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
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 &)
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:4
void storeECal(PGlobalRecHit &)
std::map< int, edm::PSimHitContainer > theMap
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
void putBRL2RecHits(const std::vector< float > &rx, const std::vector< float > &ry, const std::vector< float > &sx, const std::vector< float > &sy)
virtual void produce(edm::Event &, const edm::EventSetup &)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
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
virtual LocalPoint localPosition() const final
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:37
#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_
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:60
unsigned int pxbLayer(const DetId &id) const
const_iterator end() const
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 &)
const GeomDetUnit * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: CSCGeometry.cc:93
T const * product() const
Definition: Handle.h:81
int chamberType() const
void putDTRecHits(const std::vector< float > &rhd, const std::vector< float > &shd)
const T & get() const
Definition: EventSetup.h:55
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)
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
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)
LocalPoint localPosition() const
Definition: CSCRecHit2D.h:50
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)
virtual LocalPoint localPosition() const
void getAllStableProvenance(std::vector< StableProvenance const * > &provenances) const
Definition: Event.cc:96
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:107
iterator begin()
Definition: DetSetNew.h:67