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 }
EcalBarrelRecHitsValidation::meEBUncalibRecHitsChi2Gt100adc_
MonitorElement * meEBUncalibRecHitsChi2Gt100adc_
Definition: EcalBarrelRecHitsValidation.h:68
EcalCondObjectContainer::getMap
const self & getMap() const
Definition: EcalCondObjectContainer.h:78
EcalCondObjectContainer::end
const_iterator end() const
Definition: EcalCondObjectContainer.h:74
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
EcalBarrelRecHitsValidation::EBdigiCollection_token_
edm::EDGetTokenT< EBDigiCollection > EBdigiCollection_token_
Definition: EcalBarrelRecHitsValidation.h:54
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
EcalBarrelRecHitsValidation::meEBUncalibRecHitsChi2_
MonitorElement * meEBUncalibRecHitsChi2_
Definition: EcalBarrelRecHitsValidation.h:62
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
EcalBarrelRecHitsValidation::meEBUncalibRecHitsAmpFullMap_
MonitorElement * meEBUncalibRecHitsAmpFullMap_
Definition: EcalBarrelRecHitsValidation.h:70
EcalBarrelRecHitsValidation::meEBUncalibRecHitAmplMap_
MonitorElement * meEBUncalibRecHitAmplMap_[36]
Definition: EcalBarrelRecHitsValidation.h:72
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:278
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
EcalBarrelRecHitsValidation::meEBUncalibRecHitsPedestal_
MonitorElement * meEBUncalibRecHitsPedestal_
Definition: EcalBarrelRecHitsValidation.h:60
EcalBarrelRecHitsValidation::meEBUncalibRecHitsOccupancy_
MonitorElement * meEBUncalibRecHitsOccupancy_
Definition: EcalBarrelRecHitsValidation.h:58
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
EcalBarrelRecHitsValidation::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: EcalBarrelRecHitsValidation.cc:107
EcalBarrelRecHitsValidation::meEBUncalibRecHitsOccupancyGt100adc_
MonitorElement * meEBUncalibRecHitsOccupancyGt100adc_
Definition: EcalBarrelRecHitsValidation.h:64
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::meEBUncalibRecHitMaxSampleRatioGt100adc_
MonitorElement * meEBUncalibRecHitMaxSampleRatioGt100adc_
Definition: EcalBarrelRecHitsValidation.h:69
EcalBarrelRecHitsValidation.h
EcalBarrelRecHitsValidation::meEBUncalibRecHitMaxSampleRatio_
MonitorElement * meEBUncalibRecHitMaxSampleRatio_
Definition: EcalBarrelRecHitsValidation.h:63
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
EcalBarrelRecHitsValidation::meEBUncalibRecHitsJitterGt100adc_
MonitorElement * meEBUncalibRecHitsJitterGt100adc_
Definition: EcalBarrelRecHitsValidation.h:67
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
EcalBarrelRecHitsValidation::verbose_
bool verbose_
Definition: EcalBarrelRecHitsValidation.h:51
EcalBarrelRecHitsValidation::meEBUncalibRecHitsPedFullMap_
MonitorElement * meEBUncalibRecHitsPedFullMap_
Definition: EcalBarrelRecHitsValidation.h:71
EcalBarrelRecHitsValidation::meEBUncalibRecHitsAmplitude_
MonitorElement * meEBUncalibRecHitsAmplitude_
Definition: EcalBarrelRecHitsValidation.h:59
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
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:58
EcalBarrelRecHitsValidation::EBuncalibrechitCollection_token_
edm::EDGetTokenT< EBUncalibratedRecHitCollection > EBuncalibrechitCollection_token_
Definition: EcalBarrelRecHitsValidation.h:55
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
EcalBarrelRecHitsValidation::meEBUncalibRecHitsPedestalGt100adc_
MonitorElement * meEBUncalibRecHitsPedestalGt100adc_
Definition: EcalBarrelRecHitsValidation.h:66
EcalBarrelRecHitsValidation::meEBUncalibRecHitsAmplitudeGt100adc_
MonitorElement * meEBUncalibRecHitsAmplitudeGt100adc_
Definition: EcalBarrelRecHitsValidation.h:65
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
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
EcalBarrelRecHitsValidation::meEBUncalibRecHitPedMap_
MonitorElement * meEBUncalibRecHitPedMap_[36]
Definition: EcalBarrelRecHitsValidation.h:73
EcalBarrelRecHitsValidation::meEBUncalibRecHitsJitter_
MonitorElement * meEBUncalibRecHitsJitter_
Definition: EcalBarrelRecHitsValidation.h:61
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
EcalBarrelRecHitsValidation::ecalPeds
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > ecalPeds
Definition: EcalBarrelRecHitsValidation.h:56