CMS 3D CMS Logo

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