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