CMS 3D CMS Logo

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