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  iEvent.getByLabel(ECalEBSrc_, EcalDigiEB);
286  if (!EcalDigiEB.isValid()) {
287  edm::LogWarning(MsgLoggerCat)
288  << "Unable to find EcalDigiEB in event!";
289  return;
290  }
291  if ( EcalDigiEB->size() == 0) isBarrel = false;
292 
293  if (isBarrel) {
294 
295  // loop over simhits
296  const std::string barrelHitsName("EcalHitsEB");
297  iEvent.getByLabel("mix",barrelHitsName,crossingFrame);
298  if (!crossingFrame.isValid()) {
299  edm::LogWarning(MsgLoggerCat)
300  << "Unable to find cal barrel crossingFrame in event!";
301  return;
302  }
303  //std::auto_ptr<MixCollection<PCaloHit> >
304  //barrelHits(new MixCollection<PCaloHit>
305  // (crossingFrame.product(), barrelHitsName));
306  std::auto_ptr<MixCollection<PCaloHit> >
307  barrelHits(new MixCollection<PCaloHit>(crossingFrame.product()));
308 
309  // keep track of sum of simhit energy in each crystal
310  MapType ebSimMap;
312  = barrelHits->begin();
313  hitItr != barrelHits->end();
314  ++hitItr) {
315 
316  EBDetId ebid = EBDetId(hitItr->id());
317 
318  uint32_t crystid = ebid.rawId();
319  ebSimMap[crystid] += hitItr->energy();
320  }
321 
322  // loop over digis
323  const EBDigiCollection *barrelDigi = EcalDigiEB.product();
324 
325  std::vector<double> ebAnalogSignal;
326  std::vector<double> ebADCCounts;
327  std::vector<double> ebADCGains;
328  ebAnalogSignal.reserve(EBDataFrame::MAXSAMPLES);
329  ebADCCounts.reserve(EBDataFrame::MAXSAMPLES);
330  ebADCGains.reserve(EBDataFrame::MAXSAMPLES);
331 
332  int i = 0;
333  for (unsigned int digis=0; digis<EcalDigiEB->size(); ++digis)
334  {
335  //for (std::vector<EBDataFrame>::const_iterator digis =
336  // barrelDigi->begin();
337  // digis != barrelDigi->end();
338  // ++digis) {
339 
340  ++i;
341 
342  EBDataFrame ebdf = (*barrelDigi)[digis];
343  int nrSamples = ebdf.size();
344 
345  EBDetId ebid = ebdf.id () ;
346  //EBDetId ebid = digis->id();
347 
348  double Emax = 0;
349  int Pmax = 0;
350  double pedestalPreSample = 0.;
351  double pedestalPreSampleAnalog = 0.;
352 
353  for (int sample = 0 ; sample < nrSamples; ++sample) {
354  //for (int sample = 0; sample < digis->size(); ++sample) {
355  ebAnalogSignal[sample] = 0.;
356  ebADCCounts[sample] = 0.;
357  ebADCGains[sample] = -1.;
358  }
359 
360  // calculate maximum energy and pedestal
361  for (int sample = 0 ; sample < nrSamples; ++sample) {
362  //for (int sample = 0; sample < digis->size(); ++sample) {
363 
364  EcalMGPASample thisSample = ebdf[sample];
365  ebADCCounts[sample] = (thisSample.adc());
366  ebADCGains[sample] = (thisSample.gainId());
367  ebAnalogSignal[sample] =
368  (ebADCCounts[sample] * ECalgainConv_[(int)ebADCGains[sample]]
370  if (Emax < ebAnalogSignal[sample]) {
371  Emax = ebAnalogSignal[sample];
372  Pmax = sample;
373  }
374  if ( sample < 3 ) {
375  pedestalPreSample += ebADCCounts[sample] ;
376  pedestalPreSampleAnalog +=
377  ebADCCounts[sample] * ECalgainConv_[(int)ebADCGains[sample]]
378  * ECalbarrelADCtoGeV_ ;
379  }
380 
381  }
382  pedestalPreSample /= 3. ;
383  pedestalPreSampleAnalog /= 3. ;
384 
385  // calculate pedestal subtracted digi energy in the crystal
386  double Erec = Emax - pedestalPreSampleAnalog
387  * ECalgainConv_[(int)ebADCGains[Pmax]];
388 
389  // gather necessary information
390  EBCalAEE.push_back(Erec);
391  EBCalSHE.push_back(ebSimMap[ebid.rawId()]);
392  EBCalmaxPos.push_back(Pmax);
393  }
394 
395  if (verbosity > 1) {
396  eventout += "\n Number of EBDigis collected:.............. ";
397  eventout += i;
398  }
399  }
400 
402  //extract EE information
404  bool isEndCap = true;
405  edm::Handle<EEDigiCollection> EcalDigiEE;
406  iEvent.getByLabel(ECalEESrc_, EcalDigiEE);
407  if (!EcalDigiEE.isValid()) {
408  edm::LogWarning(MsgLoggerCat)
409  << "Unable to find EcalDigiEE in event!";
410  return;
411  }
412  if (EcalDigiEE->size() == 0) isEndCap = false;
413 
414  if (isEndCap) {
415 
416  // loop over simhits
417  const std::string endcapHitsName("EcalHitsEE");
418  iEvent.getByLabel("mix",endcapHitsName,crossingFrame);
419  if (!crossingFrame.isValid()) {
420  edm::LogWarning(MsgLoggerCat)
421  << "Unable to find cal endcap crossingFrame in event!";
422  return;
423  }
424  //std::auto_ptr<MixCollection<PCaloHit> >
425  // endcapHits(new MixCollection<PCaloHit>
426  // (crossingFrame.product(), endcapHitsName));
427  std::auto_ptr<MixCollection<PCaloHit> >
428  endcapHits(new MixCollection<PCaloHit>(crossingFrame.product()));
429 
430  // keep track of sum of simhit energy in each crystal
431  MapType eeSimMap;
433  = endcapHits->begin();
434  hitItr != endcapHits->end();
435  ++hitItr) {
436 
437  EEDetId eeid = EEDetId(hitItr->id());
438 
439  uint32_t crystid = eeid.rawId();
440  eeSimMap[crystid] += hitItr->energy();
441  }
442 
443  // loop over digis
444  const EEDigiCollection *endcapDigi = EcalDigiEE.product();
445 
446  std::vector<double> eeAnalogSignal;
447  std::vector<double> eeADCCounts;
448  std::vector<double> eeADCGains;
449  eeAnalogSignal.reserve(EEDataFrame::MAXSAMPLES);
450  eeADCCounts.reserve(EEDataFrame::MAXSAMPLES);
451  eeADCGains.reserve(EEDataFrame::MAXSAMPLES);
452 
453  int i = 0;
454  //for (std::vector<EEDataFrame>::const_iterator digis =
455  // endcapDigi->begin();
456  // digis != endcapDigi->end();
457  // ++digis) {
458  for (unsigned int digis=0; digis<EcalDigiEE->size(); ++digis){
459 
460  ++i;
461 
462  EEDataFrame eedf = (*endcapDigi)[digis];
463  int nrSamples = eedf.size();
464 
465  EEDetId eeid = eedf.id () ;
466  //EEDetId eeid = digis->id();
467 
468  double Emax = 0;
469  int Pmax = 0;
470  double pedestalPreSample = 0.;
471  double pedestalPreSampleAnalog = 0.;
472 
473  for (int sample = 0 ; sample < nrSamples; ++sample) {
474  //for (int sample = 0; sample < digis->size(); ++sample) {
475  eeAnalogSignal[sample] = 0.;
476  eeADCCounts[sample] = 0.;
477  eeADCGains[sample] = -1.;
478  }
479 
480  // calculate maximum enery and pedestal
481  for (int sample = 0 ; sample < nrSamples; ++sample) {
482  //for (int sample = 0; sample < digis->size(); ++sample) {
483 
484  EcalMGPASample thisSample = eedf[sample];
485 
486  eeADCCounts[sample] = (thisSample.adc());
487  eeADCGains[sample] = (thisSample.gainId());
488  eeAnalogSignal[sample] =
489  (eeADCCounts[sample] * ECalgainConv_[(int)eeADCGains[sample]]
491  if (Emax < eeAnalogSignal[sample]) {
492  Emax = eeAnalogSignal[sample];
493  Pmax = sample;
494  }
495  if ( sample < 3 ) {
496  pedestalPreSample += eeADCCounts[sample] ;
497  pedestalPreSampleAnalog +=
498  eeADCCounts[sample] * ECalgainConv_[(int)eeADCGains[sample]]
499  * ECalbarrelADCtoGeV_ ;
500  }
501 
502  }
503  pedestalPreSample /= 3. ;
504  pedestalPreSampleAnalog /= 3. ;
505 
506  // calculate pedestal subtracted digi energy in the crystal
507  double Erec = Emax - pedestalPreSampleAnalog
508  * ECalgainConv_[(int)eeADCGains[Pmax]];
509 
510  // gather necessary information
511  EECalAEE.push_back(Erec);
512  EECalSHE.push_back(eeSimMap[eeid.rawId()]);
513  EECalmaxPos.push_back(Pmax);
514  }
515 
516  if (verbosity > 1) {
517  eventout += "\n Number of EEDigis collected:.............. ";
518  eventout += i;
519  }
520  }
521 
523  //extract ES information
525  bool isPreshower = true;
526  edm::Handle<ESDigiCollection> EcalDigiES;
527  iEvent.getByLabel(ECalESSrc_, EcalDigiES);
528  if (!EcalDigiES.isValid()) {
529  edm::LogWarning(MsgLoggerCat)
530  << "Unable to find EcalDigiES in event!";
531  return;
532  }
533  if (EcalDigiES->size() == 0) isPreshower = false;
534 
535  if (isPreshower) {
536 
537  // loop over simhits
538  const std::string preshowerHitsName("EcalHitsES");
539  iEvent.getByLabel("mix",preshowerHitsName,crossingFrame);
540  if (!crossingFrame.isValid()) {
541  edm::LogWarning(MsgLoggerCat)
542  << "Unable to find cal preshower crossingFrame in event!";
543  return;
544  }
545  //std::auto_ptr<MixCollection<PCaloHit> >
546  // preshowerHits(new MixCollection<PCaloHit>
547  // (crossingFrame.product(), preshowerHitsName));
548  std::auto_ptr<MixCollection<PCaloHit> >
549  preshowerHits(new MixCollection<PCaloHit>(crossingFrame.product()));
550 
551  // keep track of sum of simhit energy in each crystal
552  MapType esSimMap;
554  = preshowerHits->begin();
555  hitItr != preshowerHits->end();
556  ++hitItr) {
557 
558  ESDetId esid = ESDetId(hitItr->id());
559 
560  uint32_t crystid = esid.rawId();
561  esSimMap[crystid] += hitItr->energy();
562  }
563 
564  // loop over digis
565  const ESDigiCollection *preshowerDigi = EcalDigiES.product();
566 
567  std::vector<double> esADCCounts;
568  esADCCounts.reserve(ESDataFrame::MAXSAMPLES);
569 
570  int i = 0;
571  for (unsigned int digis=0; digis<EcalDigiES->size(); ++digis) {
572  //for (std::vector<ESDataFrame>::const_iterator digis =
573  // preshowerDigi->begin();
574  // digis != preshowerDigi->end();
575  // ++digis) {
576 
577  ++i;
578 
579 
580  ESDataFrame esdf = (*preshowerDigi)[digis];
581  int nrSamples = esdf.size();
582 
583  ESDetId esid = esdf.id () ;
584  // ESDetId esid = digis->id();
585 
586  for (int sample = 0 ; sample < nrSamples; ++sample) {
587  //for (int sample = 0; sample < digis->size(); ++sample) {
588  esADCCounts[sample] = 0.;
589  }
590 
591  // gether ADC counts
592  for (int sample = 0 ; sample < nrSamples; ++sample) {
593 
594  ESSample thisSample = esdf[sample];
595  //for (int sample = 0; sample < digis->size(); ++sample) {
596  esADCCounts[sample] = (thisSample.adc());
597  }
598 
599  ESCalADC0.push_back(esADCCounts[0]);
600  ESCalADC1.push_back(esADCCounts[1]);
601  ESCalADC2.push_back(esADCCounts[2]);
602  ESCalSHE.push_back(esSimMap[esid.rawId()]);
603  }
604 
605  if (verbosity > 1) {
606  eventout += "\n Number of ESDigis collected:.............. ";
607  eventout += i;
608  }
609  }
610 
611  if (verbosity > 0)
612  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
613 
614  return;
615 }
616 
618 {
619  std::string MsgLoggerCat = "GlobalDigisProducer_storeECal";
620 
621  if (verbosity > 2) {
622  TString eventout("\n nEBDigis = ");
623  eventout += EBCalmaxPos.size();
624  for (unsigned int i = 0; i < EBCalmaxPos.size(); ++i) {
625  eventout += "\n (maxPos, AEE, SHE) = (";
626  eventout += EBCalmaxPos[i];
627  eventout += ", ";
628  eventout += EBCalAEE[i];
629  eventout += ", ";
630  eventout += EBCalSHE[i];
631  eventout += ")";
632  }
633  eventout += "\n nEEDigis = ";
634  eventout += EECalmaxPos.size();
635  for (unsigned int i = 0; i < EECalmaxPos.size(); ++i) {
636  eventout += "\n (maxPos, AEE, SHE) = (";
637  eventout += EECalmaxPos[i];
638  eventout += ", ";
639  eventout += EECalAEE[i];
640  eventout += ", ";
641  eventout += EECalSHE[i];
642  eventout += ")";
643  }
644  eventout += "\n nESDigis = ";
645  eventout += ESCalADC0.size();
646  for (unsigned int i = 0; i < ESCalADC0.size(); ++i) {
647  eventout += "\n (ADC0, ADC1, ADC2, SHE) = (";
648  eventout += ESCalADC0[i];
649  eventout += ", ";
650  eventout += ESCalADC1[i];
651  eventout += ", ";
652  eventout += ESCalADC2[i];
653  eventout += ", ";
654  eventout += ESCalSHE[i];
655  eventout += ")";
656  }
657  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
658  }
659 
663 
664  return;
665 }
666 
668  const edm::EventSetup& iSetup)
669 {
670  std::string MsgLoggerCat = "GlobalDigisProducer_fillHCal";
671 
672  TString eventout;
673  if (verbosity > 0)
674  eventout = "\nGathering info:";
675 
676  // get calibration info
677  edm::ESHandle<HcalDbService> HCalconditions;
678  iSetup.get<HcalDbRecord>().get(HCalconditions);
679  if (!HCalconditions.isValid()) {
680  edm::LogWarning(MsgLoggerCat)
681  << "Unable to find HCalconditions in event!";
682  return;
683  }
684  const HcalQIEShape *shape = HCalconditions->getHcalShape();
685  //HcalCalibrations calibrations;
686  CaloSamples tool;
687 
689  // extract simhit info
692  iEvent.getByLabel(HCalSrc_,hcalHits);
693  if (!hcalHits.isValid()) {
694  edm::LogWarning(MsgLoggerCat)
695  << "Unable to find hcalHits in event!";
696  return;
697  }
698  const edm::PCaloHitContainer *simhitResult = hcalHits.product();
699 
700  MapType fHBEnergySimHits;
701  MapType fHEEnergySimHits;
702  MapType fHOEnergySimHits;
703  MapType fHFEnergySimHits;
704  for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin();
705  simhits != simhitResult->end();
706  ++simhits) {
707 
708  HcalDetId detId(simhits->id());
709  uint32_t cellid = detId.rawId();
710 
711  if (detId.subdet() == sdHcalBrl){
712  fHBEnergySimHits[cellid] += simhits->energy();
713  }
714  if (detId.subdet() == sdHcalEC){
715  fHEEnergySimHits[cellid] += simhits->energy();
716  }
717  if (detId.subdet() == sdHcalOut){
718  fHOEnergySimHits[cellid] += simhits->energy();
719  }
720  if (detId.subdet() == sdHcalFwd){
721  fHFEnergySimHits[cellid] += simhits->energy();
722  }
723  }
724 
726  // get HBHE information
729  iEvent.getByLabel(HCalDigi_,hbhe);
730  if (!hbhe.isValid()) {
731  edm::LogWarning(MsgLoggerCat)
732  << "Unable to find HBHEDataFrame in event!";
733  return;
734  }
736 
737  int iHB = 0;
738  int iHE = 0;
739  for (ihbhe = hbhe->begin(); ihbhe != hbhe->end(); ++ihbhe) {
740  HcalDetId cell(ihbhe->id());
741 
742  if ((cell.subdet() == sdHcalBrl) || (cell.subdet() == sdHcalEC)) {
743 
744  //HCalconditions->makeHcalCalibration(cell, &calibrations);
745  const HcalCalibrations& calibrations =
746  HCalconditions->getHcalCalibrations(cell);
747  const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
748  HcalCoderDb coder(*channelCoder, *shape);
749  coder.adc2fC(*ihbhe, tool);
750 
751  // get HB info
752  if (cell.subdet() == sdHcalBrl) {
753 
754  ++iHB;
755  float fDigiSum = 0.0;
756  for (int ii = 0; ii < tool.size(); ++ii) {
757  // default ped is 4.5
758  int capid = (*ihbhe)[ii].capid();
759  fDigiSum += (tool[ii] - calibrations.pedestal(capid));
760  }
761 
762  HBCalAEE.push_back(fDigiSum);
763  HBCalSHE.push_back(fHBEnergySimHits[cell.rawId()]);
764  }
765 
766  // get HE info
767  if (cell.subdet() == sdHcalEC) {
768 
769  ++iHE;
770  float fDigiSum = 0.0;
771  for (int ii = 0; ii < tool.size(); ++ii) {
772  int capid = (*ihbhe)[ii].capid();
773  fDigiSum += (tool[ii]-calibrations.pedestal(capid));
774  }
775 
776  HECalAEE.push_back(fDigiSum);
777  HECalSHE.push_back(fHEEnergySimHits[cell.rawId()]);
778  }
779  }
780  }
781 
782  if (verbosity > 1) {
783  eventout += "\n Number of HBDigis collected:.............. ";
784  eventout += iHB;
785  }
786 
787  if (verbosity > 1) {
788  eventout += "\n Number of HEDigis collected:.............. ";
789  eventout += iHE;
790  }
791 
793  // get HO information
796  iEvent.getByLabel(HCalDigi_,ho);
797  if (!ho.isValid()) {
798  edm::LogWarning(MsgLoggerCat)
799  << "Unable to find HODataFrame in event!";
800  return;
801  }
803 
804  int iHO = 0;
805  for (iho = ho->begin(); iho != ho->end(); ++iho) {
806  HcalDetId cell(iho->id());
807 
808  if (cell.subdet() == sdHcalOut) {
809 
810  //HCalconditions->makeHcalCalibration(cell, &calibrations);
811  const HcalCalibrations& calibrations =
812  HCalconditions->getHcalCalibrations(cell);
813  const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
814  HcalCoderDb coder (*channelCoder, *shape);
815  coder.adc2fC(*iho, tool);
816 
817  ++iHO;
818  float fDigiSum = 0.0;
819  for (int ii = 0; ii < tool.size(); ++ii) {
820  // default ped is 4.5
821  int capid = (*iho)[ii].capid();
822  fDigiSum += (tool[ii] - calibrations.pedestal(capid));
823  }
824 
825  HOCalAEE.push_back(fDigiSum);
826  HOCalSHE.push_back(fHOEnergySimHits[cell.rawId()]);
827  }
828  }
829 
830  if (verbosity > 1) {
831  eventout += "\n Number of HODigis collected:.............. ";
832  eventout += iHO;
833  }
834 
836  // get HF information
839  iEvent.getByLabel(HCalDigi_,hf);
840  if (!hf.isValid()) {
841  edm::LogWarning(MsgLoggerCat)
842  << "Unable to find HFDataFrame in event!";
843  return;
844  }
846 
847  int iHF = 0;
848  for (ihf = hf->begin(); ihf != hf->end(); ++ihf) {
849  HcalDetId cell(ihf->id());
850 
851  if (cell.subdet() == sdHcalFwd) {
852 
853  //HCalconditions->makeHcalCalibration(cell, &calibrations);
854  const HcalCalibrations& calibrations =
855  HCalconditions->getHcalCalibrations(cell);
856  const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
857  HcalCoderDb coder (*channelCoder, *shape);
858  coder.adc2fC(*ihf, tool);
859 
860  ++iHF;
861  float fDigiSum = 0.0;
862  for (int ii = 0; ii < tool.size(); ++ii) {
863  // default ped is 1.73077
864  int capid = (*ihf)[ii].capid();
865  fDigiSum += (tool[ii] - calibrations.pedestal(capid));
866  }
867 
868  HFCalAEE.push_back(fDigiSum);
869  HFCalSHE.push_back(fHFEnergySimHits[cell.rawId()]);
870  }
871  }
872 
873  if (verbosity > 1) {
874  eventout += "\n Number of HFDigis collected:.............. ";
875  eventout += iHF;
876  }
877 
878  if (verbosity > 0)
879  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
880 
881  return;
882 }
883 
885 {
886  std::string MsgLoggerCat = "GlobalDigisProducer_storeHCal";
887 
888  if (verbosity > 2) {
889  TString eventout("\n nHBDigis = ");
890  eventout += HBCalAEE.size();
891  for (unsigned int i = 0; i < HBCalAEE.size(); ++i) {
892  eventout += "\n (AEE, SHE) = (";
893  eventout += HBCalAEE[i];
894  eventout += ", ";
895  eventout += HBCalSHE[i];
896  eventout += ")";
897  }
898  eventout += "\n nHEDigis = ";
899  eventout += HECalAEE.size();
900  for (unsigned int i = 0; i < HECalAEE.size(); ++i) {
901  eventout += "\n (AEE, SHE) = (";
902  eventout += HECalAEE[i];
903  eventout += ", ";
904  eventout += HECalSHE[i];
905  eventout += ")";
906  }
907  eventout += "\n nHODigis = ";
908  eventout += HOCalAEE.size();
909  for (unsigned int i = 0; i < HOCalAEE.size(); ++i) {
910  eventout += "\n (AEE, SHE) = (";
911  eventout += HOCalAEE[i];
912  eventout += ", ";
913  eventout += HOCalSHE[i];
914  eventout += ")";
915  }
916  eventout += "\n nHFDigis = ";
917  eventout += HFCalAEE.size();
918  for (unsigned int i = 0; i < HFCalAEE.size(); ++i) {
919  eventout += "\n (AEE, SHE) = (";
920  eventout += HFCalAEE[i];
921  eventout += ", ";
922  eventout += HFCalSHE[i];
923  eventout += ")";
924  }
925 
926  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
927  }
928 
933 
934  return;
935 }
936 
938  const edm::EventSetup& iSetup)
939 {
940  std::string MsgLoggerCat = "GlobalDigisProducer_fillTrk";
941 
942  TString eventout;
943  if (verbosity > 0)
944  eventout = "\nGathering info:";
945 
946  // get strip information
948  iEvent.getByLabel(SiStripSrc_, stripDigis);
949  if (!stripDigis.isValid()) {
950  edm::LogWarning(MsgLoggerCat)
951  << "Unable to find stripDigis in event!";
952  return;
953  }
954 
955  int nStripBrl = 0, nStripFwd = 0;
957  for (DSViter = stripDigis->begin(); DSViter != stripDigis->end();
958  ++DSViter) {
959  unsigned int id = DSViter->id;
960  DetId detId(id);
964 
965  // get TIB
966  if (detId.subdetId() == sdSiTIB) {
967  TIBDetId tibid(id);
968  for (iter = begin; iter != end; ++iter) {
969  ++nStripBrl;
970  if (tibid.layer() == 1) {
971  TIBL1ADC.push_back((*iter).adc());
972  TIBL1Strip.push_back((*iter).strip());
973  }
974  if (tibid.layer() == 2) {
975  TIBL2ADC.push_back((*iter).adc());
976  TIBL2Strip.push_back((*iter).strip());
977  }
978  if (tibid.layer() == 3) {
979  TIBL3ADC.push_back((*iter).adc());
980  TIBL3Strip.push_back((*iter).strip());
981  }
982  if (tibid.layer() == 4) {
983  TIBL4ADC.push_back((*iter).adc());
984  TIBL4Strip.push_back((*iter).strip());
985  }
986  }
987  }
988 
989  // get TOB
990  if (detId.subdetId() == sdSiTOB) {
991  TOBDetId tobid(id);
992  for (iter = begin; iter != end; ++iter) {
993  ++nStripBrl;
994  if (tobid.layer() == 1) {
995  TOBL1ADC.push_back((*iter).adc());
996  TOBL1Strip.push_back((*iter).strip());
997  }
998  if (tobid.layer() == 2) {
999  TOBL2ADC.push_back((*iter).adc());
1000  TOBL2Strip.push_back((*iter).strip());
1001  }
1002  if (tobid.layer() == 3) {
1003  TOBL3ADC.push_back((*iter).adc());
1004  TOBL3Strip.push_back((*iter).strip());
1005  }
1006  if (tobid.layer() == 4) {
1007  TOBL4ADC.push_back((*iter).adc());
1008  TOBL4Strip.push_back((*iter).strip());
1009  }
1010  }
1011  }
1012 
1013  // get TID
1014  if (detId.subdetId() == sdSiTID) {
1015  TIDDetId tidid(id);
1016  for (iter = begin; iter != end; ++iter) {
1017  ++nStripFwd;
1018  if (tidid.wheel() == 1) {
1019  TIDW1ADC.push_back((*iter).adc());
1020  TIDW1Strip.push_back((*iter).strip());
1021  }
1022  if (tidid.wheel() == 2) {
1023  TIDW2ADC.push_back((*iter).adc());
1024  TIDW2Strip.push_back((*iter).strip());
1025  }
1026  if (tidid.wheel() == 3) {
1027  TIDW3ADC.push_back((*iter).adc());
1028  TIDW3Strip.push_back((*iter).strip());
1029  }
1030  }
1031  }
1032 
1033  // get TEC
1034  if (detId.subdetId() == sdSiTEC) {
1035  TECDetId tecid(id);
1036  for (iter = begin; iter != end; ++iter) {
1037  ++nStripFwd;
1038  if (tecid.wheel() == 1) {
1039  TECW1ADC.push_back((*iter).adc());
1040  TECW1Strip.push_back((*iter).strip());
1041  }
1042  if (tecid.wheel() == 2) {
1043  TECW2ADC.push_back((*iter).adc());
1044  TECW2Strip.push_back((*iter).strip());
1045  }
1046  if (tecid.wheel() == 3) {
1047  TECW3ADC.push_back((*iter).adc());
1048  TECW3Strip.push_back((*iter).strip());
1049  }
1050  if (tecid.wheel() == 4) {
1051  TECW4ADC.push_back((*iter).adc());
1052  TECW4Strip.push_back((*iter).strip());
1053  }
1054  if (tecid.wheel() == 5) {
1055  TECW5ADC.push_back((*iter).adc());
1056  TECW5Strip.push_back((*iter).strip());
1057  }
1058  if (tecid.wheel() == 6) {
1059  TECW6ADC.push_back((*iter).adc());
1060  TECW6Strip.push_back((*iter).strip());
1061  }
1062  if (tecid.wheel() == 7) {
1063  TECW7ADC.push_back((*iter).adc());
1064  TECW7Strip.push_back((*iter).strip());
1065  }
1066  if (tecid.wheel() == 8) {
1067  TECW8ADC.push_back((*iter).adc());
1068  TECW8Strip.push_back((*iter).strip());
1069  }
1070  }
1071  }
1072  } // end loop over DataSetVector
1073 
1074  if (verbosity > 1) {
1075  eventout += "\n Number of BrlStripDigis collected:........ ";
1076  eventout += nStripBrl;
1077  }
1078 
1079  if (verbosity > 1) {
1080  eventout += "\n Number of FrwdStripDigis collected:....... ";
1081  eventout += nStripFwd;
1082  }
1083 
1084  // get pixel information
1086  iEvent.getByLabel(SiPxlSrc_, pixelDigis);
1087  if (!pixelDigis.isValid()) {
1088  edm::LogWarning(MsgLoggerCat)
1089  << "Unable to find pixelDigis in event!";
1090  return;
1091  }
1092 
1093  int nPxlBrl = 0, nPxlFwd = 0;
1095  for (DPViter = pixelDigis->begin(); DPViter != pixelDigis->end();
1096  ++DPViter) {
1097  unsigned int id = DPViter->id;
1098  DetId detId(id);
1102 
1103  // get Barrel pixels
1104  if (detId.subdetId() == sdPxlBrl) {
1105  PXBDetId bdetid(id);
1106  for (iter = begin; iter != end; ++iter) {
1107  ++nPxlBrl;
1108  if (bdetid.layer() == 1) {
1109  BRL1ADC.push_back((*iter).adc());
1110  BRL1Row.push_back((*iter).row());
1111  BRL1Col.push_back((*iter).column());
1112  }
1113  if (bdetid.layer() == 2) {
1114  BRL2ADC.push_back((*iter).adc());
1115  BRL2Row.push_back((*iter).row());
1116  BRL2Col.push_back((*iter).column());
1117  }
1118  if (bdetid.layer() == 3) {
1119  BRL3ADC.push_back((*iter).adc());
1120  BRL3Row.push_back((*iter).row());
1121  BRL3Col.push_back((*iter).column());
1122  }
1123  }
1124  }
1125 
1126  // get Forward pixels
1127  if (detId.subdetId() == sdPxlFwd) {
1128  PXFDetId fdetid(id);
1129  for (iter = begin; iter != end; ++iter) {
1130  ++nPxlFwd;
1131  if (fdetid.disk() == 1) {
1132  if (fdetid.side() == 1) {
1133  FWD1nADC.push_back((*iter).adc());
1134  FWD1nRow.push_back((*iter).row());
1135  FWD1nCol.push_back((*iter).column());
1136  }
1137  if (fdetid.side() == 2) {
1138  FWD1pADC.push_back((*iter).adc());
1139  FWD1pRow.push_back((*iter).row());
1140  FWD1pCol.push_back((*iter).column());
1141  }
1142  }
1143  if (fdetid.disk() == 2) {
1144  if (fdetid.side() == 1) {
1145  FWD2nADC.push_back((*iter).adc());
1146  FWD2nRow.push_back((*iter).row());
1147  FWD2nCol.push_back((*iter).column());
1148  }
1149  if (fdetid.side() == 2) {
1150  FWD2pADC.push_back((*iter).adc());
1151  FWD2pRow.push_back((*iter).row());
1152  FWD2pCol.push_back((*iter).column());
1153  }
1154  }
1155  }
1156  }
1157  }
1158 
1159  if (verbosity > 1) {
1160  eventout += "\n Number of BrlPixelDigis collected:........ ";
1161  eventout += nPxlBrl;
1162  }
1163 
1164  if (verbosity > 1) {
1165  eventout += "\n Number of FrwdPixelDigis collected:....... ";
1166  eventout += nPxlFwd;
1167  }
1168 
1169  if (verbosity > 0)
1170  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1171 
1172  return;
1173 }
1174 
1176 {
1177  std::string MsgLoggerCat = "GlobalDigisProducer_storeTrk";
1178 
1179  if (verbosity > 2) {
1180 
1181  // strip output
1182  TString eventout("\n nTIBL1 = ");
1183  eventout += TIBL1ADC.size();
1184  for (unsigned int i = 0; i < TIBL1ADC.size(); ++i) {
1185  eventout += "\n (ADC, strip) = (";
1186  eventout += TIBL1ADC[i];
1187  eventout += ", ";
1188  eventout += TIBL1Strip[i];
1189  eventout += ")";
1190  }
1191  eventout += "\n nTIBL2 = ";
1192  eventout += TIBL2ADC.size();
1193  for (unsigned int i = 0; i < TIBL2ADC.size(); ++i) {
1194  eventout += "\n (ADC, strip) = (";
1195  eventout += TIBL2ADC[i];
1196  eventout += ", ";
1197  eventout += TIBL2Strip[i];
1198  eventout += ")";
1199  }
1200  eventout += "\n nTIBL3 = ";
1201  eventout += TIBL3ADC.size();
1202  for (unsigned int i = 0; i < TIBL3ADC.size(); ++i) {
1203  eventout += "\n (ADC, strip) = (";
1204  eventout += TIBL3ADC[i];
1205  eventout += ", ";
1206  eventout += TIBL3Strip[i];
1207  eventout += ")";
1208  }
1209  eventout += "\n nTIBL4 = ";
1210  eventout += TIBL4ADC.size();
1211  for (unsigned int i = 0; i < TIBL4ADC.size(); ++i) {
1212  eventout += "\n (ADC, strip) = (";
1213  eventout += TIBL4ADC[i];
1214  eventout += ", ";
1215  eventout += TIBL4Strip[i];
1216  eventout += ")";
1217  }
1218  eventout += "\n nTOBL1 = ";
1219  eventout += TOBL1ADC.size();
1220  for (unsigned int i = 0; i < TOBL1ADC.size(); ++i) {
1221  eventout += "\n (ADC, strip) = (";
1222  eventout += TOBL1ADC[i];
1223  eventout += ", ";
1224  eventout += TOBL1Strip[i];
1225  eventout += ")";
1226  }
1227  eventout += "\n nTOBL2 = ";
1228  eventout += TOBL2ADC.size();
1229  for (unsigned int i = 0; i < TOBL2ADC.size(); ++i) {
1230  eventout += "\n (ADC, strip) = (";
1231  eventout += TOBL2ADC[i];
1232  eventout += ", ";
1233  eventout += TOBL2Strip[i];
1234  eventout += ")";
1235  }
1236  eventout += "\n nTOBL3 = ";
1237  eventout += TOBL3ADC.size();
1238  for (unsigned int i = 0; i < TOBL3ADC.size(); ++i) {
1239  eventout += "\n (ADC, strip) = (";
1240  eventout += TOBL3ADC[i];
1241  eventout += ", ";
1242  eventout += TOBL3Strip[i];
1243  eventout += ")";
1244  }
1245  eventout += "\n nTOBL4 = ";
1246  eventout += TOBL4ADC.size();
1247  for (unsigned int i = 0; i < TOBL4ADC.size(); ++i) {
1248  eventout += "\n (ADC, strip) = (";
1249  eventout += TOBL4ADC[i];
1250  eventout += ", ";
1251  eventout += TOBL4Strip[i];
1252  eventout += ")";
1253  }
1254  eventout += "\n nTIDW1 = ";
1255  eventout += TIDW1ADC.size();
1256  for (unsigned int i = 0; i < TIDW1ADC.size(); ++i) {
1257  eventout += "\n (ADC, strip) = (";
1258  eventout += TIDW1ADC[i];
1259  eventout += ", ";
1260  eventout += TIDW1Strip[i];
1261  eventout += ")";
1262  }
1263  eventout += "\n nTIDW2 = ";
1264  eventout += TIDW2ADC.size();
1265  for (unsigned int i = 0; i < TIDW2ADC.size(); ++i) {
1266  eventout += "\n (ADC, strip) = (";
1267  eventout += TIDW2ADC[i];
1268  eventout += ", ";
1269  eventout += TIDW2Strip[i];
1270  eventout += ")";
1271  }
1272  eventout += "\n nTIDW3 = ";
1273  eventout += TIDW3ADC.size();
1274  for (unsigned int i = 0; i < TIDW3ADC.size(); ++i) {
1275  eventout += "\n (ADC, strip) = (";
1276  eventout += TIDW3ADC[i];
1277  eventout += ", ";
1278  eventout += TIDW3Strip[i];
1279  eventout += ")";
1280  }
1281  eventout += "\n nTECW1 = ";
1282  eventout += TECW1ADC.size();
1283  for (unsigned int i = 0; i < TECW1ADC.size(); ++i) {
1284  eventout += "\n (ADC, strip) = (";
1285  eventout += TECW1ADC[i];
1286  eventout += ", ";
1287  eventout += TECW1Strip[i];
1288  eventout += ")";
1289  }
1290  eventout += "\n nTECW2 = ";
1291  eventout += TECW2ADC.size();
1292  for (unsigned int i = 0; i < TECW2ADC.size(); ++i) {
1293  eventout += "\n (ADC, strip) = (";
1294  eventout += TECW2ADC[i];
1295  eventout += ", ";
1296  eventout += TECW2Strip[i];
1297  eventout += ")";
1298  }
1299  eventout += "\n nTECW3 = ";
1300  eventout += TECW3ADC.size();
1301  for (unsigned int i = 0; i < TECW3ADC.size(); ++i) {
1302  eventout += "\n (ADC, strip) = (";
1303  eventout += TECW3ADC[i];
1304  eventout += ", ";
1305  eventout += TECW3Strip[i];
1306  eventout += ")";
1307  }
1308  eventout += "\n nTECW4 = ";
1309  eventout += TECW4ADC.size();
1310  for (unsigned int i = 0; i < TECW4ADC.size(); ++i) {
1311  eventout += "\n (ADC, strip) = (";
1312  eventout += TECW4ADC[i];
1313  eventout += ", ";
1314  eventout += TECW4Strip[i];
1315  eventout += ")";
1316  }
1317  eventout += "\n nTECW5 = ";
1318  eventout += TECW5ADC.size();
1319  for (unsigned int i = 0; i < TECW5ADC.size(); ++i) {
1320  eventout += "\n (ADC, strip) = (";
1321  eventout += TECW5ADC[i];
1322  eventout += ", ";
1323  eventout += TECW5Strip[i];
1324  eventout += ")";
1325  }
1326  eventout += "\n nTECW6 = ";
1327  eventout += TECW6ADC.size();
1328  for (unsigned int i = 0; i < TECW6ADC.size(); ++i) {
1329  eventout += "\n (ADC, strip) = (";
1330  eventout += TECW6ADC[i];
1331  eventout += ", ";
1332  eventout += TECW6Strip[i];
1333  eventout += ")";
1334  }
1335  eventout += "\n nTECW7 = ";
1336  eventout += TECW7ADC.size();
1337  for (unsigned int i = 0; i < TECW7ADC.size(); ++i) {
1338  eventout += "\n (ADC, strip) = (";
1339  eventout += TECW7ADC[i];
1340  eventout += ", ";
1341  eventout += TECW7Strip[i];
1342  eventout += ")";
1343  }
1344  eventout += "\n nTECW8 = ";
1345  eventout += TECW8ADC.size();
1346  for (unsigned int i = 0; i < TECW8ADC.size(); ++i) {
1347  eventout += "\n (ADC, strip) = (";
1348  eventout += TECW8ADC[i];
1349  eventout += ", ";
1350  eventout += TECW8Strip[i];
1351  eventout += ")";
1352  }
1353 
1354  // pixel output
1355  eventout += "\n nBRL1 = ";
1356  eventout += BRL1ADC.size();
1357  for (unsigned int i = 0; i < BRL1ADC.size(); ++i) {
1358  eventout += "\n (ADC, row, column) = (";
1359  eventout += BRL1ADC[i];
1360  eventout += ", ";
1361  eventout += BRL1Row[i];
1362  eventout += ", ";
1363  eventout += BRL1Col[i];
1364  eventout += ")";
1365  }
1366  eventout += "\n nBRL2 = ";
1367  eventout += BRL2ADC.size();
1368  for (unsigned int i = 0; i < BRL2ADC.size(); ++i) {
1369  eventout += "\n (ADC, row, column) = (";
1370  eventout += BRL2ADC[i];
1371  eventout += ", ";
1372  eventout += BRL2Row[i];
1373  eventout += ", ";
1374  eventout += BRL2Col[i];
1375  eventout += ")";
1376  }
1377  eventout += "\n nBRL3 = ";
1378  eventout += BRL3ADC.size();
1379  for (unsigned int i = 0; i < BRL3ADC.size(); ++i) {
1380  eventout += "\n (ADC, row, column) = (";
1381  eventout += BRL3ADC[i];
1382  eventout += ", ";
1383  eventout += BRL3Row[i];
1384  eventout += ", ";
1385  eventout += BRL3Col[i];
1386  eventout += ")";
1387  }
1388  eventout += "\n nFWD1p = ";
1389  eventout += FWD1pADC.size();
1390  for (unsigned int i = 0; i < FWD1pADC.size(); ++i) {
1391  eventout += "\n (ADC, row, column) = (";
1392  eventout += FWD1pADC[i];
1393  eventout += ", ";
1394  eventout += FWD1pRow[i];
1395  eventout += ", ";
1396  eventout += FWD1pCol[i];
1397  eventout += ")";
1398  }
1399  eventout += "\n nFWD1p = ";
1400  eventout += FWD1nADC.size();
1401  for (unsigned int i = 0; i < FWD1nADC.size(); ++i) {
1402  eventout += "\n (ADC, row, column) = (";
1403  eventout += FWD1nADC[i];
1404  eventout += ", ";
1405  eventout += FWD1nRow[i];
1406  eventout += ", ";
1407  eventout += FWD1nCol[i];
1408  eventout += ")";
1409  }
1410  eventout += "\n nFWD1p = ";
1411  eventout += FWD2pADC.size();
1412  for (unsigned int i = 0; i < FWD2pADC.size(); ++i) {
1413  eventout += "\n (ADC, row, column) = (";
1414  eventout += FWD2pADC[i];
1415  eventout += ", ";
1416  eventout += FWD2pRow[i];
1417  eventout += ", ";
1418  eventout += FWD2pCol[i];
1419  eventout += ")";
1420  }
1421  eventout += "\n nFWD2p = ";
1422  eventout += FWD2nADC.size();
1423  for (unsigned int i = 0; i < FWD2nADC.size(); ++i) {
1424  eventout += "\n (ADC, row, column) = (";
1425  eventout += FWD2nADC[i];
1426  eventout += ", ";
1427  eventout += FWD2nRow[i];
1428  eventout += ", ";
1429  eventout += FWD2nCol[i];
1430  eventout += ")";
1431  }
1432 
1433  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1434  }
1435 
1436  // strip output
1453  product.putTECW6Digis(TECW6ADC,TECW6Strip);
1455  product.putTECW8Digis(TECW8ADC,TECW8Strip);
1456 
1457  // pixel output
1458  product.putBRL1Digis(BRL1ADC, BRL1Row, BRL1Col);
1459  product.putBRL2Digis(BRL2ADC, BRL2Row, BRL2Col);
1460  product.putBRL3Digis(BRL3ADC, BRL3Row, BRL3Col);
1465 
1466  return;
1467 }
1468 
1470  const edm::EventSetup& iSetup)
1471 {
1472  std::string MsgLoggerCat = "GlobalDigisProducer_fillMuon";
1473 
1474  TString eventout;
1475  if (verbosity > 0)
1476  eventout = "\nGathering info:";
1477 
1478  // get DT information
1480  iEvent.getByLabel(MuDTSrc_, dtDigis);
1481  if (!dtDigis.isValid()) {
1482  edm::LogWarning(MsgLoggerCat)
1483  << "Unable to find dtDigis in event!";
1484  return;
1485  }
1486 
1487  int nDt = 0;
1489  for (detUnitIt = dtDigis->begin(); detUnitIt != dtDigis->end();
1490  ++detUnitIt) {
1491 
1492  const DTLayerId& id = (*detUnitIt).first;
1493  const DTDigiCollection::Range& range = (*detUnitIt).second;
1494 
1495  for (DTDigiCollection::const_iterator digiIt = range.first;
1496  digiIt != range.second;
1497  ++digiIt) {
1498 
1499  ++nDt;
1500 
1501  DTWireId wireId(id,(*digiIt).wire());
1502  if (wireId.station() == 1) {
1503  MB1SLayer.push_back(id.superlayer());
1504  MB1Time.push_back((*digiIt).time());
1505  MB1Layer.push_back(id.layer());
1506  }
1507  if (wireId.station() == 2) {
1508  MB2SLayer.push_back(id.superlayer());
1509  MB2Time.push_back((*digiIt).time());
1510  MB2Layer.push_back(id.layer());
1511  }
1512  if (wireId.station() == 3) {
1513  MB3SLayer.push_back(id.superlayer());
1514  MB3Time.push_back((*digiIt).time());
1515  MB3Layer.push_back(id.layer());
1516  }
1517  if (wireId.station() == 4) {
1518  MB4SLayer.push_back(id.superlayer());
1519  MB4Time.push_back((*digiIt).time());
1520  MB4Layer.push_back(id.layer());
1521  }
1522  }
1523  }
1524 
1525  if (verbosity > 1) {
1526  eventout += "\n Number of DtMuonDigis collected:.......... ";
1527  eventout += nDt;
1528  }
1529 
1530  // get CSC Strip information
1532  iEvent.getByLabel(MuCSCStripSrc_, strips);
1533  if (!strips.isValid()) {
1534  edm::LogWarning(MsgLoggerCat)
1535  << "Unable to find muon strips in event!";
1536  return;
1537  }
1538 
1539  int nStrips = 0;
1540  for (CSCStripDigiCollection::DigiRangeIterator j = strips->begin();
1541  j != strips->end();
1542  ++j) {
1543 
1544  std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
1545  std::vector<CSCStripDigi>::const_iterator last = (*j).second.second;
1546 
1547  for ( ; digiItr != last; ++digiItr) {
1548  ++nStrips;
1549 
1550  // average pedestals
1551  std::vector<int> adcCounts = digiItr->getADCCounts();
1552  theCSCStripPedestalSum += adcCounts[0];
1553  theCSCStripPedestalSum += adcCounts[1];
1555 
1556  // if there are enough pedestal statistics
1557  if (theCSCStripPedestalCount > 100) {
1559  if (adcCounts[5] > (pedestal + 100))
1560  CSCStripADC.push_back(adcCounts[4] - pedestal);
1561  }
1562  }
1563  }
1564 
1565  if (verbosity > 1) {
1566  eventout += "\n Number of CSCStripDigis collected:........ ";
1567  eventout += nStrips;
1568  }
1569 
1570  // get CSC Wire information
1572  iEvent.getByLabel(MuCSCWireSrc_, wires);
1573  if (!wires.isValid()) {
1574  edm::LogWarning(MsgLoggerCat)
1575  << "Unable to find muon wires in event!";
1576  return;
1577  }
1578 
1579  int nWires = 0;
1580  for (CSCWireDigiCollection::DigiRangeIterator j = wires->begin();
1581  j != wires->end();
1582  ++j) {
1583 
1584  std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
1585  std::vector<CSCWireDigi>::const_iterator endDigi = (*j).second.second;
1586 
1587  for ( ; digiItr != endDigi; ++digiItr) {
1588  ++nWires;
1589 
1590  CSCWireTime.push_back(digiItr->getTimeBin());
1591  }
1592  }
1593 
1594  if (verbosity > 1) {
1595  eventout += "\n Number of CSCWireDigis collected:......... ";
1596  eventout += nWires;
1597  }
1598 
1599  if (verbosity > 0)
1600  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1601 
1602  return;
1603 }
1604 
1606 {
1607  std::string MsgLoggerCat = "GlobalDigisProducer_storeMuon";
1608 
1609  if (verbosity > 2) {
1610 
1611  // dt output
1612  TString eventout("\n nMB1 = ");
1613  eventout += MB1SLayer.size();
1614  for (unsigned int i = 0; i < MB1SLayer.size(); ++i) {
1615  eventout += "\n (slayer, time, layer) = (";
1616  eventout += MB1SLayer[i];
1617  eventout += ", ";
1618  eventout += MB1Time[i];
1619  eventout += ", ";
1620  eventout += MB1Layer[i];
1621  eventout += ")";
1622  }
1623  eventout += "\n nMB2 = ";
1624  eventout += MB2SLayer.size();
1625  for (unsigned int i = 0; i < MB2SLayer.size(); ++i) {
1626  eventout += "\n (slayer, time, layer) = (";
1627  eventout += MB2SLayer[i];
1628  eventout += ", ";
1629  eventout += MB2Time[i];
1630  eventout += ", ";
1631  eventout += MB2Layer[i];
1632  eventout += ")";
1633  }
1634  eventout += "\n nMB3 = ";
1635  eventout += MB3SLayer.size();
1636  for (unsigned int i = 0; i < MB3SLayer.size(); ++i) {
1637  eventout += "\n (slayer, time, layer) = (";
1638  eventout += MB3SLayer[i];
1639  eventout += ", ";
1640  eventout += MB3Time[i];
1641  eventout += ", ";
1642  eventout += MB3Layer[i];
1643  eventout += ")";
1644  }
1645  eventout += "\n nMB2 = ";
1646  eventout += MB4SLayer.size();
1647  for (unsigned int i = 0; i < MB4SLayer.size(); ++i) {
1648  eventout += "\n (slayer, time, layer) = (";
1649  eventout += MB4SLayer[i];
1650  eventout += ", ";
1651  eventout += MB4Time[i];
1652  eventout += ", ";
1653  eventout += MB4Layer[i];
1654  eventout += ")";
1655  }
1656 
1657  // CSC Strip
1658  eventout += "\n nCSCStrip = ";
1659  eventout += CSCStripADC.size();
1660  for (unsigned int i = 0; i < CSCStripADC.size(); ++i) {
1661  eventout += "\n (adc) = (";
1662  eventout += CSCStripADC[i];
1663  eventout += ")";
1664  }
1665 
1666  // CSC Wire
1667  eventout += "\n nCSCWire = ";
1668  eventout += CSCWireTime.size();
1669  for (unsigned int i = 0; i < CSCWireTime.size(); ++i) {
1670  eventout += "\n (time) = (";
1671  eventout += CSCWireTime[i];
1672  eventout += ")";
1673  }
1674 
1675  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1676  }
1677 
1682 
1683  product.putCSCstripDigis(CSCStripADC);
1684 
1685  product.putCSCwireDigis(CSCWireTime);
1686 
1687  return;
1688 }
1689 
1691 {
1692  std::string MsgLoggerCat = "GlobalDigisProducer_clear";
1693 
1694  if (verbosity > 0)
1695  edm::LogInfo(MsgLoggerCat)
1696  << "Clearing event holders";
1697 
1698  // reset electromagnetic info
1699  // EE info
1700  EECalmaxPos.clear();
1701  EECalAEE.clear();
1702  EECalSHE.clear();
1703  // EB info
1704  EBCalmaxPos.clear();
1705  EBCalAEE.clear();
1706  EBCalSHE.clear();
1707  // ES info
1708  ESCalADC0.clear();
1709  ESCalADC1.clear();
1710  ESCalADC2.clear();
1711  ESCalSHE.clear();
1712 
1713  // reset HCal Info
1714  HBCalAEE.clear();
1715  HBCalSHE.clear();
1716  HECalAEE.clear();
1717  HECalSHE.clear();
1718  HOCalAEE.clear();
1719  HOCalSHE.clear();
1720  HFCalAEE.clear();
1721  HFCalSHE.clear();
1722 
1723  // reset Track Info
1724  TIBL1ADC.clear();
1725  TIBL2ADC.clear();
1726  TIBL3ADC.clear();
1727  TIBL4ADC.clear();
1728  TIBL1Strip.clear();
1729  TIBL2Strip.clear();
1730  TIBL3Strip.clear();
1731  TIBL4Strip.clear();
1732 
1733  TOBL1ADC.clear();
1734  TOBL2ADC.clear();
1735  TOBL3ADC.clear();
1736  TOBL4ADC.clear();
1737  TOBL1Strip.clear();
1738  TOBL2Strip.clear();
1739  TOBL3Strip.clear();
1740  TOBL4Strip.clear();
1741 
1742  TIDW1ADC.clear();
1743  TIDW2ADC.clear();
1744  TIDW3ADC.clear();
1745  TIDW1Strip.clear();
1746  TIDW2Strip.clear();
1747  TIDW3Strip.clear();
1748 
1749  TECW1ADC.clear();
1750  TECW2ADC.clear();
1751  TECW3ADC.clear();
1752  TECW4ADC.clear();
1753  TECW5ADC.clear();
1754  TECW6ADC.clear();
1755  TECW7ADC.clear();
1756  TECW8ADC.clear();
1757  TECW1Strip.clear();
1758  TECW2Strip.clear();
1759  TECW3Strip.clear();
1760  TECW4Strip.clear();
1761  TECW5Strip.clear();
1762  TECW6Strip.clear();
1763  TECW7Strip.clear();
1764  TECW8Strip.clear();
1765 
1766  BRL1ADC.clear();
1767  BRL1Row.clear();
1768  BRL1Col.clear();
1769  BRL2ADC.clear();
1770  BRL2Row.clear();
1771  BRL2Col.clear();
1772  BRL3ADC.clear();
1773  BRL3Row.clear();
1774  BRL3Col.clear();
1775 
1776  FWD1pADC.clear();
1777  FWD1pRow.clear();
1778  FWD1pCol.clear();
1779  FWD1nADC.clear();
1780  FWD1nRow.clear();
1781  FWD1nCol.clear();
1782  FWD2pADC.clear();
1783  FWD2pRow.clear();
1784  FWD2pCol.clear();
1785  FWD2nADC.clear();
1786  FWD2nRow.clear();
1787  FWD2nCol.clear();
1788 
1789  //muon clear
1790  MB1SLayer.clear();
1791  MB1Time.clear();
1792  MB1Layer.clear();
1793  MB2SLayer.clear();
1794  MB2Time.clear();
1795  MB2Layer.clear();
1796  MB3SLayer.clear();
1797  MB3Time.clear();
1798  MB3Layer.clear();
1799  MB4SLayer.clear();
1800  MB4Time.clear();
1801  MB4Layer.clear();
1802 
1803  CSCStripADC.clear();
1804 
1805  CSCWireTime.clear();
1806 
1807  return;
1808 }
1809 
1810 //define this as a plug-in
1811 //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:70
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
int ihf
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)
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:21
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:23
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:27
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:85
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const
Definition: HcalCoderDb.cc:37
static const int MAXSAMPLES
Definition: ESDataFrame.h:32
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:356
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
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:34
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:49
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)