CMS 3D CMS Logo

EcalEndcapRecHitsValidation.cc
Go to the documentation of this file.
1 /*
2  * \file EcalEndcapRecHitsValidation.cc
3  *
4  * \author C. Rovelli
5  *
6  */
7 
11 
12 using namespace cms;
13 using namespace edm;
14 using namespace std;
15 
17  // ----------------------
18  EEdigiCollection_token_ = consumes<EEDigiCollection>(ps.getParameter<edm::InputTag>("EEdigiCollection"));
19  EEuncalibrechitCollection_token_ =
20  consumes<EEUncalibratedRecHitCollection>(ps.getParameter<edm::InputTag>("EEuncalibrechitCollection"));
21 
22  // ----------------------
23  // verbosity switch
24  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
25 
26  // ----------------------
27  meEEUncalibRecHitsOccupancyPlus_ = nullptr;
28  meEEUncalibRecHitsOccupancyMinus_ = nullptr;
29  meEEUncalibRecHitsAmplitude_ = nullptr;
30  meEEUncalibRecHitsPedestal_ = nullptr;
31  meEEUncalibRecHitsJitter_ = nullptr;
32  meEEUncalibRecHitsChi2_ = nullptr;
33  meEEUncalibRecHitMaxSampleRatio_ = nullptr;
34  meEEUncalibRecHitsOccupancyPlusGt60adc_ = nullptr;
35  meEEUncalibRecHitsOccupancyMinusGt60adc_ = nullptr;
36  meEEUncalibRecHitsAmplitudeGt60adc_ = nullptr;
37  meEEUncalibRecHitsPedestalGt60adc_ = nullptr;
38  meEEUncalibRecHitsJitterGt60adc_ = nullptr;
39  meEEUncalibRecHitsChi2Gt60adc_ = nullptr;
40  meEEUncalibRecHitMaxSampleRatioGt60adc_ = nullptr;
41  meEEUncalibRecHitsAmpFullMap_ = nullptr;
42  meEEUncalibRecHitsPedFullMap_ = nullptr;
43 }
44 
46 
48  edm::Run const &,
49  edm::EventSetup const &) {
50  Char_t histo[200];
51 
52  ibooker.setCurrentFolder("EcalRecHitsV/EcalEndcapRecHitsTask");
53 
54  sprintf(histo, "EE+ Occupancy");
55  meEEUncalibRecHitsOccupancyPlus_ = ibooker.book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
56 
57  sprintf(histo, "EE- Occupancy");
58  meEEUncalibRecHitsOccupancyMinus_ = ibooker.book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
59 
60  sprintf(histo, "EE Amplitude");
61  meEEUncalibRecHitsAmplitude_ = ibooker.book1D(histo, histo, 201, -20., 4000.);
62 
63  sprintf(histo, "EE Pedestal");
64  meEEUncalibRecHitsPedestal_ = ibooker.book1D(histo, histo, 50, 190., 210.);
65 
66  sprintf(histo, "EE Jitter");
67  meEEUncalibRecHitsJitter_ = ibooker.book1D(histo, histo, 100, 0., 100.);
68 
69  sprintf(histo, "EE Chi2");
70  meEEUncalibRecHitsChi2_ = ibooker.book1D(histo, histo, 100, 18000., 22000.);
71 
72  sprintf(histo, "EE RecHit Max Sample Ratio");
73  meEEUncalibRecHitMaxSampleRatio_ = ibooker.book1D(histo, histo, 120, 0.90, 1.05);
74 
75  sprintf(histo, "EE+ Occupancy gt 60 adc counts");
76  meEEUncalibRecHitsOccupancyPlusGt60adc_ = ibooker.book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
77 
78  sprintf(histo, "EE- Occupancy gt 60 adc counts");
79  meEEUncalibRecHitsOccupancyMinusGt60adc_ = ibooker.book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
80 
81  sprintf(histo, "EE Amplitude gt 60 adc counts");
82  meEEUncalibRecHitsAmplitudeGt60adc_ = ibooker.book1D(histo, histo, 200, 0., 4000.);
83 
84  sprintf(histo, "EE Pedestal gt 60 adc counts");
85  meEEUncalibRecHitsPedestalGt60adc_ = ibooker.book1D(histo, histo, 50, 190., 210.);
86 
87  sprintf(histo, "EE Jitter gt 60 adc counts");
88  meEEUncalibRecHitsJitterGt60adc_ = ibooker.book1D(histo, histo, 100, 0., 100.);
89 
90  sprintf(histo, "EE Chi2 gt 60 adc counts");
91  meEEUncalibRecHitsChi2Gt60adc_ = ibooker.book1D(histo, histo, 100, 18000., 22000.);
92 
93  sprintf(histo, "EE RecHit Max Sample Ratio gt 60 adc counts");
94  meEEUncalibRecHitMaxSampleRatioGt60adc_ = ibooker.book1D(histo, histo, 120, 0.90, 1.05);
95 
96  sprintf(histo, "EE Amplitude Full Map");
97  meEEUncalibRecHitsAmpFullMap_ = ibooker.bookProfile2D(histo, histo, 100, 0., 100., 100, 0., 100., 200, 0., 4000.);
98 
99  sprintf(histo, "EE Pedestal Full Map");
100  meEEUncalibRecHitsPedFullMap_ = ibooker.bookProfile2D(histo, histo, 100, 0., 100., 100, 0., 100., 50, 194., 201.);
101 }
102 
104  const EEUncalibratedRecHitCollection *EEUncalibRecHit = nullptr;
105  Handle<EEUncalibratedRecHitCollection> EcalUncalibRecHitEE;
106  e.getByToken(EEuncalibrechitCollection_token_, EcalUncalibRecHitEE);
107  if (EcalUncalibRecHitEE.isValid()) {
108  EEUncalibRecHit = EcalUncalibRecHitEE.product();
109  } else {
110  return;
111  }
112 
113  bool skipDigis = false;
114  const EEDigiCollection *EEDigi = nullptr;
115  Handle<EEDigiCollection> EcalDigiEE;
116  e.getByToken(EEdigiCollection_token_, EcalDigiEE);
117  if (EcalDigiEE.isValid()) {
118  EEDigi = EcalDigiEE.product();
119  } else {
120  skipDigis = true;
121  }
122 
124  c.get<EcalPedestalsRcd>().get(ecalPeds);
125 
126  // ----------------------
127  // loop over UncalibRecHits
128  for (EcalUncalibratedRecHitCollection::const_iterator uncalibRecHit = EEUncalibRecHit->begin();
129  uncalibRecHit != EEUncalibRecHit->end();
130  ++uncalibRecHit) {
131  EEDetId EEid = EEDetId(uncalibRecHit->id());
132 
133  int mySide = EEid.zside();
134 
135  // general checks
136  if (mySide > 0) {
137  if (meEEUncalibRecHitsOccupancyPlus_)
138  meEEUncalibRecHitsOccupancyPlus_->Fill(EEid.ix(), EEid.iy());
139  }
140  if (mySide < 0) {
141  if (meEEUncalibRecHitsOccupancyMinus_)
142  meEEUncalibRecHitsOccupancyMinus_->Fill(EEid.ix(), EEid.iy());
143  }
144  if (meEEUncalibRecHitsAmplitude_)
145  meEEUncalibRecHitsAmplitude_->Fill(uncalibRecHit->amplitude());
146  if (meEEUncalibRecHitsPedestal_)
147  meEEUncalibRecHitsPedestal_->Fill(uncalibRecHit->pedestal());
148  if (meEEUncalibRecHitsJitter_)
149  meEEUncalibRecHitsJitter_->Fill(uncalibRecHit->jitter());
150  if (meEEUncalibRecHitsChi2_)
151  meEEUncalibRecHitsChi2_->Fill(uncalibRecHit->chi2());
152  if (meEEUncalibRecHitsAmpFullMap_)
153  meEEUncalibRecHitsAmpFullMap_->Fill(EEid.ix(), EEid.iy(), uncalibRecHit->amplitude());
154  if (meEEUncalibRecHitsPedFullMap_)
155  meEEUncalibRecHitsPedFullMap_->Fill(EEid.ix(), EEid.iy(), uncalibRecHit->pedestal());
156 
157  // general checks, with threshold at 60 ADC counts
158  if (uncalibRecHit->amplitude() > 60) {
159  if (mySide > 0) {
160  if (meEEUncalibRecHitsOccupancyPlusGt60adc_)
161  meEEUncalibRecHitsOccupancyPlusGt60adc_->Fill(EEid.ix(), EEid.iy());
162  }
163  if (mySide < 0) {
164  if (meEEUncalibRecHitsOccupancyMinusGt60adc_)
165  meEEUncalibRecHitsOccupancyMinusGt60adc_->Fill(EEid.ix(), EEid.iy());
166  }
167  if (meEEUncalibRecHitsAmplitudeGt60adc_)
168  meEEUncalibRecHitsAmplitudeGt60adc_->Fill(uncalibRecHit->amplitude());
169  if (meEEUncalibRecHitsPedestalGt60adc_)
170  meEEUncalibRecHitsPedestalGt60adc_->Fill(uncalibRecHit->pedestal());
171  if (meEEUncalibRecHitsJitterGt60adc_)
172  meEEUncalibRecHitsJitterGt60adc_->Fill(uncalibRecHit->jitter());
173  if (meEEUncalibRecHitsChi2Gt60adc_)
174  meEEUncalibRecHitsChi2Gt60adc_->Fill(uncalibRecHit->chi2());
175  }
176 
177  if (!skipDigis) {
178  // Find the rechit corresponding digi
179  EEDigiCollection::const_iterator myDigi = EEDigi->find(EEid);
180  // int sMax = -1; // UNUSED
181  double eMax = 0.;
182  if (myDigi != EEDigi->end()) {
183  for (unsigned int sample = 0; sample < myDigi->size(); ++sample) {
184  EcalMGPASample thisSample = (*myDigi)[sample];
185  double analogSample = thisSample.adc();
186  if (eMax < analogSample) {
187  eMax = analogSample;
188  // sMax = sample; // UNUSED
189  }
190  }
191  } else
192  continue;
193 
194  // ratio uncalibratedRecHit amplitude + ped / max energy digi
195  const EcalPedestals *myped = ecalPeds.product();
196  EcalPedestalsMap::const_iterator it = myped->getMap().find(EEid);
197  if (it != myped->getMap().end()) {
198  if (eMax > (*it).mean_x1 + 5 * (*it).rms_x1 && eMax != 0) { // only real signal RecHit
199 
200  if (meEEUncalibRecHitMaxSampleRatio_) {
201  meEEUncalibRecHitMaxSampleRatio_->Fill((uncalibRecHit->amplitude() + uncalibRecHit->pedestal()) / eMax);
202  }
203 
204  if (meEEUncalibRecHitMaxSampleRatioGt60adc_ && (uncalibRecHit->amplitude() > 60)) {
205  meEEUncalibRecHitMaxSampleRatioGt60adc_->Fill((uncalibRecHit->amplitude() + uncalibRecHit->pedestal()) /
206  eMax);
207  }
208 
209  LogDebug("EcalRecHitsTaskInfo")
210  << "endcap, eMax = " << eMax << " Amplitude = " << uncalibRecHit->amplitude() + uncalibRecHit->pedestal();
211  } else
212  continue;
213  } else
214  continue;
215  }
216  } // loop over the UncalibratedRecHitCollection
217 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
EcalEndcapRecHitsValidation(const edm::ParameterSet &ps)
Constructor.
int ix() const
Definition: EEDetId.h:77
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
const self & getMap() const
std::vector< T >::const_iterator const_iterator
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
const_iterator find(id_type i) const
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * bookProfile2D(Args &&...args)
Definition: DQMStore.h:114
int zside() const
Definition: EEDetId.h:71
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
int iy() const
Definition: EEDetId.h:83
bool isValid() const
Definition: HandleBase.h:74
Namespace of DDCMS conversion namespace.
const_iterator end() const
T const * product() const
Definition: Handle.h:74
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
std::vector< Item >::const_iterator const_iterator
const_iterator end() const
HLT enums.
T get() const
Definition: EventSetup.h:71
const_iterator find(uint32_t rawId) const
const_iterator end() const
~EcalEndcapRecHitsValidation() override
Destructor.
T const * product() const
Definition: ESHandle.h:86
const_iterator begin() const
Definition: Run.h:45
int adc() const
get the ADC sample (12 bits)