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  // ----------------------
19  EEdigiCollection_token_ = consumes< EEDigiCollection > (ps.getParameter<edm::InputTag>("EEdigiCollection") );
20  EEuncalibrechitCollection_token_ = consumes< EEUncalibratedRecHitCollection > (ps.getParameter<edm::InputTag>("EEuncalibrechitCollection") );
21 
22  // ----------------------
23  // verbosity switch
24  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
25 
26  // ----------------------
27  meEEUncalibRecHitsOccupancyPlus_ = 0;
28  meEEUncalibRecHitsOccupancyMinus_ = 0;
29  meEEUncalibRecHitsAmplitude_ = 0;
30  meEEUncalibRecHitsPedestal_ = 0;
31  meEEUncalibRecHitsJitter_ = 0;
32  meEEUncalibRecHitsChi2_ = 0;
33  meEEUncalibRecHitMaxSampleRatio_ = 0;
34  meEEUncalibRecHitsOccupancyPlusGt60adc_ = 0;
35  meEEUncalibRecHitsOccupancyMinusGt60adc_ = 0;
36  meEEUncalibRecHitsAmplitudeGt60adc_ = 0;
37  meEEUncalibRecHitsPedestalGt60adc_ = 0;
38  meEEUncalibRecHitsJitterGt60adc_ = 0;
39  meEEUncalibRecHitsChi2Gt60adc_ = 0;
40  meEEUncalibRecHitMaxSampleRatioGt60adc_ = 0;
41  meEEUncalibRecHitsAmpFullMap_ = 0;
42  meEEUncalibRecHitsPedFullMap_ = 0;
43 
44 }
45 
47 
48 }
49 
51 
52  Char_t histo[200];
53 
54  ibooker.setCurrentFolder("EcalRecHitsV/EcalEndcapRecHitsTask");
55 
56  sprintf (histo, "EE+ Occupancy" );
57  meEEUncalibRecHitsOccupancyPlus_ = ibooker.book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
58 
59  sprintf (histo, "EE- Occupancy" );
60  meEEUncalibRecHitsOccupancyMinus_ = ibooker.book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
61 
62  sprintf (histo, "EE Amplitude" );
63  meEEUncalibRecHitsAmplitude_ = ibooker.book1D(histo, histo, 201, -20., 4000.);
64 
65  sprintf (histo, "EE Pedestal" );
66  meEEUncalibRecHitsPedestal_ = ibooker.book1D(histo, histo, 50, 190., 210.);
67 
68  sprintf (histo, "EE Jitter" );
69  meEEUncalibRecHitsJitter_ = ibooker.book1D(histo, histo, 100, 0., 100.);
70 
71  sprintf (histo, "EE Chi2" );
72  meEEUncalibRecHitsChi2_ = ibooker.book1D(histo, histo, 100, 18000., 22000.);
73 
74  sprintf (histo, "EE RecHit Max Sample Ratio");
75  meEEUncalibRecHitMaxSampleRatio_ = ibooker.book1D(histo, histo, 120, 0.90, 1.05);
76 
77  sprintf (histo, "EE+ Occupancy gt 60 adc counts" );
78  meEEUncalibRecHitsOccupancyPlusGt60adc_ = ibooker.book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
79 
80  sprintf (histo, "EE- Occupancy gt 60 adc counts" );
81  meEEUncalibRecHitsOccupancyMinusGt60adc_ = ibooker.book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
82 
83  sprintf (histo, "EE Amplitude gt 60 adc counts" );
84  meEEUncalibRecHitsAmplitudeGt60adc_ = ibooker.book1D(histo, histo, 200, 0., 4000.);
85 
86  sprintf (histo, "EE Pedestal gt 60 adc counts" );
87  meEEUncalibRecHitsPedestalGt60adc_ = ibooker.book1D(histo, histo, 50, 190., 210.);
88 
89  sprintf (histo, "EE Jitter gt 60 adc counts" );
90  meEEUncalibRecHitsJitterGt60adc_ = ibooker.book1D(histo, histo, 100, 0., 100.);
91 
92  sprintf (histo, "EE Chi2 gt 60 adc counts" );
93  meEEUncalibRecHitsChi2Gt60adc_ = ibooker.book1D(histo, histo, 100, 18000., 22000.);
94 
95  sprintf (histo, "EE RecHit Max Sample Ratio gt 60 adc counts");
96  meEEUncalibRecHitMaxSampleRatioGt60adc_ = ibooker.book1D(histo, histo, 120, 0.90, 1.05);
97 
98  sprintf (histo, "EE Amplitude Full Map");
99  meEEUncalibRecHitsAmpFullMap_ = ibooker.bookProfile2D(histo, histo, 100, 0., 100., 100, 0., 100., 200, 0., 4000.);
100 
101  sprintf (histo, "EE Pedestal Full Map");
102  meEEUncalibRecHitsPedFullMap_ = ibooker.bookProfile2D(histo, histo, 100, 0., 100., 100, 0., 100., 50, 194., 201.);
103 
104 }
105 
107 
108  const EEUncalibratedRecHitCollection *EEUncalibRecHit = 0;
109  Handle< EEUncalibratedRecHitCollection > EcalUncalibRecHitEE;
110  e.getByToken( EEuncalibrechitCollection_token_, EcalUncalibRecHitEE);
111  if (EcalUncalibRecHitEE.isValid()) {
112  EEUncalibRecHit = EcalUncalibRecHitEE.product() ;
113  } else {
114  return;
115  }
116 
117  bool skipDigis = false;
118  const EEDigiCollection *EEDigi = 0;
119  Handle< EEDigiCollection > EcalDigiEE;
120  e.getByToken( EEdigiCollection_token_, EcalDigiEE);
121  if (EcalDigiEE.isValid()) {
122  EEDigi = EcalDigiEE.product();
123  } else {
124  skipDigis = true;
125  }
126 
128  c.get<EcalPedestalsRcd>().get(ecalPeds);
129 
130  // ----------------------
131  // loop over UncalibRecHits
132  for (EcalUncalibratedRecHitCollection::const_iterator uncalibRecHit = EEUncalibRecHit->begin(); uncalibRecHit != EEUncalibRecHit->end() ; ++uncalibRecHit)
133  {
134  EEDetId EEid = EEDetId(uncalibRecHit->id());
135 
136  int mySide = EEid.zside();
137 
138  // general checks
139  if (mySide > 0) { if (meEEUncalibRecHitsOccupancyPlus_) meEEUncalibRecHitsOccupancyPlus_ ->Fill(EEid.ix(), EEid.iy()); }
140  if (mySide < 0) { if (meEEUncalibRecHitsOccupancyMinus_) meEEUncalibRecHitsOccupancyMinus_ ->Fill(EEid.ix(), EEid.iy()); }
141  if (meEEUncalibRecHitsAmplitude_) meEEUncalibRecHitsAmplitude_ -> Fill(uncalibRecHit->amplitude());
142  if (meEEUncalibRecHitsPedestal_) meEEUncalibRecHitsPedestal_ -> Fill(uncalibRecHit->pedestal());
143  if (meEEUncalibRecHitsJitter_) meEEUncalibRecHitsJitter_ -> Fill(uncalibRecHit->jitter());
144  if (meEEUncalibRecHitsChi2_) meEEUncalibRecHitsChi2_ -> Fill(uncalibRecHit->chi2());
145  if (meEEUncalibRecHitsAmpFullMap_) meEEUncalibRecHitsAmpFullMap_ -> Fill(EEid.ix(), EEid.iy(), uncalibRecHit->amplitude());
146  if (meEEUncalibRecHitsPedFullMap_) meEEUncalibRecHitsPedFullMap_ -> Fill(EEid.ix(), EEid.iy(), uncalibRecHit->pedestal());
147 
148 
149  // general checks, with threshold at 60 ADC counts
150  if ( uncalibRecHit->amplitude() > 60 )
151  {
152  if (mySide > 0) { if (meEEUncalibRecHitsOccupancyPlusGt60adc_) meEEUncalibRecHitsOccupancyPlusGt60adc_ ->Fill(EEid.ix(), EEid.iy()); }
153  if (mySide < 0) { if (meEEUncalibRecHitsOccupancyMinusGt60adc_) meEEUncalibRecHitsOccupancyMinusGt60adc_->Fill(EEid.ix(), EEid.iy()); }
154  if (meEEUncalibRecHitsAmplitudeGt60adc_) meEEUncalibRecHitsAmplitudeGt60adc_ -> Fill(uncalibRecHit->amplitude());
155  if (meEEUncalibRecHitsPedestalGt60adc_) meEEUncalibRecHitsPedestalGt60adc_ -> Fill(uncalibRecHit->pedestal());
156  if (meEEUncalibRecHitsJitterGt60adc_) meEEUncalibRecHitsJitterGt60adc_ -> Fill(uncalibRecHit->jitter());
157  if (meEEUncalibRecHitsChi2Gt60adc_) meEEUncalibRecHitsChi2Gt60adc_ -> Fill(uncalibRecHit->chi2());
158  }
159 
160  if ( ! skipDigis ) {
161  // Find the rechit corresponding digi
162  EEDigiCollection::const_iterator myDigi = EEDigi->find(EEid);
163  // int sMax = -1; // UNUSED
164  double eMax = 0.;
165  if (myDigi != EEDigi->end()){
166  for (unsigned int sample = 0 ; sample < myDigi->size(); ++sample){
167  EcalMGPASample thisSample = (*myDigi)[sample];
168  double analogSample = thisSample.adc();
169  if ( eMax < analogSample ){
170  eMax = analogSample;
171  // sMax = sample; // UNUSED
172  }
173  }
174  }
175  else
176  continue;
177 
178  // ratio uncalibratedRecHit amplitude + ped / max energy digi
179  const EcalPedestals* myped = ecalPeds.product();
180  EcalPedestalsMap::const_iterator it=myped->getMap().find( EEid );
181  if( it != myped->getMap().end() ){
182 
183  if (eMax > (*it).mean_x1 + 5 * (*it).rms_x1 && eMax != 0 ){ //only real signal RecHit
184 
185  if ( meEEUncalibRecHitMaxSampleRatio_ )
186  { meEEUncalibRecHitMaxSampleRatio_->Fill( (uncalibRecHit->amplitude()+uncalibRecHit->pedestal())/eMax); }
187 
188  if ( meEEUncalibRecHitMaxSampleRatioGt60adc_ && (uncalibRecHit->amplitude() > 60) )
189  { meEEUncalibRecHitMaxSampleRatioGt60adc_->Fill( (uncalibRecHit->amplitude()+uncalibRecHit->pedestal())/eMax); }
190 
191  LogDebug("EcalRecHitsTaskInfo") << "endcap, eMax = " << eMax << " Amplitude = " << uncalibRecHit->amplitude()+uncalibRecHit->pedestal();
192  }
193  else
194  continue;
195  }
196  else
197  continue;
198  }
199  } // loop over the UncalibratedRecHitCollection
200 
201 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
EcalEndcapRecHitsValidation(const edm::ParameterSet &ps)
Constructor.
int ix() const
Definition: EEDetId.h:76
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
const self & getMap() const
std::vector< EcalUncalibratedRecHit >::const_iterator const_iterator
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
const_iterator find(id_type i) const
MonitorElement * bookProfile2D(Args &&...args)
Definition: DQMStore.h:163
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int zside() const
Definition: EEDetId.h:70
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
int iy() const
Definition: EEDetId.h:82
bool isValid() const
Definition: HandleBase.h:75
const_iterator end() const
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
T const * product() const
Definition: Handle.h:81
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
const T & get() const
Definition: EventSetup.h:56
std::vector< Item >::const_iterator const_iterator
const_iterator end() const
HLT enums.
const_iterator find(uint32_t rawId) const
const_iterator end() const
T const * product() const
Definition: ESHandle.h:86
const_iterator begin() const
Definition: Run.h:42
int adc() const
get the ADC sample (12 bits)