CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalDigisProducer.cc
Go to the documentation of this file.
1 
11 
13  fName(""), verbosity(0), frequency(0), label(""), getAllProvenances(false),
14  printProvenanceInfo(false), theCSCStripPedestalSum(0),
15  theCSCStripPedestalCount(0), count(0)
16 {
17  std::string MsgLoggerCat = "GlobalDigisProducer_GlobalDigisProducer";
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  ECalEESrc_ = iPSet.getParameter<edm::InputTag>("ECalEESrc");
34  ECalESSrc_ = iPSet.getParameter<edm::InputTag>("ECalESSrc");
35  HCalSrc_ = iPSet.getParameter<edm::InputTag>("HCalSrc");
36  HCalDigi_ = iPSet.getParameter<edm::InputTag>("HCalDigi");
37  SiStripSrc_ = iPSet.getParameter<edm::InputTag>("SiStripSrc");
38  SiPxlSrc_ = iPSet.getParameter<edm::InputTag>("SiPxlSrc");
39  MuDTSrc_ = iPSet.getParameter<edm::InputTag>("MuDTSrc");
40  MuCSCStripSrc_ = iPSet.getParameter<edm::InputTag>("MuCSCStripSrc");
41  MuCSCWireSrc_ = iPSet.getParameter<edm::InputTag>("MuCSCWireSrc");
42 
43  // use value of first digit to determine default output level (inclusive)
44  // 0 is none, 1 is basic, 2 is fill output, 3 is gather output
45  verbosity %= 10;
46 
47  // create persistent object
48  produces<PGlobalDigi>(label);
49 
50  // print out Parameter Set information being used
51  if (verbosity >= 0) {
52  edm::LogInfo(MsgLoggerCat)
53  << "\n===============================\n"
54  << "Initialized as EDProducer with parameter values:\n"
55  << " Name = " << fName << "\n"
56  << " Verbosity = " << verbosity << "\n"
57  << " Frequency = " << frequency << "\n"
58  << " Label = " << label << "\n"
59  << " GetProv = " << getAllProvenances << "\n"
60  << " PrintProv = " << printProvenanceInfo << "\n"
61  << " ECalEBSrc = " << ECalEBSrc_.label()
62  << ":" << ECalEBSrc_.instance() << "\n"
63  << " ECalEESrc = " << ECalEESrc_.label()
64  << ":" << ECalEESrc_.instance() << "\n"
65  << " ECalESSrc = " << ECalESSrc_.label()
66  << ":" << ECalESSrc_.instance() << "\n"
67  << " HCalSrc = " << HCalSrc_.label()
68  << ":" << HCalSrc_.instance() << "\n"
69  << " HCalDigi = " << HCalDigi_.label()
70  << ":" << HCalDigi_.instance() << "\n"
71  << " SiStripSrc = " << SiStripSrc_.label()
72  << ":" << SiStripSrc_.instance() << "\n"
73  << " SiPixelSrc = " << SiPxlSrc_.label()
74  << ":" << SiPxlSrc_.instance() << "\n"
75  << " MuDTSrc = " << MuDTSrc_.label()
76  << ":" << MuDTSrc_.instance() << "\n"
77  << " MuCSCStripSrc = " << MuCSCStripSrc_.label()
78  << ":" << MuCSCStripSrc_.instance() << "\n"
79  << " MuCSCWireSrc = " << MuCSCWireSrc_.label()
80  << ":" << MuCSCWireSrc_.instance() << "\n"
81  << "===============================\n";
82  }
83 
84  // set default constants
85  // ECal
86  ECalgainConv_[0] = 0.;
87  ECalgainConv_[1] = 1.;
88  ECalgainConv_[2] = 2.;
89  ECalgainConv_[3] = 12.;
90  ECalbarrelADCtoGeV_ = 0.035;
91  ECalendcapADCtoGeV_ = 0.06;
92 
93 }
94 
96 {
97 }
98 
100 {
101  std::string MsgLoggerCat = "GlobalDigisProducer_beginJob";
102 
103 // // setup calorimeter constants from service
104 // edm::ESHandle<EcalADCToGeVConstant> pAgc;
105 // iSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
106 // const EcalADCToGeVConstant* agc = pAgc.product();
107 
108  EcalMGPAGainRatio * defaultRatios = new EcalMGPAGainRatio();
109 
110  ECalgainConv_[0] = 0.;
111  ECalgainConv_[1] = 1.;
112  ECalgainConv_[2] = defaultRatios->gain12Over6() ;
113  ECalgainConv_[3] = ECalgainConv_[2]*(defaultRatios->gain6Over1()) ;
114 
115  delete defaultRatios;
116 
117 // ECalbarrelADCtoGeV_ = agc->getEBValue();
118 // ECalendcapADCtoGeV_ = agc->getEEValue();
119 
120  if (verbosity >= 0) {
121  edm::LogInfo(MsgLoggerCat)
122  << "Modified Calorimeter gain constants: g0 = " << ECalgainConv_[0]
123  << ", g1 = " << ECalgainConv_[1] << ", g2 = " << ECalgainConv_[2]
124  << ", g3 = " << ECalgainConv_[3];
125 // edm::LogInfo(MsgLoggerCat)
126 // << "Modified Calorimeter ADCtoGeV constants: barrel = "
127 // << ECalbarrelADCtoGeV_ << ", endcap = " << ECalendcapADCtoGeV_;
128  }
129 
130  // clear storage vectors
131  clear();
132  return;
133 }
134 
136 {
137  std::string MsgLoggerCat = "GlobalDigisProducer_endJob";
138  if (verbosity >= 0)
139  edm::LogInfo(MsgLoggerCat)
140  << "Terminating having processed " << count << " events.";
141  return;
142 }
143 
145  const edm::EventSetup& iSetup)
146 {
147  std::string MsgLoggerCat = "GlobalDigisProducer_produce";
148 
149  // keep track of number of events processed
150  ++count;
151 
152 
153  // THIS BLOCK MIGRATED HERE FROM beginJob:
154  // setup calorimeter constants from service
156  iSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
157  const EcalADCToGeVConstant* agc = pAgc.product();
160  if (verbosity >= 0) {
161  edm::LogInfo(MsgLoggerCat)
162  << "Modified Calorimeter ADCtoGeV constants: barrel = "
163  << ECalbarrelADCtoGeV_ << ", endcap = " << ECalendcapADCtoGeV_;
164  }
165 
166 
167  // get event id information
168  int nrun = iEvent.id().run();
169  int nevt = iEvent.id().event();
170 
171  if (verbosity > 0) {
172  edm::LogInfo(MsgLoggerCat)
173  << "Processing run " << nrun << ", event " << nevt
174  << " (" << count << " events total)";
175  } else if (verbosity == 0) {
176  if (nevt%frequency == 0 || nevt == 1) {
177  edm::LogInfo(MsgLoggerCat)
178  << "Processing run " << nrun << ", event " << nevt
179  << " (" << count << " events total)";
180  }
181  }
182 
183  // clear event holders
184  clear();
185 
186  // look at information available in the event
187  if (getAllProvenances) {
188 
189  std::vector<const edm::Provenance*> AllProv;
190  iEvent.getAllProvenance(AllProv);
191 
192  if (verbosity >= 0)
193  edm::LogInfo(MsgLoggerCat)
194  << "Number of Provenances = " << AllProv.size();
195 
196  if (printProvenanceInfo && (verbosity >= 0)) {
197  TString eventout("\nProvenance info:\n");
198 
199  for (unsigned int i = 0; i < AllProv.size(); ++i) {
200  eventout += "\n ******************************";
201  eventout += "\n Module : ";
202  //eventout += (AllProv[i]->product).moduleLabel();
203  eventout += AllProv[i]->moduleLabel();
204  eventout += "\n ProductID : ";
205  //eventout += (AllProv[i]->product).productID_.id_;
206  eventout += AllProv[i]->productID().id();
207  eventout += "\n ClassName : ";
208  //eventout += (AllProv[i]->product).fullClassName_;
209  eventout += AllProv[i]->className();
210  eventout += "\n InstanceName : ";
211  //eventout += (AllProv[i]->product).productInstanceName_;
212  eventout += AllProv[i]->productInstanceName();
213  eventout += "\n BranchName : ";
214  //eventout += (AllProv[i]->product).branchName_;
215  eventout += AllProv[i]->branchName();
216  }
217  eventout += "\n ******************************\n";
218  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
219  printProvenanceInfo = false;
220  }
221  getAllProvenances = false;
222  }
223 
224  // call fill functions
225  // gather Ecal information from event
226  fillECal(iEvent, iSetup);
227  // gather Hcal information from event
228  fillHCal(iEvent, iSetup);
229  // gather Track information from event
230  fillTrk(iEvent, iSetup);
231  // gather Muon information from event
232  fillMuon(iEvent, iSetup);
233 
234  if (verbosity > 0)
235  edm::LogInfo (MsgLoggerCat)
236  << "Done gathering data from event.";
237 
238  // produce object to put into event
239  std::auto_ptr<PGlobalDigi> pOut(new PGlobalDigi);
240 
241  if (verbosity > 2)
242  edm::LogInfo (MsgLoggerCat)
243  << "Saving event contents:";
244 
245  // call store functions
246  // store ECal information in produce
247  storeECal(*pOut);
248  // store HCal information in produce
249  storeHCal(*pOut);
250  // store Track information in produce
251  storeTrk(*pOut);
252  // store Muon information in produce
253  storeMuon(*pOut);
254 
255  // store information in event
256  iEvent.put(pOut,label);
257 
258  return;
259 }
260 
262  const edm::EventSetup& iSetup)
263 {
264  std::string MsgLoggerCat = "GlobalDigisProducer_fillECal";
265 
266  TString eventout;
267  if (verbosity > 0)
268  eventout = "\nGathering info:";
269 
270  // extract crossing frame from event
271  //edm::Handle<CrossingFrame> crossingFrame;
272  edm::Handle<CrossingFrame<PCaloHit> > crossingFrame;
273  //iEvent.getByType(crossingFrame);
274  //if (!crossingFrame.isValid()) {
275  // edm::LogWarning(MsgLoggerCat)
276  // << "Unable to crossingFrame in event!";
277  // return;
278  //}
279 
281  //extract EB information
283  bool isBarrel = true;
284  edm::Handle<EBDigiCollection> EcalDigiEB;
285  const EBDigiCollection *EBdigis = 0;
286  iEvent.getByLabel(ECalEBSrc_, EcalDigiEB);
287  if (!EcalDigiEB.isValid()) {
288  edm::LogWarning(MsgLoggerCat)
289  << "Unable to find EcalDigiEB in event!";
290  return;
291  }
292  EBdigis = EcalDigiEB.product();
293  if ( EcalDigiEB->size() == 0) isBarrel = false;
294 
295  if (isBarrel) {
296 
297  // loop over simhits
298  const std::string barrelHitsName("EcalHitsEB");
299  iEvent.getByLabel("mix",barrelHitsName,crossingFrame);
300  if (!crossingFrame.isValid()) {
301  edm::LogWarning(MsgLoggerCat)
302  << "Unable to find cal barrel crossingFrame in event!";
303  return;
304  }
305  //std::auto_ptr<MixCollection<PCaloHit> >
306  //barrelHits(new MixCollection<PCaloHit>
307  // (crossingFrame.product(), barrelHitsName));
308  std::auto_ptr<MixCollection<PCaloHit> >
309  barrelHits(new MixCollection<PCaloHit>(crossingFrame.product()));
310 
311  // keep track of sum of simhit energy in each crystal
312  MapType ebSimMap;
314  = barrelHits->begin();
315  hitItr != barrelHits->end();
316  ++hitItr) {
317 
318  EBDetId ebid = EBDetId(hitItr->id());
319 
320  uint32_t crystid = ebid.rawId();
321  ebSimMap[crystid] += hitItr->energy();
322  }
323 
324  // loop over digis
325  const EBDigiCollection *barrelDigi = EcalDigiEB.product();
326 
327  std::vector<double> ebAnalogSignal;
328  std::vector<double> ebADCCounts;
329  std::vector<double> ebADCGains;
330  ebAnalogSignal.reserve(EBDataFrame::MAXSAMPLES);
331  ebADCCounts.reserve(EBDataFrame::MAXSAMPLES);
332  ebADCGains.reserve(EBDataFrame::MAXSAMPLES);
333 
334  int i = 0;
335  for (unsigned int digis=0; digis<EcalDigiEB->size(); ++digis)
336  {
337  //for (std::vector<EBDataFrame>::const_iterator digis =
338  // barrelDigi->begin();
339  // digis != barrelDigi->end();
340  // ++digis) {
341 
342  ++i;
343 
344  EBDataFrame ebdf = (*barrelDigi)[digis];
345  int nrSamples = ebdf.size();
346 
347  EBDetId ebid = ebdf.id () ;
348  //EBDetId ebid = digis->id();
349 
350  double Emax = 0;
351  int Pmax = 0;
352  double pedestalPreSample = 0.;
353  double pedestalPreSampleAnalog = 0.;
354 
355  for (int sample = 0 ; sample < nrSamples; ++sample) {
356  //for (int sample = 0; sample < digis->size(); ++sample) {
357  ebAnalogSignal[sample] = 0.;
358  ebADCCounts[sample] = 0.;
359  ebADCGains[sample] = -1.;
360  }
361 
362  // calculate maximum energy and pedestal
363  for (int sample = 0 ; sample < nrSamples; ++sample) {
364  //for (int sample = 0; sample < digis->size(); ++sample) {
365 
366  EcalMGPASample thisSample = ebdf[sample];
367  ebADCCounts[sample] = (thisSample.adc());
368  ebADCGains[sample] = (thisSample.gainId());
369  ebAnalogSignal[sample] =
370  (ebADCCounts[sample] * ECalgainConv_[(int)ebADCGains[sample]]
372  if (Emax < ebAnalogSignal[sample]) {
373  Emax = ebAnalogSignal[sample];
374  Pmax = sample;
375  }
376  if ( sample < 3 ) {
377  pedestalPreSample += ebADCCounts[sample] ;
378  pedestalPreSampleAnalog +=
379  ebADCCounts[sample] * ECalgainConv_[(int)ebADCGains[sample]]
380  * ECalbarrelADCtoGeV_ ;
381  }
382 
383  }
384  pedestalPreSample /= 3. ;
385  pedestalPreSampleAnalog /= 3. ;
386 
387  // calculate pedestal subtracted digi energy in the crystal
388  double Erec = Emax - pedestalPreSampleAnalog
389  * ECalgainConv_[(int)ebADCGains[Pmax]];
390 
391  // gather necessary information
392  EBCalAEE.push_back(Erec);
393  EBCalSHE.push_back(ebSimMap[ebid.rawId()]);
394  EBCalmaxPos.push_back(Pmax);
395  }
396 
397  if (verbosity > 1) {
398  eventout += "\n Number of EBDigis collected:.............. ";
399  eventout += i;
400  }
401  }
402 
404  //extract EE information
406  bool isEndCap = true;
407  edm::Handle<EEDigiCollection> EcalDigiEE;
408  const EEDigiCollection *EEdigis = 0;
409  iEvent.getByLabel(ECalEESrc_, EcalDigiEE);
410  if (!EcalDigiEE.isValid()) {
411  edm::LogWarning(MsgLoggerCat)
412  << "Unable to find EcalDigiEE in event!";
413  return;
414  }
415  EEdigis = EcalDigiEE.product();
416  if (EcalDigiEE->size() == 0) isEndCap = false;
417 
418  if (isEndCap) {
419 
420  // loop over simhits
421  const std::string endcapHitsName("EcalHitsEE");
422  iEvent.getByLabel("mix",endcapHitsName,crossingFrame);
423  if (!crossingFrame.isValid()) {
424  edm::LogWarning(MsgLoggerCat)
425  << "Unable to find cal endcap crossingFrame in event!";
426  return;
427  }
428  //std::auto_ptr<MixCollection<PCaloHit> >
429  // endcapHits(new MixCollection<PCaloHit>
430  // (crossingFrame.product(), endcapHitsName));
431  std::auto_ptr<MixCollection<PCaloHit> >
432  endcapHits(new MixCollection<PCaloHit>(crossingFrame.product()));
433 
434  // keep track of sum of simhit energy in each crystal
435  MapType eeSimMap;
437  = endcapHits->begin();
438  hitItr != endcapHits->end();
439  ++hitItr) {
440 
441  EEDetId eeid = EEDetId(hitItr->id());
442 
443  uint32_t crystid = eeid.rawId();
444  eeSimMap[crystid] += hitItr->energy();
445  }
446 
447  // loop over digis
448  const EEDigiCollection *endcapDigi = EcalDigiEE.product();
449 
450  std::vector<double> eeAnalogSignal;
451  std::vector<double> eeADCCounts;
452  std::vector<double> eeADCGains;
453  eeAnalogSignal.reserve(EEDataFrame::MAXSAMPLES);
454  eeADCCounts.reserve(EEDataFrame::MAXSAMPLES);
455  eeADCGains.reserve(EEDataFrame::MAXSAMPLES);
456 
457  int i = 0;
458  //for (std::vector<EEDataFrame>::const_iterator digis =
459  // endcapDigi->begin();
460  // digis != endcapDigi->end();
461  // ++digis) {
462  for (unsigned int digis=0; digis<EcalDigiEE->size(); ++digis){
463 
464  ++i;
465 
466  EEDataFrame eedf = (*endcapDigi)[digis];
467  int nrSamples = eedf.size();
468 
469  EEDetId eeid = eedf.id () ;
470  //EEDetId eeid = digis->id();
471 
472  double Emax = 0;
473  int Pmax = 0;
474  double pedestalPreSample = 0.;
475  double pedestalPreSampleAnalog = 0.;
476 
477  for (int sample = 0 ; sample < nrSamples; ++sample) {
478  //for (int sample = 0; sample < digis->size(); ++sample) {
479  eeAnalogSignal[sample] = 0.;
480  eeADCCounts[sample] = 0.;
481  eeADCGains[sample] = -1.;
482  }
483 
484  // calculate maximum enery and pedestal
485  for (int sample = 0 ; sample < nrSamples; ++sample) {
486  //for (int sample = 0; sample < digis->size(); ++sample) {
487 
488  EcalMGPASample thisSample = eedf[sample];
489 
490  eeADCCounts[sample] = (thisSample.adc());
491  eeADCGains[sample] = (thisSample.gainId());
492  eeAnalogSignal[sample] =
493  (eeADCCounts[sample] * ECalgainConv_[(int)eeADCGains[sample]]
495  if (Emax < eeAnalogSignal[sample]) {
496  Emax = eeAnalogSignal[sample];
497  Pmax = sample;
498  }
499  if ( sample < 3 ) {
500  pedestalPreSample += eeADCCounts[sample] ;
501  pedestalPreSampleAnalog +=
502  eeADCCounts[sample] * ECalgainConv_[(int)eeADCGains[sample]]
503  * ECalbarrelADCtoGeV_ ;
504  }
505 
506  }
507  pedestalPreSample /= 3. ;
508  pedestalPreSampleAnalog /= 3. ;
509 
510  // calculate pedestal subtracted digi energy in the crystal
511  double Erec = Emax - pedestalPreSampleAnalog
512  * ECalgainConv_[(int)eeADCGains[Pmax]];
513 
514  // gather necessary information
515  EECalAEE.push_back(Erec);
516  EECalSHE.push_back(eeSimMap[eeid.rawId()]);
517  EECalmaxPos.push_back(Pmax);
518  }
519 
520  if (verbosity > 1) {
521  eventout += "\n Number of EEDigis collected:.............. ";
522  eventout += i;
523  }
524  }
525 
527  //extract ES information
529  bool isPreshower = true;
530  edm::Handle<ESDigiCollection> EcalDigiES;
531  const ESDigiCollection *ESdigis = 0;
532  iEvent.getByLabel(ECalESSrc_, EcalDigiES);
533  if (!EcalDigiES.isValid()) {
534  edm::LogWarning(MsgLoggerCat)
535  << "Unable to find EcalDigiES in event!";
536  return;
537  }
538  ESdigis = EcalDigiES.product();
539  if (EcalDigiES->size() == 0) isPreshower = false;
540 
541  if (isPreshower) {
542 
543  // loop over simhits
544  const std::string preshowerHitsName("EcalHitsES");
545  iEvent.getByLabel("mix",preshowerHitsName,crossingFrame);
546  if (!crossingFrame.isValid()) {
547  edm::LogWarning(MsgLoggerCat)
548  << "Unable to find cal preshower crossingFrame in event!";
549  return;
550  }
551  //std::auto_ptr<MixCollection<PCaloHit> >
552  // preshowerHits(new MixCollection<PCaloHit>
553  // (crossingFrame.product(), preshowerHitsName));
554  std::auto_ptr<MixCollection<PCaloHit> >
555  preshowerHits(new MixCollection<PCaloHit>(crossingFrame.product()));
556 
557  // keep track of sum of simhit energy in each crystal
558  MapType esSimMap;
560  = preshowerHits->begin();
561  hitItr != preshowerHits->end();
562  ++hitItr) {
563 
564  ESDetId esid = ESDetId(hitItr->id());
565 
566  uint32_t crystid = esid.rawId();
567  esSimMap[crystid] += hitItr->energy();
568  }
569 
570  // loop over digis
571  const ESDigiCollection *preshowerDigi = EcalDigiES.product();
572 
573  std::vector<double> esADCCounts;
574  esADCCounts.reserve(ESDataFrame::MAXSAMPLES);
575 
576  int i = 0;
577  for (unsigned int digis=0; digis<EcalDigiES->size(); ++digis) {
578  //for (std::vector<ESDataFrame>::const_iterator digis =
579  // preshowerDigi->begin();
580  // digis != preshowerDigi->end();
581  // ++digis) {
582 
583  ++i;
584 
585 
586  ESDataFrame esdf = (*preshowerDigi)[digis];
587  int nrSamples = esdf.size();
588 
589  ESDetId esid = esdf.id () ;
590  // ESDetId esid = digis->id();
591 
592  for (int sample = 0 ; sample < nrSamples; ++sample) {
593  //for (int sample = 0; sample < digis->size(); ++sample) {
594  esADCCounts[sample] = 0.;
595  }
596 
597  // gether ADC counts
598  for (int sample = 0 ; sample < nrSamples; ++sample) {
599 
600  ESSample thisSample = esdf[sample];
601  //for (int sample = 0; sample < digis->size(); ++sample) {
602  esADCCounts[sample] = (thisSample.adc());
603  }
604 
605  ESCalADC0.push_back(esADCCounts[0]);
606  ESCalADC1.push_back(esADCCounts[1]);
607  ESCalADC2.push_back(esADCCounts[2]);
608  ESCalSHE.push_back(esSimMap[esid.rawId()]);
609  }
610 
611  if (verbosity > 1) {
612  eventout += "\n Number of ESDigis collected:.............. ";
613  eventout += i;
614  }
615  }
616 
617  if (verbosity > 0)
618  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
619 
620  return;
621 }
622 
624 {
625  std::string MsgLoggerCat = "GlobalDigisProducer_storeECal";
626 
627  if (verbosity > 2) {
628  TString eventout("\n nEBDigis = ");
629  eventout += EBCalmaxPos.size();
630  for (unsigned int i = 0; i < EBCalmaxPos.size(); ++i) {
631  eventout += "\n (maxPos, AEE, SHE) = (";
632  eventout += EBCalmaxPos[i];
633  eventout += ", ";
634  eventout += EBCalAEE[i];
635  eventout += ", ";
636  eventout += EBCalSHE[i];
637  eventout += ")";
638  }
639  eventout += "\n nEEDigis = ";
640  eventout += EECalmaxPos.size();
641  for (unsigned int i = 0; i < EECalmaxPos.size(); ++i) {
642  eventout += "\n (maxPos, AEE, SHE) = (";
643  eventout += EECalmaxPos[i];
644  eventout += ", ";
645  eventout += EECalAEE[i];
646  eventout += ", ";
647  eventout += EECalSHE[i];
648  eventout += ")";
649  }
650  eventout += "\n nESDigis = ";
651  eventout += ESCalADC0.size();
652  for (unsigned int i = 0; i < ESCalADC0.size(); ++i) {
653  eventout += "\n (ADC0, ADC1, ADC2, SHE) = (";
654  eventout += ESCalADC0[i];
655  eventout += ", ";
656  eventout += ESCalADC1[i];
657  eventout += ", ";
658  eventout += ESCalADC2[i];
659  eventout += ", ";
660  eventout += ESCalSHE[i];
661  eventout += ")";
662  }
663  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
664  }
665 
669 
670  return;
671 }
672 
674  const edm::EventSetup& iSetup)
675 {
676  std::string MsgLoggerCat = "GlobalDigisProducer_fillHCal";
677 
678  TString eventout;
679  if (verbosity > 0)
680  eventout = "\nGathering info:";
681 
682  // get calibration info
683  edm::ESHandle<HcalDbService> HCalconditions;
684  iSetup.get<HcalDbRecord>().get(HCalconditions);
685  if (!HCalconditions.isValid()) {
686  edm::LogWarning(MsgLoggerCat)
687  << "Unable to find HCalconditions in event!";
688  return;
689  }
690  const HcalQIEShape *shape = HCalconditions->getHcalShape();
691  //HcalCalibrations calibrations;
692  CaloSamples tool;
693 
695  // extract simhit info
698  iEvent.getByLabel(HCalSrc_,hcalHits);
699  if (!hcalHits.isValid()) {
700  edm::LogWarning(MsgLoggerCat)
701  << "Unable to find hcalHits in event!";
702  return;
703  }
704  const edm::PCaloHitContainer *simhitResult = hcalHits.product();
705 
706  MapType fHBEnergySimHits;
707  MapType fHEEnergySimHits;
708  MapType fHOEnergySimHits;
709  MapType fHFEnergySimHits;
710  for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin();
711  simhits != simhitResult->end();
712  ++simhits) {
713 
714  HcalDetId detId(simhits->id());
715  uint32_t cellid = detId.rawId();
716 
717  if (detId.subdet() == sdHcalBrl){
718  fHBEnergySimHits[cellid] += simhits->energy();
719  }
720  if (detId.subdet() == sdHcalEC){
721  fHEEnergySimHits[cellid] += simhits->energy();
722  }
723  if (detId.subdet() == sdHcalOut){
724  fHOEnergySimHits[cellid] += simhits->energy();
725  }
726  if (detId.subdet() == sdHcalFwd){
727  fHFEnergySimHits[cellid] += simhits->energy();
728  }
729  }
730 
732  // get HBHE information
735  iEvent.getByLabel(HCalDigi_,hbhe);
736  if (!hbhe.isValid()) {
737  edm::LogWarning(MsgLoggerCat)
738  << "Unable to find HBHEDataFrame in event!";
739  return;
740  }
742 
743  int iHB = 0;
744  int iHE = 0;
745  for (ihbhe = hbhe->begin(); ihbhe != hbhe->end(); ++ihbhe) {
746  HcalDetId cell(ihbhe->id());
747 
748  if ((cell.subdet() == sdHcalBrl) || (cell.subdet() == sdHcalEC)) {
749 
750  //HCalconditions->makeHcalCalibration(cell, &calibrations);
751  const HcalCalibrations& calibrations =
752  HCalconditions->getHcalCalibrations(cell);
753  const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
754  HcalCoderDb coder(*channelCoder, *shape);
755  coder.adc2fC(*ihbhe, tool);
756 
757  // get HB info
758  if (cell.subdet() == sdHcalBrl) {
759 
760  ++iHB;
761  float fDigiSum = 0.0;
762  for (int ii = 0; ii < tool.size(); ++ii) {
763  // default ped is 4.5
764  int capid = (*ihbhe)[ii].capid();
765  fDigiSum += (tool[ii] - calibrations.pedestal(capid));
766  }
767 
768  HBCalAEE.push_back(fDigiSum);
769  HBCalSHE.push_back(fHBEnergySimHits[cell.rawId()]);
770  }
771 
772  // get HE info
773  if (cell.subdet() == sdHcalEC) {
774 
775  ++iHE;
776  float fDigiSum = 0.0;
777  for (int ii = 0; ii < tool.size(); ++ii) {
778  int capid = (*ihbhe)[ii].capid();
779  fDigiSum += (tool[ii]-calibrations.pedestal(capid));
780  }
781 
782  HECalAEE.push_back(fDigiSum);
783  HECalSHE.push_back(fHEEnergySimHits[cell.rawId()]);
784  }
785  }
786  }
787 
788  if (verbosity > 1) {
789  eventout += "\n Number of HBDigis collected:.............. ";
790  eventout += iHB;
791  }
792 
793  if (verbosity > 1) {
794  eventout += "\n Number of HEDigis collected:.............. ";
795  eventout += iHE;
796  }
797 
799  // get HO information
802  iEvent.getByLabel(HCalDigi_,ho);
803  if (!ho.isValid()) {
804  edm::LogWarning(MsgLoggerCat)
805  << "Unable to find HODataFrame in event!";
806  return;
807  }
809 
810  int iHO = 0;
811  for (iho = ho->begin(); iho != ho->end(); ++iho) {
812  HcalDetId cell(iho->id());
813 
814  if (cell.subdet() == sdHcalOut) {
815 
816  //HCalconditions->makeHcalCalibration(cell, &calibrations);
817  const HcalCalibrations& calibrations =
818  HCalconditions->getHcalCalibrations(cell);
819  const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
820  HcalCoderDb coder (*channelCoder, *shape);
821  coder.adc2fC(*iho, tool);
822 
823  ++iHO;
824  float fDigiSum = 0.0;
825  for (int ii = 0; ii < tool.size(); ++ii) {
826  // default ped is 4.5
827  int capid = (*iho)[ii].capid();
828  fDigiSum += (tool[ii] - calibrations.pedestal(capid));
829  }
830 
831  HOCalAEE.push_back(fDigiSum);
832  HOCalSHE.push_back(fHOEnergySimHits[cell.rawId()]);
833  }
834  }
835 
836  if (verbosity > 1) {
837  eventout += "\n Number of HODigis collected:.............. ";
838  eventout += iHO;
839  }
840 
842  // get HF information
845  iEvent.getByLabel(HCalDigi_,hf);
846  if (!hf.isValid()) {
847  edm::LogWarning(MsgLoggerCat)
848  << "Unable to find HFDataFrame in event!";
849  return;
850  }
852 
853  int iHF = 0;
854  for (ihf = hf->begin(); ihf != hf->end(); ++ihf) {
855  HcalDetId cell(ihf->id());
856 
857  if (cell.subdet() == sdHcalFwd) {
858 
859  //HCalconditions->makeHcalCalibration(cell, &calibrations);
860  const HcalCalibrations& calibrations =
861  HCalconditions->getHcalCalibrations(cell);
862  const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
863  HcalCoderDb coder (*channelCoder, *shape);
864  coder.adc2fC(*ihf, tool);
865 
866  ++iHF;
867  float fDigiSum = 0.0;
868  for (int ii = 0; ii < tool.size(); ++ii) {
869  // default ped is 1.73077
870  int capid = (*ihf)[ii].capid();
871  fDigiSum += (tool[ii] - calibrations.pedestal(capid));
872  }
873 
874  HFCalAEE.push_back(fDigiSum);
875  HFCalSHE.push_back(fHFEnergySimHits[cell.rawId()]);
876  }
877  }
878 
879  if (verbosity > 1) {
880  eventout += "\n Number of HFDigis collected:.............. ";
881  eventout += iHF;
882  }
883 
884  if (verbosity > 0)
885  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
886 
887  return;
888 }
889 
891 {
892  std::string MsgLoggerCat = "GlobalDigisProducer_storeHCal";
893 
894  if (verbosity > 2) {
895  TString eventout("\n nHBDigis = ");
896  eventout += HBCalAEE.size();
897  for (unsigned int i = 0; i < HBCalAEE.size(); ++i) {
898  eventout += "\n (AEE, SHE) = (";
899  eventout += HBCalAEE[i];
900  eventout += ", ";
901  eventout += HBCalSHE[i];
902  eventout += ")";
903  }
904  eventout += "\n nHEDigis = ";
905  eventout += HECalAEE.size();
906  for (unsigned int i = 0; i < HECalAEE.size(); ++i) {
907  eventout += "\n (AEE, SHE) = (";
908  eventout += HECalAEE[i];
909  eventout += ", ";
910  eventout += HECalSHE[i];
911  eventout += ")";
912  }
913  eventout += "\n nHODigis = ";
914  eventout += HOCalAEE.size();
915  for (unsigned int i = 0; i < HOCalAEE.size(); ++i) {
916  eventout += "\n (AEE, SHE) = (";
917  eventout += HOCalAEE[i];
918  eventout += ", ";
919  eventout += HOCalSHE[i];
920  eventout += ")";
921  }
922  eventout += "\n nHFDigis = ";
923  eventout += HFCalAEE.size();
924  for (unsigned int i = 0; i < HFCalAEE.size(); ++i) {
925  eventout += "\n (AEE, SHE) = (";
926  eventout += HFCalAEE[i];
927  eventout += ", ";
928  eventout += HFCalSHE[i];
929  eventout += ")";
930  }
931 
932  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
933  }
934 
939 
940  return;
941 }
942 
944  const edm::EventSetup& iSetup)
945 {
946  std::string MsgLoggerCat = "GlobalDigisProducer_fillTrk";
947 
948  TString eventout;
949  if (verbosity > 0)
950  eventout = "\nGathering info:";
951 
952  // get strip information
954  iEvent.getByLabel(SiStripSrc_, stripDigis);
955  if (!stripDigis.isValid()) {
956  edm::LogWarning(MsgLoggerCat)
957  << "Unable to find stripDigis in event!";
958  return;
959  }
960 
961  int nStripBrl = 0, nStripFwd = 0;
963  for (DSViter = stripDigis->begin(); DSViter != stripDigis->end();
964  ++DSViter) {
965  unsigned int id = DSViter->id;
966  DetId detId(id);
970 
971  // get TIB
972  if (detId.subdetId() == sdSiTIB) {
973  TIBDetId tibid(id);
974  for (iter = begin; iter != end; ++iter) {
975  ++nStripBrl;
976  if (tibid.layer() == 1) {
977  TIBL1ADC.push_back((*iter).adc());
978  TIBL1Strip.push_back((*iter).strip());
979  }
980  if (tibid.layer() == 2) {
981  TIBL2ADC.push_back((*iter).adc());
982  TIBL2Strip.push_back((*iter).strip());
983  }
984  if (tibid.layer() == 3) {
985  TIBL3ADC.push_back((*iter).adc());
986  TIBL3Strip.push_back((*iter).strip());
987  }
988  if (tibid.layer() == 4) {
989  TIBL4ADC.push_back((*iter).adc());
990  TIBL4Strip.push_back((*iter).strip());
991  }
992  }
993  }
994 
995  // get TOB
996  if (detId.subdetId() == sdSiTOB) {
997  TOBDetId tobid(id);
998  for (iter = begin; iter != end; ++iter) {
999  ++nStripBrl;
1000  if (tobid.layer() == 1) {
1001  TOBL1ADC.push_back((*iter).adc());
1002  TOBL1Strip.push_back((*iter).strip());
1003  }
1004  if (tobid.layer() == 2) {
1005  TOBL2ADC.push_back((*iter).adc());
1006  TOBL2Strip.push_back((*iter).strip());
1007  }
1008  if (tobid.layer() == 3) {
1009  TOBL3ADC.push_back((*iter).adc());
1010  TOBL3Strip.push_back((*iter).strip());
1011  }
1012  if (tobid.layer() == 4) {
1013  TOBL4ADC.push_back((*iter).adc());
1014  TOBL4Strip.push_back((*iter).strip());
1015  }
1016  }
1017  }
1018 
1019  // get TID
1020  if (detId.subdetId() == sdSiTID) {
1021  TIDDetId tidid(id);
1022  for (iter = begin; iter != end; ++iter) {
1023  ++nStripFwd;
1024  if (tidid.wheel() == 1) {
1025  TIDW1ADC.push_back((*iter).adc());
1026  TIDW1Strip.push_back((*iter).strip());
1027  }
1028  if (tidid.wheel() == 2) {
1029  TIDW2ADC.push_back((*iter).adc());
1030  TIDW2Strip.push_back((*iter).strip());
1031  }
1032  if (tidid.wheel() == 3) {
1033  TIDW3ADC.push_back((*iter).adc());
1034  TIDW3Strip.push_back((*iter).strip());
1035  }
1036  }
1037  }
1038 
1039  // get TEC
1040  if (detId.subdetId() == sdSiTEC) {
1041  TECDetId tecid(id);
1042  for (iter = begin; iter != end; ++iter) {
1043  ++nStripFwd;
1044  if (tecid.wheel() == 1) {
1045  TECW1ADC.push_back((*iter).adc());
1046  TECW1Strip.push_back((*iter).strip());
1047  }
1048  if (tecid.wheel() == 2) {
1049  TECW2ADC.push_back((*iter).adc());
1050  TECW2Strip.push_back((*iter).strip());
1051  }
1052  if (tecid.wheel() == 3) {
1053  TECW3ADC.push_back((*iter).adc());
1054  TECW3Strip.push_back((*iter).strip());
1055  }
1056  if (tecid.wheel() == 4) {
1057  TECW4ADC.push_back((*iter).adc());
1058  TECW4Strip.push_back((*iter).strip());
1059  }
1060  if (tecid.wheel() == 5) {
1061  TECW5ADC.push_back((*iter).adc());
1062  TECW5Strip.push_back((*iter).strip());
1063  }
1064  if (tecid.wheel() == 6) {
1065  TECW6ADC.push_back((*iter).adc());
1066  TECW6Strip.push_back((*iter).strip());
1067  }
1068  if (tecid.wheel() == 7) {
1069  TECW7ADC.push_back((*iter).adc());
1070  TECW7Strip.push_back((*iter).strip());
1071  }
1072  if (tecid.wheel() == 8) {
1073  TECW8ADC.push_back((*iter).adc());
1074  TECW8Strip.push_back((*iter).strip());
1075  }
1076  }
1077  }
1078  } // end loop over DataSetVector
1079 
1080  if (verbosity > 1) {
1081  eventout += "\n Number of BrlStripDigis collected:........ ";
1082  eventout += nStripBrl;
1083  }
1084 
1085  if (verbosity > 1) {
1086  eventout += "\n Number of FrwdStripDigis collected:....... ";
1087  eventout += nStripFwd;
1088  }
1089 
1090  // get pixel information
1092  iEvent.getByLabel(SiPxlSrc_, pixelDigis);
1093  if (!pixelDigis.isValid()) {
1094  edm::LogWarning(MsgLoggerCat)
1095  << "Unable to find pixelDigis in event!";
1096  return;
1097  }
1098 
1099  int nPxlBrl = 0, nPxlFwd = 0;
1101  for (DPViter = pixelDigis->begin(); DPViter != pixelDigis->end();
1102  ++DPViter) {
1103  unsigned int id = DPViter->id;
1104  DetId detId(id);
1108 
1109  // get Barrel pixels
1110  if (detId.subdetId() == sdPxlBrl) {
1111  PXBDetId bdetid(id);
1112  for (iter = begin; iter != end; ++iter) {
1113  ++nPxlBrl;
1114  if (bdetid.layer() == 1) {
1115  BRL1ADC.push_back((*iter).adc());
1116  BRL1Row.push_back((*iter).row());
1117  BRL1Col.push_back((*iter).column());
1118  }
1119  if (bdetid.layer() == 2) {
1120  BRL2ADC.push_back((*iter).adc());
1121  BRL2Row.push_back((*iter).row());
1122  BRL2Col.push_back((*iter).column());
1123  }
1124  if (bdetid.layer() == 3) {
1125  BRL3ADC.push_back((*iter).adc());
1126  BRL3Row.push_back((*iter).row());
1127  BRL3Col.push_back((*iter).column());
1128  }
1129  }
1130  }
1131 
1132  // get Forward pixels
1133  if (detId.subdetId() == sdPxlFwd) {
1134  PXFDetId fdetid(id);
1135  for (iter = begin; iter != end; ++iter) {
1136  ++nPxlFwd;
1137  if (fdetid.disk() == 1) {
1138  if (fdetid.side() == 1) {
1139  FWD1nADC.push_back((*iter).adc());
1140  FWD1nRow.push_back((*iter).row());
1141  FWD1nCol.push_back((*iter).column());
1142  }
1143  if (fdetid.side() == 2) {
1144  FWD1pADC.push_back((*iter).adc());
1145  FWD1pRow.push_back((*iter).row());
1146  FWD1pCol.push_back((*iter).column());
1147  }
1148  }
1149  if (fdetid.disk() == 2) {
1150  if (fdetid.side() == 1) {
1151  FWD2nADC.push_back((*iter).adc());
1152  FWD2nRow.push_back((*iter).row());
1153  FWD2nCol.push_back((*iter).column());
1154  }
1155  if (fdetid.side() == 2) {
1156  FWD2pADC.push_back((*iter).adc());
1157  FWD2pRow.push_back((*iter).row());
1158  FWD2pCol.push_back((*iter).column());
1159  }
1160  }
1161  }
1162  }
1163  }
1164 
1165  if (verbosity > 1) {
1166  eventout += "\n Number of BrlPixelDigis collected:........ ";
1167  eventout += nPxlBrl;
1168  }
1169 
1170  if (verbosity > 1) {
1171  eventout += "\n Number of FrwdPixelDigis collected:....... ";
1172  eventout += nPxlFwd;
1173  }
1174 
1175  if (verbosity > 0)
1176  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1177 
1178  return;
1179 }
1180 
1182 {
1183  std::string MsgLoggerCat = "GlobalDigisProducer_storeTrk";
1184 
1185  if (verbosity > 2) {
1186 
1187  // strip output
1188  TString eventout("\n nTIBL1 = ");
1189  eventout += TIBL1ADC.size();
1190  for (unsigned int i = 0; i < TIBL1ADC.size(); ++i) {
1191  eventout += "\n (ADC, strip) = (";
1192  eventout += TIBL1ADC[i];
1193  eventout += ", ";
1194  eventout += TIBL1Strip[i];
1195  eventout += ")";
1196  }
1197  eventout += "\n nTIBL2 = ";
1198  eventout += TIBL2ADC.size();
1199  for (unsigned int i = 0; i < TIBL2ADC.size(); ++i) {
1200  eventout += "\n (ADC, strip) = (";
1201  eventout += TIBL2ADC[i];
1202  eventout += ", ";
1203  eventout += TIBL2Strip[i];
1204  eventout += ")";
1205  }
1206  eventout += "\n nTIBL3 = ";
1207  eventout += TIBL3ADC.size();
1208  for (unsigned int i = 0; i < TIBL3ADC.size(); ++i) {
1209  eventout += "\n (ADC, strip) = (";
1210  eventout += TIBL3ADC[i];
1211  eventout += ", ";
1212  eventout += TIBL3Strip[i];
1213  eventout += ")";
1214  }
1215  eventout += "\n nTIBL4 = ";
1216  eventout += TIBL4ADC.size();
1217  for (unsigned int i = 0; i < TIBL4ADC.size(); ++i) {
1218  eventout += "\n (ADC, strip) = (";
1219  eventout += TIBL4ADC[i];
1220  eventout += ", ";
1221  eventout += TIBL4Strip[i];
1222  eventout += ")";
1223  }
1224  eventout += "\n nTOBL1 = ";
1225  eventout += TOBL1ADC.size();
1226  for (unsigned int i = 0; i < TOBL1ADC.size(); ++i) {
1227  eventout += "\n (ADC, strip) = (";
1228  eventout += TOBL1ADC[i];
1229  eventout += ", ";
1230  eventout += TOBL1Strip[i];
1231  eventout += ")";
1232  }
1233  eventout += "\n nTOBL2 = ";
1234  eventout += TOBL2ADC.size();
1235  for (unsigned int i = 0; i < TOBL2ADC.size(); ++i) {
1236  eventout += "\n (ADC, strip) = (";
1237  eventout += TOBL2ADC[i];
1238  eventout += ", ";
1239  eventout += TOBL2Strip[i];
1240  eventout += ")";
1241  }
1242  eventout += "\n nTOBL3 = ";
1243  eventout += TOBL3ADC.size();
1244  for (unsigned int i = 0; i < TOBL3ADC.size(); ++i) {
1245  eventout += "\n (ADC, strip) = (";
1246  eventout += TOBL3ADC[i];
1247  eventout += ", ";
1248  eventout += TOBL3Strip[i];
1249  eventout += ")";
1250  }
1251  eventout += "\n nTOBL4 = ";
1252  eventout += TOBL4ADC.size();
1253  for (unsigned int i = 0; i < TOBL4ADC.size(); ++i) {
1254  eventout += "\n (ADC, strip) = (";
1255  eventout += TOBL4ADC[i];
1256  eventout += ", ";
1257  eventout += TOBL4Strip[i];
1258  eventout += ")";
1259  }
1260  eventout += "\n nTIDW1 = ";
1261  eventout += TIDW1ADC.size();
1262  for (unsigned int i = 0; i < TIDW1ADC.size(); ++i) {
1263  eventout += "\n (ADC, strip) = (";
1264  eventout += TIDW1ADC[i];
1265  eventout += ", ";
1266  eventout += TIDW1Strip[i];
1267  eventout += ")";
1268  }
1269  eventout += "\n nTIDW2 = ";
1270  eventout += TIDW2ADC.size();
1271  for (unsigned int i = 0; i < TIDW2ADC.size(); ++i) {
1272  eventout += "\n (ADC, strip) = (";
1273  eventout += TIDW2ADC[i];
1274  eventout += ", ";
1275  eventout += TIDW2Strip[i];
1276  eventout += ")";
1277  }
1278  eventout += "\n nTIDW3 = ";
1279  eventout += TIDW3ADC.size();
1280  for (unsigned int i = 0; i < TIDW3ADC.size(); ++i) {
1281  eventout += "\n (ADC, strip) = (";
1282  eventout += TIDW3ADC[i];
1283  eventout += ", ";
1284  eventout += TIDW3Strip[i];
1285  eventout += ")";
1286  }
1287  eventout += "\n nTECW1 = ";
1288  eventout += TECW1ADC.size();
1289  for (unsigned int i = 0; i < TECW1ADC.size(); ++i) {
1290  eventout += "\n (ADC, strip) = (";
1291  eventout += TECW1ADC[i];
1292  eventout += ", ";
1293  eventout += TECW1Strip[i];
1294  eventout += ")";
1295  }
1296  eventout += "\n nTECW2 = ";
1297  eventout += TECW2ADC.size();
1298  for (unsigned int i = 0; i < TECW2ADC.size(); ++i) {
1299  eventout += "\n (ADC, strip) = (";
1300  eventout += TECW2ADC[i];
1301  eventout += ", ";
1302  eventout += TECW2Strip[i];
1303  eventout += ")";
1304  }
1305  eventout += "\n nTECW3 = ";
1306  eventout += TECW3ADC.size();
1307  for (unsigned int i = 0; i < TECW3ADC.size(); ++i) {
1308  eventout += "\n (ADC, strip) = (";
1309  eventout += TECW3ADC[i];
1310  eventout += ", ";
1311  eventout += TECW3Strip[i];
1312  eventout += ")";
1313  }
1314  eventout += "\n nTECW4 = ";
1315  eventout += TECW4ADC.size();
1316  for (unsigned int i = 0; i < TECW4ADC.size(); ++i) {
1317  eventout += "\n (ADC, strip) = (";
1318  eventout += TECW4ADC[i];
1319  eventout += ", ";
1320  eventout += TECW4Strip[i];
1321  eventout += ")";
1322  }
1323  eventout += "\n nTECW5 = ";
1324  eventout += TECW5ADC.size();
1325  for (unsigned int i = 0; i < TECW5ADC.size(); ++i) {
1326  eventout += "\n (ADC, strip) = (";
1327  eventout += TECW5ADC[i];
1328  eventout += ", ";
1329  eventout += TECW5Strip[i];
1330  eventout += ")";
1331  }
1332  eventout += "\n nTECW6 = ";
1333  eventout += TECW6ADC.size();
1334  for (unsigned int i = 0; i < TECW6ADC.size(); ++i) {
1335  eventout += "\n (ADC, strip) = (";
1336  eventout += TECW6ADC[i];
1337  eventout += ", ";
1338  eventout += TECW6Strip[i];
1339  eventout += ")";
1340  }
1341  eventout += "\n nTECW7 = ";
1342  eventout += TECW7ADC.size();
1343  for (unsigned int i = 0; i < TECW7ADC.size(); ++i) {
1344  eventout += "\n (ADC, strip) = (";
1345  eventout += TECW7ADC[i];
1346  eventout += ", ";
1347  eventout += TECW7Strip[i];
1348  eventout += ")";
1349  }
1350  eventout += "\n nTECW8 = ";
1351  eventout += TECW8ADC.size();
1352  for (unsigned int i = 0; i < TECW8ADC.size(); ++i) {
1353  eventout += "\n (ADC, strip) = (";
1354  eventout += TECW8ADC[i];
1355  eventout += ", ";
1356  eventout += TECW8Strip[i];
1357  eventout += ")";
1358  }
1359 
1360  // pixel output
1361  eventout += "\n nBRL1 = ";
1362  eventout += BRL1ADC.size();
1363  for (unsigned int i = 0; i < BRL1ADC.size(); ++i) {
1364  eventout += "\n (ADC, row, column) = (";
1365  eventout += BRL1ADC[i];
1366  eventout += ", ";
1367  eventout += BRL1Row[i];
1368  eventout += ", ";
1369  eventout += BRL1Col[i];
1370  eventout += ")";
1371  }
1372  eventout += "\n nBRL2 = ";
1373  eventout += BRL2ADC.size();
1374  for (unsigned int i = 0; i < BRL2ADC.size(); ++i) {
1375  eventout += "\n (ADC, row, column) = (";
1376  eventout += BRL2ADC[i];
1377  eventout += ", ";
1378  eventout += BRL2Row[i];
1379  eventout += ", ";
1380  eventout += BRL2Col[i];
1381  eventout += ")";
1382  }
1383  eventout += "\n nBRL3 = ";
1384  eventout += BRL3ADC.size();
1385  for (unsigned int i = 0; i < BRL3ADC.size(); ++i) {
1386  eventout += "\n (ADC, row, column) = (";
1387  eventout += BRL3ADC[i];
1388  eventout += ", ";
1389  eventout += BRL3Row[i];
1390  eventout += ", ";
1391  eventout += BRL3Col[i];
1392  eventout += ")";
1393  }
1394  eventout += "\n nFWD1p = ";
1395  eventout += FWD1pADC.size();
1396  for (unsigned int i = 0; i < FWD1pADC.size(); ++i) {
1397  eventout += "\n (ADC, row, column) = (";
1398  eventout += FWD1pADC[i];
1399  eventout += ", ";
1400  eventout += FWD1pRow[i];
1401  eventout += ", ";
1402  eventout += FWD1pCol[i];
1403  eventout += ")";
1404  }
1405  eventout += "\n nFWD1p = ";
1406  eventout += FWD1nADC.size();
1407  for (unsigned int i = 0; i < FWD1nADC.size(); ++i) {
1408  eventout += "\n (ADC, row, column) = (";
1409  eventout += FWD1nADC[i];
1410  eventout += ", ";
1411  eventout += FWD1nRow[i];
1412  eventout += ", ";
1413  eventout += FWD1nCol[i];
1414  eventout += ")";
1415  }
1416  eventout += "\n nFWD1p = ";
1417  eventout += FWD2pADC.size();
1418  for (unsigned int i = 0; i < FWD2pADC.size(); ++i) {
1419  eventout += "\n (ADC, row, column) = (";
1420  eventout += FWD2pADC[i];
1421  eventout += ", ";
1422  eventout += FWD2pRow[i];
1423  eventout += ", ";
1424  eventout += FWD2pCol[i];
1425  eventout += ")";
1426  }
1427  eventout += "\n nFWD2p = ";
1428  eventout += FWD2nADC.size();
1429  for (unsigned int i = 0; i < FWD2nADC.size(); ++i) {
1430  eventout += "\n (ADC, row, column) = (";
1431  eventout += FWD2nADC[i];
1432  eventout += ", ";
1433  eventout += FWD2nRow[i];
1434  eventout += ", ";
1435  eventout += FWD2nCol[i];
1436  eventout += ")";
1437  }
1438 
1439  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1440  }
1441 
1442  // strip output
1459  product.putTECW6Digis(TECW6ADC,TECW6Strip);
1461  product.putTECW8Digis(TECW8ADC,TECW8Strip);
1462 
1463  // pixel output
1464  product.putBRL1Digis(BRL1ADC, BRL1Row, BRL1Col);
1465  product.putBRL2Digis(BRL2ADC, BRL2Row, BRL2Col);
1466  product.putBRL3Digis(BRL3ADC, BRL3Row, BRL3Col);
1471 
1472  return;
1473 }
1474 
1476  const edm::EventSetup& iSetup)
1477 {
1478  std::string MsgLoggerCat = "GlobalDigisProducer_fillMuon";
1479 
1480  TString eventout;
1481  if (verbosity > 0)
1482  eventout = "\nGathering info:";
1483 
1484  // get DT information
1486  iEvent.getByLabel(MuDTSrc_, dtDigis);
1487  if (!dtDigis.isValid()) {
1488  edm::LogWarning(MsgLoggerCat)
1489  << "Unable to find dtDigis in event!";
1490  return;
1491  }
1492 
1493  int nDt = 0;
1495  for (detUnitIt = dtDigis->begin(); detUnitIt != dtDigis->end();
1496  ++detUnitIt) {
1497 
1498  const DTLayerId& id = (*detUnitIt).first;
1499  const DTDigiCollection::Range& range = (*detUnitIt).second;
1500 
1501  for (DTDigiCollection::const_iterator digiIt = range.first;
1502  digiIt != range.second;
1503  ++digiIt) {
1504 
1505  ++nDt;
1506 
1507  DTWireId wireId(id,(*digiIt).wire());
1508  if (wireId.station() == 1) {
1509  MB1SLayer.push_back(id.superlayer());
1510  MB1Time.push_back((*digiIt).time());
1511  MB1Layer.push_back(id.layer());
1512  }
1513  if (wireId.station() == 2) {
1514  MB2SLayer.push_back(id.superlayer());
1515  MB2Time.push_back((*digiIt).time());
1516  MB2Layer.push_back(id.layer());
1517  }
1518  if (wireId.station() == 3) {
1519  MB3SLayer.push_back(id.superlayer());
1520  MB3Time.push_back((*digiIt).time());
1521  MB3Layer.push_back(id.layer());
1522  }
1523  if (wireId.station() == 4) {
1524  MB4SLayer.push_back(id.superlayer());
1525  MB4Time.push_back((*digiIt).time());
1526  MB4Layer.push_back(id.layer());
1527  }
1528  }
1529  }
1530 
1531  if (verbosity > 1) {
1532  eventout += "\n Number of DtMuonDigis collected:.......... ";
1533  eventout += nDt;
1534  }
1535 
1536  // get CSC Strip information
1538  iEvent.getByLabel(MuCSCStripSrc_, strips);
1539  if (!strips.isValid()) {
1540  edm::LogWarning(MsgLoggerCat)
1541  << "Unable to find muon strips in event!";
1542  return;
1543  }
1544 
1545  int nStrips = 0;
1546  for (CSCStripDigiCollection::DigiRangeIterator j = strips->begin();
1547  j != strips->end();
1548  ++j) {
1549 
1550  std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
1551  std::vector<CSCStripDigi>::const_iterator last = (*j).second.second;
1552 
1553  for ( ; digiItr != last; ++digiItr) {
1554  ++nStrips;
1555 
1556  // average pedestals
1557  std::vector<int> adcCounts = digiItr->getADCCounts();
1558  theCSCStripPedestalSum += adcCounts[0];
1559  theCSCStripPedestalSum += adcCounts[1];
1561 
1562  // if there are enough pedestal statistics
1563  if (theCSCStripPedestalCount > 100) {
1565  if (adcCounts[5] > (pedestal + 100))
1566  CSCStripADC.push_back(adcCounts[4] - pedestal);
1567  }
1568  }
1569  }
1570 
1571  if (verbosity > 1) {
1572  eventout += "\n Number of CSCStripDigis collected:........ ";
1573  eventout += nStrips;
1574  }
1575 
1576  // get CSC Wire information
1578  iEvent.getByLabel(MuCSCWireSrc_, wires);
1579  if (!wires.isValid()) {
1580  edm::LogWarning(MsgLoggerCat)
1581  << "Unable to find muon wires in event!";
1582  return;
1583  }
1584 
1585  int nWires = 0;
1586  for (CSCWireDigiCollection::DigiRangeIterator j = wires->begin();
1587  j != wires->end();
1588  ++j) {
1589 
1590  std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
1591  std::vector<CSCWireDigi>::const_iterator endDigi = (*j).second.second;
1592 
1593  for ( ; digiItr != endDigi; ++digiItr) {
1594  ++nWires;
1595 
1596  CSCWireTime.push_back(digiItr->getTimeBin());
1597  }
1598  }
1599 
1600  if (verbosity > 1) {
1601  eventout += "\n Number of CSCWireDigis collected:......... ";
1602  eventout += nWires;
1603  }
1604 
1605  if (verbosity > 0)
1606  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1607 
1608  return;
1609 }
1610 
1612 {
1613  std::string MsgLoggerCat = "GlobalDigisProducer_storeMuon";
1614 
1615  if (verbosity > 2) {
1616 
1617  // dt output
1618  TString eventout("\n nMB1 = ");
1619  eventout += MB1SLayer.size();
1620  for (unsigned int i = 0; i < MB1SLayer.size(); ++i) {
1621  eventout += "\n (slayer, time, layer) = (";
1622  eventout += MB1SLayer[i];
1623  eventout += ", ";
1624  eventout += MB1Time[i];
1625  eventout += ", ";
1626  eventout += MB1Layer[i];
1627  eventout += ")";
1628  }
1629  eventout += "\n nMB2 = ";
1630  eventout += MB2SLayer.size();
1631  for (unsigned int i = 0; i < MB2SLayer.size(); ++i) {
1632  eventout += "\n (slayer, time, layer) = (";
1633  eventout += MB2SLayer[i];
1634  eventout += ", ";
1635  eventout += MB2Time[i];
1636  eventout += ", ";
1637  eventout += MB2Layer[i];
1638  eventout += ")";
1639  }
1640  eventout += "\n nMB3 = ";
1641  eventout += MB3SLayer.size();
1642  for (unsigned int i = 0; i < MB3SLayer.size(); ++i) {
1643  eventout += "\n (slayer, time, layer) = (";
1644  eventout += MB3SLayer[i];
1645  eventout += ", ";
1646  eventout += MB3Time[i];
1647  eventout += ", ";
1648  eventout += MB3Layer[i];
1649  eventout += ")";
1650  }
1651  eventout += "\n nMB2 = ";
1652  eventout += MB4SLayer.size();
1653  for (unsigned int i = 0; i < MB4SLayer.size(); ++i) {
1654  eventout += "\n (slayer, time, layer) = (";
1655  eventout += MB4SLayer[i];
1656  eventout += ", ";
1657  eventout += MB4Time[i];
1658  eventout += ", ";
1659  eventout += MB4Layer[i];
1660  eventout += ")";
1661  }
1662 
1663  // CSC Strip
1664  eventout += "\n nCSCStrip = ";
1665  eventout += CSCStripADC.size();
1666  for (unsigned int i = 0; i < CSCStripADC.size(); ++i) {
1667  eventout += "\n (adc) = (";
1668  eventout += CSCStripADC[i];
1669  eventout += ")";
1670  }
1671 
1672  // CSC Wire
1673  eventout += "\n nCSCWire = ";
1674  eventout += CSCWireTime.size();
1675  for (unsigned int i = 0; i < CSCWireTime.size(); ++i) {
1676  eventout += "\n (time) = (";
1677  eventout += CSCWireTime[i];
1678  eventout += ")";
1679  }
1680 
1681  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1682  }
1683 
1688 
1689  product.putCSCstripDigis(CSCStripADC);
1690 
1691  product.putCSCwireDigis(CSCWireTime);
1692 
1693  return;
1694 }
1695 
1697 {
1698  std::string MsgLoggerCat = "GlobalDigisProducer_clear";
1699 
1700  if (verbosity > 0)
1701  edm::LogInfo(MsgLoggerCat)
1702  << "Clearing event holders";
1703 
1704  // reset electromagnetic info
1705  // EE info
1706  EECalmaxPos.clear();
1707  EECalAEE.clear();
1708  EECalSHE.clear();
1709  // EB info
1710  EBCalmaxPos.clear();
1711  EBCalAEE.clear();
1712  EBCalSHE.clear();
1713  // ES info
1714  ESCalADC0.clear();
1715  ESCalADC1.clear();
1716  ESCalADC2.clear();
1717  ESCalSHE.clear();
1718 
1719  // reset HCal Info
1720  HBCalAEE.clear();
1721  HBCalSHE.clear();
1722  HECalAEE.clear();
1723  HECalSHE.clear();
1724  HOCalAEE.clear();
1725  HOCalSHE.clear();
1726  HFCalAEE.clear();
1727  HFCalSHE.clear();
1728 
1729  // reset Track Info
1730  TIBL1ADC.clear();
1731  TIBL2ADC.clear();
1732  TIBL3ADC.clear();
1733  TIBL4ADC.clear();
1734  TIBL1Strip.clear();
1735  TIBL2Strip.clear();
1736  TIBL3Strip.clear();
1737  TIBL4Strip.clear();
1738 
1739  TOBL1ADC.clear();
1740  TOBL2ADC.clear();
1741  TOBL3ADC.clear();
1742  TOBL4ADC.clear();
1743  TOBL1Strip.clear();
1744  TOBL2Strip.clear();
1745  TOBL3Strip.clear();
1746  TOBL4Strip.clear();
1747 
1748  TIDW1ADC.clear();
1749  TIDW2ADC.clear();
1750  TIDW3ADC.clear();
1751  TIDW1Strip.clear();
1752  TIDW2Strip.clear();
1753  TIDW3Strip.clear();
1754 
1755  TECW1ADC.clear();
1756  TECW2ADC.clear();
1757  TECW3ADC.clear();
1758  TECW4ADC.clear();
1759  TECW5ADC.clear();
1760  TECW6ADC.clear();
1761  TECW7ADC.clear();
1762  TECW8ADC.clear();
1763  TECW1Strip.clear();
1764  TECW2Strip.clear();
1765  TECW3Strip.clear();
1766  TECW4Strip.clear();
1767  TECW5Strip.clear();
1768  TECW6Strip.clear();
1769  TECW7Strip.clear();
1770  TECW8Strip.clear();
1771 
1772  BRL1ADC.clear();
1773  BRL1Row.clear();
1774  BRL1Col.clear();
1775  BRL2ADC.clear();
1776  BRL2Row.clear();
1777  BRL2Col.clear();
1778  BRL3ADC.clear();
1779  BRL3Row.clear();
1780  BRL3Col.clear();
1781 
1782  FWD1pADC.clear();
1783  FWD1pRow.clear();
1784  FWD1pCol.clear();
1785  FWD1nADC.clear();
1786  FWD1nRow.clear();
1787  FWD1nCol.clear();
1788  FWD2pADC.clear();
1789  FWD2pRow.clear();
1790  FWD2pCol.clear();
1791  FWD2nADC.clear();
1792  FWD2nRow.clear();
1793  FWD2nCol.clear();
1794 
1795  //muon clear
1796  MB1SLayer.clear();
1797  MB1Time.clear();
1798  MB1Layer.clear();
1799  MB2SLayer.clear();
1800  MB2Time.clear();
1801  MB2Layer.clear();
1802  MB3SLayer.clear();
1803  MB3Time.clear();
1804  MB3Layer.clear();
1805  MB4SLayer.clear();
1806  MB4Time.clear();
1807  MB4Layer.clear();
1808 
1809  CSCStripADC.clear();
1810 
1811  CSCWireTime.clear();
1812 
1813  return;
1814 }
1815 
1816 //define this as a plug-in
1817 //DEFINE_FWK_MODULE(GlobalDigisProducer);
RunNumber_t run() const
Definition: EventID.h:42
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
T getUntrackedParameter(std::string const &, T const &) const
void getAllProvenance(std::vector< Provenance const * > &provenances) const
Definition: Event.cc:71
void putHBCalDigis(std::vector< float > aee, std::vector< float > she)
int i
Definition: DBlmapReader.cc:9
void putBRL2Digis(std::vector< float > adc, std::vector< int > row, std::vector< int > column)
std::vector< PCaloHit > PCaloHitContainer
std::map< uint32_t, float, std::less< uint32_t > > MapType
void putTECW6Digis(std::vector< float > adc, std::vector< int > strip)
key_type id() const
Definition: EBDataFrame.h:32
void putMB2Digis(std::vector< int > slayer, std::vector< float > time, std::vector< int > layer)
unsigned int layer() const
layer id
Definition: TOBDetId.h:39
void putCSCstripDigis(std::vector< float > adc)
const std::string & label
Definition: MVAComputer.cc:186
void putTOBL1Digis(std::vector< float > adc, std::vector< int > strip)
static const int sdHcalOut
edm::InputTag MuCSCStripSrc_
void putTIBL2Digis(std::vector< float > adc, std::vector< int > strip)
const ESDetId & id() const
Definition: ESDataFrame.h:18
void putHOCalDigis(std::vector< float > aee, std::vector< float > she)
void putTOBL3Digis(std::vector< float > adc, std::vector< int > strip)
static const int sdSiTID
void putTIBL3Digis(std::vector< float > adc, std::vector< int > strip)
std::vector< T >::const_iterator const_iterator
void putTIDW2Digis(std::vector< float > adc, std::vector< int > strip)
void putBRL3Digis(std::vector< float > adc, std::vector< int > row, std::vector< int > column)
double pedestal(int fCapId) const
get pedestal for capid=0..3
void putFWD1nDigis(std::vector< float > adc, std::vector< int > row, std::vector< int > column)
void fillTrk(edm::Event &, const edm::EventSetup &)
int size() const
Definition: ESDataFrame.h:20
virtual void beginJob(void)
void storeECal(PGlobalDigi &)
int gainId() const
get the gainId (2 bits)
void putMB1Digis(std::vector< int > slayer, std::vector< float > time, std::vector< int > layer)
void putFWD1pDigis(std::vector< float > adc, std::vector< int > row, std::vector< int > column)
int size() const
Definition: EcalDataFrame.h:25
unsigned int layer() const
layer id
Definition: PXBDetId.h:35
void putHECalDigis(std::vector< float > aee, std::vector< float > she)
void putMB4Digis(std::vector< int > slayer, std::vector< float > time, std::vector< int > layer)
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
void putTIBL4Digis(std::vector< float > adc, std::vector< int > strip)
void fillMuon(edm::Event &, const edm::EventSetup &)
GlobalDigisProducer(const edm::ParameterSet &)
void putTIBL1Digis(std::vector< float > adc, std::vector< int > strip)
void putTOBL4Digis(std::vector< float > adc, std::vector< int > strip)
int iEvent
Definition: GenABIO.cc:243
static const int sdSiTIB
static const int sdPxlBrl
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const
Definition: HcalCoderDb.cc:37
static const int MAXSAMPLES
Definition: ESDataFrame.h:29
void putESCalDigis(std::vector< float > adc0, std::vector< float > adc1, std::vector< float > adc2, std::vector< float > she)
void storeTrk(PGlobalDigi &)
int j
Definition: DBlmapReader.cc:9
void putMB3Digis(std::vector< int > slayer, std::vector< float > time, std::vector< int > layer)
void storeHCal(PGlobalDigi &)
virtual void produce(edm::Event &, const edm::EventSetup &)
void putCSCwireDigis(std::vector< float > time)
static const int sdSiTOB
float gain6Over1() const
void putTECW5Digis(std::vector< float > adc, std::vector< int > strip)
#define end
Definition: vmac.h:38
void putFWD2nDigis(std::vector< float > adc, std::vector< int > row, std::vector< int > column)
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:39
void putTECW1Digis(std::vector< float > adc, std::vector< int > strip)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:356
unsigned int disk() const
disk id
Definition: PXFDetId.h:43
key_type id() const
Definition: EEDataFrame.h:29
const int verbosity
void putTECW8Digis(std::vector< float > adc, std::vector< int > strip)
void putHFCalDigis(std::vector< float > aee, std::vector< float > she)
Definition: DetId.h:20
void putEBCalDigis(std::vector< int > maxpos, std::vector< double > aee, std::vector< float > she)
std::map< int, double, std::less< int > > ECalgainConv_
void putTECW3Digis(std::vector< float > adc, std::vector< int > strip)
int size() const
get the size
Definition: CaloSamples.h:24
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
static const int sdHcalFwd
float gain12Over6() const
std::vector< DigiType >::const_iterator const_iterator
void putTIDW3Digis(std::vector< float > adc, std::vector< int > strip)
T const * product() const
Definition: Handle.h:74
unsigned int wheel() const
wheel id
Definition: TECDetId.h:52
static const int sdHcalBrl
void putTECW2Digis(std::vector< float > adc, std::vector< int > strip)
unsigned int layer() const
layer id
Definition: TIBDetId.h:41
std::string const & label() const
Definition: InputTag.h:25
edm::EventID id() const
Definition: EventBase.h:56
static const int sdSiTEC
void putTOBL2Digis(std::vector< float > adc, std::vector< int > strip)
#define begin
Definition: vmac.h:31
void putEECalDigis(std::vector< int > maxpos, std::vector< double > aee, std::vector< float > she)
void storeMuon(PGlobalDigi &)
unsigned int side() const
positive or negative id
Definition: PXFDetId.h:38
void putTIDW1Digis(std::vector< float > adc, std::vector< int > strip)
std::pair< const_iterator, const_iterator > Range
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:18
void fillHCal(edm::Event &, const edm::EventSetup &)
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:341
static const int sdPxlFwd
void fillECal(edm::Event &, const edm::EventSetup &)
collection_type::const_iterator const_iterator
Definition: DetSet.h:32
bool isValid() const
Definition: ESHandle.h:37
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
void putBRL1Digis(std::vector< float > adc, std::vector< int > row, std::vector< int > column)
void putFWD2pDigis(std::vector< float > adc, std::vector< int > row, std::vector< int > column)
std::string const & instance() const
Definition: InputTag.h:26
static const int sdHcalEC
static const int MAXSAMPLES
Definition: EcalDataFrame.h:44
void putTECW7Digis(std::vector< float > adc, std::vector< int > strip)
int adc() const
get the ADC sample (12 bits)
unsigned int wheel() const
wheel id
Definition: TIDDetId.h:50
void putTECW4Digis(std::vector< float > adc, std::vector< int > strip)