test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalPreshowerNoiseDistrib.cc
Go to the documentation of this file.
1 /*
2  * \file EcalPreshowerNoiseDistrib.cc
3  *
4 */
5 
7 
9  ESdigiCollectionToken_( consumes<ESDigiCollection>( ps.getParameter<edm::InputTag>( "ESdigiCollection" ) ) )
10 {
11 
12  // verbosity switch
13  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
14 
15  // histos
17  for (int ii=0; ii<3; ii++ ) { meESDigiADC_[ii] = 0; }
18 
19 }
20 
22  Char_t histo[200];
23 
24  sprintf (histo, "multiplicity" ) ;
25  meESDigiMultiplicity_ = ibooker.book1D(histo, histo, 1000, 0., 137728);
26 
27  for ( int ii = 0; ii < 3 ; ii++ ) {
28  sprintf (histo, "esRefHistos%02d", ii) ;
29  meESDigiADC_[ii] = ibooker.book1D(histo, histo, 35, 983.5, 1018.5) ;
30  }
31 
32  for ( int ii = 0; ii < 3 ; ii++ ) {
33  sprintf (histo, "esRefHistosCorr%02d", ii) ;
34  meESDigiCorr_[ii] = ibooker.book2D(histo, histo, 35, 983.5, 1018.5, 35, 983.5, 1018.5) ;
35  }
36 
37  meESDigi3D_ = ibooker.book3D("meESDigi3D_", "meESDigi3D_", 35, 983.5, 1018.5, 35, 983.5, 1018.5, 35, 983.5, 1018.5) ;
38 }
39 
40 
42 
44 
45  e.getByToken( ESdigiCollectionToken_ , EcalDigiES );
46 
47  // retrun if no data
48  if( !EcalDigiES.isValid() ) return;
49 
50  // loop over Digis
51  const ESDigiCollection * preshowerDigi = EcalDigiES.product () ;
52 
53  std::vector<double> esADCCounts ;
54  esADCCounts.reserve(ESDataFrame::MAXSAMPLES);
55 
56  int nDigis = 0;
57 
58  for (unsigned int digis=0; digis<EcalDigiES->size(); ++digis) {
59  nDigis++;
60  ESDataFrame esdf=(*preshowerDigi)[digis];
61  int nrSamples=esdf.size();
62  for (int sample = 0 ; sample < nrSamples; ++sample) {
63  ESSample mySample = esdf[sample];
64  if (meESDigiADC_[sample]) { meESDigiADC_[sample] ->Fill(mySample.adc()); }
65  }
66 
67  // to study correlations
68  if(meESDigiCorr_[0]){ meESDigiCorr_[0]->Fill(esdf[0].adc(),esdf[1].adc()); }
69  if(meESDigiCorr_[1]){ meESDigiCorr_[1]->Fill(esdf[0].adc(),esdf[2].adc()); }
70  if(meESDigiCorr_[2]){ meESDigiCorr_[2]->Fill(esdf[1].adc(),esdf[2].adc()); }
71 
72  // reference histo: sample0, sample1, sample2
73  if ( meESDigi3D_ ) meESDigi3D_ -> Fill(esdf[0].adc(),esdf[1].adc(),esdf[2].adc());
74  }
75 
77 
78 }
79 
int adc(sample_type sample)
get the ADC sample (12 bits)
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
int size() const
Definition: ESDataFrame.h:23
int ii
Definition: cuy.py:588
EcalPreshowerNoiseDistrib(const edm::ParameterSet &ps)
Constructor.
void Fill(long long x)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
static const int MAXSAMPLES
Definition: ESDataFrame.h:32
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
bool isValid() const
Definition: HandleBase.h:75
T const * product() const
Definition: Handle.h:81
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
edm::EDGetTokenT< ESDigiCollection > ESdigiCollectionToken_
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:18
MonitorElement * book3D(Args &&...args)
Definition: DQMStore.h:151
Definition: Run.h:43