CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalPreshowerDigisValidation.cc
Go to the documentation of this file.
1 /*
2  * \file EcalPreshowerDigisValidation.cc
3  *
4  * \author F. Cossutti
5  *
6 */
7 
9 
11  ESdigiCollectionToken_( consumes<ESDigiCollection>( ps.getParameter<edm::InputTag>( "ESdigiCollection" ) ) )
12 {
13 
14  // verbosity switch
15  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
16 
17  dbe_ = 0;
18 
19  // get hold of back-end interface
20  dbe_ = edm::Service<DQMStore>().operator->();
21 
22  if ( dbe_ ) {
23  if ( verbose_ ) {
24  dbe_->setVerbose(1);
25  } else {
26  dbe_->setVerbose(0);
27  }
28  }
29 
30  if ( dbe_ ) {
31  if ( verbose_ ) dbe_->showDirStructure();
32  }
33 
35 
36  for (int i = 0; i < 3 ; i++ ) {
37  meESDigiADC_[i] = 0;
38  }
39 
40  Char_t histo[200];
41 
42  if ( dbe_ ) {
43  dbe_->setCurrentFolder("EcalDigisV/EcalDigiTask");
44 
45  sprintf (histo, "EcalDigiTask Preshower digis multiplicity" ) ;
46  meESDigiMultiplicity_ = dbe_->book1D(histo, histo, 1000, 0., 137728);
47 
48  for ( int i = 0; i < 3 ; i++ ) {
49 
50  sprintf (histo, "EcalDigiTask Preshower ADC pulse %02d", i+1) ;
51  meESDigiADC_[i] = dbe_->book1D(histo, histo, 4096, -0.5, 4095.5) ;
52  }
53 
54  }
55 
56 }
57 
59 
60  //LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
61 
63 
64  e.getByToken( ESdigiCollectionToken_ , EcalDigiES );
65 
66  // Return if no preshower data
67  if( !EcalDigiES.isValid() ) return;
68 
69  // PRESHOWER
70 
71  // loop over Digis
72 
73  const ESDigiCollection * preshowerDigi = EcalDigiES.product () ;
74 
75  std::vector<double> esADCCounts ;
76  esADCCounts.reserve(ESDataFrame::MAXSAMPLES);
77 
78  int nDigis = 0;
79 
80  for (unsigned int digis=0; digis<EcalDigiES->size(); ++digis) {
81 
82  ESDataFrame esdf=(*preshowerDigi)[digis];
83  int nrSamples=esdf.size();
84 
85  ESDetId esid = esdf.id () ;
86 
87  nDigis++;
88 
89  for (int sample = 0 ; sample < nrSamples; ++sample) {
90  esADCCounts[sample] = 0.;
91  }
92 
93  for (int sample = 0 ; sample < nrSamples; ++sample) {
94  ESSample mySample = esdf[sample];
95  esADCCounts[sample] = (mySample.adc()) ;
96  }
97  if (verbose_) {
98  LogDebug("DigiInfo") << "Preshower Digi for ESDetId: z side " << esid.zside() << " plane " << esid.plane() << esid.six() << ',' << esid.siy() << ':' << esid.strip();
99  for ( int i = 0; i < 3 ; i++ ) {
100  LogDebug("DigiInfo") << "sample " << i << " ADC = " << esADCCounts[i];
101  }
102  }
103 
104  for ( int i = 0 ; i < 3 ; i++ ) {
105  if (meESDigiADC_[i]) meESDigiADC_[i]->Fill( esADCCounts[i] ) ;
106  }
107 
108  }
109 
111 
112 }
113 
114 
#define LogDebug(id)
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
int strip() const
Definition: ESDetId.h:52
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
const ESDetId & id() const
Definition: ESDataFrame.h:21
int six() const
Definition: ESDetId.h:48
int size() const
Definition: ESDataFrame.h:23
void Fill(long long x)
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
int siy() const
Definition: ESDetId.h:50
static const int MAXSAMPLES
Definition: ESDataFrame.h:32
int zside() const
Definition: ESDetId.h:44
bool isValid() const
Definition: HandleBase.h:76
edm::EDGetTokenT< ESDigiCollection > ESdigiCollectionToken_
T const * product() const
Definition: Handle.h:81
EcalPreshowerDigisValidation(const edm::ParameterSet &ps)
Constructor.
int plane() const
Definition: ESDetId.h:46
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:18