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