CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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  // ----------------------
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  // get hold of back-end interface
28  dbe_ = 0;
29  dbe_ = Service<DQMStore>().operator->();
30  if ( dbe_ ) {
31  if ( verbose_ ) {
32  dbe_->setVerbose(1);
33  } else {
34  dbe_->setVerbose(0);
35  }
36  }
37  if ( dbe_ ) {
38  if ( verbose_ ) dbe_->showDirStructure();
39  }
40 
41 
42  // ----------------------
43  meEEUncalibRecHitsOccupancyPlus_ = 0;
44  meEEUncalibRecHitsOccupancyMinus_ = 0;
45  meEEUncalibRecHitsAmplitude_ = 0;
46  meEEUncalibRecHitsPedestal_ = 0;
47  meEEUncalibRecHitsJitter_ = 0;
48  meEEUncalibRecHitsChi2_ = 0;
49  meEEUncalibRecHitMaxSampleRatio_ = 0;
50  meEEUncalibRecHitsOccupancyPlusGt60adc_ = 0;
51  meEEUncalibRecHitsOccupancyMinusGt60adc_ = 0;
52  meEEUncalibRecHitsAmplitudeGt60adc_ = 0;
53  meEEUncalibRecHitsPedestalGt60adc_ = 0;
54  meEEUncalibRecHitsJitterGt60adc_ = 0;
55  meEEUncalibRecHitsChi2Gt60adc_ = 0;
56  meEEUncalibRecHitMaxSampleRatioGt60adc_ = 0;
57  meEEUncalibRecHitsAmpFullMap_ = 0;
58  meEEUncalibRecHitsPedFullMap_ = 0;
59 
60  // ----------------------
61  Char_t histo[200];
62 
63  if ( dbe_ )
64  {
65  dbe_->setCurrentFolder("EcalRecHitsV/EcalEndcapRecHitsTask");
66 
67  sprintf (histo, "EE+ Occupancy" );
68  meEEUncalibRecHitsOccupancyPlus_ = dbe_->book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
69 
70  sprintf (histo, "EE- Occupancy" );
71  meEEUncalibRecHitsOccupancyMinus_ = dbe_->book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
72 
73  sprintf (histo, "EE Amplitude" );
74  meEEUncalibRecHitsAmplitude_ = dbe_->book1D(histo, histo, 201, -20., 4000.);
75 
76  sprintf (histo, "EE Pedestal" );
77  meEEUncalibRecHitsPedestal_ = dbe_->book1D(histo, histo, 50, 190., 210.);
78 
79  sprintf (histo, "EE Jitter" );
80  meEEUncalibRecHitsJitter_ = dbe_->book1D(histo, histo, 100, 0., 100.);
81 
82  sprintf (histo, "EE Chi2" );
83  meEEUncalibRecHitsChi2_ = dbe_->book1D(histo, histo, 100, 18000., 22000.);
84 
85  sprintf (histo, "EE RecHit Max Sample Ratio");
86  meEEUncalibRecHitMaxSampleRatio_ = dbe_->book1D(histo, histo, 120, 0.90, 1.05);
87 
88  sprintf (histo, "EE+ Occupancy gt 60 adc counts" );
89  meEEUncalibRecHitsOccupancyPlusGt60adc_ = dbe_->book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
90 
91  sprintf (histo, "EE- Occupancy gt 60 adc counts" );
92  meEEUncalibRecHitsOccupancyMinusGt60adc_ = dbe_->book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
93 
94  sprintf (histo, "EE Amplitude gt 60 adc counts" );
95  meEEUncalibRecHitsAmplitudeGt60adc_ = dbe_->book1D(histo, histo, 200, 0., 4000.);
96 
97  sprintf (histo, "EE Pedestal gt 60 adc counts" );
98  meEEUncalibRecHitsPedestalGt60adc_ = dbe_->book1D(histo, histo, 50, 190., 210.);
99 
100  sprintf (histo, "EE Jitter gt 60 adc counts" );
101  meEEUncalibRecHitsJitterGt60adc_ = dbe_->book1D(histo, histo, 100, 0., 100.);
102 
103  sprintf (histo, "EE Chi2 gt 60 adc counts" );
104  meEEUncalibRecHitsChi2Gt60adc_ = dbe_->book1D(histo, histo, 100, 18000., 22000.);
105 
106  sprintf (histo, "EE RecHit Max Sample Ratio gt 60 adc counts");
107  meEEUncalibRecHitMaxSampleRatioGt60adc_ = dbe_->book1D(histo, histo, 120, 0.90, 1.05);
108 
109  sprintf (histo, "EE Amplitude Full Map");
110  meEEUncalibRecHitsAmpFullMap_ = dbe_->bookProfile2D(histo, histo, 100, 0., 100., 100, 0., 100., 200, 0., 4000.);
111 
112  sprintf (histo, "EE Pedestal Full Map");
113  meEEUncalibRecHitsPedFullMap_ = dbe_->bookProfile2D(histo, histo, 100, 0., 100., 100, 0., 100., 50, 194., 201.);
114  }
115 }
116 
118 
119 }
120 
122 
123 }
124 
126 
127 }
128 
130 
131  const EEUncalibratedRecHitCollection *EEUncalibRecHit = 0;
132  Handle< EEUncalibratedRecHitCollection > EcalUncalibRecHitEE;
133  e.getByToken( EEuncalibrechitCollection_token_, EcalUncalibRecHitEE);
134  if (EcalUncalibRecHitEE.isValid()) {
135  EEUncalibRecHit = EcalUncalibRecHitEE.product() ;
136  } else {
137  return;
138  }
139 
140  bool skipDigis = false;
141  const EEDigiCollection *EEDigi = 0;
142  Handle< EEDigiCollection > EcalDigiEE;
143  e.getByToken( EEdigiCollection_token_, EcalDigiEE);
144  if (EcalDigiEE.isValid()) {
145  EEDigi = EcalDigiEE.product();
146  } else {
147  skipDigis = true;
148  }
149 
151  c.get<EcalPedestalsRcd>().get(ecalPeds);
152 
153  // ----------------------
154  // loop over UncalibRecHits
155  for (EcalUncalibratedRecHitCollection::const_iterator uncalibRecHit = EEUncalibRecHit->begin(); uncalibRecHit != EEUncalibRecHit->end() ; ++uncalibRecHit)
156  {
157  EEDetId EEid = EEDetId(uncalibRecHit->id());
158 
159  int mySide = EEid.zside();
160 
161  // general checks
162  if (mySide > 0) { if (meEEUncalibRecHitsOccupancyPlus_) meEEUncalibRecHitsOccupancyPlus_ ->Fill(EEid.ix(), EEid.iy()); }
163  if (mySide < 0) { if (meEEUncalibRecHitsOccupancyMinus_) meEEUncalibRecHitsOccupancyMinus_ ->Fill(EEid.ix(), EEid.iy()); }
164  if (meEEUncalibRecHitsAmplitude_) meEEUncalibRecHitsAmplitude_ -> Fill(uncalibRecHit->amplitude());
165  if (meEEUncalibRecHitsPedestal_) meEEUncalibRecHitsPedestal_ -> Fill(uncalibRecHit->pedestal());
166  if (meEEUncalibRecHitsJitter_) meEEUncalibRecHitsJitter_ -> Fill(uncalibRecHit->jitter());
167  if (meEEUncalibRecHitsChi2_) meEEUncalibRecHitsChi2_ -> Fill(uncalibRecHit->chi2());
168  if (meEEUncalibRecHitsAmpFullMap_) meEEUncalibRecHitsAmpFullMap_ -> Fill(EEid.ix(), EEid.iy(), uncalibRecHit->amplitude());
169  if (meEEUncalibRecHitsPedFullMap_) meEEUncalibRecHitsPedFullMap_ -> Fill(EEid.ix(), EEid.iy(), uncalibRecHit->pedestal());
170 
171 
172  // general checks, with threshold at 60 ADC counts
173  if ( uncalibRecHit->amplitude() > 60 )
174  {
175  if (mySide > 0) { if (meEEUncalibRecHitsOccupancyPlusGt60adc_) meEEUncalibRecHitsOccupancyPlusGt60adc_ ->Fill(EEid.ix(), EEid.iy()); }
176  if (mySide < 0) { if (meEEUncalibRecHitsOccupancyMinusGt60adc_) meEEUncalibRecHitsOccupancyMinusGt60adc_->Fill(EEid.ix(), EEid.iy()); }
177  if (meEEUncalibRecHitsAmplitudeGt60adc_) meEEUncalibRecHitsAmplitudeGt60adc_ -> Fill(uncalibRecHit->amplitude());
178  if (meEEUncalibRecHitsPedestalGt60adc_) meEEUncalibRecHitsPedestalGt60adc_ -> Fill(uncalibRecHit->pedestal());
179  if (meEEUncalibRecHitsJitterGt60adc_) meEEUncalibRecHitsJitterGt60adc_ -> Fill(uncalibRecHit->jitter());
180  if (meEEUncalibRecHitsChi2Gt60adc_) meEEUncalibRecHitsChi2Gt60adc_ -> Fill(uncalibRecHit->chi2());
181  }
182 
183  if ( ! skipDigis ) {
184  // Find the rechit corresponding digi
185  EEDigiCollection::const_iterator myDigi = EEDigi->find(EEid);
186  // int sMax = -1; // UNUSED
187  double eMax = 0.;
188  if (myDigi != EEDigi->end()){
189  for (unsigned int sample = 0 ; sample < myDigi->size(); ++sample){
190  EcalMGPASample thisSample = (*myDigi)[sample];
191  double analogSample = thisSample.adc();
192  if ( eMax < analogSample ){
193  eMax = analogSample;
194  // sMax = sample; // UNUSED
195  }
196  }
197  }
198  else
199  continue;
200 
201  // ratio uncalibratedRecHit amplitude + ped / max energy digi
202  const EcalPedestals* myped = ecalPeds.product();
203  EcalPedestalsMap::const_iterator it=myped->getMap().find( EEid );
204  if( it != myped->getMap().end() ){
205 
206  if (eMax > (*it).mean_x1 + 5 * (*it).rms_x1 && eMax != 0 ){ //only real signal RecHit
207 
208  if ( meEEUncalibRecHitMaxSampleRatio_ )
209  { meEEUncalibRecHitMaxSampleRatio_->Fill( (uncalibRecHit->amplitude()+uncalibRecHit->pedestal())/eMax); }
210 
211  if ( meEEUncalibRecHitMaxSampleRatioGt60adc_ && (uncalibRecHit->amplitude() > 60) )
212  { meEEUncalibRecHitMaxSampleRatioGt60adc_->Fill( (uncalibRecHit->amplitude()+uncalibRecHit->pedestal())/eMax); }
213 
214  LogDebug("EcalRecHitsTaskInfo") << "endcap, eMax = " << eMax << " Amplitude = " << uncalibRecHit->amplitude()+uncalibRecHit->pedestal();
215  }
216  else
217  continue;
218  }
219  else
220  continue;
221  }
222  } // loop over the UncalibratedRecHitCollection
223 
224 }
#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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
const self & getMap() const
std::vector< EcalUncalibratedRecHit >::const_iterator const_iterator
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
const_iterator find(id_type i) const
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int zside() const
Definition: EEDetId.h:70
int iy() const
Definition: EEDetId.h:82
bool isValid() const
Definition: HandleBase.h:75
DQMStore * dbe_
const_iterator end() const
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:55
std::vector< Item >::const_iterator const_iterator
T const * product() const
Definition: ESHandle.h:86
const_iterator end() const
const_iterator find(uint32_t rawId) const
const_iterator end() const
const_iterator begin() const
int adc() const
get the ADC sample (12 bits)