CMS 3D CMS Logo

EcalBarrelRecHitsValidation.cc
Go to the documentation of this file.
1 /*
2  * \file EcalBarrelRecHitsValidation.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  EBdigiCollection_token_ = consumes<EBDigiCollection>(ps.getParameter<edm::InputTag>("EBdigiCollection"));
20  consumes<EBUncalibratedRecHitCollection>(ps.getParameter<edm::InputTag>("EBuncalibrechitCollection"));
21 
22  // ----------------------
23  // verbosity switch
24  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
25 
26  // ----------------------
30  meEBUncalibRecHitsJitter_ = nullptr;
31  meEBUncalibRecHitsChi2_ = nullptr;
41  for (int i = 0; i < 36; i++) {
42  meEBUncalibRecHitAmplMap_[i] = nullptr;
43  meEBUncalibRecHitPedMap_[i] = nullptr;
44  }
45 }
46 
48 
50  edm::Run const &,
51  edm::EventSetup const &) {
52  Char_t histo[200];
53 
54  ibooker.setCurrentFolder("EcalRecHitsV/EcalBarrelRecHitsTask");
55 
56  sprintf(histo, "EB Occupancy");
57  meEBUncalibRecHitsOccupancy_ = ibooker.book2D(histo, histo, 170, -85., 85., 360, 0., 360.);
58 
59  sprintf(histo, "EB Amplitude");
60  meEBUncalibRecHitsAmplitude_ = ibooker.book1D(histo, histo, 201, -20., 4000.);
61 
62  sprintf(histo, "EB Pedestal");
63  meEBUncalibRecHitsPedestal_ = ibooker.book1D(histo, histo, 50, 190., 210.);
64 
65  sprintf(histo, "EB Jitter");
66  meEBUncalibRecHitsJitter_ = ibooker.book1D(histo, histo, 100, 0., 100.);
67 
68  sprintf(histo, "EB Chi2");
69  meEBUncalibRecHitsChi2_ = ibooker.book1D(histo, histo, 100, 18000., 22000.);
70 
71  sprintf(histo, "EB RecHit Max Sample Ratio");
72  meEBUncalibRecHitMaxSampleRatio_ = ibooker.book1D(histo, histo, 120, 0.90, 1.05);
73 
74  sprintf(histo, "EB Occupancy gt 100 adc counts");
75  meEBUncalibRecHitsOccupancyGt100adc_ = ibooker.book2D(histo, histo, 170, -85., 85., 360, 0., 360.);
76 
77  sprintf(histo, "EB Amplitude gt 100 adc counts");
78  meEBUncalibRecHitsAmplitudeGt100adc_ = ibooker.book1D(histo, histo, 200, 0., 4000.);
79 
80  sprintf(histo, "EB Pedestal gt 100 adc counts");
81  meEBUncalibRecHitsPedestalGt100adc_ = ibooker.book1D(histo, histo, 50, 190., 210.);
82 
83  sprintf(histo, "EB Jitter gt 100 adc counts");
84  meEBUncalibRecHitsJitterGt100adc_ = ibooker.book1D(histo, histo, 100, 0., 100.);
85 
86  sprintf(histo, "EB Chi2 gt 100 adc counts");
87  meEBUncalibRecHitsChi2Gt100adc_ = ibooker.book1D(histo, histo, 100, 18000., 22000.);
88 
89  sprintf(histo, "EB RecHit Max Sample Ratio gt 100 adc counts");
90  meEBUncalibRecHitMaxSampleRatioGt100adc_ = ibooker.book1D(histo, histo, 120, 0.90, 1.05);
91 
92  sprintf(histo, "EB Amplitude Full Map");
93  meEBUncalibRecHitsAmpFullMap_ = ibooker.bookProfile2D(histo, histo, 170, -85., 85., 360, 0., 360., 200, 0., 4000.);
94 
95  sprintf(histo, "EB Pedestal Full Map");
96  meEBUncalibRecHitsPedFullMap_ = ibooker.bookProfile2D(histo, histo, 170, -85., 85., 360, 0., 360., 50, 194., 201.);
97 
98  for (int i = 0; i < 36; i++) {
99  sprintf(histo, "EB Amp SM%02d", i + 1);
100  meEBUncalibRecHitAmplMap_[i] = ibooker.bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 200, 0., 4000.);
101 
102  sprintf(histo, "EB Ped SM%02d", i + 1);
103  meEBUncalibRecHitPedMap_[i] = ibooker.bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 50, 194., 201.);
104  }
105 }
106 
109  Handle<EBUncalibratedRecHitCollection> EcalUncalibRecHitEB;
110  e.getByToken(EBuncalibrechitCollection_token_, EcalUncalibRecHitEB);
111  if (EcalUncalibRecHitEB.isValid()) {
112  EBUncalibRecHit = EcalUncalibRecHitEB.product();
113  } else {
114  return;
115  }
116 
117  bool skipDigis = false;
118  const EBDigiCollection *EBDigi = nullptr;
119  Handle<EBDigiCollection> EcalDigiEB;
120  e.getByToken(EBdigiCollection_token_, EcalDigiEB);
121  if (EcalDigiEB.isValid()) {
122  EBDigi = EcalDigiEB.product();
123  } else {
124  skipDigis = true;
125  }
126 
127  // ----------------------
128  // loop over UncalibRecHits
130  uncalibRecHit != EBUncalibRecHit->end();
131  ++uncalibRecHit) {
132  EBDetId EBid = EBDetId(uncalibRecHit->id());
133 
134  // general checks
136  meEBUncalibRecHitsOccupancy_->Fill(EBid.ieta(), EBid.iphi());
138  meEBUncalibRecHitsAmplitude_->Fill(uncalibRecHit->amplitude());
140  meEBUncalibRecHitsPedestal_->Fill(uncalibRecHit->pedestal());
142  meEBUncalibRecHitsJitter_->Fill(uncalibRecHit->jitter());
144  meEBUncalibRecHitsChi2_->Fill(uncalibRecHit->chi2());
146  meEBUncalibRecHitsAmpFullMap_->Fill(EBid.ieta(), EBid.iphi(), uncalibRecHit->amplitude());
148  meEBUncalibRecHitsPedFullMap_->Fill(EBid.ieta(), EBid.iphi(), uncalibRecHit->pedestal());
149 
150  // general checks, with threshold at 3.5 GeV = 100 ADC counts
151  if (uncalibRecHit->amplitude() > 100) {
155  meEBUncalibRecHitsAmplitudeGt100adc_->Fill(uncalibRecHit->amplitude());
157  meEBUncalibRecHitsPedestalGt100adc_->Fill(uncalibRecHit->pedestal());
159  meEBUncalibRecHitsJitterGt100adc_->Fill(uncalibRecHit->jitter());
161  meEBUncalibRecHitsChi2Gt100adc_->Fill(uncalibRecHit->chi2());
162  }
163 
164  // supermodule maps
165  int ic = EBid.ic();
166  int ie = (ic - 1) / 20 + 1;
167  int ip = (ic - 1) % 20 + 1;
168  int ism = EBid.ism();
169  float xie = ie - 0.5;
170  float xip = ip - 0.5;
171  if (meEBUncalibRecHitPedMap_[ism - 1])
172  meEBUncalibRecHitPedMap_[ism - 1]->Fill(xie, xip, uncalibRecHit->pedestal());
174  meEBUncalibRecHitAmplMap_[ism - 1]->Fill(xie, xip, uncalibRecHit->amplitude());
175 
176  if (!skipDigis) {
177  // find the rechit corresponding digi and the max sample
178  EBDigiCollection::const_iterator myDigi = EBDigi->find(EBid);
179  // int sMax = -1; // UNUSED
180  double eMax = 0.;
181  if (myDigi != EBDigi->end()) {
182  for (unsigned int sample = 0; sample < myDigi->size(); ++sample) {
183  EcalMGPASample thisSample = (*myDigi)[sample];
184  double analogSample = thisSample.adc();
185  if (eMax < analogSample) {
186  eMax = analogSample;
187  // sMax = sample; // UNUSED
188  }
189  }
190  } else
191  continue;
192 
193  // ratio uncalibratedRecHit amplitude + ped / max energy digi
194  const EcalPedestals *myped = &c.getData(ecalPeds);
195  EcalPedestalsMap::const_iterator it = myped->getMap().find(EBid);
196  if (it != myped->getMap().end()) {
197  if (eMax > (*it).mean_x1 + 5 * (*it).rms_x1 && eMax != 0) { // only real signal RecHit
198 
200  meEBUncalibRecHitMaxSampleRatio_->Fill((uncalibRecHit->amplitude() + uncalibRecHit->pedestal()) / eMax);
201  if (meEBUncalibRecHitMaxSampleRatioGt100adc_ && (uncalibRecHit->amplitude() > 100))
202  meEBUncalibRecHitMaxSampleRatioGt100adc_->Fill((uncalibRecHit->amplitude() + uncalibRecHit->pedestal()) /
203  eMax);
204  LogDebug("EcalRecHitsTaskInfo")
205  << "barrel, eMax = " << eMax << " Amplitude = " << uncalibRecHit->amplitude() + uncalibRecHit->pedestal();
206  } else
207  continue;
208  } else
209  continue;
210  }
211 
212  } // loop over the UncalibratedRecHitCollection
213 }
MonitorElement * meEBUncalibRecHitsOccupancyGt100adc_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:476
EcalBarrelRecHitsValidation(const edm::ParameterSet &ps)
Constructor.
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > ecalPeds
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
edm::EDGetTokenT< EBUncalibratedRecHitCollection > EBuncalibrechitCollection_token_
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
T const * product() const
Definition: Handle.h:70
std::vector< T >::const_iterator const_iterator
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
Analyze.
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
T getUntrackedParameter(std::string const &, T const &) const
void Fill(long long x)
MonitorElement * meEBUncalibRecHitAmplMap_[36]
MonitorElement * meEBUncalibRecHitPedMap_[36]
int ic() const
get ECAL/crystal number inside SM
Definition: EBDetId.cc:41
MonitorElement * meEBUncalibRecHitsAmplitudeGt100adc_
int ism() const
get the ECAL/SM id
Definition: EBDetId.h:59
const_iterator find(uint32_t rawId) const
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Namespace of DDCMS conversion namespace.
std::vector< Item >::const_iterator const_iterator
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
bool isValid() const
Definition: HandleBase.h:70
HLT enums.
int adc() const
get the ADC sample (12 bits)
const_iterator end() const
MonitorElement * meEBUncalibRecHitMaxSampleRatioGt100adc_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:49
edm::EDGetTokenT< EBDigiCollection > EBdigiCollection_token_
Definition: Run.h:45
MonitorElement * meEBUncalibRecHitsPedestalGt100adc_
#define LogDebug(id)
~EcalBarrelRecHitsValidation() override
Destructor.