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  * $Date: 2010/01/04 15:10:59 $
5  * $Revision: 1.15 $
6  * \author F. Cossutti
7  *
8 */
9 
12 
13 using namespace cms;
14 using namespace edm;
15 using namespace std;
16 
18  ESdigiCollection_(ps.getParameter<edm::InputTag>("ESdigiCollection"))
19 {
20 
21  // verbosity switch
22  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
23 
24  dbe_ = 0;
25 
26  // get hold of back-end interface
27  dbe_ = Service<DQMStore>().operator->();
28 
29  if ( dbe_ ) {
30  if ( verbose_ ) {
31  dbe_->setVerbose(1);
32  } else {
33  dbe_->setVerbose(0);
34  }
35  }
36 
37  if ( dbe_ ) {
38  if ( verbose_ ) dbe_->showDirStructure();
39  }
40 
42 
43  for (int i = 0; i < 3 ; i++ ) {
44  meESDigiADC_[i] = 0;
45  }
46 
47  Char_t histo[200];
48 
49  if ( dbe_ ) {
50  dbe_->setCurrentFolder("EcalDigisV/EcalDigiTask");
51 
52  sprintf (histo, "EcalDigiTask Preshower digis multiplicity" ) ;
53  meESDigiMultiplicity_ = dbe_->book1D(histo, histo, 1000, 0., 137728);
54 
55  for ( int i = 0; i < 3 ; i++ ) {
56 
57  sprintf (histo, "EcalDigiTask Preshower ADC pulse %02d", i+1) ;
58  meESDigiADC_[i] = dbe_->book1D(histo, histo, 4096, -0.5, 4095.5) ;
59  }
60 
61  }
62 
63 }
64 
66 
67  //LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
68 
69  Handle<ESDigiCollection> EcalDigiES;
70 
71  e.getByLabel( ESdigiCollection_ , EcalDigiES );
72 
73  // Return if no preshower data
74  if( !EcalDigiES.isValid() ) return;
75 
76  // PRESHOWER
77 
78  // loop over Digis
79 
80  const ESDigiCollection * preshowerDigi = EcalDigiES.product () ;
81 
82  std::vector<double> esADCCounts ;
83  esADCCounts.reserve(ESDataFrame::MAXSAMPLES);
84 
85  int nDigis = 0;
86 
87  for (unsigned int digis=0; digis<EcalDigiES->size(); ++digis) {
88 
89  ESDataFrame esdf=(*preshowerDigi)[digis];
90  int nrSamples=esdf.size();
91 
92  ESDetId esid = esdf.id () ;
93 
94  nDigis++;
95 
96  for (int sample = 0 ; sample < nrSamples; ++sample) {
97  esADCCounts[sample] = 0.;
98  }
99 
100  for (int sample = 0 ; sample < nrSamples; ++sample) {
101  ESSample mySample = esdf[sample];
102  esADCCounts[sample] = (mySample.adc()) ;
103  }
104  if (verbose_) {
105  LogDebug("DigiInfo") << "Preshower Digi for ESDetId: z side " << esid.zside() << " plane " << esid.plane() << esid.six() << ',' << esid.siy() << ':' << esid.strip();
106  for ( int i = 0; i < 3 ; i++ ) {
107  LogDebug("DigiInfo") << "sample " << i << " ADC = " << esADCCounts[i];
108  }
109  }
110 
111  for ( int i = 0 ; i < 3 ; i++ ) {
112  if (meESDigiADC_[i]) meESDigiADC_[i]->Fill( esADCCounts[i] ) ;
113  }
114 
115  }
116 
118 
119 }
120 
121 
#define LogDebug(id)
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
int strip() const
Definition: ESDetId.h:41
const ESDetId & id() const
Definition: ESDataFrame.h:21
int six() const
Definition: ESDetId.h:37
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:39
static const int MAXSAMPLES
Definition: ESDataFrame.h:32
int zside() const
Definition: ESDetId.h:33
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
T const * product() const
Definition: Handle.h:74
EcalPreshowerDigisValidation(const edm::ParameterSet &ps)
Constructor.
int plane() const
Definition: ESDetId.h:35
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:18