CMS 3D CMS Logo

EcalPreshowerDigisValidation.cc

Go to the documentation of this file.
00001 /*
00002  * \file EcalPreshowerDigisValidation.cc
00003  *
00004  * $Date: 2008/10/29 10:54:11 $
00005  * $Revision: 1.14 $
00006  * \author F. Cossutti
00007  *
00008 */
00009 
00010 #include <Validation/EcalDigis/interface/EcalPreshowerDigisValidation.h>
00011 #include "DQMServices/Core/interface/DQMStore.h"
00012 
00013 using namespace cms;
00014 using namespace edm;
00015 using namespace std;
00016 
00017 EcalPreshowerDigisValidation::EcalPreshowerDigisValidation(const ParameterSet& ps):
00018   ESdigiCollection_(ps.getParameter<edm::InputTag>("ESdigiCollection"))
00019 {
00020   
00021   // verbosity switch
00022   verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
00023                                                                                                                                            
00024   dbe_ = 0;
00025                                                                                                                                           
00026   // get hold of back-end interface
00027   dbe_ = Service<DQMStore>().operator->();
00028                                                                                                                                           
00029   if ( dbe_ ) {
00030     if ( verbose_ ) {
00031       dbe_->setVerbose(1);
00032     } else {
00033       dbe_->setVerbose(0);
00034     }
00035   }
00036                                                                                                                                           
00037   if ( dbe_ ) {
00038     if ( verbose_ ) dbe_->showDirStructure();
00039   }
00040 
00041   meESDigiMultiplicity_=0;
00042 
00043   for (int i = 0; i < 3 ; i++ ) {
00044     meESDigiADC_[i] = 0;
00045   }
00046 
00047   Char_t histo[200];
00048  
00049   if ( dbe_ ) {
00050     dbe_->setCurrentFolder("EcalDigisV/EcalDigiTask");
00051 
00052     sprintf (histo, "EcalDigiTask Preshower digis multiplicity" ) ;
00053     meESDigiMultiplicity_ = dbe_->book1D(histo, histo, 1000, 0., 137728);
00054   
00055     for ( int i = 0; i < 3 ; i++ ) {
00056       
00057       sprintf (histo, "EcalDigiTask Preshower ADC pulse %02d", i+1) ;
00058       meESDigiADC_[i] = dbe_->book1D(histo, histo, 4096, -0.5, 4095.5) ;
00059     }
00060 
00061   }
00062  
00063 }
00064 
00065 EcalPreshowerDigisValidation::~EcalPreshowerDigisValidation(){
00066  
00067 }
00068 
00069 void EcalPreshowerDigisValidation::beginJob(const EventSetup& c){
00070 
00071 }
00072 
00073 void EcalPreshowerDigisValidation::endJob(){
00074 
00075 }
00076 
00077 void EcalPreshowerDigisValidation::analyze(const Event& e, const EventSetup& c){
00078 
00079   //LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
00080 
00081   Handle<ESDigiCollection> EcalDigiES;
00082 
00083   e.getByLabel( ESdigiCollection_ , EcalDigiES );
00084 
00085   // Return if no preshower data
00086   if( !EcalDigiES.isValid() ) return;
00087 
00088   // PRESHOWER
00089   
00090   // loop over Digis
00091 
00092   const ESDigiCollection * preshowerDigi = EcalDigiES.product () ;
00093 
00094   std::vector<double> esADCCounts ;
00095   esADCCounts.reserve(ESDataFrame::MAXSAMPLES);
00096 
00097   int nDigis = 0;
00098 
00099   for (unsigned int digis=0; digis<EcalDigiES->size(); ++digis) {
00100 
00101     ESDataFrame esdf=(*preshowerDigi)[digis];
00102     int nrSamples=esdf.size();
00103     
00104     ESDetId esid = esdf.id () ;
00105     
00106     nDigis++;
00107     
00108     for (int sample = 0 ; sample < nrSamples; ++sample) {
00109       esADCCounts[sample] = 0.;
00110     }
00111     
00112     for (int sample = 0 ; sample < nrSamples; ++sample) {
00113       ESSample mySample = esdf[sample];
00114       esADCCounts[sample] = (mySample.adc()) ;
00115     }
00116     if (verbose_) {
00117       LogDebug("DigiInfo") << "Preshower Digi for ESDetId: z side " << esid.zside() << "  plane " << esid.plane() << esid.six() << ',' << esid.siy() << ':' << esid.strip();
00118       for ( int i = 0; i < 3 ; i++ ) {
00119         LogDebug("DigiInfo") << "sample " << i << " ADC = " << esADCCounts[i];
00120       }
00121     }
00122     
00123     for ( int i = 0 ; i < 3 ; i++ ) {
00124       if (meESDigiADC_[i]) meESDigiADC_[i]->Fill( esADCCounts[i] ) ;
00125     }
00126     
00127   } 
00128   
00129   if ( meESDigiMultiplicity_ ) meESDigiMultiplicity_->Fill(nDigis);
00130   
00131 }
00132 
00133                                                                                                                                                              

Generated on Tue Jun 9 17:49:08 2009 for CMSSW by  doxygen 1.5.4