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"));
19  EBuncalibrechitCollection_token_ =
20  consumes<EBUncalibratedRecHitCollection>(ps.getParameter<edm::InputTag>("EBuncalibrechitCollection"));
21 
22  // ----------------------
23  // verbosity switch
24  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
25 
26  // ----------------------
27  meEBUncalibRecHitsOccupancy_ = nullptr;
28  meEBUncalibRecHitsAmplitude_ = nullptr;
29  meEBUncalibRecHitsPedestal_ = nullptr;
30  meEBUncalibRecHitsJitter_ = nullptr;
31  meEBUncalibRecHitsChi2_ = nullptr;
32  meEBUncalibRecHitMaxSampleRatio_ = nullptr;
33  meEBUncalibRecHitsOccupancyGt100adc_ = nullptr;
34  meEBUncalibRecHitsAmplitudeGt100adc_ = nullptr;
35  meEBUncalibRecHitsPedestalGt100adc_ = nullptr;
36  meEBUncalibRecHitsJitterGt100adc_ = nullptr;
37  meEBUncalibRecHitsChi2Gt100adc_ = nullptr;
38  meEBUncalibRecHitMaxSampleRatioGt100adc_ = nullptr;
39  meEBUncalibRecHitsAmpFullMap_ = nullptr;
40  meEBUncalibRecHitsPedFullMap_ = 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 
128  c.get<EcalPedestalsRcd>().get(ecalPeds);
129 
130  // ----------------------
131  // loop over UncalibRecHits
133  uncalibRecHit != EBUncalibRecHit->end();
134  ++uncalibRecHit) {
135  EBDetId EBid = EBDetId(uncalibRecHit->id());
136 
137  // general checks
138  if (meEBUncalibRecHitsOccupancy_)
139  meEBUncalibRecHitsOccupancy_->Fill(EBid.ieta(), EBid.iphi());
140  if (meEBUncalibRecHitsAmplitude_)
141  meEBUncalibRecHitsAmplitude_->Fill(uncalibRecHit->amplitude());
142  if (meEBUncalibRecHitsPedestal_)
143  meEBUncalibRecHitsPedestal_->Fill(uncalibRecHit->pedestal());
144  if (meEBUncalibRecHitsJitter_)
145  meEBUncalibRecHitsJitter_->Fill(uncalibRecHit->jitter());
146  if (meEBUncalibRecHitsChi2_)
147  meEBUncalibRecHitsChi2_->Fill(uncalibRecHit->chi2());
148  if (meEBUncalibRecHitsAmpFullMap_)
149  meEBUncalibRecHitsAmpFullMap_->Fill(EBid.ieta(), EBid.iphi(), uncalibRecHit->amplitude());
150  if (meEBUncalibRecHitsPedFullMap_)
151  meEBUncalibRecHitsPedFullMap_->Fill(EBid.ieta(), EBid.iphi(), uncalibRecHit->pedestal());
152 
153  // general checks, with threshold at 3.5 GeV = 100 ADC counts
154  if (uncalibRecHit->amplitude() > 100) {
155  if (meEBUncalibRecHitsOccupancyGt100adc_)
156  meEBUncalibRecHitsOccupancyGt100adc_->Fill(EBid.ieta(), EBid.iphi());
157  if (meEBUncalibRecHitsAmplitudeGt100adc_)
158  meEBUncalibRecHitsAmplitudeGt100adc_->Fill(uncalibRecHit->amplitude());
159  if (meEBUncalibRecHitsPedestalGt100adc_)
160  meEBUncalibRecHitsPedestalGt100adc_->Fill(uncalibRecHit->pedestal());
161  if (meEBUncalibRecHitsJitterGt100adc_)
162  meEBUncalibRecHitsJitterGt100adc_->Fill(uncalibRecHit->jitter());
163  if (meEBUncalibRecHitsChi2Gt100adc_)
164  meEBUncalibRecHitsChi2Gt100adc_->Fill(uncalibRecHit->chi2());
165  }
166 
167  // supermodule maps
168  int ic = EBid.ic();
169  int ie = (ic - 1) / 20 + 1;
170  int ip = (ic - 1) % 20 + 1;
171  int ism = EBid.ism();
172  float xie = ie - 0.5;
173  float xip = ip - 0.5;
174  if (meEBUncalibRecHitPedMap_[ism - 1])
175  meEBUncalibRecHitPedMap_[ism - 1]->Fill(xie, xip, uncalibRecHit->pedestal());
176  if (meEBUncalibRecHitAmplMap_[ism - 1])
177  meEBUncalibRecHitAmplMap_[ism - 1]->Fill(xie, xip, uncalibRecHit->amplitude());
178 
179  if (!skipDigis) {
180  // find the rechit corresponding digi and the max sample
181  EBDigiCollection::const_iterator myDigi = EBDigi->find(EBid);
182  // int sMax = -1; // UNUSED
183  double eMax = 0.;
184  if (myDigi != EBDigi->end()) {
185  for (unsigned int sample = 0; sample < myDigi->size(); ++sample) {
186  EcalMGPASample thisSample = (*myDigi)[sample];
187  double analogSample = thisSample.adc();
188  if (eMax < analogSample) {
189  eMax = analogSample;
190  // sMax = sample; // UNUSED
191  }
192  }
193  } else
194  continue;
195 
196  // ratio uncalibratedRecHit amplitude + ped / max energy digi
197  const EcalPedestals *myped = ecalPeds.product();
198  EcalPedestalsMap::const_iterator it = myped->getMap().find(EBid);
199  if (it != myped->getMap().end()) {
200  if (eMax > (*it).mean_x1 + 5 * (*it).rms_x1 && eMax != 0) { // only real signal RecHit
201 
202  if (meEBUncalibRecHitMaxSampleRatio_)
203  meEBUncalibRecHitMaxSampleRatio_->Fill((uncalibRecHit->amplitude() + uncalibRecHit->pedestal()) / eMax);
204  if (meEBUncalibRecHitMaxSampleRatioGt100adc_ && (uncalibRecHit->amplitude() > 100))
205  meEBUncalibRecHitMaxSampleRatioGt100adc_->Fill((uncalibRecHit->amplitude() + uncalibRecHit->pedestal()) /
206  eMax);
207  LogDebug("EcalRecHitsTaskInfo")
208  << "barrel, eMax = " << eMax << " Amplitude = " << uncalibRecHit->amplitude() + uncalibRecHit->pedestal();
209  } else
210  continue;
211  } else
212  continue;
213  }
214 
215  } // loop over the UncalibratedRecHitCollection
216 }
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
EBDetId::ieta
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
mps_fire.i
i
Definition: mps_fire.py:428
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
EcalBarrelRecHitsValidation::~EcalBarrelRecHitsValidation
~EcalBarrelRecHitsValidation() override
Destructor.
Definition: EcalBarrelRecHitsValidation.cc:47
EBDetId::ic
int ic() const
get ECAL/crystal number inside SM
Definition: EBDetId.cc:41
edm::Run
Definition: Run.h:45
EBDetId
Definition: EBDetId.h:17
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
EBDetId.h
EcalBarrelRecHitsValidation::EcalBarrelRecHitsValidation
EcalBarrelRecHitsValidation(const edm::ParameterSet &ps)
Constructor.
Definition: EcalBarrelRecHitsValidation.cc:16
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
CollectionTags_cfi.EBDigi
EBDigi
Definition: CollectionTags_cfi.py:27
edm::SortedCollection
Definition: SortedCollection.h:49
EcalBarrelRecHitsValidation::bookHistograms
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
Analyze.
Definition: EcalBarrelRecHitsValidation.cc:49
DQMStore.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
EcalBarrelRecHitsValidation::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: EcalBarrelRecHitsValidation.cc:107
edm::Handle
Definition: AssociativeIterator.h:50
EcalMGPASample::adc
int adc() const
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:31
CollectionTags_cfi.EBUncalibRecHit
EBUncalibRecHit
Definition: CollectionTags_cfi.py:32
EcalBarrelRecHitsValidation.h
edm::ESHandle
Definition: DTSurvey.h:22
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
cosmicPhotonAnalyzer_cfi.eMax
eMax
Definition: cosmicPhotonAnalyzer_cfi.py:10
EBDigiCollection
Definition: EcalDigiCollections.h:56
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
get
#define get
EcalMGPASample
Definition: EcalMGPASample.h:22
ecalpyutils::ism
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:51
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
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm::implementation::IBooker
Definition: DQMStore.h:43
EBDetId::ism
int ism() const
get the ECAL/SM id
Definition: EBDetId.h:59
EcalCondObjectContainer::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondObjectContainer.h:19
EBDetId::iphi
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
EcalPedestalsRcd
Definition: EcalPedestalsRcd.h:5
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