CMS 3D CMS Logo

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  // verbosity switch
13  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
14 
15  meESDigiMultiplicity_ = nullptr;
16 
17  for (int i = 0; i < 3; i++) {
18  meESDigiADC_[i] = nullptr;
19  }
20 }
21 
23  Char_t histo[200];
24 
25  ibooker.setCurrentFolder("EcalDigisV/EcalDigiTask");
26 
27  sprintf(histo, "EcalDigiTask Preshower digis multiplicity");
28  meESDigiMultiplicity_ = ibooker.book1D(histo, histo, 1000, 0., 137728);
29 
30  for (int i = 0; i < 3; i++) {
31  sprintf(histo, "EcalDigiTask Preshower ADC pulse %02d", i + 1);
32  meESDigiADC_[i] = ibooker.book1D(histo, histo, 4096, -0.5, 4095.5);
33  }
34 }
35 
37  //LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
38 
40 
41  e.getByToken(ESdigiCollectionToken_, EcalDigiES);
42 
43  // Return if no preshower data
44  if (!EcalDigiES.isValid())
45  return;
46 
47  // PRESHOWER
48 
49  // loop over Digis
50 
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  ESDataFrame esdf = (*preshowerDigi)[digis];
60  int nrSamples = esdf.size();
61 
62  ESDetId esid = esdf.id();
63 
64  nDigis++;
65 
66  for (int sample = 0; sample < nrSamples; ++sample) {
67  esADCCounts[sample] = 0.;
68  }
69 
70  for (int sample = 0; sample < nrSamples; ++sample) {
71  ESSample mySample = esdf[sample];
72  esADCCounts[sample] = (mySample.adc());
73  }
74  if (verbose_) {
75  LogDebug("DigiInfo") << "Preshower Digi for ESDetId: z side " << esid.zside() << " plane " << esid.plane()
76  << esid.six() << ',' << esid.siy() << ':' << esid.strip();
77  for (int i = 0; i < 3; i++) {
78  LogDebug("DigiInfo") << "sample " << i << " ADC = " << esADCCounts[i];
79  }
80  }
81 
82  for (int i = 0; i < 3; i++) {
83  if (meESDigiADC_[i])
84  meESDigiADC_[i]->Fill(esADCCounts[i]);
85  }
86  }
87 
89  meESDigiMultiplicity_->Fill(nDigis);
90 }
const ESDetId & id() const
Definition: ESDataFrame.h:19
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
int size() const
Definition: ESDataFrame.h:21
T const * product() const
Definition: Handle.h:70
int zside() const
Definition: ESDetId.h:39
T getUntrackedParameter(std::string const &, T const &) const
void Fill(long long x)
int plane() const
Definition: ESDetId.h:41
static const int MAXSAMPLES
Definition: ESDataFrame.h:30
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
void reserve(size_t isize)
edm::EDGetTokenT< ESDigiCollection > ESdigiCollectionToken_
int siy() const
Definition: ESDetId.h:45
bool isValid() const
Definition: HandleBase.h:70
EcalPreshowerDigisValidation(const edm::ParameterSet &ps)
Constructor.
HLT enums.
int six() const
Definition: ESDetId.h:43
int strip() const
Definition: ESDetId.h:47
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
Definition: Run.h:45
#define LogDebug(id)