test
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:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
 
 EcalDigisValidation (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~EcalDigisValidation ()
 Destructor. More...
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 dqmBeginRun (edm::Run const &, edm::EventSetup const &) override
 
- 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_
 
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::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 48 of file EcalDigisValidation.h.

Member Typedef Documentation

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

Definition at line 50 of file EcalDigisValidation.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 14 of file EcalDigisValidation.cc.

References barrelADCtoGeV_, endcapADCtoGeV_, gainConv_, edm::ParameterSet::getUntrackedParameter(), meEBDigiSimRatio_, meEBDigiSimRatiogt100ADC_, meEBDigiSimRatiogt10ADC_, meEEDigiSimRatio_, meEEDigiSimRatiogt100ADC_, meEEDigiSimRatiogt20ADC_, meGunEnergy_, meGunEta_, meGunPhi_, 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  gainConv_[1] = 1.;
51  gainConv_[2] = 2.;
52  gainConv_[3] = 12.;
53  gainConv_[0] = 12.; // saturated channels
54  barrelADCtoGeV_ = 0.035;
55  endcapADCtoGeV_ = 0.06;
56 
57  meGunEnergy_ = 0;
58  meGunEta_ = 0;
59  meGunPhi_ = 0;
60 
63 
66 
69 
70 }
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< EBDigiCollection > EBdigiCollectionToken_
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_
MonitorElement * meGunEta_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEBToken_
MonitorElement * meEEDigiSimRatio_
MonitorElement * meGunPhi_
edm::EDGetTokenT< ESDigiCollection > ESdigiCollectionToken_
MonitorElement * meEEDigiSimRatiogt20ADC_
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEEToken_
MonitorElement * meEBDigiSimRatiogt100ADC_
edm::EDGetTokenT< edm::SimTrackContainer > g4TkInfoToken_
EcalDigisValidation::~EcalDigisValidation ( )

Destructor.

Definition at line 72 of file EcalDigisValidation.cc.

72  {
73 
74 }

Member Function Documentation

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

Analyze.

Implements edm::stream::EDAnalyzerBase.

Definition at line 117 of file EcalDigisValidation.cc.

References funct::abs(), EcalMGPASample::adc(), barrelADCtoGeV_, HLT_25ns10e33_v2_cff::barrelHits, crossingFramePCaloHitEBToken_, crossingFramePCaloHitEEToken_, crossingFramePCaloHitESToken_, EBdigiCollectionToken_, EEdigiCollectionToken_, endcapADCtoGeV_, HLT_25ns10e33_v2_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(), dqm-mbProfile::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().

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

Implements DQMEDAnalyzer.

Definition at line 82 of file EcalDigisValidation.cc.

References DQMStore::IBooker::book1D(), timingPdfMaker::histo, meEBDigiSimRatio_, meEBDigiSimRatiogt100ADC_, meEBDigiSimRatiogt10ADC_, meEEDigiSimRatio_, meEEDigiSimRatiogt100ADC_, meEEDigiSimRatiogt20ADC_, meGunEnergy_, meGunEta_, meGunPhi_, and DQMStore::IBooker::setCurrentFolder().

82  {
83 
84  Char_t histo[200];
85 
86  ibooker.setCurrentFolder("EcalDigisV/EcalDigiTask");
87 
88  sprintf (histo, "EcalDigiTask Gun Momentum" ) ;
89  meGunEnergy_ = ibooker.book1D(histo, histo, 100, 0., 1000.);
90 
91  sprintf (histo, "EcalDigiTask Gun Eta" ) ;
92  meGunEta_ = ibooker.book1D(histo, histo, 700, -3.5, 3.5);
93 
94  sprintf (histo, "EcalDigiTask Gun Phi" ) ;
95  meGunPhi_ = ibooker.book1D(histo, histo, 360, 0., 360.);
96 
97  sprintf (histo, "EcalDigiTask Barrel maximum Digi over Sim ratio" ) ;
98  meEBDigiSimRatio_ = ibooker.book1D(histo, histo, 100, 0., 2.) ;
99 
100  sprintf (histo, "EcalDigiTask Endcap maximum Digi over Sim ratio" ) ;
101  meEEDigiSimRatio_ = ibooker.book1D(histo, histo, 100, 0., 2.) ;
102 
103  sprintf (histo, "EcalDigiTask Barrel maximum Digi over Sim ratio gt 10 ADC" ) ;
104  meEBDigiSimRatiogt10ADC_ = ibooker.book1D(histo, histo, 100, 0., 2.) ;
105 
106  sprintf (histo, "EcalDigiTask Endcap maximum Digi over Sim ratio gt 20 ADC" ) ;
107  meEEDigiSimRatiogt20ADC_ = ibooker.book1D(histo, histo, 100, 0., 2.) ;
108 
109  sprintf (histo, "EcalDigiTask Barrel maximum Digi over Sim ratio gt 100 ADC" ) ;
110  meEBDigiSimRatiogt100ADC_ = ibooker.book1D(histo, histo, 100, 0., 2.) ;
111 
112  sprintf (histo, "EcalDigiTask Endcap maximum Digi over Sim ratio gt 100 ADC" ) ;
113  meEEDigiSimRatiogt100ADC_ = ibooker.book1D(histo, histo, 100, 0., 2.) ;
114 
115 }
MonitorElement * meEEDigiSimRatiogt100ADC_
MonitorElement * meGunEnergy_
MonitorElement * meEBDigiSimRatiogt10ADC_
MonitorElement * meEBDigiSimRatio_
MonitorElement * meGunEta_
MonitorElement * meEEDigiSimRatio_
MonitorElement * meGunPhi_
MonitorElement * meEEDigiSimRatiogt20ADC_
MonitorElement * meEBDigiSimRatiogt100ADC_
void EcalDigisValidation::checkCalibrations ( edm::EventSetup const &  c)
private

Definition at line 418 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 dqmBeginRun().

419 {
420 
421  // ADC -> GeV Scale
423  eventSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
424  const EcalADCToGeVConstant* agc = pAgc.product();
425 
426  EcalMGPAGainRatio * defaultRatios = new EcalMGPAGainRatio();
427 
428  gainConv_[1] = 1.;
429  gainConv_[2] = defaultRatios->gain12Over6() ;
430  gainConv_[3] = gainConv_[2]*(defaultRatios->gain6Over1()) ;
431  gainConv_[0] = gainConv_[2]*(defaultRatios->gain6Over1()) ; // saturated channels
432 
433  LogDebug("EcalDigi") << " Gains conversions: " << "\n" << " g1 = " << gainConv_[1] << "\n" << " g2 = " << gainConv_[2] << "\n" << " g3 = " << gainConv_[3];
434  LogDebug("EcalDigi") << " Gains conversions: " << "\n" << " saturation = " << gainConv_[0];
435 
436  delete defaultRatios;
437 
438  const double barrelADCtoGeV_ = agc->getEBValue();
439  LogDebug("EcalDigi") << " Barrel GeV/ADC = " << barrelADCtoGeV_;
440  const double endcapADCtoGeV_ = agc->getEEValue();
441  LogDebug("EcalDigi") << " Endcap GeV/ADC = " << endcapADCtoGeV_;
442 
443 }
#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::dqmBeginRun ( edm::Run const &  ,
edm::EventSetup const &  c 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 76 of file EcalDigisValidation.cc.

References checkCalibrations().

76  {
77 
79 
80 }
void checkCalibrations(edm::EventSetup const &c)

Member Data Documentation

double EcalDigisValidation::barrelADCtoGeV_
private

Definition at line 88 of file EcalDigisValidation.h.

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

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

Definition at line 84 of file EcalDigisValidation.h.

Referenced by analyze().

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

Definition at line 84 of file EcalDigisValidation.h.

Referenced by analyze().

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

Definition at line 84 of file EcalDigisValidation.h.

Referenced by analyze().

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

Definition at line 80 of file EcalDigisValidation.h.

Referenced by analyze().

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

Definition at line 81 of file EcalDigisValidation.h.

Referenced by analyze().

double EcalDigisValidation::endcapADCtoGeV_
private

Definition at line 89 of file EcalDigisValidation.h.

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

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

Definition at line 82 of file EcalDigisValidation.h.

Referenced by analyze().

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

Definition at line 77 of file EcalDigisValidation.h.

Referenced by analyze().

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

Definition at line 78 of file EcalDigisValidation.h.

Referenced by analyze().

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

Definition at line 86 of file EcalDigisValidation.h.

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

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

Definition at line 76 of file EcalDigisValidation.h.

Referenced by analyze().

MonitorElement* EcalDigisValidation::meEBDigiSimRatio_
private

Definition at line 95 of file EcalDigisValidation.h.

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

MonitorElement* EcalDigisValidation::meEBDigiSimRatiogt100ADC_
private

Definition at line 101 of file EcalDigisValidation.h.

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

MonitorElement* EcalDigisValidation::meEBDigiSimRatiogt10ADC_
private

Definition at line 98 of file EcalDigisValidation.h.

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

MonitorElement* EcalDigisValidation::meEEDigiSimRatio_
private

Definition at line 96 of file EcalDigisValidation.h.

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

MonitorElement* EcalDigisValidation::meEEDigiSimRatiogt100ADC_
private

Definition at line 102 of file EcalDigisValidation.h.

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

MonitorElement* EcalDigisValidation::meEEDigiSimRatiogt20ADC_
private

Definition at line 99 of file EcalDigisValidation.h.

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

MonitorElement* EcalDigisValidation::meGunEnergy_
private

Definition at line 91 of file EcalDigisValidation.h.

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

MonitorElement* EcalDigisValidation::meGunEta_
private

Definition at line 92 of file EcalDigisValidation.h.

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

MonitorElement* EcalDigisValidation::meGunPhi_
private

Definition at line 93 of file EcalDigisValidation.h.

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

std::string EcalDigisValidation::outputFile_
private

Definition at line 74 of file EcalDigisValidation.h.

Referenced by EcalDigisValidation().

bool EcalDigisValidation::verbose_
private

Definition at line 72 of file EcalDigisValidation.h.

Referenced by EcalDigisValidation().