Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-13 03:16:17

0001 /** \file GlobalDigisProducer.cc
0002  *
0003  *  See header file for description of class
0004  *
0005  *  \author M. Strang SUNY-Buffalo
0006  */
0007 
0008 #include "CondFormats/EcalObjects/interface/EcalMGPAGainRatio.h"
0009 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0010 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0011 #include "Validation/GlobalDigis/interface/GlobalDigisProducer.h"
0012 
0013 GlobalDigisProducer::GlobalDigisProducer(const edm::ParameterSet &iPSet)
0014     : fName(""),
0015       verbosity(0),
0016       frequency(0),
0017       label(""),
0018       getAllProvenances(false),
0019       printProvenanceInfo(false),
0020       theCSCStripPedestalSum(0),
0021       theCSCStripPedestalCount(0),
0022       count(0) {
0023   std::string MsgLoggerCat = "GlobalDigisProducer_GlobalDigisProducer";
0024 
0025   // get information from parameter set
0026   fName = iPSet.getUntrackedParameter<std::string>("Name");
0027   verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
0028   frequency = iPSet.getUntrackedParameter<int>("Frequency");
0029   label = iPSet.getParameter<std::string>("Label");
0030   edm::ParameterSet m_Prov = iPSet.getParameter<edm::ParameterSet>("ProvenanceLookup");
0031   getAllProvenances = m_Prov.getUntrackedParameter<bool>("GetAllProvenances");
0032   printProvenanceInfo = m_Prov.getUntrackedParameter<bool>("PrintProvenanceInfo");
0033 
0034   // get Labels to use to extract information
0035   ECalEBSrc_ = iPSet.getParameter<edm::InputTag>("ECalEBSrc");
0036   ECalEESrc_ = iPSet.getParameter<edm::InputTag>("ECalEESrc");
0037   ECalESSrc_ = iPSet.getParameter<edm::InputTag>("ECalESSrc");
0038   HCalSrc_ = iPSet.getParameter<edm::InputTag>("HCalSrc");
0039   HCalDigi_ = iPSet.getParameter<edm::InputTag>("HCalDigi");
0040   SiStripSrc_ = iPSet.getParameter<edm::InputTag>("SiStripSrc");
0041   SiPxlSrc_ = iPSet.getParameter<edm::InputTag>("SiPxlSrc");
0042   MuDTSrc_ = iPSet.getParameter<edm::InputTag>("MuDTSrc");
0043   MuCSCStripSrc_ = iPSet.getParameter<edm::InputTag>("MuCSCStripSrc");
0044   MuCSCWireSrc_ = iPSet.getParameter<edm::InputTag>("MuCSCWireSrc");
0045   // fix for consumes
0046   ECalEBSrc_Token_ = consumes<EBDigiCollection>(iPSet.getParameter<edm::InputTag>("ECalEBSrc"));
0047   ECalEESrc_Token_ = consumes<EEDigiCollection>(iPSet.getParameter<edm::InputTag>("ECalEESrc"));
0048   ECalESSrc_Token_ = consumes<ESDigiCollection>(iPSet.getParameter<edm::InputTag>("ECalESSrc"));
0049   HCalSrc_Token_ = consumes<edm::PCaloHitContainer>(iPSet.getParameter<edm::InputTag>("HCalSrc"));
0050   HBHEDigi_Token_ = consumes<edm::SortedCollection<HBHEDataFrame>>(iPSet.getParameter<edm::InputTag>("HCalDigi"));
0051   HODigi_Token_ = consumes<edm::SortedCollection<HODataFrame>>(iPSet.getParameter<edm::InputTag>("HCalDigi"));
0052   HFDigi_Token_ = consumes<edm::SortedCollection<HFDataFrame>>(iPSet.getParameter<edm::InputTag>("HCalDigi"));
0053   SiStripSrc_Token_ = consumes<edm::DetSetVector<SiStripDigi>>(iPSet.getParameter<edm::InputTag>("SiStripSrc"));
0054   SiPxlSrc_Token_ = consumes<edm::DetSetVector<PixelDigi>>(iPSet.getParameter<edm::InputTag>("SiPxlSrc"));
0055   MuDTSrc_Token_ = consumes<DTDigiCollection>(iPSet.getParameter<edm::InputTag>("MuDTSrc"));
0056   MuCSCStripSrc_Token_ = consumes<CSCStripDigiCollection>(iPSet.getParameter<edm::InputTag>("MuCSCStripSrc"));
0057   MuCSCWireSrc_Token_ = consumes<CSCWireDigiCollection>(iPSet.getParameter<edm::InputTag>("MuCSCWireSrc"));
0058   //
0059   const std::string barrelHitsName("EcalHitsEB");
0060   const std::string endcapHitsName("EcalHitsEE");
0061   const std::string preshowerHitsName("EcalHitsES");
0062   EBHits_Token_ = consumes<CrossingFrame<PCaloHit>>(edm::InputTag(std::string("mix"), std::string("barrelHitsName")));
0063   EEHits_Token_ = consumes<CrossingFrame<PCaloHit>>(edm::InputTag(std::string("mix"), std::string("endcapHitsName")));
0064   ESHits_Token_ =
0065       consumes<CrossingFrame<PCaloHit>>(edm::InputTag(std::string("mix"), std::string("preshowerHitsName")));
0066 
0067   ecalADCtoGevToken_ = esConsumes();
0068   tTopoToken_ = esConsumes();
0069   hcaldbToken_ = esConsumes();
0070   // use value of first digit to determine default output level (inclusive)
0071   // 0 is none, 1 is basic, 2 is fill output, 3 is gather output
0072   verbosity %= 10;
0073 
0074   // create persistent object
0075   produces<PGlobalDigi>(label);
0076 
0077   // print out Parameter Set information being used
0078   if (verbosity >= 0) {
0079     edm::LogInfo(MsgLoggerCat) << "\n===============================\n"
0080                                << "Initialized as EDProducer with parameter values:\n"
0081                                << "    Name          = " << fName << "\n"
0082                                << "    Verbosity     = " << verbosity << "\n"
0083                                << "    Frequency     = " << frequency << "\n"
0084                                << "    Label         = " << label << "\n"
0085                                << "    GetProv       = " << getAllProvenances << "\n"
0086                                << "    PrintProv     = " << printProvenanceInfo << "\n"
0087                                << "    ECalEBSrc     = " << ECalEBSrc_.label() << ":" << ECalEBSrc_.instance() << "\n"
0088                                << "    ECalEESrc     = " << ECalEESrc_.label() << ":" << ECalEESrc_.instance() << "\n"
0089                                << "    ECalESSrc     = " << ECalESSrc_.label() << ":" << ECalESSrc_.instance() << "\n"
0090                                << "    HCalSrc       = " << HCalSrc_.label() << ":" << HCalSrc_.instance() << "\n"
0091                                << "    HCalDigi       = " << HCalDigi_.label() << ":" << HCalDigi_.instance() << "\n"
0092                                << "    SiStripSrc    = " << SiStripSrc_.label() << ":" << SiStripSrc_.instance() << "\n"
0093                                << "    SiPixelSrc    = " << SiPxlSrc_.label() << ":" << SiPxlSrc_.instance() << "\n"
0094                                << "    MuDTSrc       = " << MuDTSrc_.label() << ":" << MuDTSrc_.instance() << "\n"
0095                                << "    MuCSCStripSrc = " << MuCSCStripSrc_.label() << ":" << MuCSCStripSrc_.instance()
0096                                << "\n"
0097                                << "    MuCSCWireSrc  = " << MuCSCWireSrc_.label() << ":" << MuCSCWireSrc_.instance()
0098                                << "\n"
0099                                << "===============================\n";
0100   }
0101 
0102   // set default constants
0103   // ECal
0104   ECalgainConv_[0] = 0.;
0105   ECalgainConv_[1] = 1.;
0106   ECalgainConv_[2] = 2.;
0107   ECalgainConv_[3] = 12.;
0108   ECalbarrelADCtoGeV_ = 0.035;
0109   ECalendcapADCtoGeV_ = 0.06;
0110 }
0111 
0112 GlobalDigisProducer::~GlobalDigisProducer() {}
0113 
0114 void GlobalDigisProducer::beginJob(void) {
0115   std::string MsgLoggerCat = "GlobalDigisProducer_beginJob";
0116 
0117   EcalMGPAGainRatio *defaultRatios = new EcalMGPAGainRatio();
0118 
0119   ECalgainConv_[0] = 0.;
0120   ECalgainConv_[1] = 1.;
0121   ECalgainConv_[2] = defaultRatios->gain12Over6();
0122   ECalgainConv_[3] = ECalgainConv_[2] * (defaultRatios->gain6Over1());
0123 
0124   delete defaultRatios;
0125 
0126   if (verbosity >= 0) {
0127     edm::LogInfo(MsgLoggerCat) << "Modified Calorimeter gain constants: g0 = " << ECalgainConv_[0]
0128                                << ", g1 = " << ECalgainConv_[1] << ", g2 = " << ECalgainConv_[2]
0129                                << ", g3 = " << ECalgainConv_[3];
0130     //     edm::LogInfo(MsgLoggerCat)
0131     //       << "Modified Calorimeter ADCtoGeV constants: barrel = "
0132     //       << ECalbarrelADCtoGeV_ << ", endcap = " << ECalendcapADCtoGeV_;
0133   }
0134 
0135   // clear storage vectors
0136   clear();
0137   return;
0138 }
0139 
0140 void GlobalDigisProducer::endJob() {
0141   std::string MsgLoggerCat = "GlobalDigisProducer_endJob";
0142   if (verbosity >= 0)
0143     edm::LogInfo(MsgLoggerCat) << "Terminating having processed " << count << " events.";
0144   return;
0145 }
0146 
0147 void GlobalDigisProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) {
0148   std::string MsgLoggerCat = "GlobalDigisProducer_produce";
0149 
0150   // keep track of number of events processed
0151   ++count;
0152 
0153   // THIS BLOCK MIGRATED HERE FROM beginJob:
0154   // setup calorimeter constants from service
0155   const EcalADCToGeVConstant *agc = &iSetup.getData(ecalADCtoGevToken_);
0156   ECalbarrelADCtoGeV_ = agc->getEBValue();
0157   ECalendcapADCtoGeV_ = agc->getEEValue();
0158   if (verbosity >= 0) {
0159     edm::LogInfo(MsgLoggerCat) << "Modified Calorimeter ADCtoGeV constants: barrel = " << ECalbarrelADCtoGeV_
0160                                << ", endcap = " << ECalendcapADCtoGeV_;
0161   }
0162 
0163   // get event id information
0164   edm::RunNumber_t nrun = iEvent.id().run();
0165   edm::EventNumber_t nevt = iEvent.id().event();
0166 
0167   if (verbosity > 0) {
0168     edm::LogInfo(MsgLoggerCat) << "Processing run " << nrun << ", event " << nevt << " (" << count << " events total)";
0169   } else if (verbosity == 0) {
0170     if (nevt % frequency == 0 || nevt == 1) {
0171       edm::LogInfo(MsgLoggerCat) << "Processing run " << nrun << ", event " << nevt << " (" << count
0172                                  << " events total)";
0173     }
0174   }
0175 
0176   // clear event holders
0177   clear();
0178 
0179   // look at information available in the event
0180   if (getAllProvenances) {
0181     std::vector<const edm::StableProvenance *> AllProv;
0182     iEvent.getAllStableProvenance(AllProv);
0183 
0184     if (verbosity >= 0)
0185       edm::LogInfo(MsgLoggerCat) << "Number of Provenances = " << AllProv.size();
0186 
0187     if (printProvenanceInfo && (verbosity >= 0)) {
0188       TString eventout("\nProvenance info:\n");
0189 
0190       for (unsigned int i = 0; i < AllProv.size(); ++i) {
0191         eventout += "\n       ******************************";
0192         eventout += "\n       Module       : ";
0193         // eventout += (AllProv[i]->product).moduleLabel();
0194         eventout += AllProv[i]->moduleLabel();
0195         eventout += "\n       ProductID    : ";
0196         // eventout += (AllProv[i]->product).productID_.id_;
0197         eventout += AllProv[i]->productID().id();
0198         eventout += "\n       ClassName    : ";
0199         // eventout += (AllProv[i]->product).fullClassName_;
0200         eventout += AllProv[i]->className();
0201         eventout += "\n       InstanceName : ";
0202         // eventout += (AllProv[i]->product).productInstanceName_;
0203         eventout += AllProv[i]->productInstanceName();
0204         eventout += "\n       BranchName   : ";
0205         // eventout += (AllProv[i]->product).branchName_;
0206         eventout += AllProv[i]->branchName();
0207       }
0208       eventout += "\n       ******************************\n";
0209       edm::LogInfo(MsgLoggerCat) << eventout << "\n";
0210       printProvenanceInfo = false;
0211     }
0212     getAllProvenances = false;
0213   }
0214 
0215   // call fill functions
0216   // gather Ecal information from event
0217   fillECal(iEvent, iSetup);
0218   // gather Hcal information from event
0219   fillHCal(iEvent, iSetup);
0220   // gather Track information from event
0221   fillTrk(iEvent, iSetup);
0222   // gather Muon information from event
0223   fillMuon(iEvent, iSetup);
0224 
0225   if (verbosity > 0)
0226     edm::LogInfo(MsgLoggerCat) << "Done gathering data from event.";
0227 
0228   // produce object to put into event
0229   std::unique_ptr<PGlobalDigi> pOut(new PGlobalDigi);
0230 
0231   if (verbosity > 2)
0232     edm::LogInfo(MsgLoggerCat) << "Saving event contents:";
0233 
0234   // call store functions
0235   // store ECal information in produce
0236   storeECal(*pOut);
0237   // store HCal information in produce
0238   storeHCal(*pOut);
0239   // store Track information in produce
0240   storeTrk(*pOut);
0241   // store Muon information in produce
0242   storeMuon(*pOut);
0243 
0244   // store information in event
0245   iEvent.put(std::move(pOut), label);
0246 
0247   return;
0248 }
0249 
0250 void GlobalDigisProducer::fillECal(edm::Event &iEvent, const edm::EventSetup &iSetup) {
0251   std::string MsgLoggerCat = "GlobalDigisProducer_fillECal";
0252 
0253   TString eventout;
0254   if (verbosity > 0)
0255     eventout = "\nGathering info:";
0256 
0257   // extract crossing frame from event
0258   // edm::Handle<CrossingFrame> crossingFrame;
0259   edm::Handle<CrossingFrame<PCaloHit>> crossingFrame;
0260   // iEvent.getByType(crossingFrame);
0261   // if (!crossingFrame.isValid()) {
0262   //  edm::LogWarning(MsgLoggerCat)
0263   //    << "Unable to crossingFrame in event!";
0264   //  return;
0265   //}
0266 
0267   ////////////////////////
0268   // extract EB information
0269   ////////////////////////
0270   bool isBarrel = true;
0271   edm::Handle<EBDigiCollection> EcalDigiEB;
0272   iEvent.getByToken(ECalEBSrc_Token_, EcalDigiEB);
0273   if (!EcalDigiEB.isValid()) {
0274     edm::LogWarning(MsgLoggerCat) << "Unable to find EcalDigiEB in event!";
0275     return;
0276   }
0277   if (EcalDigiEB->empty())
0278     isBarrel = false;
0279 
0280   if (isBarrel) {
0281     // loop over simhits
0282     iEvent.getByToken(EBHits_Token_, crossingFrame);
0283     if (!crossingFrame.isValid()) {
0284       edm::LogWarning(MsgLoggerCat) << "Unable to find cal barrel crossingFrame in event!";
0285       return;
0286     }
0287     // std::unique_ptr<MixCollection<PCaloHit> >
0288     // barrelHits(new MixCollection<PCaloHit>
0289     //       (crossingFrame.product(), barrelHitsName));
0290     std::unique_ptr<MixCollection<PCaloHit>> barrelHits(new MixCollection<PCaloHit>(crossingFrame.product()));
0291 
0292     // keep track of sum of simhit energy in each crystal
0293     MapType ebSimMap;
0294     for (MixCollection<PCaloHit>::MixItr hitItr = barrelHits->begin(); hitItr != barrelHits->end(); ++hitItr) {
0295       EBDetId ebid = EBDetId(hitItr->id());
0296 
0297       uint32_t crystid = ebid.rawId();
0298       ebSimMap[crystid] += hitItr->energy();
0299     }
0300 
0301     // loop over digis
0302     const EBDigiCollection *barrelDigi = EcalDigiEB.product();
0303 
0304     std::vector<double> ebAnalogSignal;
0305     std::vector<double> ebADCCounts;
0306     std::vector<double> ebADCGains;
0307     ebAnalogSignal.reserve(EBDataFrame::MAXSAMPLES);
0308     ebADCCounts.reserve(EBDataFrame::MAXSAMPLES);
0309     ebADCGains.reserve(EBDataFrame::MAXSAMPLES);
0310 
0311     int i = 0;
0312     for (unsigned int digis = 0; digis < EcalDigiEB->size(); ++digis) {
0313       // for (std::vector<EBDataFrame>::const_iterator digis =
0314       //   barrelDigi->begin();
0315       // digis != barrelDigi->end();
0316       // ++digis) {
0317 
0318       ++i;
0319 
0320       EBDataFrame ebdf = (*barrelDigi)[digis];
0321       int nrSamples = ebdf.size();
0322 
0323       EBDetId ebid = ebdf.id();
0324       // EBDetId ebid = digis->id();
0325 
0326       double Emax = 0;
0327       int Pmax = 0;
0328       double pedestalPreSample = 0.;
0329       double pedestalPreSampleAnalog = 0.;
0330 
0331       for (int sample = 0; sample < nrSamples; ++sample) {
0332         // for (int sample = 0; sample < digis->size(); ++sample) {
0333         ebAnalogSignal[sample] = 0.;
0334         ebADCCounts[sample] = 0.;
0335         ebADCGains[sample] = -1.;
0336       }
0337 
0338       // calculate maximum energy and pedestal
0339       for (int sample = 0; sample < nrSamples; ++sample) {
0340         // for (int sample = 0; sample < digis->size(); ++sample) {
0341 
0342         EcalMGPASample thisSample = ebdf[sample];
0343         ebADCCounts[sample] = (thisSample.adc());
0344         ebADCGains[sample] = (thisSample.gainId());
0345         ebAnalogSignal[sample] = (ebADCCounts[sample] * ECalgainConv_[(int)ebADCGains[sample]] * ECalbarrelADCtoGeV_);
0346         if (Emax < ebAnalogSignal[sample]) {
0347           Emax = ebAnalogSignal[sample];
0348           Pmax = sample;
0349         }
0350         if (sample < 3) {
0351           pedestalPreSample += ebADCCounts[sample];
0352           pedestalPreSampleAnalog += ebADCCounts[sample] * ECalgainConv_[(int)ebADCGains[sample]] * ECalbarrelADCtoGeV_;
0353         }
0354       }
0355       pedestalPreSample /= 3.;
0356       pedestalPreSampleAnalog /= 3.;
0357 
0358       // calculate pedestal subtracted digi energy in the crystal
0359       double Erec = Emax - pedestalPreSampleAnalog * ECalgainConv_[(int)ebADCGains[Pmax]];
0360 
0361       // gather necessary information
0362       EBCalAEE.push_back(Erec);
0363       EBCalSHE.push_back(ebSimMap[ebid.rawId()]);
0364       EBCalmaxPos.push_back(Pmax);
0365     }
0366 
0367     if (verbosity > 1) {
0368       eventout += "\n          Number of EBDigis collected:.............. ";
0369       eventout += i;
0370     }
0371   }
0372 
0373   /////////////////////////
0374   // extract EE information
0375   ////////////////////////
0376   bool isEndCap = true;
0377   edm::Handle<EEDigiCollection> EcalDigiEE;
0378   iEvent.getByToken(ECalEESrc_Token_, EcalDigiEE);
0379   if (!EcalDigiEE.isValid()) {
0380     edm::LogWarning(MsgLoggerCat) << "Unable to find EcalDigiEE in event!";
0381     return;
0382   }
0383   if (EcalDigiEE->empty())
0384     isEndCap = false;
0385 
0386   if (isEndCap) {
0387     // loop over simhits
0388     iEvent.getByToken(EEHits_Token_, crossingFrame);
0389     if (!crossingFrame.isValid()) {
0390       edm::LogWarning(MsgLoggerCat) << "Unable to find cal endcap crossingFrame in event!";
0391       return;
0392     }
0393     // std::unique_ptr<MixCollection<PCaloHit> >
0394     //  endcapHits(new MixCollection<PCaloHit>
0395     //   (crossingFrame.product(), endcapHitsName));
0396     std::unique_ptr<MixCollection<PCaloHit>> endcapHits(new MixCollection<PCaloHit>(crossingFrame.product()));
0397 
0398     // keep track of sum of simhit energy in each crystal
0399     MapType eeSimMap;
0400     for (MixCollection<PCaloHit>::MixItr hitItr = endcapHits->begin(); hitItr != endcapHits->end(); ++hitItr) {
0401       EEDetId eeid = EEDetId(hitItr->id());
0402 
0403       uint32_t crystid = eeid.rawId();
0404       eeSimMap[crystid] += hitItr->energy();
0405     }
0406 
0407     // loop over digis
0408     const EEDigiCollection *endcapDigi = EcalDigiEE.product();
0409 
0410     std::vector<double> eeAnalogSignal;
0411     std::vector<double> eeADCCounts;
0412     std::vector<double> eeADCGains;
0413     eeAnalogSignal.reserve(EEDataFrame::MAXSAMPLES);
0414     eeADCCounts.reserve(EEDataFrame::MAXSAMPLES);
0415     eeADCGains.reserve(EEDataFrame::MAXSAMPLES);
0416 
0417     int i = 0;
0418     // for (std::vector<EEDataFrame>::const_iterator digis =
0419     //   endcapDigi->begin();
0420     // digis != endcapDigi->end();
0421     // ++digis) {
0422     for (unsigned int digis = 0; digis < EcalDigiEE->size(); ++digis) {
0423       ++i;
0424 
0425       EEDataFrame eedf = (*endcapDigi)[digis];
0426       int nrSamples = eedf.size();
0427 
0428       EEDetId eeid = eedf.id();
0429       // EEDetId eeid = digis->id();
0430 
0431       double Emax = 0;
0432       int Pmax = 0;
0433       double pedestalPreSample = 0.;
0434       double pedestalPreSampleAnalog = 0.;
0435 
0436       for (int sample = 0; sample < nrSamples; ++sample) {
0437         // for (int sample = 0; sample < digis->size(); ++sample) {
0438         eeAnalogSignal[sample] = 0.;
0439         eeADCCounts[sample] = 0.;
0440         eeADCGains[sample] = -1.;
0441       }
0442 
0443       // calculate maximum enery and pedestal
0444       for (int sample = 0; sample < nrSamples; ++sample) {
0445         // for (int sample = 0; sample < digis->size(); ++sample) {
0446 
0447         EcalMGPASample thisSample = eedf[sample];
0448 
0449         eeADCCounts[sample] = (thisSample.adc());
0450         eeADCGains[sample] = (thisSample.gainId());
0451         eeAnalogSignal[sample] = (eeADCCounts[sample] * ECalgainConv_[(int)eeADCGains[sample]] * ECalbarrelADCtoGeV_);
0452         if (Emax < eeAnalogSignal[sample]) {
0453           Emax = eeAnalogSignal[sample];
0454           Pmax = sample;
0455         }
0456         if (sample < 3) {
0457           pedestalPreSample += eeADCCounts[sample];
0458           pedestalPreSampleAnalog += eeADCCounts[sample] * ECalgainConv_[(int)eeADCGains[sample]] * ECalbarrelADCtoGeV_;
0459         }
0460       }
0461       pedestalPreSample /= 3.;
0462       pedestalPreSampleAnalog /= 3.;
0463 
0464       // calculate pedestal subtracted digi energy in the crystal
0465       double Erec = Emax - pedestalPreSampleAnalog * ECalgainConv_[(int)eeADCGains[Pmax]];
0466 
0467       // gather necessary information
0468       EECalAEE.push_back(Erec);
0469       EECalSHE.push_back(eeSimMap[eeid.rawId()]);
0470       EECalmaxPos.push_back(Pmax);
0471     }
0472 
0473     if (verbosity > 1) {
0474       eventout += "\n          Number of EEDigis collected:.............. ";
0475       eventout += i;
0476     }
0477   }
0478 
0479   /////////////////////////
0480   // extract ES information
0481   ////////////////////////
0482   bool isPreshower = true;
0483   edm::Handle<ESDigiCollection> EcalDigiES;
0484   iEvent.getByToken(ECalESSrc_Token_, EcalDigiES);
0485   if (!EcalDigiES.isValid()) {
0486     edm::LogWarning(MsgLoggerCat) << "Unable to find EcalDigiES in event!";
0487     return;
0488   }
0489   if (EcalDigiES->empty())
0490     isPreshower = false;
0491 
0492   if (isPreshower) {
0493     // loop over simhits
0494     iEvent.getByToken(ESHits_Token_, crossingFrame);
0495     if (!crossingFrame.isValid()) {
0496       edm::LogWarning(MsgLoggerCat) << "Unable to find cal preshower crossingFrame in event!";
0497       return;
0498     }
0499     // std::unique_ptr<MixCollection<PCaloHit> >
0500     //  preshowerHits(new MixCollection<PCaloHit>
0501     //       (crossingFrame.product(), preshowerHitsName));
0502     std::unique_ptr<MixCollection<PCaloHit>> preshowerHits(new MixCollection<PCaloHit>(crossingFrame.product()));
0503 
0504     // keep track of sum of simhit energy in each crystal
0505     MapType esSimMap;
0506     for (MixCollection<PCaloHit>::MixItr hitItr = preshowerHits->begin(); hitItr != preshowerHits->end(); ++hitItr) {
0507       ESDetId esid = ESDetId(hitItr->id());
0508 
0509       uint32_t crystid = esid.rawId();
0510       esSimMap[crystid] += hitItr->energy();
0511     }
0512 
0513     // loop over digis
0514     const ESDigiCollection *preshowerDigi = EcalDigiES.product();
0515 
0516     std::vector<double> esADCCounts;
0517     esADCCounts.reserve(ESDataFrame::MAXSAMPLES);
0518 
0519     int i = 0;
0520     for (unsigned int digis = 0; digis < EcalDigiES->size(); ++digis) {
0521       // for (std::vector<ESDataFrame>::const_iterator digis =
0522       //   preshowerDigi->begin();
0523       // digis != preshowerDigi->end();
0524       // ++digis) {
0525 
0526       ++i;
0527 
0528       ESDataFrame esdf = (*preshowerDigi)[digis];
0529       int nrSamples = esdf.size();
0530 
0531       ESDetId esid = esdf.id();
0532       // ESDetId esid = digis->id();
0533 
0534       for (int sample = 0; sample < nrSamples; ++sample) {
0535         // for (int sample = 0; sample < digis->size(); ++sample) {
0536         esADCCounts[sample] = 0.;
0537       }
0538 
0539       // gether ADC counts
0540       for (int sample = 0; sample < nrSamples; ++sample) {
0541         ESSample thisSample = esdf[sample];
0542         // for (int sample = 0; sample < digis->size(); ++sample) {
0543         esADCCounts[sample] = (thisSample.adc());
0544       }
0545 
0546       ESCalADC0.push_back(esADCCounts[0]);
0547       ESCalADC1.push_back(esADCCounts[1]);
0548       ESCalADC2.push_back(esADCCounts[2]);
0549       ESCalSHE.push_back(esSimMap[esid.rawId()]);
0550     }
0551 
0552     if (verbosity > 1) {
0553       eventout += "\n          Number of ESDigis collected:.............. ";
0554       eventout += i;
0555     }
0556   }
0557 
0558   if (verbosity > 0)
0559     edm::LogInfo(MsgLoggerCat) << eventout << "\n";
0560 
0561   return;
0562 }
0563 
0564 void GlobalDigisProducer::storeECal(PGlobalDigi &product) {
0565   std::string MsgLoggerCat = "GlobalDigisProducer_storeECal";
0566 
0567   if (verbosity > 2) {
0568     TString eventout("\n         nEBDigis     = ");
0569     eventout += EBCalmaxPos.size();
0570     for (unsigned int i = 0; i < EBCalmaxPos.size(); ++i) {
0571       eventout += "\n      (maxPos, AEE, SHE) = (";
0572       eventout += EBCalmaxPos[i];
0573       eventout += ", ";
0574       eventout += EBCalAEE[i];
0575       eventout += ", ";
0576       eventout += EBCalSHE[i];
0577       eventout += ")";
0578     }
0579     eventout += "\n         nEEDigis     = ";
0580     eventout += EECalmaxPos.size();
0581     for (unsigned int i = 0; i < EECalmaxPos.size(); ++i) {
0582       eventout += "\n      (maxPos, AEE, SHE) = (";
0583       eventout += EECalmaxPos[i];
0584       eventout += ", ";
0585       eventout += EECalAEE[i];
0586       eventout += ", ";
0587       eventout += EECalSHE[i];
0588       eventout += ")";
0589     }
0590     eventout += "\n         nESDigis          = ";
0591     eventout += ESCalADC0.size();
0592     for (unsigned int i = 0; i < ESCalADC0.size(); ++i) {
0593       eventout += "\n      (ADC0, ADC1, ADC2, SHE) = (";
0594       eventout += ESCalADC0[i];
0595       eventout += ", ";
0596       eventout += ESCalADC1[i];
0597       eventout += ", ";
0598       eventout += ESCalADC2[i];
0599       eventout += ", ";
0600       eventout += ESCalSHE[i];
0601       eventout += ")";
0602     }
0603     edm::LogInfo(MsgLoggerCat) << eventout << "\n";
0604   }
0605 
0606   product.putEBCalDigis(EBCalmaxPos, EBCalAEE, EBCalSHE);
0607   product.putEECalDigis(EECalmaxPos, EECalAEE, EECalSHE);
0608   product.putESCalDigis(ESCalADC0, ESCalADC1, ESCalADC2, ESCalSHE);
0609 
0610   return;
0611 }
0612 
0613 void GlobalDigisProducer::fillHCal(edm::Event &iEvent, const edm::EventSetup &iSetup) {
0614   std::string MsgLoggerCat = "GlobalDigisProducer_fillHCal";
0615 
0616   TString eventout;
0617   if (verbosity > 0)
0618     eventout = "\nGathering info:";
0619 
0620   // get calibration info
0621   const auto &HCalconditions = iSetup.getHandle(hcaldbToken_);
0622   if (!HCalconditions.isValid()) {
0623     edm::LogWarning(MsgLoggerCat) << "Unable to find HCalconditions in event!";
0624     return;
0625   }
0626   // HcalCalibrations calibrations;
0627   CaloSamples tool;
0628 
0629   ///////////////////////
0630   // extract simhit info
0631   //////////////////////
0632   edm::Handle<edm::PCaloHitContainer> hcalHits;
0633   iEvent.getByToken(HCalSrc_Token_, hcalHits);
0634   if (!hcalHits.isValid()) {
0635     edm::LogWarning(MsgLoggerCat) << "Unable to find hcalHits in event!";
0636     return;
0637   }
0638   const edm::PCaloHitContainer *simhitResult = hcalHits.product();
0639 
0640   MapType fHBEnergySimHits;
0641   MapType fHEEnergySimHits;
0642   MapType fHOEnergySimHits;
0643   MapType fHFEnergySimHits;
0644   for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin(); simhits != simhitResult->end();
0645        ++simhits) {
0646     HcalDetId detId(simhits->id());
0647     uint32_t cellid = detId.rawId();
0648 
0649     if (detId.subdet() == sdHcalBrl) {
0650       fHBEnergySimHits[cellid] += simhits->energy();
0651     }
0652     if (detId.subdet() == sdHcalEC) {
0653       fHEEnergySimHits[cellid] += simhits->energy();
0654     }
0655     if (detId.subdet() == sdHcalOut) {
0656       fHOEnergySimHits[cellid] += simhits->energy();
0657     }
0658     if (detId.subdet() == sdHcalFwd) {
0659       fHFEnergySimHits[cellid] += simhits->energy();
0660     }
0661   }
0662 
0663   ////////////////////////
0664   // get HBHE information
0665   ///////////////////////
0666   edm::Handle<edm::SortedCollection<HBHEDataFrame>> hbhe;
0667   iEvent.getByToken(HBHEDigi_Token_, hbhe);
0668   if (!hbhe.isValid()) {
0669     edm::LogWarning(MsgLoggerCat) << "Unable to find HBHEDataFrame in event!";
0670     return;
0671   }
0672   edm::SortedCollection<HBHEDataFrame>::const_iterator ihbhe;
0673 
0674   int iHB = 0;
0675   int iHE = 0;
0676   for (ihbhe = hbhe->begin(); ihbhe != hbhe->end(); ++ihbhe) {
0677     HcalDetId cell(ihbhe->id());
0678 
0679     if ((cell.subdet() == sdHcalBrl) || (cell.subdet() == sdHcalEC)) {
0680       // HCalconditions->makeHcalCalibration(cell, &calibrations);
0681       const HcalCalibrations &calibrations = HCalconditions->getHcalCalibrations(cell);
0682       const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
0683       const HcalQIEShape *shape = HCalconditions->getHcalShape(channelCoder);
0684 
0685       HcalCoderDb coder(*channelCoder, *shape);
0686       coder.adc2fC(*ihbhe, tool);
0687 
0688       // get HB info
0689       if (cell.subdet() == sdHcalBrl) {
0690         ++iHB;
0691         float fDigiSum = 0.0;
0692         for (int ii = 0; ii < tool.size(); ++ii) {
0693           // default ped is 4.5
0694           int capid = (*ihbhe)[ii].capid();
0695           fDigiSum += (tool[ii] - calibrations.pedestal(capid));
0696         }
0697 
0698         HBCalAEE.push_back(fDigiSum);
0699         HBCalSHE.push_back(fHBEnergySimHits[cell.rawId()]);
0700       }
0701 
0702       // get HE info
0703       if (cell.subdet() == sdHcalEC) {
0704         ++iHE;
0705         float fDigiSum = 0.0;
0706         for (int ii = 0; ii < tool.size(); ++ii) {
0707           int capid = (*ihbhe)[ii].capid();
0708           fDigiSum += (tool[ii] - calibrations.pedestal(capid));
0709         }
0710 
0711         HECalAEE.push_back(fDigiSum);
0712         HECalSHE.push_back(fHEEnergySimHits[cell.rawId()]);
0713       }
0714     }
0715   }
0716 
0717   if (verbosity > 1) {
0718     eventout += "\n          Number of HBDigis collected:.............. ";
0719     eventout += iHB;
0720   }
0721 
0722   if (verbosity > 1) {
0723     eventout += "\n          Number of HEDigis collected:.............. ";
0724     eventout += iHE;
0725   }
0726 
0727   ////////////////////////
0728   // get HO information
0729   ///////////////////////
0730   edm::Handle<edm::SortedCollection<HODataFrame>> ho;
0731   iEvent.getByToken(HODigi_Token_, ho);
0732   if (!ho.isValid()) {
0733     edm::LogWarning(MsgLoggerCat) << "Unable to find HODataFrame in event!";
0734     return;
0735   }
0736   edm::SortedCollection<HODataFrame>::const_iterator iho;
0737 
0738   int iHO = 0;
0739   for (iho = ho->begin(); iho != ho->end(); ++iho) {
0740     HcalDetId cell(iho->id());
0741 
0742     if (cell.subdet() == sdHcalOut) {
0743       // HCalconditions->makeHcalCalibration(cell, &calibrations);
0744       const HcalCalibrations &calibrations = HCalconditions->getHcalCalibrations(cell);
0745       const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
0746       const HcalQIEShape *shape = HCalconditions->getHcalShape(channelCoder);
0747 
0748       HcalCoderDb coder(*channelCoder, *shape);
0749       coder.adc2fC(*iho, tool);
0750 
0751       ++iHO;
0752       float fDigiSum = 0.0;
0753       for (int ii = 0; ii < tool.size(); ++ii) {
0754         // default ped is 4.5
0755         int capid = (*iho)[ii].capid();
0756         fDigiSum += (tool[ii] - calibrations.pedestal(capid));
0757       }
0758 
0759       HOCalAEE.push_back(fDigiSum);
0760       HOCalSHE.push_back(fHOEnergySimHits[cell.rawId()]);
0761     }
0762   }
0763 
0764   if (verbosity > 1) {
0765     eventout += "\n          Number of HODigis collected:.............. ";
0766     eventout += iHO;
0767   }
0768 
0769   ////////////////////////
0770   // get HF information
0771   ///////////////////////
0772   edm::Handle<edm::SortedCollection<HFDataFrame>> hf;
0773   iEvent.getByToken(HFDigi_Token_, hf);
0774   if (!hf.isValid()) {
0775     edm::LogWarning(MsgLoggerCat) << "Unable to find HFDataFrame in event!";
0776     return;
0777   }
0778   edm::SortedCollection<HFDataFrame>::const_iterator ihf;
0779 
0780   int iHF = 0;
0781   for (ihf = hf->begin(); ihf != hf->end(); ++ihf) {
0782     HcalDetId cell(ihf->id());
0783 
0784     if (cell.subdet() == sdHcalFwd) {
0785       // HCalconditions->makeHcalCalibration(cell, &calibrations);
0786       const HcalCalibrations &calibrations = HCalconditions->getHcalCalibrations(cell);
0787       const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
0788       const HcalQIEShape *shape = HCalconditions->getHcalShape(channelCoder);
0789 
0790       HcalCoderDb coder(*channelCoder, *shape);
0791       coder.adc2fC(*ihf, tool);
0792 
0793       ++iHF;
0794       float fDigiSum = 0.0;
0795       for (int ii = 0; ii < tool.size(); ++ii) {
0796         // default ped is 1.73077
0797         int capid = (*ihf)[ii].capid();
0798         fDigiSum += (tool[ii] - calibrations.pedestal(capid));
0799       }
0800 
0801       HFCalAEE.push_back(fDigiSum);
0802       HFCalSHE.push_back(fHFEnergySimHits[cell.rawId()]);
0803     }
0804   }
0805 
0806   if (verbosity > 1) {
0807     eventout += "\n          Number of HFDigis collected:.............. ";
0808     eventout += iHF;
0809   }
0810 
0811   if (verbosity > 0)
0812     edm::LogInfo(MsgLoggerCat) << eventout << "\n";
0813 
0814   return;
0815 }
0816 
0817 void GlobalDigisProducer::storeHCal(PGlobalDigi &product) {
0818   std::string MsgLoggerCat = "GlobalDigisProducer_storeHCal";
0819 
0820   if (verbosity > 2) {
0821     TString eventout("\n         nHBDigis     = ");
0822     eventout += HBCalAEE.size();
0823     for (unsigned int i = 0; i < HBCalAEE.size(); ++i) {
0824       eventout += "\n      (AEE, SHE) = (";
0825       eventout += HBCalAEE[i];
0826       eventout += ", ";
0827       eventout += HBCalSHE[i];
0828       eventout += ")";
0829     }
0830     eventout += "\n         nHEDigis     = ";
0831     eventout += HECalAEE.size();
0832     for (unsigned int i = 0; i < HECalAEE.size(); ++i) {
0833       eventout += "\n      (AEE, SHE) = (";
0834       eventout += HECalAEE[i];
0835       eventout += ", ";
0836       eventout += HECalSHE[i];
0837       eventout += ")";
0838     }
0839     eventout += "\n         nHODigis     = ";
0840     eventout += HOCalAEE.size();
0841     for (unsigned int i = 0; i < HOCalAEE.size(); ++i) {
0842       eventout += "\n      (AEE, SHE) = (";
0843       eventout += HOCalAEE[i];
0844       eventout += ", ";
0845       eventout += HOCalSHE[i];
0846       eventout += ")";
0847     }
0848     eventout += "\n         nHFDigis     = ";
0849     eventout += HFCalAEE.size();
0850     for (unsigned int i = 0; i < HFCalAEE.size(); ++i) {
0851       eventout += "\n      (AEE, SHE) = (";
0852       eventout += HFCalAEE[i];
0853       eventout += ", ";
0854       eventout += HFCalSHE[i];
0855       eventout += ")";
0856     }
0857 
0858     edm::LogInfo(MsgLoggerCat) << eventout << "\n";
0859   }
0860 
0861   product.putHBCalDigis(HBCalAEE, HBCalSHE);
0862   product.putHECalDigis(HECalAEE, HECalSHE);
0863   product.putHOCalDigis(HOCalAEE, HOCalSHE);
0864   product.putHFCalDigis(HFCalAEE, HFCalSHE);
0865 
0866   return;
0867 }
0868 
0869 void GlobalDigisProducer::fillTrk(edm::Event &iEvent, const edm::EventSetup &iSetup) {
0870   // Retrieve tracker topology from geometry
0871   const TrackerTopology *const tTopo = &iSetup.getData(tTopoToken_);
0872 
0873   std::string MsgLoggerCat = "GlobalDigisProducer_fillTrk";
0874 
0875   TString eventout;
0876   if (verbosity > 0)
0877     eventout = "\nGathering info:";
0878 
0879   // get strip information
0880   edm::Handle<edm::DetSetVector<SiStripDigi>> stripDigis;
0881   iEvent.getByToken(SiStripSrc_Token_, stripDigis);
0882   if (!stripDigis.isValid()) {
0883     edm::LogWarning(MsgLoggerCat) << "Unable to find stripDigis in event!";
0884     return;
0885   }
0886 
0887   int nStripBrl = 0, nStripFwd = 0;
0888   edm::DetSetVector<SiStripDigi>::const_iterator DSViter;
0889   for (DSViter = stripDigis->begin(); DSViter != stripDigis->end(); ++DSViter) {
0890     unsigned int id = DSViter->id;
0891     DetId detId(id);
0892     edm::DetSet<SiStripDigi>::const_iterator begin = DSViter->data.begin();
0893     edm::DetSet<SiStripDigi>::const_iterator end = DSViter->data.end();
0894     edm::DetSet<SiStripDigi>::const_iterator iter;
0895 
0896     // get TIB
0897     if (detId.subdetId() == sdSiTIB) {
0898       for (iter = begin; iter != end; ++iter) {
0899         ++nStripBrl;
0900         if (tTopo->tibLayer(id) == 1) {
0901           TIBL1ADC.push_back((*iter).adc());
0902           TIBL1Strip.push_back((*iter).strip());
0903         }
0904         if (tTopo->tibLayer(id) == 2) {
0905           TIBL2ADC.push_back((*iter).adc());
0906           TIBL2Strip.push_back((*iter).strip());
0907         }
0908         if (tTopo->tibLayer(id) == 3) {
0909           TIBL3ADC.push_back((*iter).adc());
0910           TIBL3Strip.push_back((*iter).strip());
0911         }
0912         if (tTopo->tibLayer(id) == 4) {
0913           TIBL4ADC.push_back((*iter).adc());
0914           TIBL4Strip.push_back((*iter).strip());
0915         }
0916       }
0917     }
0918 
0919     // get TOB
0920     if (detId.subdetId() == sdSiTOB) {
0921       for (iter = begin; iter != end; ++iter) {
0922         ++nStripBrl;
0923         if (tTopo->tobLayer(id) == 1) {
0924           TOBL1ADC.push_back((*iter).adc());
0925           TOBL1Strip.push_back((*iter).strip());
0926         }
0927         if (tTopo->tobLayer(id) == 2) {
0928           TOBL2ADC.push_back((*iter).adc());
0929           TOBL2Strip.push_back((*iter).strip());
0930         }
0931         if (tTopo->tobLayer(id) == 3) {
0932           TOBL3ADC.push_back((*iter).adc());
0933           TOBL3Strip.push_back((*iter).strip());
0934         }
0935         if (tTopo->tobLayer(id) == 4) {
0936           TOBL4ADC.push_back((*iter).adc());
0937           TOBL4Strip.push_back((*iter).strip());
0938         }
0939       }
0940     }
0941 
0942     // get TID
0943     if (detId.subdetId() == sdSiTID) {
0944       for (iter = begin; iter != end; ++iter) {
0945         ++nStripFwd;
0946         if (tTopo->tidWheel(id) == 1) {
0947           TIDW1ADC.push_back((*iter).adc());
0948           TIDW1Strip.push_back((*iter).strip());
0949         }
0950         if (tTopo->tidWheel(id) == 2) {
0951           TIDW2ADC.push_back((*iter).adc());
0952           TIDW2Strip.push_back((*iter).strip());
0953         }
0954         if (tTopo->tidWheel(id) == 3) {
0955           TIDW3ADC.push_back((*iter).adc());
0956           TIDW3Strip.push_back((*iter).strip());
0957         }
0958       }
0959     }
0960 
0961     // get TEC
0962     if (detId.subdetId() == sdSiTEC) {
0963       for (iter = begin; iter != end; ++iter) {
0964         ++nStripFwd;
0965         if (tTopo->tecWheel(id) == 1) {
0966           TECW1ADC.push_back((*iter).adc());
0967           TECW1Strip.push_back((*iter).strip());
0968         }
0969         if (tTopo->tecWheel(id) == 2) {
0970           TECW2ADC.push_back((*iter).adc());
0971           TECW2Strip.push_back((*iter).strip());
0972         }
0973         if (tTopo->tecWheel(id) == 3) {
0974           TECW3ADC.push_back((*iter).adc());
0975           TECW3Strip.push_back((*iter).strip());
0976         }
0977         if (tTopo->tecWheel(id) == 4) {
0978           TECW4ADC.push_back((*iter).adc());
0979           TECW4Strip.push_back((*iter).strip());
0980         }
0981         if (tTopo->tecWheel(id) == 5) {
0982           TECW5ADC.push_back((*iter).adc());
0983           TECW5Strip.push_back((*iter).strip());
0984         }
0985         if (tTopo->tecWheel(id) == 6) {
0986           TECW6ADC.push_back((*iter).adc());
0987           TECW6Strip.push_back((*iter).strip());
0988         }
0989         if (tTopo->tecWheel(id) == 7) {
0990           TECW7ADC.push_back((*iter).adc());
0991           TECW7Strip.push_back((*iter).strip());
0992         }
0993         if (tTopo->tecWheel(id) == 8) {
0994           TECW8ADC.push_back((*iter).adc());
0995           TECW8Strip.push_back((*iter).strip());
0996         }
0997       }
0998     }
0999   }  // end loop over DataSetVector
1000 
1001   if (verbosity > 1) {
1002     eventout += "\n          Number of BrlStripDigis collected:........ ";
1003     eventout += nStripBrl;
1004   }
1005 
1006   if (verbosity > 1) {
1007     eventout += "\n          Number of FrwdStripDigis collected:....... ";
1008     eventout += nStripFwd;
1009   }
1010 
1011   // get pixel information
1012   edm::Handle<edm::DetSetVector<PixelDigi>> pixelDigis;
1013   iEvent.getByToken(SiPxlSrc_Token_, pixelDigis);
1014   if (!pixelDigis.isValid()) {
1015     edm::LogWarning(MsgLoggerCat) << "Unable to find pixelDigis in event!";
1016     return;
1017   }
1018 
1019   int nPxlBrl = 0, nPxlFwd = 0;
1020   edm::DetSetVector<PixelDigi>::const_iterator DPViter;
1021   for (DPViter = pixelDigis->begin(); DPViter != pixelDigis->end(); ++DPViter) {
1022     unsigned int id = DPViter->id;
1023     DetId detId(id);
1024     edm::DetSet<PixelDigi>::const_iterator begin = DPViter->data.begin();
1025     edm::DetSet<PixelDigi>::const_iterator end = DPViter->data.end();
1026     edm::DetSet<PixelDigi>::const_iterator iter;
1027 
1028     // get Barrel pixels
1029     if (detId.subdetId() == sdPxlBrl) {
1030       for (iter = begin; iter != end; ++iter) {
1031         ++nPxlBrl;
1032         if (tTopo->pxbLayer(id) == 1) {
1033           BRL1ADC.push_back((*iter).adc());
1034           BRL1Row.push_back((*iter).row());
1035           BRL1Col.push_back((*iter).column());
1036         }
1037         if (tTopo->pxbLayer(id) == 2) {
1038           BRL2ADC.push_back((*iter).adc());
1039           BRL2Row.push_back((*iter).row());
1040           BRL2Col.push_back((*iter).column());
1041         }
1042         if (tTopo->pxbLayer(id) == 3) {
1043           BRL3ADC.push_back((*iter).adc());
1044           BRL3Row.push_back((*iter).row());
1045           BRL3Col.push_back((*iter).column());
1046         }
1047       }
1048     }
1049 
1050     // get Forward pixels
1051     if (detId.subdetId() == sdPxlFwd) {
1052       for (iter = begin; iter != end; ++iter) {
1053         ++nPxlFwd;
1054         if (tTopo->pxfDisk(id) == 1) {
1055           if (tTopo->pxfSide(id) == 1) {
1056             FWD1nADC.push_back((*iter).adc());
1057             FWD1nRow.push_back((*iter).row());
1058             FWD1nCol.push_back((*iter).column());
1059           }
1060           if (tTopo->pxfSide(id) == 2) {
1061             FWD1pADC.push_back((*iter).adc());
1062             FWD1pRow.push_back((*iter).row());
1063             FWD1pCol.push_back((*iter).column());
1064           }
1065         }
1066         if (tTopo->pxfDisk(id) == 2) {
1067           if (tTopo->pxfSide(id) == 1) {
1068             FWD2nADC.push_back((*iter).adc());
1069             FWD2nRow.push_back((*iter).row());
1070             FWD2nCol.push_back((*iter).column());
1071           }
1072           if (tTopo->pxfSide(id) == 2) {
1073             FWD2pADC.push_back((*iter).adc());
1074             FWD2pRow.push_back((*iter).row());
1075             FWD2pCol.push_back((*iter).column());
1076           }
1077         }
1078       }
1079     }
1080   }
1081 
1082   if (verbosity > 1) {
1083     eventout += "\n          Number of BrlPixelDigis collected:........ ";
1084     eventout += nPxlBrl;
1085   }
1086 
1087   if (verbosity > 1) {
1088     eventout += "\n          Number of FrwdPixelDigis collected:....... ";
1089     eventout += nPxlFwd;
1090   }
1091 
1092   if (verbosity > 0)
1093     edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1094 
1095   return;
1096 }
1097 
1098 void GlobalDigisProducer::storeTrk(PGlobalDigi &product) {
1099   std::string MsgLoggerCat = "GlobalDigisProducer_storeTrk";
1100 
1101   if (verbosity > 2) {
1102     // strip output
1103     TString eventout("\n         nTIBL1     = ");
1104     eventout += TIBL1ADC.size();
1105     for (unsigned int i = 0; i < TIBL1ADC.size(); ++i) {
1106       eventout += "\n      (ADC, strip) = (";
1107       eventout += TIBL1ADC[i];
1108       eventout += ", ";
1109       eventout += TIBL1Strip[i];
1110       eventout += ")";
1111     }
1112     eventout += "\n         nTIBL2     = ";
1113     eventout += TIBL2ADC.size();
1114     for (unsigned int i = 0; i < TIBL2ADC.size(); ++i) {
1115       eventout += "\n      (ADC, strip) = (";
1116       eventout += TIBL2ADC[i];
1117       eventout += ", ";
1118       eventout += TIBL2Strip[i];
1119       eventout += ")";
1120     }
1121     eventout += "\n         nTIBL3     = ";
1122     eventout += TIBL3ADC.size();
1123     for (unsigned int i = 0; i < TIBL3ADC.size(); ++i) {
1124       eventout += "\n      (ADC, strip) = (";
1125       eventout += TIBL3ADC[i];
1126       eventout += ", ";
1127       eventout += TIBL3Strip[i];
1128       eventout += ")";
1129     }
1130     eventout += "\n         nTIBL4     = ";
1131     eventout += TIBL4ADC.size();
1132     for (unsigned int i = 0; i < TIBL4ADC.size(); ++i) {
1133       eventout += "\n      (ADC, strip) = (";
1134       eventout += TIBL4ADC[i];
1135       eventout += ", ";
1136       eventout += TIBL4Strip[i];
1137       eventout += ")";
1138     }
1139     eventout += "\n         nTOBL1     = ";
1140     eventout += TOBL1ADC.size();
1141     for (unsigned int i = 0; i < TOBL1ADC.size(); ++i) {
1142       eventout += "\n      (ADC, strip) = (";
1143       eventout += TOBL1ADC[i];
1144       eventout += ", ";
1145       eventout += TOBL1Strip[i];
1146       eventout += ")";
1147     }
1148     eventout += "\n         nTOBL2     = ";
1149     eventout += TOBL2ADC.size();
1150     for (unsigned int i = 0; i < TOBL2ADC.size(); ++i) {
1151       eventout += "\n      (ADC, strip) = (";
1152       eventout += TOBL2ADC[i];
1153       eventout += ", ";
1154       eventout += TOBL2Strip[i];
1155       eventout += ")";
1156     }
1157     eventout += "\n         nTOBL3     = ";
1158     eventout += TOBL3ADC.size();
1159     for (unsigned int i = 0; i < TOBL3ADC.size(); ++i) {
1160       eventout += "\n      (ADC, strip) = (";
1161       eventout += TOBL3ADC[i];
1162       eventout += ", ";
1163       eventout += TOBL3Strip[i];
1164       eventout += ")";
1165     }
1166     eventout += "\n         nTOBL4     = ";
1167     eventout += TOBL4ADC.size();
1168     for (unsigned int i = 0; i < TOBL4ADC.size(); ++i) {
1169       eventout += "\n      (ADC, strip) = (";
1170       eventout += TOBL4ADC[i];
1171       eventout += ", ";
1172       eventout += TOBL4Strip[i];
1173       eventout += ")";
1174     }
1175     eventout += "\n         nTIDW1     = ";
1176     eventout += TIDW1ADC.size();
1177     for (unsigned int i = 0; i < TIDW1ADC.size(); ++i) {
1178       eventout += "\n      (ADC, strip) = (";
1179       eventout += TIDW1ADC[i];
1180       eventout += ", ";
1181       eventout += TIDW1Strip[i];
1182       eventout += ")";
1183     }
1184     eventout += "\n         nTIDW2     = ";
1185     eventout += TIDW2ADC.size();
1186     for (unsigned int i = 0; i < TIDW2ADC.size(); ++i) {
1187       eventout += "\n      (ADC, strip) = (";
1188       eventout += TIDW2ADC[i];
1189       eventout += ", ";
1190       eventout += TIDW2Strip[i];
1191       eventout += ")";
1192     }
1193     eventout += "\n         nTIDW3     = ";
1194     eventout += TIDW3ADC.size();
1195     for (unsigned int i = 0; i < TIDW3ADC.size(); ++i) {
1196       eventout += "\n      (ADC, strip) = (";
1197       eventout += TIDW3ADC[i];
1198       eventout += ", ";
1199       eventout += TIDW3Strip[i];
1200       eventout += ")";
1201     }
1202     eventout += "\n         nTECW1     = ";
1203     eventout += TECW1ADC.size();
1204     for (unsigned int i = 0; i < TECW1ADC.size(); ++i) {
1205       eventout += "\n      (ADC, strip) = (";
1206       eventout += TECW1ADC[i];
1207       eventout += ", ";
1208       eventout += TECW1Strip[i];
1209       eventout += ")";
1210     }
1211     eventout += "\n         nTECW2     = ";
1212     eventout += TECW2ADC.size();
1213     for (unsigned int i = 0; i < TECW2ADC.size(); ++i) {
1214       eventout += "\n      (ADC, strip) = (";
1215       eventout += TECW2ADC[i];
1216       eventout += ", ";
1217       eventout += TECW2Strip[i];
1218       eventout += ")";
1219     }
1220     eventout += "\n         nTECW3     = ";
1221     eventout += TECW3ADC.size();
1222     for (unsigned int i = 0; i < TECW3ADC.size(); ++i) {
1223       eventout += "\n      (ADC, strip) = (";
1224       eventout += TECW3ADC[i];
1225       eventout += ", ";
1226       eventout += TECW3Strip[i];
1227       eventout += ")";
1228     }
1229     eventout += "\n         nTECW4     = ";
1230     eventout += TECW4ADC.size();
1231     for (unsigned int i = 0; i < TECW4ADC.size(); ++i) {
1232       eventout += "\n      (ADC, strip) = (";
1233       eventout += TECW4ADC[i];
1234       eventout += ", ";
1235       eventout += TECW4Strip[i];
1236       eventout += ")";
1237     }
1238     eventout += "\n         nTECW5     = ";
1239     eventout += TECW5ADC.size();
1240     for (unsigned int i = 0; i < TECW5ADC.size(); ++i) {
1241       eventout += "\n      (ADC, strip) = (";
1242       eventout += TECW5ADC[i];
1243       eventout += ", ";
1244       eventout += TECW5Strip[i];
1245       eventout += ")";
1246     }
1247     eventout += "\n         nTECW6     = ";
1248     eventout += TECW6ADC.size();
1249     for (unsigned int i = 0; i < TECW6ADC.size(); ++i) {
1250       eventout += "\n      (ADC, strip) = (";
1251       eventout += TECW6ADC[i];
1252       eventout += ", ";
1253       eventout += TECW6Strip[i];
1254       eventout += ")";
1255     }
1256     eventout += "\n         nTECW7     = ";
1257     eventout += TECW7ADC.size();
1258     for (unsigned int i = 0; i < TECW7ADC.size(); ++i) {
1259       eventout += "\n      (ADC, strip) = (";
1260       eventout += TECW7ADC[i];
1261       eventout += ", ";
1262       eventout += TECW7Strip[i];
1263       eventout += ")";
1264     }
1265     eventout += "\n         nTECW8     = ";
1266     eventout += TECW8ADC.size();
1267     for (unsigned int i = 0; i < TECW8ADC.size(); ++i) {
1268       eventout += "\n      (ADC, strip) = (";
1269       eventout += TECW8ADC[i];
1270       eventout += ", ";
1271       eventout += TECW8Strip[i];
1272       eventout += ")";
1273     }
1274 
1275     // pixel output
1276     eventout += "\n         nBRL1     = ";
1277     eventout += BRL1ADC.size();
1278     for (unsigned int i = 0; i < BRL1ADC.size(); ++i) {
1279       eventout += "\n      (ADC, row, column) = (";
1280       eventout += BRL1ADC[i];
1281       eventout += ", ";
1282       eventout += BRL1Row[i];
1283       eventout += ", ";
1284       eventout += BRL1Col[i];
1285       eventout += ")";
1286     }
1287     eventout += "\n         nBRL2     = ";
1288     eventout += BRL2ADC.size();
1289     for (unsigned int i = 0; i < BRL2ADC.size(); ++i) {
1290       eventout += "\n      (ADC, row, column) = (";
1291       eventout += BRL2ADC[i];
1292       eventout += ", ";
1293       eventout += BRL2Row[i];
1294       eventout += ", ";
1295       eventout += BRL2Col[i];
1296       eventout += ")";
1297     }
1298     eventout += "\n         nBRL3     = ";
1299     eventout += BRL3ADC.size();
1300     for (unsigned int i = 0; i < BRL3ADC.size(); ++i) {
1301       eventout += "\n      (ADC, row, column) = (";
1302       eventout += BRL3ADC[i];
1303       eventout += ", ";
1304       eventout += BRL3Row[i];
1305       eventout += ", ";
1306       eventout += BRL3Col[i];
1307       eventout += ")";
1308     }
1309     eventout += "\n         nFWD1p     = ";
1310     eventout += FWD1pADC.size();
1311     for (unsigned int i = 0; i < FWD1pADC.size(); ++i) {
1312       eventout += "\n      (ADC, row, column) = (";
1313       eventout += FWD1pADC[i];
1314       eventout += ", ";
1315       eventout += FWD1pRow[i];
1316       eventout += ", ";
1317       eventout += FWD1pCol[i];
1318       eventout += ")";
1319     }
1320     eventout += "\n         nFWD1p     = ";
1321     eventout += FWD1nADC.size();
1322     for (unsigned int i = 0; i < FWD1nADC.size(); ++i) {
1323       eventout += "\n      (ADC, row, column) = (";
1324       eventout += FWD1nADC[i];
1325       eventout += ", ";
1326       eventout += FWD1nRow[i];
1327       eventout += ", ";
1328       eventout += FWD1nCol[i];
1329       eventout += ")";
1330     }
1331     eventout += "\n         nFWD1p     = ";
1332     eventout += FWD2pADC.size();
1333     for (unsigned int i = 0; i < FWD2pADC.size(); ++i) {
1334       eventout += "\n      (ADC, row, column) = (";
1335       eventout += FWD2pADC[i];
1336       eventout += ", ";
1337       eventout += FWD2pRow[i];
1338       eventout += ", ";
1339       eventout += FWD2pCol[i];
1340       eventout += ")";
1341     }
1342     eventout += "\n         nFWD2p     = ";
1343     eventout += FWD2nADC.size();
1344     for (unsigned int i = 0; i < FWD2nADC.size(); ++i) {
1345       eventout += "\n      (ADC, row, column) = (";
1346       eventout += FWD2nADC[i];
1347       eventout += ", ";
1348       eventout += FWD2nRow[i];
1349       eventout += ", ";
1350       eventout += FWD2nCol[i];
1351       eventout += ")";
1352     }
1353 
1354     edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1355   }
1356 
1357   // strip output
1358   product.putTIBL1Digis(TIBL1ADC, TIBL1Strip);
1359   product.putTIBL2Digis(TIBL2ADC, TIBL2Strip);
1360   product.putTIBL3Digis(TIBL3ADC, TIBL3Strip);
1361   product.putTIBL4Digis(TIBL4ADC, TIBL4Strip);
1362   product.putTOBL1Digis(TOBL1ADC, TOBL1Strip);
1363   product.putTOBL2Digis(TOBL2ADC, TOBL2Strip);
1364   product.putTOBL3Digis(TOBL3ADC, TOBL3Strip);
1365   product.putTOBL4Digis(TOBL4ADC, TOBL4Strip);
1366   product.putTIDW1Digis(TIDW1ADC, TIDW1Strip);
1367   product.putTIDW2Digis(TIDW2ADC, TIDW2Strip);
1368   product.putTIDW3Digis(TIDW3ADC, TIDW3Strip);
1369   product.putTECW1Digis(TECW1ADC, TECW1Strip);
1370   product.putTECW2Digis(TECW2ADC, TECW2Strip);
1371   product.putTECW3Digis(TECW3ADC, TECW3Strip);
1372   product.putTECW4Digis(TECW4ADC, TECW4Strip);
1373   product.putTECW5Digis(TECW5ADC, TECW5Strip);
1374   product.putTECW6Digis(TECW6ADC, TECW6Strip);
1375   product.putTECW7Digis(TECW7ADC, TECW7Strip);
1376   product.putTECW8Digis(TECW8ADC, TECW8Strip);
1377 
1378   // pixel output
1379   product.putBRL1Digis(BRL1ADC, BRL1Row, BRL1Col);
1380   product.putBRL2Digis(BRL2ADC, BRL2Row, BRL2Col);
1381   product.putBRL3Digis(BRL3ADC, BRL3Row, BRL3Col);
1382   product.putFWD1pDigis(FWD1pADC, FWD1pRow, FWD1pCol);
1383   product.putFWD1nDigis(FWD1nADC, FWD1nRow, FWD1nCol);
1384   product.putFWD2pDigis(FWD2pADC, FWD2pRow, FWD2pCol);
1385   product.putFWD2nDigis(FWD2nADC, FWD2nRow, FWD2nCol);
1386 
1387   return;
1388 }
1389 
1390 void GlobalDigisProducer::fillMuon(edm::Event &iEvent, const edm::EventSetup &iSetup) {
1391   std::string MsgLoggerCat = "GlobalDigisProducer_fillMuon";
1392 
1393   TString eventout;
1394   if (verbosity > 0)
1395     eventout = "\nGathering info:";
1396 
1397   // get DT information
1398   edm::Handle<DTDigiCollection> dtDigis;
1399   iEvent.getByToken(MuDTSrc_Token_, dtDigis);
1400   if (!dtDigis.isValid()) {
1401     edm::LogWarning(MsgLoggerCat) << "Unable to find dtDigis in event!";
1402     return;
1403   }
1404 
1405   int nDt = 0;
1406   DTDigiCollection::DigiRangeIterator detUnitIt;
1407   for (detUnitIt = dtDigis->begin(); detUnitIt != dtDigis->end(); ++detUnitIt) {
1408     const DTLayerId &id = (*detUnitIt).first;
1409     const DTDigiCollection::Range &range = (*detUnitIt).second;
1410 
1411     for (DTDigiCollection::const_iterator digiIt = range.first; digiIt != range.second; ++digiIt) {
1412       ++nDt;
1413 
1414       DTWireId wireId(id, (*digiIt).wire());
1415       if (wireId.station() == 1) {
1416         MB1SLayer.push_back(id.superlayer());
1417         MB1Time.push_back((*digiIt).time());
1418         MB1Layer.push_back(id.layer());
1419       }
1420       if (wireId.station() == 2) {
1421         MB2SLayer.push_back(id.superlayer());
1422         MB2Time.push_back((*digiIt).time());
1423         MB2Layer.push_back(id.layer());
1424       }
1425       if (wireId.station() == 3) {
1426         MB3SLayer.push_back(id.superlayer());
1427         MB3Time.push_back((*digiIt).time());
1428         MB3Layer.push_back(id.layer());
1429       }
1430       if (wireId.station() == 4) {
1431         MB4SLayer.push_back(id.superlayer());
1432         MB4Time.push_back((*digiIt).time());
1433         MB4Layer.push_back(id.layer());
1434       }
1435     }
1436   }
1437 
1438   if (verbosity > 1) {
1439     eventout += "\n          Number of DtMuonDigis collected:.......... ";
1440     eventout += nDt;
1441   }
1442 
1443   // get CSC Strip information
1444   edm::Handle<CSCStripDigiCollection> strips;
1445   iEvent.getByToken(MuCSCStripSrc_Token_, strips);
1446   if (!strips.isValid()) {
1447     edm::LogWarning(MsgLoggerCat) << "Unable to find muon strips in event!";
1448     return;
1449   }
1450 
1451   int nStrips = 0;
1452   for (CSCStripDigiCollection::DigiRangeIterator j = strips->begin(); j != strips->end(); ++j) {
1453     std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
1454     std::vector<CSCStripDigi>::const_iterator last = (*j).second.second;
1455 
1456     for (; digiItr != last; ++digiItr) {
1457       ++nStrips;
1458 
1459       // average pedestals
1460       std::vector<int> adcCounts = digiItr->getADCCounts();
1461       theCSCStripPedestalSum += adcCounts[0];
1462       theCSCStripPedestalSum += adcCounts[1];
1463       theCSCStripPedestalCount += 2;
1464 
1465       // if there are enough pedestal statistics
1466       if (theCSCStripPedestalCount > 100) {
1467         float pedestal = theCSCStripPedestalSum / theCSCStripPedestalCount;
1468         if (adcCounts[5] > (pedestal + 100))
1469           CSCStripADC.push_back(adcCounts[4] - pedestal);
1470       }
1471     }
1472   }
1473 
1474   if (verbosity > 1) {
1475     eventout += "\n          Number of CSCStripDigis collected:........ ";
1476     eventout += nStrips;
1477   }
1478 
1479   // get CSC Wire information
1480   edm::Handle<CSCWireDigiCollection> wires;
1481   iEvent.getByToken(MuCSCWireSrc_Token_, wires);
1482   if (!wires.isValid()) {
1483     edm::LogWarning(MsgLoggerCat) << "Unable to find muon wires in event!";
1484     return;
1485   }
1486 
1487   int nWires = 0;
1488   for (CSCWireDigiCollection::DigiRangeIterator j = wires->begin(); j != wires->end(); ++j) {
1489     std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
1490     std::vector<CSCWireDigi>::const_iterator endDigi = (*j).second.second;
1491 
1492     for (; digiItr != endDigi; ++digiItr) {
1493       ++nWires;
1494 
1495       CSCWireTime.push_back(digiItr->getTimeBin());
1496     }
1497   }
1498 
1499   if (verbosity > 1) {
1500     eventout += "\n          Number of CSCWireDigis collected:......... ";
1501     eventout += nWires;
1502   }
1503 
1504   if (verbosity > 0)
1505     edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1506 
1507   return;
1508 }
1509 
1510 void GlobalDigisProducer::storeMuon(PGlobalDigi &product) {
1511   std::string MsgLoggerCat = "GlobalDigisProducer_storeMuon";
1512 
1513   if (verbosity > 2) {
1514     // dt output
1515     TString eventout("\n         nMB1     = ");
1516     eventout += MB1SLayer.size();
1517     for (unsigned int i = 0; i < MB1SLayer.size(); ++i) {
1518       eventout += "\n      (slayer, time, layer) = (";
1519       eventout += MB1SLayer[i];
1520       eventout += ", ";
1521       eventout += MB1Time[i];
1522       eventout += ", ";
1523       eventout += MB1Layer[i];
1524       eventout += ")";
1525     }
1526     eventout += "\n         nMB2     = ";
1527     eventout += MB2SLayer.size();
1528     for (unsigned int i = 0; i < MB2SLayer.size(); ++i) {
1529       eventout += "\n      (slayer, time, layer) = (";
1530       eventout += MB2SLayer[i];
1531       eventout += ", ";
1532       eventout += MB2Time[i];
1533       eventout += ", ";
1534       eventout += MB2Layer[i];
1535       eventout += ")";
1536     }
1537     eventout += "\n         nMB3     = ";
1538     eventout += MB3SLayer.size();
1539     for (unsigned int i = 0; i < MB3SLayer.size(); ++i) {
1540       eventout += "\n      (slayer, time, layer) = (";
1541       eventout += MB3SLayer[i];
1542       eventout += ", ";
1543       eventout += MB3Time[i];
1544       eventout += ", ";
1545       eventout += MB3Layer[i];
1546       eventout += ")";
1547     }
1548     eventout += "\n         nMB2     = ";
1549     eventout += MB4SLayer.size();
1550     for (unsigned int i = 0; i < MB4SLayer.size(); ++i) {
1551       eventout += "\n      (slayer, time, layer) = (";
1552       eventout += MB4SLayer[i];
1553       eventout += ", ";
1554       eventout += MB4Time[i];
1555       eventout += ", ";
1556       eventout += MB4Layer[i];
1557       eventout += ")";
1558     }
1559 
1560     // CSC Strip
1561     eventout += "\n         nCSCStrip     = ";
1562     eventout += CSCStripADC.size();
1563     for (unsigned int i = 0; i < CSCStripADC.size(); ++i) {
1564       eventout += "\n      (adc) = (";
1565       eventout += CSCStripADC[i];
1566       eventout += ")";
1567     }
1568 
1569     // CSC Wire
1570     eventout += "\n         nCSCWire     = ";
1571     eventout += CSCWireTime.size();
1572     for (unsigned int i = 0; i < CSCWireTime.size(); ++i) {
1573       eventout += "\n      (time) = (";
1574       eventout += CSCWireTime[i];
1575       eventout += ")";
1576     }
1577 
1578     edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1579   }
1580 
1581   product.putMB1Digis(MB1SLayer, MB1Time, MB1Layer);
1582   product.putMB2Digis(MB2SLayer, MB2Time, MB2Layer);
1583   product.putMB3Digis(MB3SLayer, MB3Time, MB3Layer);
1584   product.putMB4Digis(MB4SLayer, MB4Time, MB4Layer);
1585 
1586   product.putCSCstripDigis(CSCStripADC);
1587 
1588   product.putCSCwireDigis(CSCWireTime);
1589 
1590   return;
1591 }
1592 
1593 void GlobalDigisProducer::clear() {
1594   std::string MsgLoggerCat = "GlobalDigisProducer_clear";
1595 
1596   if (verbosity > 0)
1597     edm::LogInfo(MsgLoggerCat) << "Clearing event holders";
1598 
1599   // reset electromagnetic info
1600   // EE info
1601   EECalmaxPos.clear();
1602   EECalAEE.clear();
1603   EECalSHE.clear();
1604   // EB info
1605   EBCalmaxPos.clear();
1606   EBCalAEE.clear();
1607   EBCalSHE.clear();
1608   // ES info
1609   ESCalADC0.clear();
1610   ESCalADC1.clear();
1611   ESCalADC2.clear();
1612   ESCalSHE.clear();
1613 
1614   // reset HCal Info
1615   HBCalAEE.clear();
1616   HBCalSHE.clear();
1617   HECalAEE.clear();
1618   HECalSHE.clear();
1619   HOCalAEE.clear();
1620   HOCalSHE.clear();
1621   HFCalAEE.clear();
1622   HFCalSHE.clear();
1623 
1624   // reset Track Info
1625   TIBL1ADC.clear();
1626   TIBL2ADC.clear();
1627   TIBL3ADC.clear();
1628   TIBL4ADC.clear();
1629   TIBL1Strip.clear();
1630   TIBL2Strip.clear();
1631   TIBL3Strip.clear();
1632   TIBL4Strip.clear();
1633 
1634   TOBL1ADC.clear();
1635   TOBL2ADC.clear();
1636   TOBL3ADC.clear();
1637   TOBL4ADC.clear();
1638   TOBL1Strip.clear();
1639   TOBL2Strip.clear();
1640   TOBL3Strip.clear();
1641   TOBL4Strip.clear();
1642 
1643   TIDW1ADC.clear();
1644   TIDW2ADC.clear();
1645   TIDW3ADC.clear();
1646   TIDW1Strip.clear();
1647   TIDW2Strip.clear();
1648   TIDW3Strip.clear();
1649 
1650   TECW1ADC.clear();
1651   TECW2ADC.clear();
1652   TECW3ADC.clear();
1653   TECW4ADC.clear();
1654   TECW5ADC.clear();
1655   TECW6ADC.clear();
1656   TECW7ADC.clear();
1657   TECW8ADC.clear();
1658   TECW1Strip.clear();
1659   TECW2Strip.clear();
1660   TECW3Strip.clear();
1661   TECW4Strip.clear();
1662   TECW5Strip.clear();
1663   TECW6Strip.clear();
1664   TECW7Strip.clear();
1665   TECW8Strip.clear();
1666 
1667   BRL1ADC.clear();
1668   BRL1Row.clear();
1669   BRL1Col.clear();
1670   BRL2ADC.clear();
1671   BRL2Row.clear();
1672   BRL2Col.clear();
1673   BRL3ADC.clear();
1674   BRL3Row.clear();
1675   BRL3Col.clear();
1676 
1677   FWD1pADC.clear();
1678   FWD1pRow.clear();
1679   FWD1pCol.clear();
1680   FWD1nADC.clear();
1681   FWD1nRow.clear();
1682   FWD1nCol.clear();
1683   FWD2pADC.clear();
1684   FWD2pRow.clear();
1685   FWD2pCol.clear();
1686   FWD2nADC.clear();
1687   FWD2nRow.clear();
1688   FWD2nCol.clear();
1689 
1690   // muon clear
1691   MB1SLayer.clear();
1692   MB1Time.clear();
1693   MB1Layer.clear();
1694   MB2SLayer.clear();
1695   MB2Time.clear();
1696   MB2Layer.clear();
1697   MB3SLayer.clear();
1698   MB3Time.clear();
1699   MB3Layer.clear();
1700   MB4SLayer.clear();
1701   MB4Time.clear();
1702   MB4Layer.clear();
1703 
1704   CSCStripADC.clear();
1705 
1706   CSCWireTime.clear();
1707 
1708   return;
1709 }
1710 
1711 // define this as a plug-in
1712 // DEFINE_FWK_MODULE(GlobalDigisProducer);