CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes
EcalDigisValidation Class Reference

#include <EcalDigisValidation.h>

Inheritance diagram for EcalDigisValidation:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 EcalDigisValidation (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~EcalDigisValidation ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void analyze (edm::Event const &e, edm::EventSetup const &c)
 Analyze. More...
 
void beginRun (edm::Run const &, edm::EventSetup const &c)
 
void endJob (void)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Types

typedef std::map< uint32_t,
float, std::less< uint32_t > > 
MapType
 

Private Member Functions

void checkCalibrations (edm::EventSetup const &c)
 

Private Attributes

double barrelADCtoGeV_
 
edm::EDGetTokenT
< CrossingFrame< PCaloHit > > 
crossingFramePCaloHitEBToken_
 
edm::EDGetTokenT
< CrossingFrame< PCaloHit > > 
crossingFramePCaloHitEEToken_
 
edm::EDGetTokenT
< CrossingFrame< PCaloHit > > 
crossingFramePCaloHitESToken_
 
DQMStoredbe_
 
edm::EDGetTokenT
< EBDigiCollection
EBdigiCollectionToken_
 
edm::EDGetTokenT
< EEDigiCollection
EEdigiCollectionToken_
 
double endcapADCtoGeV_
 
edm::EDGetTokenT
< ESDigiCollection
ESdigiCollectionToken_
 
edm::EDGetTokenT
< edm::SimTrackContainer
g4TkInfoToken_
 
edm::EDGetTokenT
< edm::SimVertexContainer
g4VtxInfoToken_
 
std::map< int, double,
std::less< int > > 
gainConv_
 
edm::EDGetTokenT
< edm::HepMCProduct
HepMCToken_
 
MonitorElementmeEBDigiSimRatio_
 
MonitorElementmeEBDigiSimRatiogt100ADC_
 
MonitorElementmeEBDigiSimRatiogt10ADC_
 
MonitorElementmeEEDigiSimRatio_
 
MonitorElementmeEEDigiSimRatiogt100ADC_
 
MonitorElementmeEEDigiSimRatiogt20ADC_
 
MonitorElementmeGunEnergy_
 
MonitorElementmeGunEta_
 
MonitorElementmeGunPhi_
 
std::string outputFile_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 47 of file EcalDigisValidation.h.

Member Typedef Documentation

typedef std::map<uint32_t,float,std::less<uint32_t> > EcalDigisValidation::MapType
private

Definition at line 49 of file EcalDigisValidation.h.

Constructor & Destructor Documentation

EcalDigisValidation::EcalDigisValidation ( const edm::ParameterSet ps)

Constructor.

Definition at line 14 of file EcalDigisValidation.cc.

References barrelADCtoGeV_, dbe_, endcapADCtoGeV_, gainConv_, edm::ParameterSet::getUntrackedParameter(), timingPdfMaker::histo, meEBDigiSimRatio_, meEBDigiSimRatiogt100ADC_, meEBDigiSimRatiogt10ADC_, meEEDigiSimRatio_, meEEDigiSimRatiogt100ADC_, meEEDigiSimRatiogt20ADC_, meGunEnergy_, meGunEta_, meGunPhi_, cppFunctionSkipper::operator, outputFile_, AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.

14  :
15  HepMCToken_( consumes<edm::HepMCProduct>( edm::InputTag( ps.getParameter<std::string>( "moduleLabelMC" ) ) ) ),
16  g4TkInfoToken_( consumes<edm::SimTrackContainer>( edm::InputTag( ps.getParameter<std::string>( "moduleLabelG4" ) ) ) ),
17  g4VtxInfoToken_( consumes<edm::SimVertexContainer>( edm::InputTag( ps.getParameter<std::string>( "moduleLabelG4" ) ) ) ),
18  EBdigiCollectionToken_( consumes<EBDigiCollection>( ps.getParameter<edm::InputTag>( "EBdigiCollection" ) ) ),
19  EEdigiCollectionToken_( consumes<EEDigiCollection>( ps.getParameter<edm::InputTag>( "EEdigiCollection" ) ) ),
20  ESdigiCollectionToken_( consumes<ESDigiCollection>( ps.getParameter<edm::InputTag>( "ESdigiCollection" ) ) ),
22  , ps.getParameter<std::string>( "moduleLabelG4" ) + std::string( "EcalHitsEB" )
23  )
24  )
25  ),
27  , ps.getParameter<std::string>( "moduleLabelG4" ) + std::string( "EcalHitsEE" )
28  )
29  )
30  ),
32  , ps.getParameter<std::string>( "moduleLabelG4" ) + std::string( "EcalHitsES" )
33  )
34  )
35  ) {
36 
37 
38  // DQM ROOT output
39  outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "");
40 
41  if ( outputFile_.size() != 0 ) {
42  edm::LogInfo("OutputInfo") << " Ecal Digi Task histograms will be saved to '" << outputFile_.c_str() << "'";
43  } else {
44  edm::LogInfo("OutputInfo") << " Ecal Digi Task histograms will NOT be saved";
45  }
46 
47  // verbosity switch
48  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
49 
50  dbe_ = 0;
51 
52  // get hold of back-end interface
53  dbe_ = edm::Service<DQMStore>().operator->();
54 
55  if ( dbe_ ) {
56  if ( verbose_ ) {
57  dbe_->setVerbose(1);
58  } else {
59  dbe_->setVerbose(0);
60  }
61  }
62 
63  if ( dbe_ ) {
64  if ( verbose_ ) dbe_->showDirStructure();
65  }
66 
67  gainConv_[1] = 1.;
68  gainConv_[2] = 2.;
69  gainConv_[3] = 12.;
70  gainConv_[0] = 12.; // saturated channels
71  barrelADCtoGeV_ = 0.035;
72  endcapADCtoGeV_ = 0.06;
73 
74  meGunEnergy_ = 0;
75  meGunEta_ = 0;
76  meGunPhi_ = 0;
77 
80 
83 
86 
87  Char_t histo[200];
88 
89 
90  if ( dbe_ ) {
91  dbe_->setCurrentFolder("EcalDigisV/EcalDigiTask");
92 
93  sprintf (histo, "EcalDigiTask Gun Momentum" ) ;
94  meGunEnergy_ = dbe_->book1D(histo, histo, 100, 0., 1000.);
95 
96  sprintf (histo, "EcalDigiTask Gun Eta" ) ;
97  meGunEta_ = dbe_->book1D(histo, histo, 700, -3.5, 3.5);
98 
99  sprintf (histo, "EcalDigiTask Gun Phi" ) ;
100  meGunPhi_ = dbe_->book1D(histo, histo, 360, 0., 360.);
101 
102  sprintf (histo, "EcalDigiTask Barrel maximum Digi over Sim ratio" ) ;
103  meEBDigiSimRatio_ = dbe_->book1D(histo, histo, 100, 0., 2.) ;
104 
105  sprintf (histo, "EcalDigiTask Endcap maximum Digi over Sim ratio" ) ;
106  meEEDigiSimRatio_ = dbe_->book1D(histo, histo, 100, 0., 2.) ;
107 
108  sprintf (histo, "EcalDigiTask Barrel maximum Digi over Sim ratio gt 10 ADC" ) ;
109  meEBDigiSimRatiogt10ADC_ = dbe_->book1D(histo, histo, 100, 0., 2.) ;
110 
111  sprintf (histo, "EcalDigiTask Endcap maximum Digi over Sim ratio gt 20 ADC" ) ;
112  meEEDigiSimRatiogt20ADC_ = dbe_->book1D(histo, histo, 100, 0., 2.) ;
113 
114  sprintf (histo, "EcalDigiTask Barrel maximum Digi over Sim ratio gt 100 ADC" ) ;
115  meEBDigiSimRatiogt100ADC_ = dbe_->book1D(histo, histo, 100, 0., 2.) ;
116 
117  sprintf (histo, "EcalDigiTask Endcap maximum Digi over Sim ratio gt 100 ADC" ) ;
118  meEEDigiSimRatiogt100ADC_ = dbe_->book1D(histo, histo, 100, 0., 2.) ;
119 
120  }
121 
122 }
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< EBDigiCollection > EBdigiCollectionToken_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:1006
edm::EDGetTokenT< edm::SimVertexContainer > g4VtxInfoToken_
MonitorElement * meEEDigiSimRatiogt100ADC_
std::map< int, double, std::less< int > > gainConv_
MonitorElement * meGunEnergy_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
MonitorElement * meEBDigiSimRatiogt10ADC_
MonitorElement * meEBDigiSimRatio_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitESToken_
void setVerbose(unsigned level)
Definition: DQMStore.cc:683
MonitorElement * meGunEta_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEBToken_
MonitorElement * meEEDigiSimRatio_
MonitorElement * meGunPhi_
edm::EDGetTokenT< ESDigiCollection > ESdigiCollectionToken_
MonitorElement * meEEDigiSimRatiogt20ADC_
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken_
void showDirStructure(void) const
Definition: DQMStore.cc:3401
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEEToken_
MonitorElement * meEBDigiSimRatiogt100ADC_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:719
edm::EDGetTokenT< edm::SimTrackContainer > g4TkInfoToken_
EcalDigisValidation::~EcalDigisValidation ( )

Destructor.

Definition at line 124 of file EcalDigisValidation.cc.

References dbe_, outputFile_, and DQMStore::save().

124  {
125 
126  if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
127 
128 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2608

Member Function Documentation

void EcalDigisValidation::analyze ( edm::Event const &  e,
edm::EventSetup const &  c 
)
protectedvirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 140 of file EcalDigisValidation.cc.

References funct::abs(), EcalMGPASample::adc(), barrelADCtoGeV_, HLT_25ns14e33_v3_cff::barrelHits, crossingFramePCaloHitEBToken_, crossingFramePCaloHitEEToken_, crossingFramePCaloHitESToken_, EBdigiCollectionToken_, EEdigiCollectionToken_, endcapADCtoGeV_, HLT_25ns14e33_v3_cff::endcapHits, ESdigiCollectionToken_, edm::EventID::event(), MonitorElement::Fill(), g4TkInfoToken_, g4VtxInfoToken_, gainConv_, EcalMGPASample::gainId(), edm::Event::getByToken(), HepMCToken_, EEDataFrame::id(), EBDataFrame::id(), edm::EventBase::id(), EBDetId::ieta(), EBDetId::iphi(), GeomDetEnumerators::isBarrel(), GeomDetEnumerators::isEndcap(), edm::HandleBase::isValid(), EEDetId::ix(), EEDetId::iy(), cmsBatch::log, LogDebug, M_PI, EcalDataFrame::MAXSAMPLES, meEBDigiSimRatio_, meEBDigiSimRatiogt100ADC_, meEBDigiSimRatiogt10ADC_, meEEDigiSimRatio_, meEEDigiSimRatiogt100ADC_, meEEDigiSimRatiogt20ADC_, meGunEnergy_, meGunEta_, meGunPhi_, ecalTB2006H4_GenSimDigiReco_cfg::mySample, AlCaHLTBitMon_ParallelJobs::p, ESDetId::plane(), edm::Handle< T >::product(), DetId::rawId(), edm::EventID::run(), compare_using_db::sample, ESDetId::six(), ESDetId::siy(), EcalDataFrame::size(), edm::DataFrameContainer::size(), ESDetId::strip(), funct::tan(), ESDetId::zside(), and EEDetId::zside().

140  {
141 
142  edm::LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
143 
144  std::vector<SimTrack> theSimTracks;
145  std::vector<SimVertex> theSimVertexes;
146 
150  edm::Handle<CrossingFrame<PCaloHit> > crossingFrame;
154 
155  bool skipMC = false;
156  e.getByToken( HepMCToken_, MCEvt );
157  if (!MCEvt.isValid()) { skipMC = true; }
158  e.getByToken( g4TkInfoToken_, SimTk );
159  e.getByToken( g4VtxInfoToken_, SimVtx );
160 
161  const EBDigiCollection* EBdigis =0;
162  const EEDigiCollection* EEdigis =0;
163  const ESDigiCollection* ESdigis =0;
164 
165  bool isBarrel = true;
166  e.getByToken( EBdigiCollectionToken_, EcalDigiEB );
167  if (EcalDigiEB.isValid()) {
168  EBdigis = EcalDigiEB.product();
169  LogDebug("DigiInfo") << "total # EBdigis: " << EBdigis->size() ;
170  if ( EBdigis->size() == 0 ) isBarrel = false;
171  } else {
172  isBarrel = false;
173  }
174 
175  bool isEndcap = true;
176  e.getByToken( EEdigiCollectionToken_, EcalDigiEE );
177  if (EcalDigiEE.isValid()) {
178  EEdigis = EcalDigiEE.product();
179  LogDebug("DigiInfo") << "total # EEdigis: " << EEdigis->size() ;
180  if ( EEdigis->size() == 0 ) isEndcap = false;
181  } else {
182  isEndcap = false;
183  }
184 
185  bool isPreshower = true;
186  e.getByToken( ESdigiCollectionToken_, EcalDigiES );
187  if (EcalDigiES.isValid()) {
188  ESdigis = EcalDigiES.product();
189  LogDebug("DigiInfo") << "total # ESdigis: " << ESdigis->size() ;
190  if ( ESdigis->size() == 0 ) isPreshower = false;
191  } else {
192  isPreshower = false;
193  }
194 
195  theSimTracks.insert(theSimTracks.end(),SimTk->begin(),SimTk->end());
196  theSimVertexes.insert(theSimVertexes.end(),SimVtx->begin(),SimVtx->end());
197 
198  if ( ! skipMC ) {
199  double theGunEnergy = 0.;
200  for ( HepMC::GenEvent::particle_const_iterator p = MCEvt->GetEvent()->particles_begin();
201  p != MCEvt->GetEvent()->particles_end(); ++p ) {
202 
203  theGunEnergy = (*p)->momentum().e();
204  double htheta = (*p)->momentum().theta();
205  double heta = -log(tan(htheta * 0.5));
206  double hphi = (*p)->momentum().phi();
207  hphi = (hphi>=0) ? hphi : hphi+2*M_PI;
208  hphi = hphi / M_PI * 180.;
209  LogDebug("EventInfo") << "Particle gun type form MC = " << abs((*p)->pdg_id()) << "\n" << "Energy = "<< (*p)->momentum().e() << " Eta = " << heta << " Phi = " << hphi;
210 
211  if (meGunEnergy_) meGunEnergy_->Fill(theGunEnergy);
212  if (meGunEta_) meGunEta_->Fill(heta);
213  if (meGunPhi_) meGunPhi_->Fill(hphi);
214 
215  }
216  }
217 
218  int nvtx = 0;
219  for (std::vector<SimVertex>::iterator isimvtx = theSimVertexes.begin();
220  isimvtx != theSimVertexes.end(); ++isimvtx){
221  LogDebug("EventInfo") <<" Vertex index = " << nvtx << " event Id = " << isimvtx->eventId().rawId() << "\n" << " vertex dump: " << *isimvtx ;
222  ++nvtx;
223  }
224 
225  int ntrk = 0;
226  for (std::vector<SimTrack>::iterator isimtrk = theSimTracks.begin();
227  isimtrk != theSimTracks.end(); ++isimtrk){
228  LogDebug("EventInfo") <<" Track index = " << ntrk << " track Id = " << isimtrk->trackId() << " event Id = " << isimtrk->eventId().rawId() << "\n" << " track dump: " << *isimtrk ;
229  ++ntrk;
230  }
231 
232  // BARREL
233 
234  // loop over simHits
235 
236  if ( isBarrel ) {
237 
238  e.getByToken( crossingFramePCaloHitEBToken_, crossingFrame );
239  std::auto_ptr<MixCollection<PCaloHit> >
240  barrelHits( new MixCollection<PCaloHit>( crossingFrame.product() ) );
241 
242  MapType ebSimMap;
243 
244  for (MixCollection<PCaloHit>::MixItr hitItr = barrelHits->begin () ;
245  hitItr != barrelHits->end () ;
246  ++hitItr) {
247 
248  EBDetId ebid = EBDetId(hitItr->id()) ;
249 
250  LogDebug("HitInfo")
251  << " CaloHit " << hitItr->getName() << "\n"
252  << " DetID = " << hitItr->id()<< " EBDetId = " << ebid.ieta() << " " << ebid.iphi() << "\n"
253  << " Time = " << hitItr->time() << " Event id. = " << hitItr->eventId().rawId() << "\n"
254  << " Track Id = " << hitItr->geantTrackId() << "\n"
255  << " Energy = " << hitItr->energy();
256 
257  uint32_t crystid = ebid.rawId();
258  ebSimMap[crystid] += hitItr->energy();
259 
260  }
261 
262  // loop over Digis
263 
264  const EBDigiCollection * barrelDigi = EcalDigiEB.product () ;
265 
266  std::vector<double> ebAnalogSignal ;
267  std::vector<double> ebADCCounts ;
268  std::vector<double> ebADCGains ;
269  ebAnalogSignal.reserve(EBDataFrame::MAXSAMPLES);
270  ebADCCounts.reserve(EBDataFrame::MAXSAMPLES);
271  ebADCGains.reserve(EBDataFrame::MAXSAMPLES);
272 
273  for (unsigned int digis=0; digis<EcalDigiEB->size(); ++digis) {
274 
275  EBDataFrame ebdf=(*barrelDigi)[digis];
276  int nrSamples=ebdf.size();
277 
278  EBDetId ebid = ebdf.id () ;
279 
280  double Emax = 0. ;
281  int Pmax = 0 ;
282  double pedestalPreSample = 0.;
283  double pedestalPreSampleAnalog = 0.;
284 
285  for (int sample = 0 ; sample < nrSamples; ++sample) {
286  ebAnalogSignal[sample] = 0.;
287  ebADCCounts[sample] = 0.;
288  ebADCGains[sample] = -1.;
289  }
290 
291  for (int sample = 0 ; sample < nrSamples; ++sample) {
292 
294 
295  ebADCCounts[sample] = (mySample.adc()) ;
296  ebADCGains[sample] = (mySample.gainId()) ;
297  ebAnalogSignal[sample] = (ebADCCounts[sample]*gainConv_[(int)ebADCGains[sample]]*barrelADCtoGeV_);
298  if (Emax < ebAnalogSignal[sample] ) {
299  Emax = ebAnalogSignal[sample] ;
300  Pmax = sample ;
301  }
302  if ( sample < 3 ) {
303  pedestalPreSample += ebADCCounts[sample] ;
304  pedestalPreSampleAnalog += ebADCCounts[sample]*gainConv_[(int)ebADCGains[sample]]*barrelADCtoGeV_ ;
305  }
306  LogDebug("DigiInfo") << "EB sample " << sample << " ADC counts = " << ebADCCounts[sample] << " Gain Id = " << ebADCGains[sample] << " Analog eq = " << ebAnalogSignal[sample];
307  }
308 
309  pedestalPreSample /= 3. ;
310  pedestalPreSampleAnalog /= 3. ;
311  double Erec = Emax - pedestalPreSampleAnalog*gainConv_[(int)ebADCGains[Pmax]];
312 
313  if ( ebSimMap[ebid.rawId()] != 0. ) {
314  LogDebug("DigiInfo") << " Digi / Hit = " << Erec << " / " << ebSimMap[ebid.rawId()] << " gainConv " << gainConv_[(int)ebADCGains[Pmax]];
315  if ( meEBDigiSimRatio_ ) meEBDigiSimRatio_->Fill( Erec/ebSimMap[ebid.rawId()] ) ;
316  if ( Erec > 10.*barrelADCtoGeV_ && meEBDigiSimRatiogt10ADC_ ) meEBDigiSimRatiogt10ADC_->Fill( Erec/ebSimMap[ebid.rawId()] );
317  if ( Erec > 100.*barrelADCtoGeV_ && meEBDigiSimRatiogt100ADC_ ) meEBDigiSimRatiogt100ADC_->Fill( Erec/ebSimMap[ebid.rawId()] );
318 
319  }
320 
321  }
322 
323  }
324 
325  // ENDCAP
326 
327  // loop over simHits
328 
329  if ( isEndcap ) {
330 
331  e.getByToken( crossingFramePCaloHitEEToken_, crossingFrame );
332  std::auto_ptr<MixCollection<PCaloHit> >
333  endcapHits( new MixCollection<PCaloHit>( crossingFrame.product() ) );
334 
335  MapType eeSimMap;
336 
337  for (MixCollection<PCaloHit>::MixItr hitItr = endcapHits->begin () ;
338  hitItr != endcapHits->end () ;
339  ++hitItr) {
340 
341  EEDetId eeid = EEDetId(hitItr->id()) ;
342 
343  LogDebug("HitInfo")
344  << " CaloHit " << hitItr->getName() << "\n"
345  << " DetID = "<<hitItr->id()<< " EEDetId side = " << eeid.zside() << " = " << eeid.ix() << " " << eeid.iy() << "\n"
346  << " Time = " << hitItr->time() << " Event id. = " << hitItr->eventId().rawId() << "\n"
347  << " Track Id = " << hitItr->geantTrackId() << "\n"
348  << " Energy = " << hitItr->energy();
349 
350  uint32_t crystid = eeid.rawId();
351  eeSimMap[crystid] += hitItr->energy();
352 
353  }
354 
355  // loop over Digis
356 
357  const EEDigiCollection * endcapDigi = EcalDigiEE.product () ;
358 
359  std::vector<double> eeAnalogSignal ;
360  std::vector<double> eeADCCounts ;
361  std::vector<double> eeADCGains ;
362  eeAnalogSignal.reserve(EEDataFrame::MAXSAMPLES);
363  eeADCCounts.reserve(EEDataFrame::MAXSAMPLES);
364  eeADCGains.reserve(EEDataFrame::MAXSAMPLES);
365 
366  for (unsigned int digis=0; digis<EcalDigiEE->size(); ++digis) {
367 
368  EEDataFrame eedf=(*endcapDigi)[digis];
369  int nrSamples=eedf.size();
370 
371  EEDetId eeid = eedf.id () ;
372 
373  double Emax = 0. ;
374  int Pmax = 0 ;
375  double pedestalPreSample = 0.;
376  double pedestalPreSampleAnalog = 0.;
377 
378  for (int sample = 0 ; sample < nrSamples; ++sample) {
379  eeAnalogSignal[sample] = 0.;
380  eeADCCounts[sample] = 0.;
381  eeADCGains[sample] = -1.;
382  }
383 
384  for (int sample = 0 ; sample < nrSamples; ++sample) {
385 
386  EcalMGPASample mySample = eedf[sample];
387 
388  eeADCCounts[sample] = (mySample.adc()) ;
389  eeADCGains[sample] = (mySample.gainId()) ;
390  eeAnalogSignal[sample] = (eeADCCounts[sample]*gainConv_[(int)eeADCGains[sample]]*endcapADCtoGeV_);
391  if (Emax < eeAnalogSignal[sample] ) {
392  Emax = eeAnalogSignal[sample] ;
393  Pmax = sample ;
394  }
395  if ( sample < 3 ) {
396  pedestalPreSample += eeADCCounts[sample] ;
397  pedestalPreSampleAnalog += eeADCCounts[sample]*gainConv_[(int)eeADCGains[sample]]*endcapADCtoGeV_ ;
398  }
399  LogDebug("DigiInfo") << "EE sample " << sample << " ADC counts = " << eeADCCounts[sample] << " Gain Id = " << eeADCGains[sample] << " Analog eq = " << eeAnalogSignal[sample];
400  }
401  pedestalPreSample /= 3. ;
402  pedestalPreSampleAnalog /= 3. ;
403  double Erec = Emax - pedestalPreSampleAnalog*gainConv_[(int)eeADCGains[Pmax]];
404 
405  if (eeSimMap[eeid.rawId()] != 0. ) {
406  LogDebug("DigiInfo") << " Digi / Hit = " << Erec << " / " << eeSimMap[eeid.rawId()] << " gainConv " << gainConv_[(int)eeADCGains[Pmax]];
407  if ( meEEDigiSimRatio_) meEEDigiSimRatio_->Fill( Erec/eeSimMap[eeid.rawId()] ) ;
408  if ( Erec > 20.*endcapADCtoGeV_ && meEEDigiSimRatiogt20ADC_ ) meEEDigiSimRatiogt20ADC_->Fill( Erec/eeSimMap[eeid.rawId()] );
409  if ( Erec > 100.*endcapADCtoGeV_ && meEEDigiSimRatiogt100ADC_ ) meEEDigiSimRatiogt100ADC_->Fill( Erec/eeSimMap[eeid.rawId()] );
410  }
411 
412  }
413 
414  }
415 
416  if ( isPreshower) {
417 
418  e.getByToken( crossingFramePCaloHitESToken_, crossingFrame );
419  std::auto_ptr<MixCollection<PCaloHit> >
420  preshowerHits (new MixCollection<PCaloHit>(crossingFrame.product ()));
421 
422  for (MixCollection<PCaloHit>::MixItr hitItr = preshowerHits->begin () ;
423  hitItr != preshowerHits->end () ;
424  ++hitItr) {
425 
426  ESDetId esid = ESDetId(hitItr->id()) ;
427 
428  LogDebug("HitInfo")
429  << " CaloHit " << hitItr->getName() << "\n"
430  << " DetID = " << hitItr->id()<< "ESDetId: z side " << esid.zside() << " plane " << esid.plane() << esid.six() << ',' << esid.siy() << ':' << esid.strip() << "\n"
431  << " Time = " << hitItr->time() << " Event id. = " << hitItr->eventId().rawId() << "\n"
432  << " Track Id = " << hitItr->geantTrackId() << "\n"
433  << " Energy = " << hitItr->energy();
434 
435  }
436 
437  }
438 
439 }
#define LogDebug(id)
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
int strip() const
Definition: ESDetId.h:52
int ix() const
Definition: EEDetId.h:76
key_type id() const
Definition: EBDataFrame.h:31
edm::EDGetTokenT< EBDigiCollection > EBdigiCollectionToken_
std::map< uint32_t, float, std::less< uint32_t > > MapType
bool isBarrel(GeomDetEnumerators::SubDetector m)
edm::EDGetTokenT< edm::SimVertexContainer > g4VtxInfoToken_
int six() const
Definition: ESDetId.h:48
MonitorElement * meEEDigiSimRatiogt100ADC_
std::map< int, double, std::less< int > > gainConv_
int gainId() const
get the gainId (2 bits)
int size() const
Definition: EcalDataFrame.h:26
MonitorElement * meGunEnergy_
void Fill(long long x)
int iphi() const
get the crystal iphi
Definition: EBDetId.h:53
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
MonitorElement * meEBDigiSimRatiogt10ADC_
MonitorElement * meEBDigiSimRatio_
int siy() const
Definition: ESDetId.h:50
int zside() const
Definition: EEDetId.h:70
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitESToken_
int iy() const
Definition: EEDetId.h:82
int ieta() const
get the crystal ieta
Definition: EBDetId.h:51
int zside() const
Definition: ESDetId.h:44
bool isValid() const
Definition: HandleBase.h:75
MonitorElement * meGunEta_
bool isEndcap(GeomDetEnumerators::SubDetector m)
#define M_PI
key_type id() const
Definition: EEDataFrame.h:28
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEBToken_
T const * product() const
Definition: Handle.h:81
MonitorElement * meEEDigiSimRatio_
MonitorElement * meGunPhi_
int plane() const
Definition: ESDetId.h:46
edm::EDGetTokenT< ESDigiCollection > ESdigiCollectionToken_
MonitorElement * meEEDigiSimRatiogt20ADC_
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEEToken_
MonitorElement * meEBDigiSimRatiogt100ADC_
static const int MAXSAMPLES
Definition: EcalDataFrame.h:48
edm::EDGetTokenT< edm::SimTrackContainer > g4TkInfoToken_
int adc() const
get the ADC sample (12 bits)
tuple log
Definition: cmsBatch.py:347
void EcalDigisValidation::beginRun ( edm::Run const &  ,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 130 of file EcalDigisValidation.cc.

References checkCalibrations().

130  {
131 
133 
134 }
void checkCalibrations(edm::EventSetup const &c)
void EcalDigisValidation::checkCalibrations ( edm::EventSetup const &  c)
private

Definition at line 441 of file EcalDigisValidation.cc.

References barrelADCtoGeV_, endcapADCtoGeV_, EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), gainConv_, edm::EventSetup::get(), EcalADCToGeVConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), LogDebug, and edm::ESHandle< class >::product().

Referenced by beginRun().

442 {
443 
444  // ADC -> GeV Scale
446  eventSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
447  const EcalADCToGeVConstant* agc = pAgc.product();
448 
449  EcalMGPAGainRatio * defaultRatios = new EcalMGPAGainRatio();
450 
451  gainConv_[1] = 1.;
452  gainConv_[2] = defaultRatios->gain12Over6() ;
453  gainConv_[3] = gainConv_[2]*(defaultRatios->gain6Over1()) ;
454  gainConv_[0] = gainConv_[2]*(defaultRatios->gain6Over1()) ; // saturated channels
455 
456  LogDebug("EcalDigi") << " Gains conversions: " << "\n" << " g1 = " << gainConv_[1] << "\n" << " g2 = " << gainConv_[2] << "\n" << " g3 = " << gainConv_[3];
457  LogDebug("EcalDigi") << " Gains conversions: " << "\n" << " saturation = " << gainConv_[0];
458 
459  delete defaultRatios;
460 
461  const double barrelADCtoGeV_ = agc->getEBValue();
462  LogDebug("EcalDigi") << " Barrel GeV/ADC = " << barrelADCtoGeV_;
463  const double endcapADCtoGeV_ = agc->getEEValue();
464  LogDebug("EcalDigi") << " Endcap GeV/ADC = " << endcapADCtoGeV_;
465 
466 }
#define LogDebug(id)
std::map< int, double, std::less< int > > gainConv_
float gain6Over1() const
T const * product() const
Definition: ESHandle.h:86
float gain12Over6() const
void EcalDigisValidation::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 136 of file EcalDigisValidation.cc.

136  {
137 
138 }

Member Data Documentation

double EcalDigisValidation::barrelADCtoGeV_
private

Definition at line 92 of file EcalDigisValidation.h.

Referenced by analyze(), checkCalibrations(), and EcalDigisValidation().

edm::EDGetTokenT< CrossingFrame<PCaloHit> > EcalDigisValidation::crossingFramePCaloHitEBToken_
private

Definition at line 88 of file EcalDigisValidation.h.

Referenced by analyze().

edm::EDGetTokenT< CrossingFrame<PCaloHit> > EcalDigisValidation::crossingFramePCaloHitEEToken_
private

Definition at line 88 of file EcalDigisValidation.h.

Referenced by analyze().

edm::EDGetTokenT< CrossingFrame<PCaloHit> > EcalDigisValidation::crossingFramePCaloHitESToken_
private

Definition at line 88 of file EcalDigisValidation.h.

Referenced by analyze().

DQMStore* EcalDigisValidation::dbe_
private

Definition at line 76 of file EcalDigisValidation.h.

Referenced by EcalDigisValidation(), and ~EcalDigisValidation().

edm::EDGetTokenT<EBDigiCollection> EcalDigisValidation::EBdigiCollectionToken_
private

Definition at line 84 of file EcalDigisValidation.h.

Referenced by analyze().

edm::EDGetTokenT<EEDigiCollection> EcalDigisValidation::EEdigiCollectionToken_
private

Definition at line 85 of file EcalDigisValidation.h.

Referenced by analyze().

double EcalDigisValidation::endcapADCtoGeV_
private

Definition at line 93 of file EcalDigisValidation.h.

Referenced by analyze(), checkCalibrations(), and EcalDigisValidation().

edm::EDGetTokenT<ESDigiCollection> EcalDigisValidation::ESdigiCollectionToken_
private

Definition at line 86 of file EcalDigisValidation.h.

Referenced by analyze().

edm::EDGetTokenT<edm::SimTrackContainer> EcalDigisValidation::g4TkInfoToken_
private

Definition at line 81 of file EcalDigisValidation.h.

Referenced by analyze().

edm::EDGetTokenT<edm::SimVertexContainer> EcalDigisValidation::g4VtxInfoToken_
private

Definition at line 82 of file EcalDigisValidation.h.

Referenced by analyze().

std::map<int, double, std::less<int> > EcalDigisValidation::gainConv_
private

Definition at line 90 of file EcalDigisValidation.h.

Referenced by analyze(), checkCalibrations(), and EcalDigisValidation().

edm::EDGetTokenT<edm::HepMCProduct> EcalDigisValidation::HepMCToken_
private

Definition at line 80 of file EcalDigisValidation.h.

Referenced by analyze().

MonitorElement* EcalDigisValidation::meEBDigiSimRatio_
private

Definition at line 99 of file EcalDigisValidation.h.

Referenced by analyze(), and EcalDigisValidation().

MonitorElement* EcalDigisValidation::meEBDigiSimRatiogt100ADC_
private

Definition at line 105 of file EcalDigisValidation.h.

Referenced by analyze(), and EcalDigisValidation().

MonitorElement* EcalDigisValidation::meEBDigiSimRatiogt10ADC_
private

Definition at line 102 of file EcalDigisValidation.h.

Referenced by analyze(), and EcalDigisValidation().

MonitorElement* EcalDigisValidation::meEEDigiSimRatio_
private

Definition at line 100 of file EcalDigisValidation.h.

Referenced by analyze(), and EcalDigisValidation().

MonitorElement* EcalDigisValidation::meEEDigiSimRatiogt100ADC_
private

Definition at line 106 of file EcalDigisValidation.h.

Referenced by analyze(), and EcalDigisValidation().

MonitorElement* EcalDigisValidation::meEEDigiSimRatiogt20ADC_
private

Definition at line 103 of file EcalDigisValidation.h.

Referenced by analyze(), and EcalDigisValidation().

MonitorElement* EcalDigisValidation::meGunEnergy_
private

Definition at line 95 of file EcalDigisValidation.h.

Referenced by analyze(), and EcalDigisValidation().

MonitorElement* EcalDigisValidation::meGunEta_
private

Definition at line 96 of file EcalDigisValidation.h.

Referenced by analyze(), and EcalDigisValidation().

MonitorElement* EcalDigisValidation::meGunPhi_
private

Definition at line 97 of file EcalDigisValidation.h.

Referenced by analyze(), and EcalDigisValidation().

std::string EcalDigisValidation::outputFile_
private

Definition at line 78 of file EcalDigisValidation.h.

Referenced by EcalDigisValidation(), and ~EcalDigisValidation().

bool EcalDigisValidation::verbose_
private

Definition at line 74 of file EcalDigisValidation.h.

Referenced by EcalDigisValidation().