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 | Static Private Attributes
EcalMixingModuleValidation Class Reference

#include <EcalMixingModuleValidation.h>

Inheritance diagram for EcalMixingModuleValidation:
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
 
 EcalMixingModuleValidation (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~EcalMixingModuleValidation ()
 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
 
void endRun (const edm::Run &r, const edm::EventSetup &c)
 
- 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 bunchSumTest (std::vector< MonitorElement * > &theBunches, MonitorElement *&theTotal, MonitorElement *&theRatio, int nSample)
 
void checkCalibrations (edm::EventSetup const &c)
 
void checkPedestals (const edm::EventSetup &c)
 
void computeSDBunchDigi (const edm::EventSetup &eventSetup, MixCollection< PCaloHit > &theHits, MapType &ebSignalSimMap, const EcalSubdetector &thisDet, const double &theSimThreshold, CLHEP::HepRandomEngine *)
 
void findPedestal (const DetId &detId, int gainId, double &ped) const
 
CLHEP::HepRandomEngine * randomEngine (edm::StreamID const &streamID)
 

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_
 
double esADCtokeV_
 
double esBaseline_
 
edm::EDGetTokenT
< ESDigiCollection
ESdigiCollectionToken_
 
double esThreshold_
 
std::map< int, double,
std::less< int > > 
gainConv_
 
edm::EDGetTokenT
< edm::HepMCProduct
HepMCToken_
 
double m_ESeffwei
 
int m_ESgain
 
const ESIntercalibConstantsm_ESmips
 
const ESPedestalsm_ESpeds
 
MonitorElementmeEBbunchCrossing_
 
MonitorElementmeEBBunchShape_ [nBunch]
 
MonitorElementmeEBDigiMixRatiogt100ADC_
 
MonitorElementmeEBDigiMixRatioOriggt50pc_
 
MonitorElementmeEBShape_
 
MonitorElementmeEBShapeRatio_
 
MonitorElementmeEEbunchCrossing_
 
MonitorElementmeEEBunchShape_ [nBunch]
 
MonitorElementmeEEDigiMixRatiogt100ADC_
 
MonitorElementmeEEDigiMixRatioOriggt40pc_
 
MonitorElementmeEEShape_
 
MonitorElementmeEEShapeRatio_
 
MonitorElementmeESbunchCrossing_
 
MonitorElementmeESBunchShape_ [nBunch]
 
MonitorElementmeESShape_
 
MonitorElementmeESShapeRatio_
 
std::string outputFile_
 
std::vector
< CLHEP::HepRandomEngine * > 
randomEngines_
 
CaloHitResponsetheEBResponse
 
const EBShapetheEBShape
 
CaloHitResponsetheEEResponse
 
const EEShapetheEEShape
 
CaloHitResponsetheESResponse
 
ESShapetheESShape
 
const CaloGeometrytheGeometry
 
int theMaxBunch
 
int theMinBunch
 
const EcalSimParameterMaptheParameterMap
 
const EcalPedestalsthePedestals
 
bool verbose_
 

Static Private Attributes

static const int nBunch = 21
 

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 75 of file EcalMixingModuleValidation.h.

Member Typedef Documentation

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

Definition at line 77 of file EcalMixingModuleValidation.h.

Constructor & Destructor Documentation

EcalMixingModuleValidation::EcalMixingModuleValidation ( const edm::ParameterSet ps)

Constructor.

Definition at line 19 of file EcalMixingModuleValidation.cc.

References barrelADCtoGeV_, ecalTPGAnalyzer_cfg::binOfMaximum, endcapADCtoGeV_, gainConv_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, meEBbunchCrossing_, meEBBunchShape_, meEBDigiMixRatiogt100ADC_, meEBDigiMixRatioOriggt50pc_, meEBShape_, meEBShapeRatio_, meEEbunchCrossing_, meEEBunchShape_, meEEDigiMixRatiogt100ADC_, meEEDigiMixRatioOriggt40pc_, meEEShape_, meEEShapeRatio_, meESbunchCrossing_, meESBunchShape_, meESShape_, meESShapeRatio_, nBunch, theEBResponse, theEBShape, theEEResponse, theEEShape, theESResponse, theESShape, theMaxBunch, theMinBunch, theParameterMap, and verbose_.

19  :
20  HepMCToken_( consumes<edm::HepMCProduct>( edm::InputTag( ps.getParameter<std::string>( "moduleLabelMC" ) ) ) ),
21  EBdigiCollectionToken_( consumes<EBDigiCollection>( ps.getParameter<edm::InputTag>( "EBdigiCollection" ) ) ),
22  EEdigiCollectionToken_( consumes<EEDigiCollection>( ps.getParameter<edm::InputTag>( "EEdigiCollection" ) ) ),
23  ESdigiCollectionToken_( consumes<ESDigiCollection>( ps.getParameter<edm::InputTag>( "ESdigiCollection" ) ) ),
25  , ps.getParameter<std::string>( "hitsProducer" ) + std::string( "EcalHitsEB" )
26  )
27  )
28  ),
30  , ps.getParameter<std::string>( "hitsProducer" ) + std::string( "EcalHitsEE" )
31  )
32  )
33  ),
35  , ps.getParameter<std::string>( "hitsProducer" ) + std::string( "EcalHitsES" )
36  )
37  )
38  ) {
39 
40 
41  // needed for MixingModule checks
42 
43  double simHitToPhotoelectronsBarrel = ps.getParameter<double>("simHitToPhotoelectronsBarrel");
44  double simHitToPhotoelectronsEndcap = ps.getParameter<double>("simHitToPhotoelectronsEndcap");
45  double photoelectronsToAnalogBarrel = ps.getParameter<double>("photoelectronsToAnalogBarrel");
46  double photoelectronsToAnalogEndcap = ps.getParameter<double>("photoelectronsToAnalogEndcap");
47  double samplingFactor = ps.getParameter<double>("samplingFactor");
48  double timePhase = ps.getParameter<double>("timePhase");
49  int readoutFrameSize = ps.getParameter<int>("readoutFrameSize");
50  int binOfMaximum = ps.getParameter<int>("binOfMaximum");
51  bool doPhotostatistics = ps.getParameter<bool>("doPhotostatistics");
52  bool syncPhase = ps.getParameter<bool>("syncPhase");
53 
54  doPhotostatistics = false;
55 
56  theParameterMap = new EcalSimParameterMap(simHitToPhotoelectronsBarrel, simHitToPhotoelectronsEndcap,
57  photoelectronsToAnalogBarrel, photoelectronsToAnalogEndcap,
58  samplingFactor, timePhase, readoutFrameSize, binOfMaximum,
59  doPhotostatistics, syncPhase);
60  //theEcalShape = new EcalShape(timePhase);
61 
62  //theEcalResponse = new CaloHitResponse(theParameterMap, theEcalShape);
63 
64 /*
65  int ESGain = ps.getParameter<int>("ESGain");
66  double ESNoiseSigma = ps.getParameter<double> ("ESNoiseSigma");
67  int ESBaseline = ps.getParameter<int>("ESBaseline");
68  double ESMIPADC = ps.getParameter<double>("ESMIPADC");
69  double ESMIPkeV = ps.getParameter<double>("ESMIPkeV");
70 */
71 
72  theESShape = new ESShape();
73  theEBShape = new EBShape();
74  theEEShape = new EEShape();
75 
79 
80 // double effwei = 1.;
81 
82 /*
83  if (ESGain == 0)
84  effwei = 1.45;
85  else if (ESGain == 1)
86  effwei = 0.9066;
87  else if (ESGain == 2)
88  effwei = 0.8815;
89 
90  esBaseline_ = (double)ESBaseline;
91  esADCtokeV_ = 1000000.*ESMIPADC/ESMIPkeV;
92  esThreshold_ = 3.*effwei*ESNoiseSigma/esADCtokeV_;
93 */
94  theMinBunch = -10;
95  theMaxBunch = 10;
96 
97 
98  // verbosity switch
99  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
100 
101  gainConv_[1] = 1.;
102  gainConv_[2] = 2.;
103  gainConv_[3] = 12.;
104  gainConv_[0] = 12.;
105  barrelADCtoGeV_ = 0.035;
106  endcapADCtoGeV_ = 0.06;
107 
110 
113 
114  meEBbunchCrossing_ = 0;
115  meEEbunchCrossing_ = 0;
116  meESbunchCrossing_ = 0;
117 
118  for ( int i = 0 ; i < nBunch ; i++ ) {
119  meEBBunchShape_[i] = 0;
120  meEEBunchShape_[i] = 0;
121  meESBunchShape_[i] = 0;
122  }
123 
124  meEBShape_ = 0;
125  meEEShape_ = 0;
126  meESShape_ = 0;
127 
128  meEBShapeRatio_ = 0;
129  meEEShapeRatio_ = 0;
130  meESShapeRatio_ = 0;
131 
132 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitESToken_
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken_
MonitorElement * meEEBunchShape_[nBunch]
edm::EDGetTokenT< EBDigiCollection > EBdigiCollectionToken_
MonitorElement * meEBBunchShape_[nBunch]
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEEToken_
MonitorElement * meESBunchShape_[nBunch]
Creates electronics signals from hits.
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEBToken_
Definition: EBShape.h:6
std::map< int, double, std::less< int > > gainConv_
const EcalSimParameterMap * theParameterMap
edm::EDGetTokenT< ESDigiCollection > ESdigiCollectionToken_
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
Definition: EEShape.h:6
EcalMixingModuleValidation::~EcalMixingModuleValidation ( )

Destructor.

Definition at line 134 of file EcalMixingModuleValidation.cc.

134 {}

Member Function Documentation

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

Analyze.

Implements edm::stream::EDAnalyzerBase.

Definition at line 286 of file EcalMixingModuleValidation.cc.

References ESSample::adc(), EcalMGPASample::adc(), barrelADCtoGeV_, HLT_25ns10e33_v2_cff::barrelHits, checkPedestals(), computeSDBunchDigi(), crossingFramePCaloHitEBToken_, crossingFramePCaloHitEEToken_, crossingFramePCaloHitESToken_, EBdigiCollectionToken_, EcalBarrel, EcalEndcap, EcalPreshower, EEdigiCollectionToken_, endcapADCtoGeV_, HLT_25ns10e33_v2_cff::endcapHits, esADCtokeV_, esBaseline_, ESdigiCollectionToken_, esThreshold_, MonitorElement::Fill(), ESCondObjectContainer< T >::find(), findPedestal(), gainConv_, EcalMGPASample::gainId(), edm::Event::getByToken(), ESCondObjectContainer< T >::getMap(), HepMCToken_, i, ESDataFrame::id(), EEDataFrame::id(), EBDataFrame::id(), EBDetId::ieta(), EBDetId::iphi(), GeomDetEnumerators::isBarrel(), GeomDetEnumerators::isEndcap(), edm::HandleBase::isValid(), EEDetId::ix(), EEDetId::iy(), LogDebug, m_ESeffwei, m_ESmips, m_ESpeds, ESDataFrame::MAXSAMPLES, EcalDataFrame::MAXSAMPLES, meEBbunchCrossing_, meEBDigiMixRatiogt100ADC_, meEBDigiMixRatioOriggt50pc_, meEBShape_, meEEbunchCrossing_, meEEDigiMixRatiogt100ADC_, meEEDigiMixRatioOriggt40pc_, meEEShape_, meESbunchCrossing_, meESShape_, ecalTB2006H4_GenSimDigiReco_cfg::mySample, AlCaHLTBitMon_ParallelJobs::p, ESDetId::plane(), edm::Handle< T >::product(), randomEngine(), DetId::rawId(), compare_using_db::sample, ESDetId::six(), ESDetId::siy(), ESDataFrame::size(), EcalDataFrame::size(), edm::DataFrameContainer::size(), edm::Event::streamID(), ESDetId::strip(), ESDetId::zside(), and EEDetId::zside().

286  {
287 
288  //LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
289 
290  checkPedestals(c);
291 
292  std::vector<SimTrack> theSimTracks;
293  std::vector<SimVertex> theSimVertexes;
294 
296  edm::Handle<CrossingFrame<PCaloHit> > crossingFrame;
300 
301 
302  bool skipMC = false;
303  e.getByToken( HepMCToken_, MCEvt );
304  if (!MCEvt.isValid()) { skipMC = true; }
305 
306  const EBDigiCollection* EBdigis =0;
307  const EEDigiCollection* EEdigis =0;
308  const ESDigiCollection* ESdigis =0;
309 
310  bool isBarrel = true;
311  e.getByToken( EBdigiCollectionToken_, EcalDigiEB );
312  if (EcalDigiEB.isValid()) {
313  EBdigis = EcalDigiEB.product();
314  LogDebug("DigiInfo") << "total # EBdigis: " << EBdigis->size() ;
315  if ( EBdigis->size() == 0 ) isBarrel = false;
316  } else {
317  isBarrel = false;
318  }
319 
320  bool isEndcap = true;
321  e.getByToken( EEdigiCollectionToken_, EcalDigiEE );
322  if (EcalDigiEE.isValid()) {
323  EEdigis = EcalDigiEE.product();
324  LogDebug("DigiInfo") << "total # EEdigis: " << EEdigis->size() ;
325  if ( EEdigis->size() == 0 ) isEndcap = false;
326  } else {
327  isEndcap = false;
328  }
329 
330  bool isPreshower = true;
331  e.getByToken( ESdigiCollectionToken_, EcalDigiES );
332  if (EcalDigiES.isValid()) {
333  ESdigis = EcalDigiES.product();
334  LogDebug("DigiInfo") << "total # ESdigis: " << ESdigis->size() ;
335  if ( ESdigis->size() == 0 ) isPreshower = false;
336  } else {
337  isPreshower = false;
338  }
339 
340  double theGunEnergy = 0.;
341  if ( ! skipMC ) {
342  for ( HepMC::GenEvent::particle_const_iterator p = MCEvt->GetEvent()->particles_begin();
343  p != MCEvt->GetEvent()->particles_end(); ++p ) {
344 
345  theGunEnergy = (*p)->momentum().e();
346  }
347  }
348  // in case no HepMC available, assume an arbitrary average energy for an interesting "gun"
349  else {
350  edm::LogWarning("DigiInfo") << "No HepMC available, using 30 GeV as giun energy";
351  theGunEnergy = 30.;
352  }
353 
354  // BARREL
355 
356  // loop over simHits
357 
358  if ( isBarrel ) {
359 
360  e.getByToken( crossingFramePCaloHitEBToken_, crossingFrame );
361  std::auto_ptr<MixCollection<PCaloHit> >
362  barrelHits (new MixCollection<PCaloHit>(crossingFrame.product ()));
363 
364  MapType ebSignalSimMap;
365 
366  double ebSimThreshold = 0.5*theGunEnergy;
367 
368  for (MixCollection<PCaloHit>::MixItr hitItr = barrelHits->begin () ;
369  hitItr != barrelHits->end () ;
370  ++hitItr) {
371 
372  EBDetId ebid = EBDetId(hitItr->id()) ;
373 
374  LogDebug("HitInfo")
375  << " CaloHit " << hitItr->getName() << "\n"
376  << " DetID = "<<hitItr->id()<< " EBDetId = " << ebid.ieta() << " " << ebid.iphi() << "\n"
377  << " Time = " << hitItr->time() << " Event id. = " << hitItr->eventId().rawId() << "\n"
378  << " Track Id = " << hitItr->geantTrackId() << "\n"
379  << " Energy = " << hitItr->energy();
380 
381  uint32_t crystid = ebid.rawId();
382 
383  if ( hitItr->eventId().rawId() == 0 ) ebSignalSimMap[crystid] += hitItr->energy();
384 
385  if ( meEBbunchCrossing_ ) meEBbunchCrossing_->Fill(hitItr->eventId().bunchCrossing());
386 
387  }
388 
389  // loop over Digis
390 
391  const EBDigiCollection * barrelDigi = EcalDigiEB.product () ;
392 
393  std::vector<double> ebAnalogSignal ;
394  std::vector<double> ebADCCounts ;
395  std::vector<double> ebADCGains ;
396  ebAnalogSignal.reserve(EBDataFrame::MAXSAMPLES);
397  ebADCCounts.reserve(EBDataFrame::MAXSAMPLES);
398  ebADCGains.reserve(EBDataFrame::MAXSAMPLES);
399 
400  for (unsigned int digis=0; digis<EcalDigiEB->size(); ++digis) {
401 
402  EBDataFrame ebdf=(*barrelDigi)[digis];
403  int nrSamples=ebdf.size();
404 
405  EBDetId ebid = ebdf.id () ;
406 
407  double Emax = 0. ;
408  int Pmax = 0 ;
409 
410  for (int sample = 0 ; sample < nrSamples; ++sample) {
411  ebAnalogSignal[sample] = 0.;
412  ebADCCounts[sample] = 0.;
413  ebADCGains[sample] = -1.;
414  }
415 
416  for (int sample = 0 ; sample < nrSamples; ++sample) {
417 
419 
420  ebADCCounts[sample] = (mySample.adc()) ;
421  ebADCGains[sample] = (mySample.gainId ()) ;
422  ebAnalogSignal[sample] = (ebADCCounts[sample]*gainConv_[(int)ebADCGains[sample]]*barrelADCtoGeV_);
423  if (Emax < ebAnalogSignal[sample] ) {
424  Emax = ebAnalogSignal[sample] ;
425  Pmax = sample ;
426  }
427  LogDebug("DigiInfo") << "EB sample " << sample << " ADC counts = " << ebADCCounts[sample] << " Gain Id = " << ebADCGains[sample] << " Analog eq = " << ebAnalogSignal[sample];
428  }
429  double pedestalPreSampleAnalog = 0.;
430  findPedestal( ebid, (int)ebADCGains[Pmax] , pedestalPreSampleAnalog);
431  pedestalPreSampleAnalog *= gainConv_[(int)ebADCGains[Pmax]]*barrelADCtoGeV_;
432  double Erec = Emax - pedestalPreSampleAnalog;
433 
434  if ( ebSignalSimMap[ebid.rawId()] != 0. ) {
435  LogDebug("DigiInfo") << " Digi / Signal Hit = " << Erec << " / " << ebSignalSimMap[ebid.rawId()] << " gainConv " << gainConv_[(int)ebADCGains[Pmax]];
436  if ( Erec > 100.*barrelADCtoGeV_ && meEBDigiMixRatiogt100ADC_ ) meEBDigiMixRatiogt100ADC_->Fill( Erec/ebSignalSimMap[ebid.rawId()] );
437  if ( ebSignalSimMap[ebid.rawId()] > ebSimThreshold && meEBDigiMixRatioOriggt50pc_ ) meEBDigiMixRatioOriggt50pc_->Fill( Erec/ebSignalSimMap[ebid.rawId()] );
438  if ( ebSignalSimMap[ebid.rawId()] > ebSimThreshold && meEBShape_ ) {
439  for ( int i = 0; i < 10 ; i++ ) {
440  pedestalPreSampleAnalog = 0.;
441  findPedestal( ebid, (int)ebADCGains[i] , pedestalPreSampleAnalog);
442  pedestalPreSampleAnalog *= gainConv_[(int)ebADCGains[i]]*barrelADCtoGeV_;
443  meEBShape_->Fill(i, ebAnalogSignal[i]-pedestalPreSampleAnalog );
444  }
445  }
446  }
447 
448  }
449 
450  EcalSubdetector thisDet = EcalBarrel;
451  computeSDBunchDigi(c, *barrelHits, ebSignalSimMap, thisDet, ebSimThreshold, randomEngine(e.streamID()));
452  }
453 
454 
455  // ENDCAP
456 
457  // loop over simHits
458 
459  if ( isEndcap ) {
460 
461  e.getByToken( crossingFramePCaloHitEEToken_, crossingFrame );
462  std::auto_ptr<MixCollection<PCaloHit> >
463  endcapHits (new MixCollection<PCaloHit>(crossingFrame.product ()));
464 
465  MapType eeSignalSimMap;
466 
467  double eeSimThreshold = 0.4*theGunEnergy;
468 
469  for (MixCollection<PCaloHit>::MixItr hitItr = endcapHits->begin () ;
470  hitItr != endcapHits->end () ;
471  ++hitItr) {
472 
473  EEDetId eeid = EEDetId(hitItr->id()) ;
474 
475  LogDebug("HitInfo")
476  << " CaloHit " << hitItr->getName() << "\n"
477  << " DetID = "<<hitItr->id()<< " EEDetId side = " << eeid.zside() << " = " << eeid.ix() << " " << eeid.iy() << "\n"
478  << " Time = " << hitItr->time() << " Event id. = " << hitItr->eventId().rawId() << "\n"
479  << " Track Id = " << hitItr->geantTrackId() << "\n"
480  << " Energy = " << hitItr->energy();
481 
482  uint32_t crystid = eeid.rawId();
483 
484  if ( hitItr->eventId().rawId() == 0 ) eeSignalSimMap[crystid] += hitItr->energy();
485 
486  if ( meEEbunchCrossing_ ) meEEbunchCrossing_->Fill(hitItr->eventId().bunchCrossing());
487 
488  }
489 
490  // loop over Digis
491 
492  const EEDigiCollection * endcapDigi = EcalDigiEE.product () ;
493 
494  std::vector<double> eeAnalogSignal ;
495  std::vector<double> eeADCCounts ;
496  std::vector<double> eeADCGains ;
497  eeAnalogSignal.reserve(EEDataFrame::MAXSAMPLES);
498  eeADCCounts.reserve(EEDataFrame::MAXSAMPLES);
499  eeADCGains.reserve(EEDataFrame::MAXSAMPLES);
500 
501  for (unsigned int digis=0; digis<EcalDigiEE->size(); ++digis) {
502 
503  EEDataFrame eedf=(*endcapDigi)[digis];
504  int nrSamples=eedf.size();
505 
506  EEDetId eeid = eedf.id () ;
507 
508  double Emax = 0. ;
509  int Pmax = 0 ;
510 
511  for (int sample = 0 ; sample < nrSamples; ++sample) {
512  eeAnalogSignal[sample] = 0.;
513  eeADCCounts[sample] = 0.;
514  eeADCGains[sample] = -1.;
515  }
516 
517  for (int sample = 0 ; sample < nrSamples; ++sample) {
518 
519  EcalMGPASample mySample = eedf[sample];
520 
521  eeADCCounts[sample] = (mySample.adc()) ;
522  eeADCGains[sample] = (mySample.gainId()) ;
523  eeAnalogSignal[sample] = (eeADCCounts[sample]*gainConv_[(int)eeADCGains[sample]]*endcapADCtoGeV_);
524  if (Emax < eeAnalogSignal[sample] ) {
525  Emax = eeAnalogSignal[sample] ;
526  Pmax = sample ;
527  }
528  LogDebug("DigiInfo") << "EE sample " << sample << " ADC counts = " << eeADCCounts[sample] << " Gain Id = " << eeADCGains[sample] << " Analog eq = " << eeAnalogSignal[sample];
529  }
530  double pedestalPreSampleAnalog = 0.;
531  findPedestal( eeid, (int)eeADCGains[Pmax] , pedestalPreSampleAnalog);
532  pedestalPreSampleAnalog *= gainConv_[(int)eeADCGains[Pmax]]*endcapADCtoGeV_;
533  double Erec = Emax - pedestalPreSampleAnalog;
534 
535  if ( eeSignalSimMap[eeid.rawId()] != 0. ) {
536  LogDebug("DigiInfo") << " Digi / Signal Hit = " << Erec << " / " << eeSignalSimMap[eeid.rawId()] << " gainConv " << gainConv_[(int)eeADCGains[Pmax]];
537  if ( Erec > 100.*endcapADCtoGeV_ && meEEDigiMixRatiogt100ADC_ ) meEEDigiMixRatiogt100ADC_->Fill( Erec/eeSignalSimMap[eeid.rawId()] );
538  if ( eeSignalSimMap[eeid.rawId()] > eeSimThreshold && meEEDigiMixRatioOriggt40pc_ ) meEEDigiMixRatioOriggt40pc_->Fill( Erec/eeSignalSimMap[eeid.rawId()] );
539  if ( eeSignalSimMap[eeid.rawId()] > eeSimThreshold && meEBShape_ ) {
540  for ( int i = 0; i < 10 ; i++ ) {
541  pedestalPreSampleAnalog = 0.;
542  findPedestal( eeid, (int)eeADCGains[i] , pedestalPreSampleAnalog);
543  pedestalPreSampleAnalog *= gainConv_[(int)eeADCGains[i]]*endcapADCtoGeV_;
544  meEEShape_->Fill(i, eeAnalogSignal[i]-pedestalPreSampleAnalog );
545  }
546  }
547  }
548  }
549 
550  EcalSubdetector thisDet = EcalEndcap;
551  computeSDBunchDigi(c, *endcapHits, eeSignalSimMap, thisDet, eeSimThreshold, randomEngine(e.streamID()));
552  }
553 
554  if ( isPreshower) {
555 
556  e.getByToken(crossingFramePCaloHitESToken_, crossingFrame );
557  std::auto_ptr<MixCollection<PCaloHit> >
558  preshowerHits (new MixCollection<PCaloHit>(crossingFrame.product ()));
559 
560  MapType esSignalSimMap;
561 
562  for (MixCollection<PCaloHit>::MixItr hitItr = preshowerHits->begin () ;
563  hitItr != preshowerHits->end () ;
564  ++hitItr) {
565 
566  ESDetId esid = ESDetId(hitItr->id()) ;
567 
568  LogDebug("HitInfo")
569  << " CaloHit " << hitItr->getName() << "\n"
570  << " DetID = "<<hitItr->id()<< "ESDetId: z side " << esid.zside() << " plane " << esid.plane() << esid.six() << ',' << esid.siy() << ':' << esid.strip() << "\n"
571  << " Time = " << hitItr->time() << " Event id. = " << hitItr->eventId().rawId() << "\n"
572  << " Track Id = " << hitItr->geantTrackId() << "\n"
573  << " Energy = " << hitItr->energy();
574 
575  uint32_t stripid = esid.rawId();
576 
577  if ( hitItr->eventId().rawId() == 0 ) esSignalSimMap[stripid] += hitItr->energy();
578 
579  if ( meESbunchCrossing_ ) meESbunchCrossing_->Fill(hitItr->eventId().bunchCrossing());
580 
581  // loop over Digis
582 
583  const ESDigiCollection * preshowerDigi = EcalDigiES.product () ;
584 
585  std::vector<double> esADCCounts ;
586  std::vector<double> esADCAnalogSignal ;
587  esADCCounts.reserve(ESDataFrame::MAXSAMPLES);
588  esADCAnalogSignal.reserve(ESDataFrame::MAXSAMPLES);
589 
590  for (unsigned int digis=0; digis<EcalDigiES->size(); ++digis) {
591 
592  ESDataFrame esdf=(*preshowerDigi)[digis];
593  int nrSamples=esdf.size();
594 
595  ESDetId esid = esdf.id () ;
596 
597  for (int sample = 0 ; sample < nrSamples; ++sample) {
598  esADCCounts[sample] = 0.;
599  esADCAnalogSignal[sample] = 0.;
600  }
601 
602  for (int sample = 0 ; sample < nrSamples; ++sample) {
603 
604  ESSample mySample = esdf[sample];
605 
606  esADCCounts[sample] = (mySample.adc()) ;
607  esBaseline_ = m_ESpeds->find(esid)->getMean() ;
608  const double factor ( esADCtokeV_/(*(m_ESmips->getMap().find(esid)) ) ) ;
609  esThreshold_ = 3.*m_ESeffwei*( (*m_ESpeds->find(esid)).getRms())/factor;
610  esADCAnalogSignal[sample] = (esADCCounts[sample]-esBaseline_)/factor;
611  }
612  LogDebug("DigiInfo") << "Preshower Digi for ESDetId: z side " << esid.zside() << " plane " << esid.plane() << esid.six() << ',' << esid.siy() << ':' << esid.strip();
613  for ( int i = 0; i < 3 ; i++ ) {
614  LogDebug("DigiInfo") << "sample " << i << " ADC = " << esADCCounts[i] << " Analog eq = " << esADCAnalogSignal[i];
615  }
616 
617  if ( esSignalSimMap[esid.rawId()] > esThreshold_ && meESShape_ ) {
618  for ( int i = 0; i < 3 ; i++ ) {
619  meESShape_->Fill(i, esADCAnalogSignal[i] );
620  }
621  }
622 
623  }
624 
625  }
626 
627  EcalSubdetector thisDet = EcalPreshower;
628  computeSDBunchDigi(c, *preshowerHits, esSignalSimMap, thisDet, esThreshold_, randomEngine(e.streamID()));
629 
630  }
631 
632 }
#define LogDebug(id)
void checkPedestals(const edm::EventSetup &c)
int i
Definition: DBlmapReader.cc:9
int strip() const
Definition: ESDetId.h:52
void computeSDBunchDigi(const edm::EventSetup &eventSetup, MixCollection< PCaloHit > &theHits, MapType &ebSignalSimMap, const EcalSubdetector &thisDet, const double &theSimThreshold, CLHEP::HepRandomEngine *)
const ESIntercalibConstants * m_ESmips
int ix() const
Definition: EEDetId.h:76
key_type id() const
Definition: EBDataFrame.h:31
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitESToken_
void findPedestal(const DetId &detId, int gainId, double &ped) const
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken_
const ESDetId & id() const
Definition: ESDataFrame.h:21
const self & getMap() const
bool isBarrel(GeomDetEnumerators::SubDetector m)
edm::EDGetTokenT< EBDigiCollection > EBdigiCollectionToken_
int six() const
Definition: ESDetId.h:48
int size() const
Definition: ESDataFrame.h:23
int gainId() const
get the gainId (2 bits)
int size() const
Definition: EcalDataFrame.h:26
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
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEEToken_
int siy() const
Definition: ESDetId.h:50
static const int MAXSAMPLES
Definition: ESDataFrame.h:32
CLHEP::HepRandomEngine * randomEngine(edm::StreamID const &streamID)
const_iterator find(uint32_t rawId) const
int zside() const
Definition: EEDetId.h:70
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
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEBToken_
bool isEndcap(GeomDetEnumerators::SubDetector m)
key_type id() const
Definition: EEDataFrame.h:28
std::map< int, double, std::less< int > > gainConv_
std::map< uint32_t, float, std::less< uint32_t > > MapType
edm::EDGetTokenT< ESDigiCollection > ESdigiCollectionToken_
T const * product() const
Definition: Handle.h:81
int plane() const
Definition: ESDetId.h:46
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:18
EcalSubdetector
static const int MAXSAMPLES
Definition: EcalDataFrame.h:48
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
int adc() const
get the ADC sample (12 bits)
void EcalMixingModuleValidation::bookHistograms ( DQMStore::IBooker i,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 142 of file EcalMixingModuleValidation.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::bookProfile(), timingPdfMaker::histo, i, meEBbunchCrossing_, meEBBunchShape_, meEBDigiMixRatiogt100ADC_, meEBDigiMixRatioOriggt50pc_, meEBShape_, meEBShapeRatio_, meEEbunchCrossing_, meEEBunchShape_, meEEDigiMixRatiogt100ADC_, meEEDigiMixRatioOriggt40pc_, meEEShape_, meEEShapeRatio_, meESbunchCrossing_, meESBunchShape_, meESShape_, meESShapeRatio_, nBunch, and DQMStore::IBooker::setCurrentFolder().

142  {
143 
144  Char_t histo[200];
145 
146  ibooker.setCurrentFolder("EcalDigisV/EcalDigiTask");
147 
148  sprintf (histo, "EcalDigiTask Barrel maximum Digi over sim signal ratio gt 100 ADC" ) ;
149  meEBDigiMixRatiogt100ADC_ = ibooker.book1D(histo, histo, 200, 0., 100.) ;
150 
151  sprintf (histo, "EcalDigiTask Endcap maximum Digi over sim signal ratio gt 100 ADC" ) ;
152  meEEDigiMixRatiogt100ADC_ = ibooker.book1D(histo, histo, 200, 0., 100.) ;
153 
154  sprintf (histo, "EcalDigiTask Barrel maximum Digi over sim signal ratio signal gt 50pc gun" ) ;
155  meEBDigiMixRatioOriggt50pc_ = ibooker.book1D(histo, histo, 200, 0., 100.) ;
156 
157  sprintf (histo, "EcalDigiTask Endcap maximum Digi over sim signal ratio signal gt 40pc gun" ) ;
158  meEEDigiMixRatioOriggt40pc_ = ibooker.book1D(histo, histo, 200, 0., 100.) ;
159 
160  sprintf (histo, "EcalDigiTask Barrel bunch crossing" ) ;
161  meEBbunchCrossing_ = ibooker.book1D(histo, histo, 20, -10., 10.) ;
162 
163  sprintf (histo, "EcalDigiTask Endcap bunch crossing" ) ;
164  meEEbunchCrossing_ = ibooker.book1D(histo, histo, 20, -10., 10.) ;
165 
166  sprintf (histo, "EcalDigiTask Preshower bunch crossing" ) ;
167  meESbunchCrossing_ = ibooker.book1D(histo, histo, 20, -10., 10.) ;
168 
169  for ( int i = 0 ; i < nBunch ; i++ ) {
170 
171  sprintf (histo, "EcalDigiTask Barrel shape bunch crossing %02d", i-10 );
172  meEBBunchShape_[i] = ibooker.bookProfile(histo, histo, 10, 0, 10, 4000, 0., 400.);
173 
174  sprintf (histo, "EcalDigiTask Endcap shape bunch crossing %02d", i-10 );
175  meEEBunchShape_[i] = ibooker.bookProfile(histo, histo, 10, 0, 10, 4000, 0., 400.);
176 
177  sprintf (histo, "EcalDigiTask Preshower shape bunch crossing %02d", i-10 );
178  meESBunchShape_[i] = ibooker.bookProfile(histo, histo, 3, 0, 3, 4000, 0., 400.);
179 
180  }
181 
182  sprintf (histo, "EcalDigiTask Barrel shape digi");
183  meEBShape_ = ibooker.bookProfile(histo, histo, 10, 0, 10, 4000, 0., 2000.);
184 
185  sprintf (histo, "EcalDigiTask Endcap shape digi");
186  meEEShape_ = ibooker.bookProfile(histo, histo, 10, 0, 10, 4000, 0., 2000.);
187 
188  sprintf (histo, "EcalDigiTask Preshower shape digi");
189  meESShape_ = ibooker.bookProfile(histo, histo, 3, 0, 3, 4000, 0., 2000.);
190 
191  sprintf (histo, "EcalDigiTask Barrel shape digi ratio");
192  meEBShapeRatio_ = ibooker.book1D(histo, histo, 10, 0, 10.);
193 
194  sprintf (histo, "EcalDigiTask Endcap shape digi ratio");
195  meEEShapeRatio_ = ibooker.book1D(histo, histo, 10, 0, 10.);
196 
197  sprintf (histo, "EcalDigiTask Preshower shape digi ratio");
198  meESShapeRatio_ = ibooker.book1D(histo, histo, 3, 0, 3.);
199 
200 }
int i
Definition: DBlmapReader.cc:9
MonitorElement * meEEBunchShape_[nBunch]
MonitorElement * meEBBunchShape_[nBunch]
MonitorElement * meESBunchShape_[nBunch]
void EcalMixingModuleValidation::bunchSumTest ( std::vector< MonitorElement * > &  theBunches,
MonitorElement *&  theTotal,
MonitorElement *&  theRatio,
int  nSample 
)
private

Definition at line 228 of file EcalMixingModuleValidation.cc.

References gather_cfg::cout, MonitorElement::getBinContent(), MonitorElement::getBinError(), funct::pow(), MonitorElement::setBinContent(), MonitorElement::setBinError(), mathSSE::sqrt(), theMaxBunch, theMinBunch, and pileupDistInMC::total.

Referenced by endRun().

229 {
230 
231  std::vector<double> bunchSum;
232  bunchSum.reserve(nSample);
233  std::vector<double> bunchSumErro;
234  bunchSumErro.reserve(nSample);
235  std::vector<double> total;
236  total.reserve(nSample);
237  std::vector<double> totalErro;
238  totalErro.reserve(nSample);
239  std::vector<double> ratio;
240  ratio.reserve(nSample);
241  std::vector<double> ratioErro;
242  ratioErro.reserve(nSample);
243 
244 
245  for ( int iEl = 0 ; iEl < nSample ; iEl++ ) {
246  bunchSum[iEl] = 0.;
247  bunchSumErro[iEl] = 0.;
248  total[iEl] = 0.;
249  totalErro[iEl] = 0.;
250  ratio[iEl] = 0.;
251  ratioErro[iEl] = 0.;
252  }
253 
254  for ( int iSample = 0 ; iSample < nSample ; iSample++ ) {
255 
256  total[iSample] += theTotal->getBinContent(iSample+1);
257  totalErro[iSample] += theTotal->getBinError(iSample+1);
258 
259  for ( int iBunch = theMinBunch; iBunch <= theMaxBunch; iBunch++ ) {
260 
261  int iHisto = iBunch - theMinBunch;
262 
263  bunchSum[iSample] += theBunches[iHisto]->getBinContent(iSample+1);
264  bunchSumErro[iSample] += pow(theBunches[iHisto]->getBinError(iSample+1),2);
265 
266  }
267  bunchSumErro[iSample] = sqrt(bunchSumErro[iSample]);
268 
269  if ( bunchSum[iSample] > 0. ) {
270  ratio[iSample] = total[iSample]/bunchSum[iSample];
271  ratioErro[iSample] = sqrt(pow(totalErro[iSample]/bunchSum[iSample],2)+
272  pow((total[iSample]*bunchSumErro[iSample])/(bunchSum[iSample]*bunchSum[iSample]),2));
273  }
274 
275  std::cout << " Sample = " << iSample << " Total = " << total[iSample] << " +- " << totalErro[iSample] << "\n"
276  << " Sum = " << bunchSum[iSample] << " +- " << bunchSumErro[iSample] << "\n"
277  << " Ratio = " << ratio[iSample] << " +- " << ratioErro[iSample] << std::endl;
278 
279  theRatio->setBinContent(iSample+1, (float)ratio[iSample]);
280  theRatio->setBinError(iSample+1, (float)ratioErro[iSample]);
281 
282  }
283 
284 }
void setBinContent(int binx, double content)
set content of bin (1-D)
T sqrt(T t)
Definition: SSEVec.h:18
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
double getBinContent(int binx) const
get content of bin (1-D)
tuple cout
Definition: gather_cfg.py:145
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void EcalMixingModuleValidation::checkCalibrations ( edm::EventSetup const &  c)
private

Definition at line 634 of file EcalMixingModuleValidation.cc.

References barrelADCtoGeV_, endcapADCtoGeV_, esADCtokeV_, EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), gainConv_, edm::EventSetup::get(), EcalADCToGeVConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), ESGain::getESGain(), ESMIPToGeVConstant::getESValueHigh(), ESMIPToGeVConstant::getESValueLow(), LogDebug, m_ESeffwei, m_ESgain, m_ESmips, m_ESpeds, edm::ESHandle< class >::product(), ESShape::setGain(), and theESShape.

Referenced by dqmBeginRun().

634  {
635 
636  // ADC -> GeV Scale
638  eventSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
639  const EcalADCToGeVConstant* agc = pAgc.product();
640 
641  EcalMGPAGainRatio * defaultRatios = new EcalMGPAGainRatio();
642 
643  gainConv_[1] = 1.;
644  gainConv_[2] = defaultRatios->gain12Over6() ;
645  gainConv_[3] = gainConv_[2]*(defaultRatios->gain6Over1()) ;
646  gainConv_[0] = gainConv_[2]*(defaultRatios->gain6Over1()) ;
647 
648  LogDebug("EcalDigi") << " Gains conversions: " << "\n" << " g1 = " << gainConv_[1] << "\n" << " g2 = " << gainConv_[2] << "\n" << " g3 = " << gainConv_[3];
649 
650  delete defaultRatios;
651 
652  const double barrelADCtoGeV_ = agc->getEBValue();
653  LogDebug("EcalDigi") << " Barrel GeV/ADC = " << barrelADCtoGeV_;
654  const double endcapADCtoGeV_ = agc->getEEValue();
655  LogDebug("EcalDigi") << " Endcap GeV/ADC = " << endcapADCtoGeV_;
656 
657 
658  // ES condition objects
659  edm::ESHandle<ESGain> esgain_;
661  edm::ESHandle<ESPedestals> esPedestals_;
663 
664  eventSetup.get<ESGainRcd>().get(esgain_);
665  eventSetup.get<ESMIPToGeVConstantRcd>().get(esMIPToGeV_);
666  eventSetup.get<ESPedestalsRcd>().get(esPedestals_);
667  eventSetup.get<ESIntercalibConstantsRcd>().get(esMIPs_);
668 
669  const ESGain *esgain = esgain_.product();
670  m_ESpeds = esPedestals_.product();
671  m_ESmips = esMIPs_.product();
672  const ESMIPToGeVConstant *esMipToGeV = esMIPToGeV_.product();
673  m_ESgain = (int) esgain->getESGain();
674  const double valESMIPToGeV = (m_ESgain == 1) ? esMipToGeV->getESValueLow() : esMipToGeV->getESValueHigh();
675 
677 
678  esADCtokeV_ = 1000000.*valESMIPToGeV ;
679 
680  m_ESeffwei = ( 0 == m_ESgain ? 1.45 :
681  ( 1 == m_ESgain ? 0.9066 :
682  ( 2 == m_ESgain ? 0.8815 : 1.0 ) ) ) ;
683 
684 }
#define LogDebug(id)
const ESIntercalibConstants * m_ESmips
Definition: ESGain.h:7
void setGain(const int gain)
Definition: ESShape.h:26
float getESValueLow() const
float gain6Over1() const
std::map< int, double, std::less< int > > gainConv_
float getESGain() const
Definition: ESGain.h:13
T const * product() const
Definition: ESHandle.h:86
float gain12Over6() const
float getESValueHigh() const
void EcalMixingModuleValidation::checkPedestals ( const edm::EventSetup c)
private

Definition at line 686 of file EcalMixingModuleValidation.cc.

References edm::EventSetup::get(), edm::ESHandle< class >::product(), and thePedestals.

Referenced by analyze().

687 {
688 
689  // Pedestals from event setup
690 
692  eventSetup.get<EcalPedestalsRcd>().get( dbPed );
693  thePedestals=dbPed.product();
694 
695 }
T const * product() const
Definition: ESHandle.h:86
void EcalMixingModuleValidation::computeSDBunchDigi ( const edm::EventSetup eventSetup,
MixCollection< PCaloHit > &  theHits,
MapType ebSignalSimMap,
const EcalSubdetector thisDet,
const double &  theSimThreshold,
CLHEP::HepRandomEngine *  engine 
)
private

Definition at line 727 of file EcalMixingModuleValidation.cc.

References CaloHitResponse::clear(), DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, MonitorElement::Fill(), CaloHitResponse::findSignal(), edm::EventSetup::get(), CaloGeometry::getValidDetIds(), i, CaloSamples::id(), MessageLogger_cff::limit, ESDataFrame::MAXSAMPLES, CaloSamples::MAXSAMPLES, meEBBunchShape_, meEEBunchShape_, meESBunchShape_, CaloHitResponse::run(), CaloHitResponse::setBunchRange(), CaloHitResponse::setGeometry(), EcalSimParameterMap::simParameters(), theEBResponse, theEEResponse, theESResponse, theGeometry, theMaxBunch, theMinBunch, and theParameterMap.

Referenced by analyze().

728 {
729 
730  if ( thisDet != EcalBarrel && thisDet != EcalEndcap && thisDet != EcalPreshower ) {
731  edm::LogError("EcalMMValid") << "Invalid subdetector type";
732  return;
733  }
734  //bool isCrystal = true;
735  //if ( thisDet == EcalPreshower ) isCrystal = false;
736 
737  // load the geometry
738 
739  edm::ESHandle<CaloGeometry> hGeometry;
740  eventSetup.get<CaloGeometryRecord>().get(hGeometry);
741 
742  const CaloGeometry * pGeometry = &*hGeometry;
743 
744  // see if we need to update
745  if(pGeometry != theGeometry) {
746  theGeometry = pGeometry;
747  //theEcalResponse->setGeometry(theGeometry);
751 
752  }
753 
754  // vector of DetId with energy above a fraction of the gun's energy
755 
756  const std::vector<DetId>& theSDId = theGeometry->getValidDetIds( DetId::Ecal, thisDet );
757 
758  std::vector<DetId> theOverThresholdId;
759  for ( unsigned int i = 0 ; i < theSDId.size() ; i++ ) {
760 
761  int sdId = theSDId[i].rawId();
762  if ( SignalSimMap[sdId] > theSimThreshold ) theOverThresholdId.push_back( theSDId[i] );
763 
764  }
765 
767  if ( thisDet == EcalPreshower ) limit = ESDataFrame::MAXSAMPLES;
768 
769  for (int iBunch = theMinBunch ; iBunch <= theMaxBunch ; iBunch++ ) {
770 
771  //if ( isCrystal ) {
772  if( thisDet == EcalBarrel ) {
773  theEBResponse->setBunchRange(iBunch, iBunch);
774  theEBResponse->clear();
775  theEBResponse->run(theHits, engine);
776  }
777  else if( thisDet == EcalEndcap ) {
778  theEEResponse->setBunchRange(iBunch, iBunch);
779  theEEResponse->clear();
780  theEEResponse->run(theHits, engine);
781  }
782  else {
783  theESResponse->setBunchRange(iBunch, iBunch);
784  theESResponse->clear();
785  theESResponse->run(theHits, engine);
786  }
787 
788  int iHisto = iBunch - theMinBunch;
789 
790  for ( std::vector<DetId>::const_iterator idItr = theOverThresholdId.begin() ; idItr != theOverThresholdId.end() ; ++idItr ) {
791 
792  CaloSamples * analogSignal;
793  //if ( isCrystal )
794  if( thisDet == EcalBarrel ) {
795  analogSignal = theEBResponse->findSignal(*idItr);
796  }
797  else if( thisDet == EcalEndcap ) {
798  analogSignal = theEEResponse->findSignal(*idItr);
799  }
800  else {
801  analogSignal = theESResponse->findSignal(*idItr);
802  }
803 
804  if ( analogSignal ) {
805 
806  (*analogSignal) *= theParameterMap->simParameters(analogSignal->id()).photoelectronsToAnalog();
807 
808  for ( int i = 0 ; i < limit ; i++ ) {
809  if ( thisDet == EcalBarrel ) { meEBBunchShape_[iHisto]->Fill(i,(float)(*analogSignal)[i]); }
810  else if ( thisDet == EcalEndcap ) { meEEBunchShape_[iHisto]->Fill(i,(float)(*analogSignal)[i]); }
811  else if ( thisDet == EcalPreshower ) { meESBunchShape_[iHisto]->Fill(i,(float)(*analogSignal)[i]); }
812  }
813  }
814 
815  }
816 
817  }
818 
819  }
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
int i
Definition: DBlmapReader.cc:9
static const int MAXSAMPLES
Definition: CaloSamples.h:73
virtual const CaloSimParameters & simParameters(const DetId &id) const
return the sim parameters relative to the right subdet
virtual void run(MixCollection< PCaloHit > &hits, CLHEP::HepRandomEngine *)
Complete cell digitization.
MonitorElement * meEEBunchShape_[nBunch]
MonitorElement * meEBBunchShape_[nBunch]
void Fill(long long x)
MonitorElement * meESBunchShape_[nBunch]
static const int MAXSAMPLES
Definition: ESDataFrame.h:32
const EcalSimParameterMap * theParameterMap
const T & get() const
Definition: EventSetup.h:56
void setBunchRange(int minBunch, int maxBunch)
tells it which pileup bunches to do
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:90
CaloSamples * findSignal(const DetId &detId)
users can look for the signal for a given cell
void clear()
frees up memory
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
void EcalMixingModuleValidation::dqmBeginRun ( edm::Run const &  ,
edm::EventSetup const &  c 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 136 of file EcalMixingModuleValidation.cc.

References checkCalibrations().

136  {
137 
139 
140 }
void checkCalibrations(edm::EventSetup const &c)
void EcalMixingModuleValidation::endRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 202 of file EcalMixingModuleValidation.cc.

References bunchSumTest(), i, ESDataFrame::MAXSAMPLES, EcalDataFrame::MAXSAMPLES, meEBBunchShape_, meEBShape_, meEBShapeRatio_, meEEBunchShape_, meEEShape_, meEEShapeRatio_, meESBunchShape_, meESShape_, meESShapeRatio_, and nBunch.

202  {
203 
204  // add shapes for each bunch crossing and divide the digi by the result
205 
206  std::vector<MonitorElement *> theBunches;
207  for ( int i = 0 ; i < nBunch ; i++ ) {
208  theBunches.push_back(meEBBunchShape_[i]);
209  }
211 
212  theBunches.clear();
213 
214  for ( int i = 0 ; i < nBunch ; i++ ) {
215  theBunches.push_back(meEEBunchShape_[i]);
216  }
218 
219  theBunches.clear();
220 
221  for ( int i = 0 ; i < nBunch ; i++ ) {
222  theBunches.push_back(meESBunchShape_[i]);
223  }
225 
226 }
int i
Definition: DBlmapReader.cc:9
MonitorElement * meEEBunchShape_[nBunch]
MonitorElement * meEBBunchShape_[nBunch]
void bunchSumTest(std::vector< MonitorElement * > &theBunches, MonitorElement *&theTotal, MonitorElement *&theRatio, int nSample)
MonitorElement * meESBunchShape_[nBunch]
static const int MAXSAMPLES
Definition: ESDataFrame.h:32
static const int MAXSAMPLES
Definition: EcalDataFrame.h:48
void EcalMixingModuleValidation::findPedestal ( const DetId detId,
int  gainId,
double &  ped 
) const
private

Definition at line 697 of file EcalMixingModuleValidation.cc.

References EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), ecalMGPA::gainId(), EcalCondObjectContainer< T >::getMap(), LogDebug, EcalPedestal::mean_x1, EcalPedestal::mean_x12, EcalPedestal::mean_x6, DetId::rawId(), EcalCondObjectContainer< T >::size(), and thePedestals.

Referenced by analyze().

698 {
700  = thePedestals->getMap().find(detId);
701  // should I care if it doesn't get found?
702  if(mapItr == thePedestals->getMap().end()) {
703  edm::LogError("EcalMMValid") << "Could not find pedestal for " << detId.rawId() << " among the " << thePedestals->getMap().size();
704  } else {
705  EcalPedestals::Item item = (*mapItr);
706 
707  switch(gainId) {
708  case 0:
709  ped = item.mean_x1;
710  case 1:
711  ped = item.mean_x12;
712  break;
713  case 2:
714  ped = item.mean_x6;
715  break;
716  case 3:
717  ped = item.mean_x1;
718  break;
719  default:
720  edm::LogError("EcalMMValid") << "Bad Pedestal " << gainId;
721  break;
722  }
723  LogDebug("EcalMMValid") << "Pedestals for " << detId.rawId() << " gain range " << gainId << " : \n" << "Mean = " << ped;
724  }
725 }
#define LogDebug(id)
int gainId(sample_type sample)
get the gainId (2 bits)
const self & getMap() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
EcalPedestalsMap::const_iterator EcalPedestalsMapIterator
Definition: EcalPedestals.h:52
const_iterator find(uint32_t rawId) const
const_iterator end() const
CLHEP::HepRandomEngine * EcalMixingModuleValidation::randomEngine ( edm::StreamID const &  streamID)
private

Definition at line 821 of file EcalMixingModuleValidation.cc.

References edm::RandomNumberGenerator::getEngine(), cmsHarvester::index, randomEngines_, and edm::StreamID::value().

Referenced by analyze().

821  {
822  unsigned int index = streamID.value();
823  if(index >= randomEngines_.size()) {
824  randomEngines_.resize(index + 1, nullptr);
825  }
826  CLHEP::HepRandomEngine* ptr = randomEngines_[index];
827  if(!ptr) {
829  ptr = &rng->getEngine(streamID);
830  randomEngines_[index] = ptr;
831  }
832  return ptr;
833 }
std::vector< CLHEP::HepRandomEngine * > randomEngines_
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.

Member Data Documentation

double EcalMixingModuleValidation::barrelADCtoGeV_
private
edm::EDGetTokenT< CrossingFrame<PCaloHit> > EcalMixingModuleValidation::crossingFramePCaloHitEBToken_
private

Definition at line 120 of file EcalMixingModuleValidation.h.

Referenced by analyze().

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

Definition at line 120 of file EcalMixingModuleValidation.h.

Referenced by analyze().

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

Definition at line 120 of file EcalMixingModuleValidation.h.

Referenced by analyze().

DQMStore* EcalMixingModuleValidation::dbe_
private

Definition at line 110 of file EcalMixingModuleValidation.h.

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

Definition at line 116 of file EcalMixingModuleValidation.h.

Referenced by analyze().

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

Definition at line 117 of file EcalMixingModuleValidation.h.

Referenced by analyze().

double EcalMixingModuleValidation::endcapADCtoGeV_
private
double EcalMixingModuleValidation::esADCtokeV_
private

Definition at line 170 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

double EcalMixingModuleValidation::esBaseline_
private

Definition at line 169 of file EcalMixingModuleValidation.h.

Referenced by analyze().

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

Definition at line 118 of file EcalMixingModuleValidation.h.

Referenced by analyze().

double EcalMixingModuleValidation::esThreshold_
private

Definition at line 171 of file EcalMixingModuleValidation.h.

Referenced by analyze().

std::map<int, double, std::less<int> > EcalMixingModuleValidation::gainConv_
private
edm::EDGetTokenT<edm::HepMCProduct> EcalMixingModuleValidation::HepMCToken_
private

Definition at line 114 of file EcalMixingModuleValidation.h.

Referenced by analyze().

double EcalMixingModuleValidation::m_ESeffwei
private

Definition at line 184 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

int EcalMixingModuleValidation::m_ESgain
private

Definition at line 181 of file EcalMixingModuleValidation.h.

Referenced by checkCalibrations().

const ESIntercalibConstants* EcalMixingModuleValidation::m_ESmips
private

Definition at line 183 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

const ESPedestals* EcalMixingModuleValidation::m_ESpeds
private

Definition at line 182 of file EcalMixingModuleValidation.h.

Referenced by analyze(), and checkCalibrations().

MonitorElement* EcalMixingModuleValidation::meEBbunchCrossing_
private
MonitorElement* EcalMixingModuleValidation::meEBBunchShape_[nBunch]
private
MonitorElement* EcalMixingModuleValidation::meEBDigiMixRatiogt100ADC_
private
MonitorElement* EcalMixingModuleValidation::meEBDigiMixRatioOriggt50pc_
private
MonitorElement* EcalMixingModuleValidation::meEBShape_
private
MonitorElement* EcalMixingModuleValidation::meEBShapeRatio_
private
MonitorElement* EcalMixingModuleValidation::meEEbunchCrossing_
private
MonitorElement* EcalMixingModuleValidation::meEEBunchShape_[nBunch]
private
MonitorElement* EcalMixingModuleValidation::meEEDigiMixRatiogt100ADC_
private
MonitorElement* EcalMixingModuleValidation::meEEDigiMixRatioOriggt40pc_
private
MonitorElement* EcalMixingModuleValidation::meEEShape_
private
MonitorElement* EcalMixingModuleValidation::meEEShapeRatio_
private
MonitorElement* EcalMixingModuleValidation::meESbunchCrossing_
private
MonitorElement* EcalMixingModuleValidation::meESBunchShape_[nBunch]
private
MonitorElement* EcalMixingModuleValidation::meESShape_
private
MonitorElement* EcalMixingModuleValidation::meESShapeRatio_
private
const int EcalMixingModuleValidation::nBunch = 21
staticprivate
std::string EcalMixingModuleValidation::outputFile_
private

Definition at line 112 of file EcalMixingModuleValidation.h.

std::vector<CLHEP::HepRandomEngine*> EcalMixingModuleValidation::randomEngines_
private

Definition at line 186 of file EcalMixingModuleValidation.h.

Referenced by randomEngine().

CaloHitResponse* EcalMixingModuleValidation::theEBResponse
private

Definition at line 160 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

const EBShape* EcalMixingModuleValidation::theEBShape
private

Definition at line 154 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().

CaloHitResponse* EcalMixingModuleValidation::theEEResponse
private

Definition at line 161 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

const EEShape* EcalMixingModuleValidation::theEEShape
private

Definition at line 155 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().

CaloHitResponse* EcalMixingModuleValidation::theESResponse
private

Definition at line 159 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

ESShape* EcalMixingModuleValidation::theESShape
private

Definition at line 153 of file EcalMixingModuleValidation.h.

Referenced by checkCalibrations(), and EcalMixingModuleValidation().

const CaloGeometry* EcalMixingModuleValidation::theGeometry
private

Definition at line 176 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi().

int EcalMixingModuleValidation::theMaxBunch
private
int EcalMixingModuleValidation::theMinBunch
private
const EcalSimParameterMap* EcalMixingModuleValidation::theParameterMap
private

Definition at line 151 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

const EcalPedestals* EcalMixingModuleValidation::thePedestals
private

Definition at line 179 of file EcalMixingModuleValidation.h.

Referenced by checkPedestals(), and findPedestal().

bool EcalMixingModuleValidation::verbose_
private

Definition at line 108 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().