Go to the documentation of this file.00001
00002
00003
00004
00005
00006
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
00022 verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
00023
00024 dbe_ = 0;
00025
00026
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 void EcalPreshowerDigisValidation::analyze(const Event& e, const EventSetup& c){
00066
00067
00068
00069 Handle<ESDigiCollection> EcalDigiES;
00070
00071 e.getByLabel( ESdigiCollection_ , EcalDigiES );
00072
00073
00074 if( !EcalDigiES.isValid() ) return;
00075
00076
00077
00078
00079
00080 const ESDigiCollection * preshowerDigi = EcalDigiES.product () ;
00081
00082 std::vector<double> esADCCounts ;
00083 esADCCounts.reserve(ESDataFrame::MAXSAMPLES);
00084
00085 int nDigis = 0;
00086
00087 for (unsigned int digis=0; digis<EcalDigiES->size(); ++digis) {
00088
00089 ESDataFrame esdf=(*preshowerDigi)[digis];
00090 int nrSamples=esdf.size();
00091
00092 ESDetId esid = esdf.id () ;
00093
00094 nDigis++;
00095
00096 for (int sample = 0 ; sample < nrSamples; ++sample) {
00097 esADCCounts[sample] = 0.;
00098 }
00099
00100 for (int sample = 0 ; sample < nrSamples; ++sample) {
00101 ESSample mySample = esdf[sample];
00102 esADCCounts[sample] = (mySample.adc()) ;
00103 }
00104 if (verbose_) {
00105 LogDebug("DigiInfo") << "Preshower Digi for ESDetId: z side " << esid.zside() << " plane " << esid.plane() << esid.six() << ',' << esid.siy() << ':' << esid.strip();
00106 for ( int i = 0; i < 3 ; i++ ) {
00107 LogDebug("DigiInfo") << "sample " << i << " ADC = " << esADCCounts[i];
00108 }
00109 }
00110
00111 for ( int i = 0 ; i < 3 ; i++ ) {
00112 if (meESDigiADC_[i]) meESDigiADC_[i]->Fill( esADCCounts[i] ) ;
00113 }
00114
00115 }
00116
00117 if ( meESDigiMultiplicity_ ) meESDigiMultiplicity_->Fill(nDigis);
00118
00119 }
00120
00121