CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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"));
20  consumes<EEUncalibratedRecHitCollection>(ps.getParameter<edm::InputTag>("EEuncalibrechitCollection"));
21 
22  // ----------------------
23  // verbosity switch
24  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
25 
26  // ----------------------
31  meEEUncalibRecHitsJitter_ = nullptr;
32  meEEUncalibRecHitsChi2_ = 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 
123  // ----------------------
124  // loop over UncalibRecHits
125  for (EcalUncalibratedRecHitCollection::const_iterator uncalibRecHit = EEUncalibRecHit->begin();
126  uncalibRecHit != EEUncalibRecHit->end();
127  ++uncalibRecHit) {
128  EEDetId EEid = EEDetId(uncalibRecHit->id());
129 
130  int mySide = EEid.zside();
131 
132  // general checks
133  if (mySide > 0) {
135  meEEUncalibRecHitsOccupancyPlus_->Fill(EEid.ix(), EEid.iy());
136  }
137  if (mySide < 0) {
139  meEEUncalibRecHitsOccupancyMinus_->Fill(EEid.ix(), EEid.iy());
140  }
142  meEEUncalibRecHitsAmplitude_->Fill(uncalibRecHit->amplitude());
144  meEEUncalibRecHitsPedestal_->Fill(uncalibRecHit->pedestal());
146  meEEUncalibRecHitsJitter_->Fill(uncalibRecHit->jitter());
148  meEEUncalibRecHitsChi2_->Fill(uncalibRecHit->chi2());
150  meEEUncalibRecHitsAmpFullMap_->Fill(EEid.ix(), EEid.iy(), uncalibRecHit->amplitude());
152  meEEUncalibRecHitsPedFullMap_->Fill(EEid.ix(), EEid.iy(), uncalibRecHit->pedestal());
153 
154  // general checks, with threshold at 60 ADC counts
155  if (uncalibRecHit->amplitude() > 60) {
156  if (mySide > 0) {
159  }
160  if (mySide < 0) {
163  }
165  meEEUncalibRecHitsAmplitudeGt60adc_->Fill(uncalibRecHit->amplitude());
167  meEEUncalibRecHitsPedestalGt60adc_->Fill(uncalibRecHit->pedestal());
169  meEEUncalibRecHitsJitterGt60adc_->Fill(uncalibRecHit->jitter());
171  meEEUncalibRecHitsChi2Gt60adc_->Fill(uncalibRecHit->chi2());
172  }
173 
174  if (!skipDigis) {
175  // Find the rechit corresponding digi
176  EEDigiCollection::const_iterator myDigi = EEDigi->find(EEid);
177  // int sMax = -1; // UNUSED
178  double eMax = 0.;
179  if (myDigi != EEDigi->end()) {
180  for (unsigned int sample = 0; sample < myDigi->size(); ++sample) {
181  EcalMGPASample thisSample = (*myDigi)[sample];
182  double analogSample = thisSample.adc();
183  if (eMax < analogSample) {
184  eMax = analogSample;
185  // sMax = sample; // UNUSED
186  }
187  }
188  } else
189  continue;
190 
191  // ratio uncalibratedRecHit amplitude + ped / max energy digi
192  const EcalPedestals *myped = &c.getData(ecalPeds);
193  EcalPedestalsMap::const_iterator it = myped->getMap().find(EEid);
194  if (it != myped->getMap().end()) {
195  if (eMax > (*it).mean_x1 + 5 * (*it).rms_x1 && eMax != 0) { // only real signal RecHit
196 
198  meEEUncalibRecHitMaxSampleRatio_->Fill((uncalibRecHit->amplitude() + uncalibRecHit->pedestal()) / eMax);
199  }
200 
201  if (meEEUncalibRecHitMaxSampleRatioGt60adc_ && (uncalibRecHit->amplitude() > 60)) {
202  meEEUncalibRecHitMaxSampleRatioGt60adc_->Fill((uncalibRecHit->amplitude() + uncalibRecHit->pedestal()) /
203  eMax);
204  }
205 
206  LogDebug("EcalRecHitsTaskInfo")
207  << "endcap, eMax = " << eMax << " Amplitude = " << uncalibRecHit->amplitude() + uncalibRecHit->pedestal();
208  } else
209  continue;
210  } else
211  continue;
212  }
213  } // loop over the UncalibratedRecHitCollection
214 }
T getUntrackedParameter(std::string const &, T const &) const
EcalEndcapRecHitsValidation(const edm::ParameterSet &ps)
Constructor.
const edm::EventSetup & c
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
int ix() const
Definition: EEDetId.h:77
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > ecalPeds
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const self & getMap() const
std::vector< T >::const_iterator const_iterator
MonitorElement * meEEUncalibRecHitsOccupancyPlusGt60adc_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
MonitorElement * meEEUncalibRecHitMaxSampleRatioGt60adc_
void Fill(long long x)
bool getData(T &iHolder) const
Definition: EventSetup.h:122
const_iterator find(id_type i) const
int zside() const
Definition: EEDetId.h:71
MonitorElement * meEEUncalibRecHitsOccupancyMinusGt60adc_
int iy() const
Definition: EEDetId.h:83
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< EEUncalibratedRecHitCollection > EEuncalibrechitCollection_token_
const_iterator end() const
T const * product() const
Definition: Handle.h:70
edm::EDGetTokenT< EEDigiCollection > EEdigiCollection_token_
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
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
const_iterator end() const
const_iterator find(uint32_t rawId) const
const_iterator end() const
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
~EcalEndcapRecHitsValidation() override
Destructor.
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
const_iterator begin() const
MonitorElement * meEEUncalibRecHitsAmplitudeGt60adc_
Definition: Run.h:45
int adc() const
get the ADC sample (12 bits)
#define LogDebug(id)