CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/Validation/GlobalDigis/src/GlobalDigisProducer.cc

Go to the documentation of this file.
00001 
00010 #include "Validation/GlobalDigis/interface/GlobalDigisProducer.h"
00011 
00012 GlobalDigisProducer::GlobalDigisProducer(const edm::ParameterSet& iPSet) :
00013   fName(""), verbosity(0), frequency(0), label(""), getAllProvenances(false),
00014   printProvenanceInfo(false), theCSCStripPedestalSum(0),
00015   theCSCStripPedestalCount(0), count(0)
00016 {
00017   std::string MsgLoggerCat = "GlobalDigisProducer_GlobalDigisProducer";
00018 
00019   // get information from parameter set
00020   fName = iPSet.getUntrackedParameter<std::string>("Name");
00021   verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
00022   frequency = iPSet.getUntrackedParameter<int>("Frequency");
00023   label = iPSet.getParameter<std::string>("Label");
00024   edm::ParameterSet m_Prov =
00025     iPSet.getParameter<edm::ParameterSet>("ProvenanceLookup");
00026   getAllProvenances = 
00027     m_Prov.getUntrackedParameter<bool>("GetAllProvenances");
00028   printProvenanceInfo = 
00029     m_Prov.getUntrackedParameter<bool>("PrintProvenanceInfo");
00030 
00031   //get Labels to use to extract information
00032   ECalEBSrc_ = iPSet.getParameter<edm::InputTag>("ECalEBSrc");
00033   ECalEESrc_ = iPSet.getParameter<edm::InputTag>("ECalEESrc");
00034   ECalESSrc_ = iPSet.getParameter<edm::InputTag>("ECalESSrc");
00035   HCalSrc_ = iPSet.getParameter<edm::InputTag>("HCalSrc");
00036   HCalDigi_ = iPSet.getParameter<edm::InputTag>("HCalDigi");
00037   SiStripSrc_ = iPSet.getParameter<edm::InputTag>("SiStripSrc"); 
00038   SiPxlSrc_ = iPSet.getParameter<edm::InputTag>("SiPxlSrc");
00039   MuDTSrc_ = iPSet.getParameter<edm::InputTag>("MuDTSrc");
00040   MuCSCStripSrc_ = iPSet.getParameter<edm::InputTag>("MuCSCStripSrc");
00041   MuCSCWireSrc_ = iPSet.getParameter<edm::InputTag>("MuCSCWireSrc");
00042 
00043   // use value of first digit to determine default output level (inclusive)
00044   // 0 is none, 1 is basic, 2 is fill output, 3 is gather output
00045   verbosity %= 10;
00046 
00047   // create persistent object
00048   produces<PGlobalDigi>(label);
00049 
00050   // print out Parameter Set information being used
00051   if (verbosity >= 0) {
00052     edm::LogInfo(MsgLoggerCat) 
00053       << "\n===============================\n"
00054       << "Initialized as EDProducer with parameter values:\n"
00055       << "    Name          = " << fName << "\n"
00056       << "    Verbosity     = " << verbosity << "\n"
00057       << "    Frequency     = " << frequency << "\n"
00058       << "    Label         = " << label << "\n"
00059       << "    GetProv       = " << getAllProvenances << "\n"
00060       << "    PrintProv     = " << printProvenanceInfo << "\n"
00061       << "    ECalEBSrc     = " << ECalEBSrc_.label() 
00062       << ":" << ECalEBSrc_.instance() << "\n"
00063       << "    ECalEESrc     = " << ECalEESrc_.label() 
00064       << ":" << ECalEESrc_.instance() << "\n"
00065       << "    ECalESSrc     = " << ECalESSrc_.label() 
00066       << ":" << ECalESSrc_.instance() << "\n"
00067       << "    HCalSrc       = " << HCalSrc_.label() 
00068       << ":" << HCalSrc_.instance() << "\n"
00069       << "    HCalDigi       = " << HCalDigi_.label() 
00070       << ":" << HCalDigi_.instance() << "\n"
00071       << "    SiStripSrc    = " << SiStripSrc_.label() 
00072       << ":" << SiStripSrc_.instance() << "\n" 
00073       << "    SiPixelSrc    = " << SiPxlSrc_.label()
00074       << ":" << SiPxlSrc_.instance() << "\n"
00075       << "    MuDTSrc       = " << MuDTSrc_.label()
00076       << ":" << MuDTSrc_.instance() << "\n"
00077       << "    MuCSCStripSrc = " << MuCSCStripSrc_.label()
00078       << ":" << MuCSCStripSrc_.instance() << "\n"
00079       << "    MuCSCWireSrc  = " << MuCSCWireSrc_.label()
00080       << ":" << MuCSCWireSrc_.instance() << "\n"
00081       << "===============================\n";
00082   }
00083 
00084   // set default constants
00085   // ECal
00086   ECalgainConv_[0] = 0.;
00087   ECalgainConv_[1] = 1.;
00088   ECalgainConv_[2] = 2.;
00089   ECalgainConv_[3] = 12.;  
00090   ECalbarrelADCtoGeV_ = 0.035;
00091   ECalendcapADCtoGeV_ = 0.06;
00092 
00093 }
00094 
00095 GlobalDigisProducer::~GlobalDigisProducer() 
00096 {
00097 }
00098 
00099 void GlobalDigisProducer::beginJob( void )
00100 {
00101   std::string MsgLoggerCat = "GlobalDigisProducer_beginJob";
00102 
00103 //   // setup calorimeter constants from service
00104 //   edm::ESHandle<EcalADCToGeVConstant> pAgc;
00105 //   iSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
00106 //   const EcalADCToGeVConstant* agc = pAgc.product();
00107   
00108   EcalMGPAGainRatio * defaultRatios = new EcalMGPAGainRatio();
00109 
00110   ECalgainConv_[0] = 0.;
00111   ECalgainConv_[1] = 1.;
00112   ECalgainConv_[2] = defaultRatios->gain12Over6() ;
00113   ECalgainConv_[3] = ECalgainConv_[2]*(defaultRatios->gain6Over1()) ;
00114 
00115   delete defaultRatios;
00116 
00117 //   ECalbarrelADCtoGeV_ = agc->getEBValue();
00118 //   ECalendcapADCtoGeV_ = agc->getEEValue();
00119 
00120   if (verbosity >= 0) {
00121     edm::LogInfo(MsgLoggerCat) 
00122       << "Modified Calorimeter gain constants: g0 = " << ECalgainConv_[0]
00123       << ", g1 = " << ECalgainConv_[1] << ", g2 = " << ECalgainConv_[2]
00124       << ", g3 = " << ECalgainConv_[3];
00125 //     edm::LogInfo(MsgLoggerCat)
00126 //       << "Modified Calorimeter ADCtoGeV constants: barrel = " 
00127 //       << ECalbarrelADCtoGeV_ << ", endcap = " << ECalendcapADCtoGeV_;
00128   }
00129 
00130   // clear storage vectors
00131   clear();
00132   return;
00133 }
00134 
00135 void GlobalDigisProducer::endJob()
00136 {
00137   std::string MsgLoggerCat = "GlobalDigisProducer_endJob";
00138   if (verbosity >= 0)
00139     edm::LogInfo(MsgLoggerCat) 
00140       << "Terminating having processed " << count << " events.";
00141   return;
00142 }
00143 
00144 void GlobalDigisProducer::produce(edm::Event& iEvent, 
00145                                   const edm::EventSetup& iSetup)
00146 {
00147   std::string MsgLoggerCat = "GlobalDigisProducer_produce";
00148 
00149   // keep track of number of events processed
00150   ++count;
00151 
00152 
00153   // THIS BLOCK MIGRATED HERE FROM beginJob:
00154   // setup calorimeter constants from service
00155   edm::ESHandle<EcalADCToGeVConstant> pAgc;
00156   iSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
00157   const EcalADCToGeVConstant* agc = pAgc.product();
00158   ECalbarrelADCtoGeV_ = agc->getEBValue();
00159   ECalendcapADCtoGeV_ = agc->getEEValue();
00160   if (verbosity >= 0) {
00161     edm::LogInfo(MsgLoggerCat)
00162       << "Modified Calorimeter ADCtoGeV constants: barrel = " 
00163       << ECalbarrelADCtoGeV_ << ", endcap = " << ECalendcapADCtoGeV_;
00164   }
00165   
00166 
00167   // get event id information
00168   int nrun = iEvent.id().run();
00169   int nevt = iEvent.id().event();
00170 
00171   if (verbosity > 0) {
00172     edm::LogInfo(MsgLoggerCat)
00173       << "Processing run " << nrun << ", event " << nevt
00174       << " (" << count << " events total)";
00175   } else if (verbosity == 0) {
00176     if (nevt%frequency == 0 || nevt == 1) {
00177       edm::LogInfo(MsgLoggerCat)
00178         << "Processing run " << nrun << ", event " << nevt
00179         << " (" << count << " events total)";
00180     }
00181   }
00182 
00183   // clear event holders
00184   clear();
00185 
00186   // look at information available in the event
00187   if (getAllProvenances) {
00188 
00189     std::vector<const edm::Provenance*> AllProv;
00190     iEvent.getAllProvenance(AllProv);
00191 
00192     if (verbosity >= 0)
00193       edm::LogInfo(MsgLoggerCat)
00194         << "Number of Provenances = " << AllProv.size();
00195 
00196     if (printProvenanceInfo && (verbosity >= 0)) {
00197       TString eventout("\nProvenance info:\n");      
00198 
00199       for (unsigned int i = 0; i < AllProv.size(); ++i) {
00200         eventout += "\n       ******************************";
00201         eventout += "\n       Module       : ";
00202         //eventout += (AllProv[i]->product).moduleLabel();
00203         eventout += AllProv[i]->moduleLabel();
00204         eventout += "\n       ProductID    : ";
00205         //eventout += (AllProv[i]->product).productID_.id_;
00206         eventout += AllProv[i]->productID().id();
00207         eventout += "\n       ClassName    : ";
00208         //eventout += (AllProv[i]->product).fullClassName_;
00209         eventout += AllProv[i]->className();
00210         eventout += "\n       InstanceName : ";
00211         //eventout += (AllProv[i]->product).productInstanceName_;
00212         eventout += AllProv[i]->productInstanceName();
00213         eventout += "\n       BranchName   : ";
00214         //eventout += (AllProv[i]->product).branchName_;
00215         eventout += AllProv[i]->branchName();
00216       }
00217       eventout += "\n       ******************************\n";
00218       edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00219       printProvenanceInfo = false;
00220     }
00221     getAllProvenances = false;
00222   }
00223 
00224   // call fill functions
00225   // gather Ecal information from event
00226   fillECal(iEvent, iSetup);
00227   // gather Hcal information from event
00228   fillHCal(iEvent, iSetup);
00229   // gather Track information from event
00230   fillTrk(iEvent, iSetup);
00231   // gather Muon information from event
00232   fillMuon(iEvent, iSetup);
00233 
00234   if (verbosity > 0)
00235     edm::LogInfo (MsgLoggerCat)
00236       << "Done gathering data from event.";
00237 
00238   // produce object to put into event
00239   std::auto_ptr<PGlobalDigi> pOut(new PGlobalDigi);
00240 
00241   if (verbosity > 2)
00242     edm::LogInfo (MsgLoggerCat)
00243       << "Saving event contents:";
00244 
00245   // call store functions
00246   // store ECal information in produce
00247   storeECal(*pOut);
00248   // store HCal information in produce
00249   storeHCal(*pOut);
00250   // store Track information in produce
00251   storeTrk(*pOut);
00252   // store Muon information in produce
00253   storeMuon(*pOut);
00254 
00255   // store information in event
00256   iEvent.put(pOut,label);
00257 
00258   return;
00259 }
00260 
00261 void GlobalDigisProducer::fillECal(edm::Event& iEvent, 
00262                                    const edm::EventSetup& iSetup)
00263 {
00264   std::string MsgLoggerCat = "GlobalDigisProducer_fillECal";
00265 
00266   TString eventout;
00267   if (verbosity > 0)
00268     eventout = "\nGathering info:";  
00269 
00270   // extract crossing frame from event
00271   //edm::Handle<CrossingFrame> crossingFrame;
00272   edm::Handle<CrossingFrame<PCaloHit> > crossingFrame;
00273   //iEvent.getByType(crossingFrame);
00274   //if (!crossingFrame.isValid()) {
00275   //  edm::LogWarning(MsgLoggerCat)
00276   //    << "Unable to crossingFrame in event!";
00277   //  return;
00278   //}
00279 
00281   //extract EB information
00283   bool isBarrel = true;
00284   edm::Handle<EBDigiCollection> EcalDigiEB;  
00285   iEvent.getByLabel(ECalEBSrc_, EcalDigiEB);
00286   if (!EcalDigiEB.isValid()) {
00287     edm::LogWarning(MsgLoggerCat)
00288       << "Unable to find EcalDigiEB in event!";
00289     return;
00290   }  
00291   if ( EcalDigiEB->size() == 0) isBarrel = false;
00292 
00293   if (isBarrel) {
00294     
00295     // loop over simhits
00296     const std::string barrelHitsName("EcalHitsEB");
00297     iEvent.getByLabel("mix",barrelHitsName,crossingFrame);
00298     if (!crossingFrame.isValid()) {
00299       edm::LogWarning(MsgLoggerCat)
00300         << "Unable to find cal barrel crossingFrame in event!";
00301       return;
00302     }
00303     //std::auto_ptr<MixCollection<PCaloHit> >
00304     //barrelHits(new MixCollection<PCaloHit>
00305     //           (crossingFrame.product(), barrelHitsName));
00306     std::auto_ptr<MixCollection<PCaloHit> >
00307       barrelHits(new MixCollection<PCaloHit>(crossingFrame.product()));
00308 
00309     // keep track of sum of simhit energy in each crystal
00310     MapType ebSimMap;
00311     for (MixCollection<PCaloHit>::MixItr hitItr 
00312            = barrelHits->begin();
00313          hitItr != barrelHits->end();
00314          ++hitItr) {
00315       
00316       EBDetId ebid = EBDetId(hitItr->id());
00317 
00318       uint32_t crystid = ebid.rawId();
00319       ebSimMap[crystid] += hitItr->energy();
00320     }
00321 
00322     // loop over digis
00323     const EBDigiCollection *barrelDigi = EcalDigiEB.product();
00324 
00325     std::vector<double> ebAnalogSignal;
00326     std::vector<double> ebADCCounts;
00327     std::vector<double> ebADCGains;
00328     ebAnalogSignal.reserve(EBDataFrame::MAXSAMPLES);
00329     ebADCCounts.reserve(EBDataFrame::MAXSAMPLES);
00330     ebADCGains.reserve(EBDataFrame::MAXSAMPLES);
00331 
00332     int i = 0;
00333     for (unsigned int digis=0; digis<EcalDigiEB->size(); ++digis) 
00334     {
00335       //for (std::vector<EBDataFrame>::const_iterator digis =
00336       //   barrelDigi->begin();
00337       // digis != barrelDigi->end();
00338       // ++digis) {
00339 
00340       ++i;
00341 
00342       EBDataFrame ebdf = (*barrelDigi)[digis];
00343       int nrSamples = ebdf.size();
00344       
00345       EBDetId ebid = ebdf.id () ;
00346       //EBDetId ebid = digis->id();
00347 
00348       double Emax = 0;
00349       int Pmax = 0;
00350       double pedestalPreSample = 0.;
00351       double pedestalPreSampleAnalog = 0.;
00352         
00353       for (int sample = 0 ; sample < nrSamples; ++sample) {
00354       //for (int sample = 0; sample < digis->size(); ++sample) {
00355         ebAnalogSignal[sample] = 0.;
00356         ebADCCounts[sample] = 0.;
00357         ebADCGains[sample] = -1.;
00358       }
00359   
00360       // calculate maximum energy and pedestal
00361       for (int sample = 0 ; sample < nrSamples; ++sample) {
00362         //for (int sample = 0; sample < digis->size(); ++sample) {
00363 
00364         EcalMGPASample thisSample = ebdf[sample];
00365         ebADCCounts[sample] = (thisSample.adc());
00366         ebADCGains[sample]  = (thisSample.gainId());
00367         ebAnalogSignal[sample] = 
00368           (ebADCCounts[sample] * ECalgainConv_[(int)ebADCGains[sample]]
00369            * ECalbarrelADCtoGeV_);
00370         if (Emax < ebAnalogSignal[sample]) {
00371           Emax = ebAnalogSignal[sample];
00372           Pmax = sample;
00373         }
00374         if ( sample < 3 ) {
00375           pedestalPreSample += ebADCCounts[sample] ;
00376           pedestalPreSampleAnalog += 
00377             ebADCCounts[sample] * ECalgainConv_[(int)ebADCGains[sample]]
00378             * ECalbarrelADCtoGeV_ ;
00379         }
00380         
00381       }
00382       pedestalPreSample /= 3. ; 
00383       pedestalPreSampleAnalog /= 3. ; 
00384 
00385       // calculate pedestal subtracted digi energy in the crystal
00386       double Erec = Emax - pedestalPreSampleAnalog
00387         * ECalgainConv_[(int)ebADCGains[Pmax]];
00388       
00389       // gather necessary information
00390       EBCalAEE.push_back(Erec);
00391       EBCalSHE.push_back(ebSimMap[ebid.rawId()]);
00392       EBCalmaxPos.push_back(Pmax);
00393     }
00394     
00395     if (verbosity > 1) {
00396       eventout += "\n          Number of EBDigis collected:.............. ";
00397       eventout += i;
00398     }
00399   }
00400 
00402   //extract EE information
00404   bool isEndCap = true;
00405   edm::Handle<EEDigiCollection> EcalDigiEE;  
00406   iEvent.getByLabel(ECalEESrc_, EcalDigiEE);
00407   if (!EcalDigiEE.isValid()) {
00408     edm::LogWarning(MsgLoggerCat)
00409       << "Unable to find EcalDigiEE in event!";
00410     return;
00411   }  
00412   if (EcalDigiEE->size() == 0) isEndCap = false;
00413 
00414   if (isEndCap) {
00415 
00416     // loop over simhits
00417     const std::string endcapHitsName("EcalHitsEE");
00418     iEvent.getByLabel("mix",endcapHitsName,crossingFrame);
00419     if (!crossingFrame.isValid()) {
00420       edm::LogWarning(MsgLoggerCat)
00421         << "Unable to find cal endcap crossingFrame in event!";
00422       return;
00423     }
00424     //std::auto_ptr<MixCollection<PCaloHit> >
00425     //  endcapHits(new MixCollection<PCaloHit>
00426     //   (crossingFrame.product(), endcapHitsName));
00427     std::auto_ptr<MixCollection<PCaloHit> >
00428       endcapHits(new MixCollection<PCaloHit>(crossingFrame.product()));
00429 
00430     // keep track of sum of simhit energy in each crystal
00431     MapType eeSimMap;
00432     for (MixCollection<PCaloHit>::MixItr hitItr 
00433            = endcapHits->begin();
00434          hitItr != endcapHits->end();
00435          ++hitItr) {
00436 
00437       EEDetId eeid = EEDetId(hitItr->id());
00438 
00439       uint32_t crystid = eeid.rawId();
00440       eeSimMap[crystid] += hitItr->energy();
00441     }
00442 
00443     // loop over digis
00444     const EEDigiCollection *endcapDigi = EcalDigiEE.product();
00445 
00446     std::vector<double> eeAnalogSignal;
00447     std::vector<double> eeADCCounts;
00448     std::vector<double> eeADCGains;
00449     eeAnalogSignal.reserve(EEDataFrame::MAXSAMPLES);
00450     eeADCCounts.reserve(EEDataFrame::MAXSAMPLES);
00451     eeADCGains.reserve(EEDataFrame::MAXSAMPLES);
00452 
00453     int i = 0;
00454     //for (std::vector<EEDataFrame>::const_iterator digis =
00455     //   endcapDigi->begin();
00456     // digis != endcapDigi->end();
00457     // ++digis) {
00458     for (unsigned int digis=0; digis<EcalDigiEE->size(); ++digis){ 
00459     
00460       ++i;
00461 
00462       EEDataFrame eedf = (*endcapDigi)[digis];
00463       int nrSamples = eedf.size();
00464       
00465       EEDetId eeid = eedf.id () ;
00466       //EEDetId eeid = digis->id();
00467 
00468       double Emax = 0;
00469       int Pmax = 0;
00470       double pedestalPreSample = 0.;
00471       double pedestalPreSampleAnalog = 0.;
00472         
00473       for (int sample = 0 ; sample < nrSamples; ++sample) {
00474       //for (int sample = 0; sample < digis->size(); ++sample) {
00475         eeAnalogSignal[sample] = 0.;
00476         eeADCCounts[sample] = 0.;
00477         eeADCGains[sample] = -1.;
00478       }
00479   
00480       // calculate maximum enery and pedestal
00481       for (int sample = 0 ; sample < nrSamples; ++sample) {
00482         //for (int sample = 0; sample < digis->size(); ++sample) {
00483 
00484         EcalMGPASample thisSample = eedf[sample];
00485 
00486         eeADCCounts[sample] = (thisSample.adc());
00487         eeADCGains[sample]  = (thisSample.gainId());
00488         eeAnalogSignal[sample] = 
00489           (eeADCCounts[sample] * ECalgainConv_[(int)eeADCGains[sample]]
00490            * ECalbarrelADCtoGeV_);
00491         if (Emax < eeAnalogSignal[sample]) {
00492           Emax = eeAnalogSignal[sample];
00493           Pmax = sample;
00494         }
00495         if ( sample < 3 ) {
00496           pedestalPreSample += eeADCCounts[sample] ;
00497           pedestalPreSampleAnalog += 
00498             eeADCCounts[sample] * ECalgainConv_[(int)eeADCGains[sample]]
00499             * ECalbarrelADCtoGeV_ ;
00500         }
00501         
00502       }
00503       pedestalPreSample /= 3. ; 
00504       pedestalPreSampleAnalog /= 3. ; 
00505 
00506       // calculate pedestal subtracted digi energy in the crystal
00507       double Erec = Emax - pedestalPreSampleAnalog
00508         * ECalgainConv_[(int)eeADCGains[Pmax]];
00509 
00510       // gather necessary information
00511       EECalAEE.push_back(Erec);
00512       EECalSHE.push_back(eeSimMap[eeid.rawId()]);
00513       EECalmaxPos.push_back(Pmax);
00514     }
00515     
00516     if (verbosity > 1) {
00517       eventout += "\n          Number of EEDigis collected:.............. ";
00518       eventout += i;
00519     }
00520   }
00521 
00523   //extract ES information
00525   bool isPreshower = true;
00526   edm::Handle<ESDigiCollection> EcalDigiES;  
00527   iEvent.getByLabel(ECalESSrc_, EcalDigiES);
00528   if (!EcalDigiES.isValid()) {
00529     edm::LogWarning(MsgLoggerCat)
00530       << "Unable to find EcalDigiES in event!";
00531     return;
00532   }  
00533   if (EcalDigiES->size() == 0) isPreshower = false;
00534 
00535   if (isPreshower) {
00536 
00537     // loop over simhits
00538     const std::string preshowerHitsName("EcalHitsES");
00539     iEvent.getByLabel("mix",preshowerHitsName,crossingFrame);
00540     if (!crossingFrame.isValid()) {
00541       edm::LogWarning(MsgLoggerCat)
00542         << "Unable to find cal preshower crossingFrame in event!";
00543       return;
00544     }
00545     //std::auto_ptr<MixCollection<PCaloHit> >
00546     //  preshowerHits(new MixCollection<PCaloHit>
00547     //           (crossingFrame.product(), preshowerHitsName));
00548    std::auto_ptr<MixCollection<PCaloHit> >
00549       preshowerHits(new MixCollection<PCaloHit>(crossingFrame.product()));
00550 
00551     // keep track of sum of simhit energy in each crystal
00552     MapType esSimMap;
00553     for (MixCollection<PCaloHit>::MixItr hitItr 
00554            = preshowerHits->begin();
00555          hitItr != preshowerHits->end();
00556          ++hitItr) {
00557 
00558       ESDetId esid = ESDetId(hitItr->id());
00559 
00560       uint32_t crystid = esid.rawId();
00561       esSimMap[crystid] += hitItr->energy();
00562     }
00563 
00564     // loop over digis
00565     const ESDigiCollection *preshowerDigi = EcalDigiES.product();
00566 
00567     std::vector<double> esADCCounts;
00568     esADCCounts.reserve(ESDataFrame::MAXSAMPLES);
00569 
00570     int i = 0;
00571     for (unsigned int digis=0; digis<EcalDigiES->size(); ++digis) {
00572     //for (std::vector<ESDataFrame>::const_iterator digis =
00573     //   preshowerDigi->begin();
00574     // digis != preshowerDigi->end();
00575     // ++digis) {
00576 
00577       ++i;
00578 
00579 
00580       ESDataFrame esdf = (*preshowerDigi)[digis];
00581       int nrSamples = esdf.size();
00582       
00583       ESDetId esid = esdf.id () ;
00584       // ESDetId esid = digis->id();
00585         
00586       for (int sample = 0 ; sample < nrSamples; ++sample) {
00587       //for (int sample = 0; sample < digis->size(); ++sample) {
00588         esADCCounts[sample] = 0.;
00589       }
00590   
00591       // gether ADC counts
00592       for (int sample = 0 ; sample < nrSamples; ++sample) {
00593 
00594         ESSample thisSample = esdf[sample];
00595         //for (int sample = 0; sample < digis->size(); ++sample) {
00596         esADCCounts[sample] = (thisSample.adc());
00597       }
00598       
00599       ESCalADC0.push_back(esADCCounts[0]);
00600       ESCalADC1.push_back(esADCCounts[1]);
00601       ESCalADC2.push_back(esADCCounts[2]);
00602       ESCalSHE.push_back(esSimMap[esid.rawId()]);
00603     }
00604     
00605     if (verbosity > 1) {
00606       eventout += "\n          Number of ESDigis collected:.............. ";
00607       eventout += i;
00608     }
00609   }
00610 
00611   if (verbosity > 0)
00612     edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00613 
00614   return;
00615 }
00616 
00617 void GlobalDigisProducer::storeECal(PGlobalDigi& product)
00618 {
00619   std::string MsgLoggerCat = "GlobalDigisProducer_storeECal";
00620 
00621   if (verbosity > 2) {
00622     TString eventout("\n         nEBDigis     = ");
00623     eventout += EBCalmaxPos.size();
00624     for (unsigned int i = 0; i < EBCalmaxPos.size(); ++i) {
00625       eventout += "\n      (maxPos, AEE, SHE) = (";
00626       eventout += EBCalmaxPos[i];
00627       eventout += ", ";
00628       eventout += EBCalAEE[i];
00629       eventout += ", ";
00630       eventout += EBCalSHE[i];
00631       eventout += ")";
00632     }
00633     eventout += "\n         nEEDigis     = ";
00634     eventout += EECalmaxPos.size();
00635     for (unsigned int i = 0; i < EECalmaxPos.size(); ++i) {
00636       eventout += "\n      (maxPos, AEE, SHE) = (";
00637       eventout += EECalmaxPos[i];
00638       eventout += ", ";
00639       eventout += EECalAEE[i];
00640       eventout += ", ";
00641       eventout += EECalSHE[i];
00642       eventout += ")";
00643     }
00644     eventout += "\n         nESDigis          = ";
00645     eventout += ESCalADC0.size();
00646     for (unsigned int i = 0; i < ESCalADC0.size(); ++i) {
00647       eventout += "\n      (ADC0, ADC1, ADC2, SHE) = (";
00648       eventout += ESCalADC0[i];
00649       eventout += ", ";
00650       eventout += ESCalADC1[i];
00651       eventout += ", ";
00652       eventout += ESCalADC2[i];
00653       eventout += ", ";
00654       eventout += ESCalSHE[i];
00655       eventout += ")";
00656     }
00657     edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00658   }
00659 
00660   product.putEBCalDigis(EBCalmaxPos,EBCalAEE,EBCalSHE);
00661   product.putEECalDigis(EECalmaxPos,EECalAEE,EECalSHE);
00662   product.putESCalDigis(ESCalADC0,ESCalADC1,ESCalADC2,ESCalSHE);
00663 
00664   return;
00665 }
00666 
00667 void GlobalDigisProducer::fillHCal(edm::Event& iEvent, 
00668                                    const edm::EventSetup& iSetup)
00669 {
00670   std::string MsgLoggerCat = "GlobalDigisProducer_fillHCal";
00671 
00672   TString eventout;
00673   if (verbosity > 0)
00674     eventout = "\nGathering info:";  
00675 
00676   // get calibration info
00677   edm::ESHandle<HcalDbService> HCalconditions;
00678   iSetup.get<HcalDbRecord>().get(HCalconditions);
00679   if (!HCalconditions.isValid()) {
00680     edm::LogWarning(MsgLoggerCat)
00681       << "Unable to find HCalconditions in event!";
00682     return;
00683   } 
00684   //HcalCalibrations calibrations;
00685   CaloSamples tool;
00686 
00688   // extract simhit info
00690   edm::Handle<edm::PCaloHitContainer> hcalHits;
00691   iEvent.getByLabel(HCalSrc_,hcalHits);
00692   if (!hcalHits.isValid()) {
00693     edm::LogWarning(MsgLoggerCat)
00694       << "Unable to find hcalHits in event!";
00695     return;
00696   }  
00697   const edm::PCaloHitContainer *simhitResult = hcalHits.product();
00698   
00699   MapType fHBEnergySimHits;
00700   MapType fHEEnergySimHits;
00701   MapType fHOEnergySimHits;
00702   MapType fHFEnergySimHits;
00703   for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin();
00704        simhits != simhitResult->end();
00705        ++simhits) {
00706     
00707     HcalDetId detId(simhits->id());
00708     uint32_t cellid = detId.rawId();
00709 
00710     if (detId.subdet() == sdHcalBrl){  
00711       fHBEnergySimHits[cellid] += simhits->energy(); 
00712     }
00713     if (detId.subdet() == sdHcalEC){  
00714       fHEEnergySimHits[cellid] += simhits->energy(); 
00715     }    
00716     if (detId.subdet() == sdHcalOut){  
00717       fHOEnergySimHits[cellid] += simhits->energy(); 
00718     }    
00719     if (detId.subdet() == sdHcalFwd){  
00720       fHFEnergySimHits[cellid] += simhits->energy(); 
00721     }    
00722   }
00723 
00725   // get HBHE information
00727   edm::Handle<edm::SortedCollection<HBHEDataFrame> > hbhe;
00728   iEvent.getByLabel(HCalDigi_,hbhe);
00729   if (!hbhe.isValid()) {
00730     edm::LogWarning(MsgLoggerCat)
00731       << "Unable to find HBHEDataFrame in event!";
00732     return;
00733   }    
00734   edm::SortedCollection<HBHEDataFrame>::const_iterator ihbhe;
00735   
00736   int iHB = 0;
00737   int iHE = 0; 
00738   for (ihbhe = hbhe->begin(); ihbhe != hbhe->end(); ++ihbhe) {
00739     HcalDetId cell(ihbhe->id()); 
00740 
00741     if ((cell.subdet() == sdHcalBrl) || (cell.subdet() == sdHcalEC)) {
00742       
00743       //HCalconditions->makeHcalCalibration(cell, &calibrations);
00744       const HcalCalibrations& calibrations = 
00745         HCalconditions->getHcalCalibrations(cell);
00746       const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
00747       const HcalQIEShape *shape = HCalconditions->getHcalShape(channelCoder);
00748 
00749       HcalCoderDb coder(*channelCoder, *shape);
00750       coder.adc2fC(*ihbhe, tool);
00751       
00752       // get HB info
00753       if (cell.subdet() == sdHcalBrl) {
00754 
00755         ++iHB;
00756         float fDigiSum = 0.0;
00757         for  (int ii = 0; ii < tool.size(); ++ii) {
00758           // default ped is 4.5
00759           int capid = (*ihbhe)[ii].capid();
00760           fDigiSum += (tool[ii] - calibrations.pedestal(capid));
00761         }
00762         
00763         HBCalAEE.push_back(fDigiSum);
00764         HBCalSHE.push_back(fHBEnergySimHits[cell.rawId()]);
00765       }
00766         
00767       // get HE info
00768       if (cell.subdet() == sdHcalEC) {
00769         
00770         ++iHE;
00771         float fDigiSum = 0.0;
00772         for  (int ii = 0; ii < tool.size(); ++ii) {
00773           int capid = (*ihbhe)[ii].capid();
00774           fDigiSum += (tool[ii]-calibrations.pedestal(capid));
00775         }
00776         
00777         HECalAEE.push_back(fDigiSum);
00778         HECalSHE.push_back(fHEEnergySimHits[cell.rawId()]);
00779       }
00780     }
00781   }
00782 
00783   if (verbosity > 1) {
00784     eventout += "\n          Number of HBDigis collected:.............. ";
00785     eventout += iHB;
00786   }
00787   
00788   if (verbosity > 1) {
00789     eventout += "\n          Number of HEDigis collected:.............. ";
00790     eventout += iHE;
00791   }
00792 
00794   // get HO information
00796   edm::Handle<edm::SortedCollection<HODataFrame> > ho;
00797   iEvent.getByLabel(HCalDigi_,ho);
00798   if (!ho.isValid()) {
00799     edm::LogWarning(MsgLoggerCat)
00800       << "Unable to find HODataFrame in event!";
00801     return;
00802   }    
00803   edm::SortedCollection<HODataFrame>::const_iterator iho;
00804   
00805   int iHO = 0; 
00806   for (iho = ho->begin(); iho != ho->end(); ++iho) {
00807     HcalDetId cell(iho->id()); 
00808 
00809     if (cell.subdet() == sdHcalOut) {
00810       
00811       //HCalconditions->makeHcalCalibration(cell, &calibrations);
00812       const HcalCalibrations& calibrations = 
00813         HCalconditions->getHcalCalibrations(cell);
00814       const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
00815       const HcalQIEShape *shape = HCalconditions->getHcalShape(channelCoder);
00816 
00817       HcalCoderDb coder (*channelCoder, *shape);
00818       coder.adc2fC(*iho, tool);
00819 
00820       ++iHO;
00821       float fDigiSum = 0.0;
00822       for  (int ii = 0; ii < tool.size(); ++ii) {
00823         // default ped is 4.5
00824         int capid = (*iho)[ii].capid();
00825         fDigiSum += (tool[ii] - calibrations.pedestal(capid));
00826       }
00827         
00828       HOCalAEE.push_back(fDigiSum);
00829       HOCalSHE.push_back(fHOEnergySimHits[cell.rawId()]);
00830     }
00831   }
00832 
00833   if (verbosity > 1) {
00834     eventout += "\n          Number of HODigis collected:.............. ";
00835     eventout += iHO;
00836   }
00837 
00839   // get HF information
00841   edm::Handle<edm::SortedCollection<HFDataFrame> > hf;
00842   iEvent.getByLabel(HCalDigi_,hf);
00843   if (!hf.isValid()) {
00844     edm::LogWarning(MsgLoggerCat)
00845       << "Unable to find HFDataFrame in event!";
00846     return;
00847   }    
00848   edm::SortedCollection<HFDataFrame>::const_iterator ihf;
00849   
00850   int iHF = 0; 
00851   for (ihf = hf->begin(); ihf != hf->end(); ++ihf) {
00852     HcalDetId cell(ihf->id()); 
00853 
00854     if (cell.subdet() == sdHcalFwd) {
00855       
00856       //HCalconditions->makeHcalCalibration(cell, &calibrations);
00857       const HcalCalibrations& calibrations = 
00858         HCalconditions->getHcalCalibrations(cell);
00859       const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
00860       const HcalQIEShape *shape = HCalconditions->getHcalShape(channelCoder);
00861 
00862       HcalCoderDb coder (*channelCoder, *shape);
00863       coder.adc2fC(*ihf, tool);
00864 
00865       ++iHF;
00866       float fDigiSum = 0.0;
00867       for  (int ii = 0; ii < tool.size(); ++ii) {
00868         // default ped is 1.73077
00869         int capid = (*ihf)[ii].capid();
00870         fDigiSum += (tool[ii] - calibrations.pedestal(capid));
00871       }
00872         
00873       HFCalAEE.push_back(fDigiSum);
00874       HFCalSHE.push_back(fHFEnergySimHits[cell.rawId()]);
00875     }
00876   }
00877 
00878   if (verbosity > 1) {
00879     eventout += "\n          Number of HFDigis collected:.............. ";
00880     eventout += iHF;
00881   }
00882 
00883   if (verbosity > 0)
00884     edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00885 
00886   return;
00887 }
00888 
00889 void GlobalDigisProducer::storeHCal(PGlobalDigi& product)
00890 {
00891   std::string MsgLoggerCat = "GlobalDigisProducer_storeHCal";
00892 
00893   if (verbosity > 2) {
00894     TString eventout("\n         nHBDigis     = ");
00895     eventout += HBCalAEE.size();
00896     for (unsigned int i = 0; i < HBCalAEE.size(); ++i) {
00897       eventout += "\n      (AEE, SHE) = (";
00898       eventout += HBCalAEE[i];
00899       eventout += ", ";
00900       eventout += HBCalSHE[i];
00901       eventout += ")";
00902     }
00903     eventout += "\n         nHEDigis     = ";
00904     eventout += HECalAEE.size();
00905     for (unsigned int i = 0; i < HECalAEE.size(); ++i) {
00906       eventout += "\n      (AEE, SHE) = (";
00907       eventout += HECalAEE[i];
00908       eventout += ", ";
00909       eventout += HECalSHE[i];
00910       eventout += ")";
00911     }
00912     eventout += "\n         nHODigis     = ";
00913     eventout += HOCalAEE.size();
00914     for (unsigned int i = 0; i < HOCalAEE.size(); ++i) {
00915       eventout += "\n      (AEE, SHE) = (";
00916       eventout += HOCalAEE[i];
00917       eventout += ", ";
00918       eventout += HOCalSHE[i];
00919       eventout += ")";
00920     }
00921     eventout += "\n         nHFDigis     = ";
00922     eventout += HFCalAEE.size();
00923     for (unsigned int i = 0; i < HFCalAEE.size(); ++i) {
00924       eventout += "\n      (AEE, SHE) = (";
00925       eventout += HFCalAEE[i];
00926       eventout += ", ";
00927       eventout += HFCalSHE[i];
00928       eventout += ")";
00929     }
00930 
00931     edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00932   }
00933 
00934   product.putHBCalDigis(HBCalAEE,HBCalSHE);
00935   product.putHECalDigis(HECalAEE,HECalSHE);
00936   product.putHOCalDigis(HOCalAEE,HOCalSHE);
00937   product.putHFCalDigis(HFCalAEE,HFCalSHE);
00938 
00939   return;
00940 }
00941 
00942 void GlobalDigisProducer::fillTrk(edm::Event& iEvent, 
00943                                    const edm::EventSetup& iSetup)
00944 {
00945   std::string MsgLoggerCat = "GlobalDigisProducer_fillTrk";
00946 
00947   TString eventout;
00948   if (verbosity > 0)
00949     eventout = "\nGathering info:";  
00950 
00951   // get strip information
00952   edm::Handle<edm::DetSetVector<SiStripDigi> > stripDigis;  
00953   iEvent.getByLabel(SiStripSrc_, stripDigis);
00954   if (!stripDigis.isValid()) {
00955     edm::LogWarning(MsgLoggerCat)
00956       << "Unable to find stripDigis in event!";
00957     return;
00958   }  
00959 
00960   int nStripBrl = 0, nStripFwd = 0;
00961   edm::DetSetVector<SiStripDigi>::const_iterator DSViter;
00962   for (DSViter = stripDigis->begin(); DSViter != stripDigis->end(); 
00963        ++DSViter) {
00964     unsigned int id = DSViter->id;
00965     DetId detId(id);
00966     edm::DetSet<SiStripDigi>::const_iterator begin = DSViter->data.begin();
00967     edm::DetSet<SiStripDigi>::const_iterator end = DSViter->data.end();
00968     edm::DetSet<SiStripDigi>::const_iterator iter;
00969     
00970     // get TIB
00971     if (detId.subdetId() == sdSiTIB) {
00972       TIBDetId tibid(id);
00973       for (iter = begin; iter != end; ++iter) {
00974         ++nStripBrl;
00975         if (tibid.layer() == 1) {
00976           TIBL1ADC.push_back((*iter).adc());
00977           TIBL1Strip.push_back((*iter).strip());
00978         }
00979         if (tibid.layer() == 2) {
00980           TIBL2ADC.push_back((*iter).adc());
00981           TIBL2Strip.push_back((*iter).strip());
00982         }       
00983         if (tibid.layer() == 3) {
00984           TIBL3ADC.push_back((*iter).adc());
00985           TIBL3Strip.push_back((*iter).strip());
00986         }
00987         if (tibid.layer() == 4) {
00988           TIBL4ADC.push_back((*iter).adc());
00989           TIBL4Strip.push_back((*iter).strip());
00990         }
00991       }
00992     }
00993     
00994     // get TOB
00995     if (detId.subdetId() == sdSiTOB) {
00996       TOBDetId tobid(id);
00997       for (iter = begin; iter != end; ++iter) {
00998         ++nStripBrl;
00999         if (tobid.layer() == 1) {
01000           TOBL1ADC.push_back((*iter).adc());
01001           TOBL1Strip.push_back((*iter).strip());
01002         }
01003         if (tobid.layer() == 2) {
01004           TOBL2ADC.push_back((*iter).adc());
01005           TOBL2Strip.push_back((*iter).strip());
01006         }       
01007         if (tobid.layer() == 3) {
01008           TOBL3ADC.push_back((*iter).adc());
01009           TOBL3Strip.push_back((*iter).strip());
01010         }
01011         if (tobid.layer() == 4) {
01012           TOBL4ADC.push_back((*iter).adc());
01013           TOBL4Strip.push_back((*iter).strip());
01014         }
01015       }
01016     }    
01017     
01018     // get TID
01019     if (detId.subdetId() == sdSiTID) {
01020       TIDDetId tidid(id);
01021       for (iter = begin; iter != end; ++iter) {
01022         ++nStripFwd;
01023         if (tidid.wheel() == 1) {
01024           TIDW1ADC.push_back((*iter).adc());
01025           TIDW1Strip.push_back((*iter).strip());
01026         }
01027         if (tidid.wheel() == 2) {
01028           TIDW2ADC.push_back((*iter).adc());
01029           TIDW2Strip.push_back((*iter).strip());
01030         }
01031         if (tidid.wheel() == 3) {
01032           TIDW3ADC.push_back((*iter).adc());
01033           TIDW3Strip.push_back((*iter).strip());
01034         }
01035       }
01036     }   
01037 
01038     // get TEC
01039     if (detId.subdetId() == sdSiTEC) {
01040       TECDetId tecid(id);
01041       for (iter = begin; iter != end; ++iter) {
01042         ++nStripFwd;
01043         if (tecid.wheel() == 1) {
01044           TECW1ADC.push_back((*iter).adc());
01045           TECW1Strip.push_back((*iter).strip());
01046         }
01047         if (tecid.wheel() == 2) {
01048           TECW2ADC.push_back((*iter).adc());
01049           TECW2Strip.push_back((*iter).strip());
01050         }
01051         if (tecid.wheel() == 3) {
01052           TECW3ADC.push_back((*iter).adc());
01053           TECW3Strip.push_back((*iter).strip());
01054         }
01055         if (tecid.wheel() == 4) {
01056           TECW4ADC.push_back((*iter).adc());
01057           TECW4Strip.push_back((*iter).strip());
01058         }
01059         if (tecid.wheel() == 5) {
01060           TECW5ADC.push_back((*iter).adc());
01061           TECW5Strip.push_back((*iter).strip());
01062         }
01063         if (tecid.wheel() == 6) {
01064           TECW6ADC.push_back((*iter).adc());
01065           TECW6Strip.push_back((*iter).strip());
01066         }
01067         if (tecid.wheel() == 7) {
01068           TECW7ADC.push_back((*iter).adc());
01069           TECW7Strip.push_back((*iter).strip());
01070         }
01071         if (tecid.wheel() == 8) {
01072           TECW8ADC.push_back((*iter).adc());
01073           TECW8Strip.push_back((*iter).strip());
01074         }
01075       }
01076     }     
01077   } // end loop over DataSetVector
01078 
01079   if (verbosity > 1) {
01080     eventout += "\n          Number of BrlStripDigis collected:........ ";
01081     eventout += nStripBrl;
01082   }
01083 
01084   if (verbosity > 1) {
01085     eventout += "\n          Number of FrwdStripDigis collected:....... ";
01086     eventout += nStripFwd;
01087   }
01088 
01089   // get pixel information
01090   edm::Handle<edm::DetSetVector<PixelDigi> > pixelDigis;  
01091   iEvent.getByLabel(SiPxlSrc_, pixelDigis);
01092   if (!pixelDigis.isValid()) {
01093     edm::LogWarning(MsgLoggerCat)
01094       << "Unable to find pixelDigis in event!";
01095     return;
01096   }  
01097 
01098   int nPxlBrl = 0, nPxlFwd = 0;
01099   edm::DetSetVector<PixelDigi>::const_iterator DPViter;
01100   for (DPViter = pixelDigis->begin(); DPViter != pixelDigis->end(); 
01101        ++DPViter) {
01102     unsigned int id = DPViter->id;
01103     DetId detId(id);
01104     edm::DetSet<PixelDigi>::const_iterator begin = DPViter->data.begin();
01105     edm::DetSet<PixelDigi>::const_iterator end = DPViter->data.end();
01106     edm::DetSet<PixelDigi>::const_iterator iter;
01107 
01108     // get Barrel pixels
01109     if (detId.subdetId() == sdPxlBrl) {
01110       PXBDetId bdetid(id);
01111       for (iter = begin; iter != end; ++iter) {
01112         ++nPxlBrl;
01113         if (bdetid.layer() == 1) {
01114           BRL1ADC.push_back((*iter).adc());
01115           BRL1Row.push_back((*iter).row());
01116           BRL1Col.push_back((*iter).column());    
01117         }
01118         if (bdetid.layer() == 2) {
01119           BRL2ADC.push_back((*iter).adc());
01120           BRL2Row.push_back((*iter).row());
01121           BRL2Col.push_back((*iter).column());    
01122         }
01123         if (bdetid.layer() == 3) {
01124           BRL3ADC.push_back((*iter).adc());
01125           BRL3Row.push_back((*iter).row());
01126           BRL3Col.push_back((*iter).column());    
01127         }
01128       }
01129     }
01130 
01131     // get Forward pixels
01132     if (detId.subdetId() == sdPxlFwd) {
01133       PXFDetId fdetid(id);
01134       for (iter = begin; iter != end; ++iter) {
01135         ++nPxlFwd;
01136         if (fdetid.disk() == 1) {
01137           if (fdetid.side() == 1) {
01138             FWD1nADC.push_back((*iter).adc());
01139             FWD1nRow.push_back((*iter).row());
01140             FWD1nCol.push_back((*iter).column());
01141           }
01142           if (fdetid.side() == 2) {
01143             FWD1pADC.push_back((*iter).adc());
01144             FWD1pRow.push_back((*iter).row());
01145             FWD1pCol.push_back((*iter).column());
01146           }
01147         }
01148         if (fdetid.disk() == 2) {
01149           if (fdetid.side() == 1) {
01150             FWD2nADC.push_back((*iter).adc());
01151             FWD2nRow.push_back((*iter).row());
01152             FWD2nCol.push_back((*iter).column());
01153           }
01154           if (fdetid.side() == 2) {
01155             FWD2pADC.push_back((*iter).adc());
01156             FWD2pRow.push_back((*iter).row());
01157             FWD2pCol.push_back((*iter).column());
01158           }
01159         }
01160       }
01161     }
01162   }
01163 
01164   if (verbosity > 1) {
01165     eventout += "\n          Number of BrlPixelDigis collected:........ ";
01166     eventout += nPxlBrl;
01167   }
01168 
01169   if (verbosity > 1) {
01170     eventout += "\n          Number of FrwdPixelDigis collected:....... ";
01171     eventout += nPxlFwd;
01172   }
01173 
01174   if (verbosity > 0)
01175     edm::LogInfo(MsgLoggerCat) << eventout << "\n";
01176 
01177   return;
01178 }
01179 
01180 void GlobalDigisProducer::storeTrk(PGlobalDigi& product)
01181 {
01182   std::string MsgLoggerCat = "GlobalDigisProducer_storeTrk";
01183 
01184   if (verbosity > 2) {
01185 
01186     // strip output
01187     TString eventout("\n         nTIBL1     = ");
01188     eventout += TIBL1ADC.size();
01189     for (unsigned int i = 0; i < TIBL1ADC.size(); ++i) {
01190       eventout += "\n      (ADC, strip) = (";
01191       eventout += TIBL1ADC[i];
01192       eventout += ", ";
01193       eventout += TIBL1Strip[i];
01194       eventout += ")";
01195     }
01196     eventout += "\n         nTIBL2     = ";
01197     eventout += TIBL2ADC.size();
01198     for (unsigned int i = 0; i < TIBL2ADC.size(); ++i) {
01199       eventout += "\n      (ADC, strip) = (";
01200       eventout += TIBL2ADC[i];
01201       eventout += ", ";
01202       eventout += TIBL2Strip[i];
01203       eventout += ")";
01204     }
01205     eventout += "\n         nTIBL3     = ";
01206     eventout += TIBL3ADC.size();
01207     for (unsigned int i = 0; i < TIBL3ADC.size(); ++i) {
01208       eventout += "\n      (ADC, strip) = (";
01209       eventout += TIBL3ADC[i];
01210       eventout += ", ";
01211       eventout += TIBL3Strip[i];
01212       eventout += ")";
01213     }
01214     eventout += "\n         nTIBL4     = ";
01215     eventout += TIBL4ADC.size();
01216     for (unsigned int i = 0; i < TIBL4ADC.size(); ++i) {
01217       eventout += "\n      (ADC, strip) = (";
01218       eventout += TIBL4ADC[i];
01219       eventout += ", ";
01220       eventout += TIBL4Strip[i];
01221       eventout += ")";
01222     }
01223     eventout += "\n         nTOBL1     = ";
01224     eventout += TOBL1ADC.size();
01225     for (unsigned int i = 0; i < TOBL1ADC.size(); ++i) {
01226       eventout += "\n      (ADC, strip) = (";
01227       eventout += TOBL1ADC[i];
01228       eventout += ", ";
01229       eventout += TOBL1Strip[i];
01230       eventout += ")";
01231     }
01232     eventout += "\n         nTOBL2     = ";
01233     eventout += TOBL2ADC.size();
01234     for (unsigned int i = 0; i < TOBL2ADC.size(); ++i) {
01235       eventout += "\n      (ADC, strip) = (";
01236       eventout += TOBL2ADC[i];
01237       eventout += ", ";
01238       eventout += TOBL2Strip[i];
01239       eventout += ")";
01240     }
01241     eventout += "\n         nTOBL3     = ";
01242     eventout += TOBL3ADC.size();
01243     for (unsigned int i = 0; i < TOBL3ADC.size(); ++i) {
01244       eventout += "\n      (ADC, strip) = (";
01245       eventout += TOBL3ADC[i];
01246       eventout += ", ";
01247       eventout += TOBL3Strip[i];
01248       eventout += ")";
01249     }
01250     eventout += "\n         nTOBL4     = ";
01251     eventout += TOBL4ADC.size();
01252     for (unsigned int i = 0; i < TOBL4ADC.size(); ++i) {
01253       eventout += "\n      (ADC, strip) = (";
01254       eventout += TOBL4ADC[i];
01255       eventout += ", ";
01256       eventout += TOBL4Strip[i];
01257       eventout += ")";
01258     }
01259     eventout += "\n         nTIDW1     = ";
01260     eventout += TIDW1ADC.size();
01261     for (unsigned int i = 0; i < TIDW1ADC.size(); ++i) {
01262       eventout += "\n      (ADC, strip) = (";
01263       eventout += TIDW1ADC[i];
01264       eventout += ", ";
01265       eventout += TIDW1Strip[i];
01266       eventout += ")";
01267     }
01268     eventout += "\n         nTIDW2     = ";
01269     eventout += TIDW2ADC.size();
01270     for (unsigned int i = 0; i < TIDW2ADC.size(); ++i) {
01271       eventout += "\n      (ADC, strip) = (";
01272       eventout += TIDW2ADC[i];
01273       eventout += ", ";
01274       eventout += TIDW2Strip[i];
01275       eventout += ")";
01276     }
01277     eventout += "\n         nTIDW3     = ";
01278     eventout += TIDW3ADC.size();
01279     for (unsigned int i = 0; i < TIDW3ADC.size(); ++i) {
01280       eventout += "\n      (ADC, strip) = (";
01281       eventout += TIDW3ADC[i];
01282       eventout += ", ";
01283       eventout += TIDW3Strip[i];
01284       eventout += ")";
01285     }
01286     eventout += "\n         nTECW1     = ";
01287     eventout += TECW1ADC.size();
01288     for (unsigned int i = 0; i < TECW1ADC.size(); ++i) {
01289       eventout += "\n      (ADC, strip) = (";
01290       eventout += TECW1ADC[i];
01291       eventout += ", ";
01292       eventout += TECW1Strip[i];
01293       eventout += ")";
01294     }
01295     eventout += "\n         nTECW2     = ";
01296     eventout += TECW2ADC.size();
01297     for (unsigned int i = 0; i < TECW2ADC.size(); ++i) {
01298       eventout += "\n      (ADC, strip) = (";
01299       eventout += TECW2ADC[i];
01300       eventout += ", ";
01301       eventout += TECW2Strip[i];
01302       eventout += ")";
01303     }
01304     eventout += "\n         nTECW3     = ";
01305     eventout += TECW3ADC.size();
01306     for (unsigned int i = 0; i < TECW3ADC.size(); ++i) {
01307       eventout += "\n      (ADC, strip) = (";
01308       eventout += TECW3ADC[i];
01309       eventout += ", ";
01310       eventout += TECW3Strip[i];
01311       eventout += ")";
01312     }
01313     eventout += "\n         nTECW4     = ";
01314     eventout += TECW4ADC.size();
01315     for (unsigned int i = 0; i < TECW4ADC.size(); ++i) {
01316       eventout += "\n      (ADC, strip) = (";
01317       eventout += TECW4ADC[i];
01318       eventout += ", ";
01319       eventout += TECW4Strip[i];
01320       eventout += ")";
01321     }
01322     eventout += "\n         nTECW5     = ";
01323     eventout += TECW5ADC.size();
01324     for (unsigned int i = 0; i < TECW5ADC.size(); ++i) {
01325       eventout += "\n      (ADC, strip) = (";
01326       eventout += TECW5ADC[i];
01327       eventout += ", ";
01328       eventout += TECW5Strip[i];
01329       eventout += ")";
01330     }
01331     eventout += "\n         nTECW6     = ";
01332     eventout += TECW6ADC.size();
01333     for (unsigned int i = 0; i < TECW6ADC.size(); ++i) {
01334       eventout += "\n      (ADC, strip) = (";
01335       eventout += TECW6ADC[i];
01336       eventout += ", ";
01337       eventout += TECW6Strip[i];
01338       eventout += ")";
01339     }
01340     eventout += "\n         nTECW7     = ";
01341     eventout += TECW7ADC.size();
01342     for (unsigned int i = 0; i < TECW7ADC.size(); ++i) {
01343       eventout += "\n      (ADC, strip) = (";
01344       eventout += TECW7ADC[i];
01345       eventout += ", ";
01346       eventout += TECW7Strip[i];
01347       eventout += ")";
01348     }
01349     eventout += "\n         nTECW8     = ";
01350     eventout += TECW8ADC.size();
01351     for (unsigned int i = 0; i < TECW8ADC.size(); ++i) {
01352       eventout += "\n      (ADC, strip) = (";
01353       eventout += TECW8ADC[i];
01354       eventout += ", ";
01355       eventout += TECW8Strip[i];
01356       eventout += ")";
01357     }
01358 
01359     // pixel output
01360     eventout += "\n         nBRL1     = ";
01361     eventout += BRL1ADC.size();
01362     for (unsigned int i = 0; i < BRL1ADC.size(); ++i) {
01363       eventout += "\n      (ADC, row, column) = (";
01364       eventout += BRL1ADC[i];
01365       eventout += ", ";
01366       eventout += BRL1Row[i];
01367       eventout += ", ";
01368       eventout += BRL1Col[i];
01369       eventout += ")";
01370     } 
01371     eventout += "\n         nBRL2     = ";
01372     eventout += BRL2ADC.size();
01373     for (unsigned int i = 0; i < BRL2ADC.size(); ++i) {
01374       eventout += "\n      (ADC, row, column) = (";
01375       eventout += BRL2ADC[i];
01376       eventout += ", ";
01377       eventout += BRL2Row[i];
01378       eventout += ", ";
01379       eventout += BRL2Col[i];
01380       eventout += ")";
01381     } 
01382     eventout += "\n         nBRL3     = ";
01383     eventout += BRL3ADC.size();
01384     for (unsigned int i = 0; i < BRL3ADC.size(); ++i) {
01385       eventout += "\n      (ADC, row, column) = (";
01386       eventout += BRL3ADC[i];
01387       eventout += ", ";
01388       eventout += BRL3Row[i];
01389       eventout += ", ";
01390       eventout += BRL3Col[i];
01391       eventout += ")";
01392     }    
01393     eventout += "\n         nFWD1p     = ";
01394     eventout += FWD1pADC.size();
01395     for (unsigned int i = 0; i < FWD1pADC.size(); ++i) {
01396       eventout += "\n      (ADC, row, column) = (";
01397       eventout += FWD1pADC[i];
01398       eventout += ", ";
01399       eventout += FWD1pRow[i];
01400       eventout += ", ";
01401       eventout += FWD1pCol[i];
01402       eventout += ")";
01403     } 
01404     eventout += "\n         nFWD1p     = ";
01405     eventout += FWD1nADC.size();
01406     for (unsigned int i = 0; i < FWD1nADC.size(); ++i) {
01407       eventout += "\n      (ADC, row, column) = (";
01408       eventout += FWD1nADC[i];
01409       eventout += ", ";
01410       eventout += FWD1nRow[i];
01411       eventout += ", ";
01412       eventout += FWD1nCol[i];
01413       eventout += ")";
01414     } 
01415     eventout += "\n         nFWD1p     = ";
01416     eventout += FWD2pADC.size();
01417     for (unsigned int i = 0; i < FWD2pADC.size(); ++i) {
01418       eventout += "\n      (ADC, row, column) = (";
01419       eventout += FWD2pADC[i];
01420       eventout += ", ";
01421       eventout += FWD2pRow[i];
01422       eventout += ", ";
01423       eventout += FWD2pCol[i];
01424       eventout += ")";
01425     } 
01426     eventout += "\n         nFWD2p     = ";
01427     eventout += FWD2nADC.size();
01428     for (unsigned int i = 0; i < FWD2nADC.size(); ++i) {
01429       eventout += "\n      (ADC, row, column) = (";
01430       eventout += FWD2nADC[i];
01431       eventout += ", ";
01432       eventout += FWD2nRow[i];
01433       eventout += ", ";
01434       eventout += FWD2nCol[i];
01435       eventout += ")";
01436     } 
01437 
01438     edm::LogInfo(MsgLoggerCat) << eventout << "\n";  
01439   }
01440 
01441   // strip output
01442   product.putTIBL1Digis(TIBL1ADC,TIBL1Strip);
01443   product.putTIBL2Digis(TIBL2ADC,TIBL2Strip);
01444   product.putTIBL3Digis(TIBL3ADC,TIBL3Strip);
01445   product.putTIBL4Digis(TIBL4ADC,TIBL4Strip);
01446   product.putTOBL1Digis(TOBL1ADC,TOBL1Strip);
01447   product.putTOBL2Digis(TOBL2ADC,TOBL2Strip);
01448   product.putTOBL3Digis(TOBL3ADC,TOBL3Strip);
01449   product.putTOBL4Digis(TOBL4ADC,TOBL4Strip);
01450   product.putTIDW1Digis(TIDW1ADC,TIDW1Strip);
01451   product.putTIDW2Digis(TIDW2ADC,TIDW2Strip);
01452   product.putTIDW3Digis(TIDW3ADC,TIDW3Strip);
01453   product.putTECW1Digis(TECW1ADC,TECW1Strip);
01454   product.putTECW2Digis(TECW2ADC,TECW2Strip);
01455   product.putTECW3Digis(TECW3ADC,TECW3Strip);
01456   product.putTECW4Digis(TECW4ADC,TECW4Strip);
01457   product.putTECW5Digis(TECW5ADC,TECW5Strip);
01458   product.putTECW6Digis(TECW6ADC,TECW6Strip);  
01459   product.putTECW7Digis(TECW7ADC,TECW7Strip);
01460   product.putTECW8Digis(TECW8ADC,TECW8Strip);  
01461 
01462   // pixel output
01463   product.putBRL1Digis(BRL1ADC, BRL1Row, BRL1Col);
01464   product.putBRL2Digis(BRL2ADC, BRL2Row, BRL2Col);
01465   product.putBRL3Digis(BRL3ADC, BRL3Row, BRL3Col);
01466   product.putFWD1pDigis(FWD1pADC, FWD1pRow, FWD1pCol);
01467   product.putFWD1nDigis(FWD1nADC, FWD1nRow, FWD1nCol);
01468   product.putFWD2pDigis(FWD2pADC, FWD2pRow, FWD2pCol);
01469   product.putFWD2nDigis(FWD2nADC, FWD2nRow, FWD2nCol);
01470 
01471   return;
01472 }
01473 
01474 void GlobalDigisProducer::fillMuon(edm::Event& iEvent, 
01475                                    const edm::EventSetup& iSetup)
01476 {
01477   std::string MsgLoggerCat = "GlobalDigisProducer_fillMuon";
01478   
01479   TString eventout;
01480   if (verbosity > 0)
01481     eventout = "\nGathering info:";  
01482 
01483   // get DT information
01484   edm::Handle<DTDigiCollection> dtDigis;  
01485   iEvent.getByLabel(MuDTSrc_, dtDigis);
01486   if (!dtDigis.isValid()) {
01487     edm::LogWarning(MsgLoggerCat)
01488       << "Unable to find dtDigis in event!";
01489     return;
01490   }  
01491 
01492   int nDt = 0;
01493   DTDigiCollection::DigiRangeIterator detUnitIt;
01494   for (detUnitIt = dtDigis->begin(); detUnitIt != dtDigis->end(); 
01495        ++detUnitIt) {
01496     
01497     const DTLayerId& id = (*detUnitIt).first;
01498     const DTDigiCollection::Range& range = (*detUnitIt).second;
01499 
01500     for (DTDigiCollection::const_iterator digiIt = range.first;
01501          digiIt != range.second;
01502          ++digiIt) {
01503       
01504       ++nDt;
01505       
01506       DTWireId wireId(id,(*digiIt).wire());
01507       if (wireId.station() == 1) {
01508         MB1SLayer.push_back(id.superlayer());
01509         MB1Time.push_back((*digiIt).time());
01510         MB1Layer.push_back(id.layer());
01511       }
01512       if (wireId.station() == 2) {
01513         MB2SLayer.push_back(id.superlayer());
01514         MB2Time.push_back((*digiIt).time());
01515         MB2Layer.push_back(id.layer());
01516       }
01517       if (wireId.station() == 3) {
01518         MB3SLayer.push_back(id.superlayer());
01519         MB3Time.push_back((*digiIt).time());
01520         MB3Layer.push_back(id.layer());
01521       }
01522       if (wireId.station() == 4) {
01523         MB4SLayer.push_back(id.superlayer());
01524         MB4Time.push_back((*digiIt).time());
01525         MB4Layer.push_back(id.layer());
01526       }
01527     }
01528   }
01529                                                                      
01530   if (verbosity > 1) {
01531     eventout += "\n          Number of DtMuonDigis collected:.......... ";
01532     eventout += nDt;
01533   }
01534 
01535   // get CSC Strip information
01536   edm::Handle<CSCStripDigiCollection> strips;  
01537   iEvent.getByLabel(MuCSCStripSrc_, strips);
01538   if (!strips.isValid()) {
01539     edm::LogWarning(MsgLoggerCat)
01540       << "Unable to find muon strips in event!";
01541     return;
01542   }  
01543 
01544   int nStrips = 0;
01545   for (CSCStripDigiCollection::DigiRangeIterator j = strips->begin();
01546        j != strips->end();
01547        ++j) {
01548 
01549     std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
01550     std::vector<CSCStripDigi>::const_iterator last = (*j).second.second;
01551 
01552     for ( ; digiItr != last; ++digiItr) {
01553       ++nStrips;
01554 
01555       // average pedestals
01556       std::vector<int> adcCounts = digiItr->getADCCounts();
01557       theCSCStripPedestalSum += adcCounts[0];
01558       theCSCStripPedestalSum += adcCounts[1];
01559       theCSCStripPedestalCount += 2;
01560  
01561       // if there are enough pedestal statistics
01562       if (theCSCStripPedestalCount > 100) {
01563         float pedestal = theCSCStripPedestalSum / theCSCStripPedestalCount;
01564         if (adcCounts[5] > (pedestal + 100)) 
01565           CSCStripADC.push_back(adcCounts[4] - pedestal);         
01566       }
01567     }
01568   }
01569                                                         
01570   if (verbosity > 1) {
01571     eventout += "\n          Number of CSCStripDigis collected:........ ";
01572     eventout += nStrips;
01573   }
01574 
01575   // get CSC Wire information
01576   edm::Handle<CSCWireDigiCollection> wires;  
01577   iEvent.getByLabel(MuCSCWireSrc_, wires);
01578   if (!wires.isValid()) {
01579     edm::LogWarning(MsgLoggerCat)
01580       << "Unable to find muon wires in event!";
01581     return;
01582   }  
01583 
01584   int nWires = 0;
01585   for (CSCWireDigiCollection::DigiRangeIterator j = wires->begin();
01586        j != wires->end();
01587        ++j) {
01588 
01589     std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
01590     std::vector<CSCWireDigi>::const_iterator endDigi = (*j).second.second;
01591 
01592     for ( ; digiItr != endDigi; ++digiItr) {
01593       ++nWires;
01594 
01595       CSCWireTime.push_back(digiItr->getTimeBin());       
01596     }
01597   }
01598                                                         
01599   if (verbosity > 1) {
01600     eventout += "\n          Number of CSCWireDigis collected:......... ";
01601     eventout += nWires;
01602   }
01603 
01604   if (verbosity > 0)
01605     edm::LogInfo(MsgLoggerCat) << eventout << "\n";
01606   
01607   return;
01608 }
01609 
01610 void GlobalDigisProducer::storeMuon(PGlobalDigi& product)
01611 {
01612   std::string MsgLoggerCat = "GlobalDigisProducer_storeMuon";
01613   
01614   if (verbosity > 2) {
01615 
01616     // dt output
01617     TString eventout("\n         nMB1     = ");
01618     eventout += MB1SLayer.size();
01619     for (unsigned int i = 0; i < MB1SLayer.size(); ++i) {
01620       eventout += "\n      (slayer, time, layer) = (";
01621       eventout += MB1SLayer[i];
01622       eventout += ", ";
01623       eventout += MB1Time[i];
01624       eventout += ", ";
01625       eventout += MB1Layer[i];
01626       eventout += ")";
01627     }
01628     eventout += "\n         nMB2     = ";
01629     eventout += MB2SLayer.size();
01630     for (unsigned int i = 0; i < MB2SLayer.size(); ++i) {
01631       eventout += "\n      (slayer, time, layer) = (";
01632       eventout += MB2SLayer[i];
01633       eventout += ", ";
01634       eventout += MB2Time[i];
01635       eventout += ", ";
01636       eventout += MB2Layer[i];
01637       eventout += ")";
01638     }
01639     eventout += "\n         nMB3     = ";
01640     eventout += MB3SLayer.size();
01641     for (unsigned int i = 0; i < MB3SLayer.size(); ++i) {
01642       eventout += "\n      (slayer, time, layer) = (";
01643       eventout += MB3SLayer[i];
01644       eventout += ", ";
01645       eventout += MB3Time[i];
01646       eventout += ", ";
01647       eventout += MB3Layer[i];
01648       eventout += ")";
01649     }
01650     eventout += "\n         nMB2     = ";
01651     eventout += MB4SLayer.size();
01652     for (unsigned int i = 0; i < MB4SLayer.size(); ++i) {
01653       eventout += "\n      (slayer, time, layer) = (";
01654       eventout += MB4SLayer[i];
01655       eventout += ", ";
01656       eventout += MB4Time[i];
01657       eventout += ", ";
01658       eventout += MB4Layer[i];
01659       eventout += ")";
01660     }    
01661 
01662     // CSC Strip
01663     eventout += "\n         nCSCStrip     = ";
01664     eventout += CSCStripADC.size();
01665     for (unsigned int i = 0; i < CSCStripADC.size(); ++i) {
01666       eventout += "\n      (adc) = (";
01667       eventout += CSCStripADC[i];
01668       eventout += ")";
01669     }    
01670 
01671     // CSC Wire
01672     eventout += "\n         nCSCWire     = ";
01673     eventout += CSCWireTime.size();
01674     for (unsigned int i = 0; i < CSCWireTime.size(); ++i) {
01675       eventout += "\n      (time) = (";
01676       eventout += CSCWireTime[i];
01677       eventout += ")";
01678     }    
01679 
01680     edm::LogInfo(MsgLoggerCat) << eventout << "\n";  
01681   }
01682   
01683   product.putMB1Digis(MB1SLayer,MB1Time,MB1Layer);
01684   product.putMB2Digis(MB2SLayer,MB2Time,MB2Layer);
01685   product.putMB3Digis(MB3SLayer,MB3Time,MB3Layer);
01686   product.putMB4Digis(MB4SLayer,MB4Time,MB4Layer);  
01687 
01688   product.putCSCstripDigis(CSCStripADC);
01689 
01690   product.putCSCwireDigis(CSCWireTime);
01691 
01692   return;
01693 }
01694 
01695 void GlobalDigisProducer::clear()
01696 {
01697   std::string MsgLoggerCat = "GlobalDigisProducer_clear";
01698 
01699   if (verbosity > 0)
01700     edm::LogInfo(MsgLoggerCat)
01701       << "Clearing event holders"; 
01702 
01703   // reset electromagnetic info
01704   // EE info
01705   EECalmaxPos.clear(); 
01706   EECalAEE.clear(); 
01707   EECalSHE.clear();
01708   // EB info
01709   EBCalmaxPos.clear(); 
01710   EBCalAEE.clear(); 
01711   EBCalSHE.clear();
01712   // ES info
01713   ESCalADC0.clear();
01714   ESCalADC1.clear();
01715   ESCalADC2.clear();
01716   ESCalSHE.clear();
01717 
01718   // reset HCal Info
01719   HBCalAEE.clear();
01720   HBCalSHE.clear();
01721   HECalAEE.clear();
01722   HECalSHE.clear();
01723   HOCalAEE.clear();
01724   HOCalSHE.clear();
01725   HFCalAEE.clear();
01726   HFCalSHE.clear();  
01727 
01728   // reset Track Info
01729   TIBL1ADC.clear(); 
01730   TIBL2ADC.clear(); 
01731   TIBL3ADC.clear(); 
01732   TIBL4ADC.clear();
01733   TIBL1Strip.clear(); 
01734   TIBL2Strip.clear(); 
01735   TIBL3Strip.clear(); 
01736   TIBL4Strip.clear();
01737   
01738   TOBL1ADC.clear(); 
01739   TOBL2ADC.clear(); 
01740   TOBL3ADC.clear(); 
01741   TOBL4ADC.clear();
01742   TOBL1Strip.clear(); 
01743   TOBL2Strip.clear(); 
01744   TOBL3Strip.clear(); 
01745   TOBL4Strip.clear();
01746   
01747   TIDW1ADC.clear(); 
01748   TIDW2ADC.clear(); 
01749   TIDW3ADC.clear();
01750   TIDW1Strip.clear(); 
01751   TIDW2Strip.clear(); 
01752   TIDW3Strip.clear();
01753   
01754   TECW1ADC.clear(); 
01755   TECW2ADC.clear(); 
01756   TECW3ADC.clear(); 
01757   TECW4ADC.clear(); 
01758   TECW5ADC.clear(); 
01759   TECW6ADC.clear(); 
01760   TECW7ADC.clear(); 
01761   TECW8ADC.clear();
01762   TECW1Strip.clear(); 
01763   TECW2Strip.clear(); 
01764   TECW3Strip.clear(); 
01765   TECW4Strip.clear(); 
01766   TECW5Strip.clear(); 
01767   TECW6Strip.clear(); 
01768   TECW7Strip.clear(); 
01769   TECW8Strip.clear();
01770 
01771   BRL1ADC.clear();
01772   BRL1Row.clear();
01773   BRL1Col.clear();
01774   BRL2ADC.clear();
01775   BRL2Row.clear();
01776   BRL2Col.clear();
01777   BRL3ADC.clear();
01778   BRL3Row.clear();
01779   BRL3Col.clear();
01780 
01781   FWD1pADC.clear();
01782   FWD1pRow.clear();  
01783   FWD1pCol.clear();
01784   FWD1nADC.clear();
01785   FWD1nRow.clear();  
01786   FWD1nCol.clear();
01787   FWD2pADC.clear();
01788   FWD2pRow.clear();  
01789   FWD2pCol.clear();
01790   FWD2nADC.clear();
01791   FWD2nRow.clear();  
01792   FWD2nCol.clear();
01793 
01794   //muon clear
01795   MB1SLayer.clear();
01796   MB1Time.clear();
01797   MB1Layer.clear();
01798   MB2SLayer.clear();
01799   MB2Time.clear(); 
01800   MB2Layer.clear(); 
01801   MB3SLayer.clear();
01802   MB3Time.clear();
01803   MB3Layer.clear();
01804   MB4SLayer.clear();
01805   MB4Time.clear();
01806   MB4Layer.clear();
01807 
01808   CSCStripADC.clear();
01809 
01810   CSCWireTime.clear();
01811 
01812   return;
01813 }
01814 
01815 //define this as a plug-in
01816 //DEFINE_FWK_MODULE(GlobalDigisProducer);