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 
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
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 }
EcalCondObjectContainer::getMap
const self & getMap() const
Definition: EcalCondObjectContainer.h:80
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
EcalCondObjectContainer::end
const_iterator end() const
Definition: EcalCondObjectContainer.h:76
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm::DataFrameContainer::const_iterator
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
Definition: DataFrameContainer.h:61
simplePhotonAnalyzer_cfi.sample
sample
Definition: simplePhotonAnalyzer_cfi.py:12
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
dqm::implementation::IBooker::bookProfile2D
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:399
EEDetId.h
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
edm::SortedCollection
Definition: SortedCollection.h:49
DQMStore.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EcalCondObjectContainer< EcalPedestal >
EEDetId::ix
int ix() const
Definition: EEDetId.h:77
edm::Handle
Definition: AssociativeIterator.h:50
EcalMGPASample::adc
int adc() const
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:31
CollectionTags_cfi.EEDigi
EEDigi
Definition: CollectionTags_cfi.py:28
edm::ESHandle
Definition: DTSurvey.h:22
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
EEDetId::zside
int zside() const
Definition: EEDetId.h:71
EEDetId
Definition: EEDetId.h:14
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
cosmicPhotonAnalyzer_cfi.eMax
eMax
Definition: cosmicPhotonAnalyzer_cfi.py:10
CollectionTags_cfi.EEUncalibRecHit
EEUncalibRecHit
Definition: CollectionTags_cfi.py:33
EEDigiCollection
Definition: EcalDigiCollections.h:45
EcalEndcapRecHitsValidation::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
Definition: EcalEndcapRecHitsValidation.cc:103
edm::EventSetup
Definition: EventSetup.h:57
EcalEndcapRecHitsValidation.h
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
get
#define get
EEDetId::iy
int iy() const
Definition: EEDetId.h:83
EcalMGPASample
Definition: EcalMGPASample.h:22
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
std
Definition: JetResolutionObject.h:76
dqm::implementation::IBooker::book2D
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:177
EcalEndcapRecHitsValidation::EcalEndcapRecHitsValidation
EcalEndcapRecHitsValidation(const edm::ParameterSet &ps)
Constructor.
Definition: EcalEndcapRecHitsValidation.cc:16
EcalEndcapRecHitsValidation::bookHistograms
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
Definition: EcalEndcapRecHitsValidation.cc:47
dqm::implementation::IBooker
Definition: DQMStore.h:43
EcalCondObjectContainer< EcalPedestal >::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondObjectContainer.h:19
EcalPedestalsRcd
Definition: EcalPedestalsRcd.h:5
EcalEndcapRecHitsValidation::~EcalEndcapRecHitsValidation
~EcalEndcapRecHitsValidation() override
Destructor.
Definition: EcalEndcapRecHitsValidation.cc:45
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37