CMS 3D CMS Logo

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::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
 
 EcalMixingModuleValidation (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~EcalMixingModuleValidation () override
 Destructor. More...
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void analyze (edm::Event const &e, edm::EventSetup const &c) override
 Analyze. More...
 
void dqmBeginRun (edm::Run const &, edm::EventSetup const &) override
 
void dqmEndRun (const edm::Run &r, const edm::EventSetup &c) override
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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, const 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_
 
edm::EDGetTokenT< EBDigiCollectionEBdigiCollectionToken_
 
edm::EDGetTokenT< EEDigiCollectionEEdigiCollectionToken_
 
double endcapADCtoGeV_
 
double esADCtokeV_
 
double esBaseline_
 
edm::EDGetTokenT< ESDigiCollectionESdigiCollectionToken_
 
double esThreshold_
 
std::map< int, double, std::less< int > > gainConv_
 
edm::EDGetTokenT< edm::HepMCProductHepMCToken_
 
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
 
EBShapetheEBShape
 
CaloHitResponsetheEEResponse
 
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 DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 74 of file EcalMixingModuleValidation.h.

Member Typedef Documentation

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

Definition at line 75 of file EcalMixingModuleValidation.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 19 of file EcalMixingModuleValidation.cc.

References barrelADCtoGeV_, ecalEBTriggerPrimitiveDigis_cfi::binOfMaximum, ecalSimParameterMap_cff::doPhotostatistics, endcapADCtoGeV_, gainConv_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, meEBbunchCrossing_, meEBBunchShape_, meEBDigiMixRatiogt100ADC_, meEBDigiMixRatioOriggt50pc_, meEBShape_, meEBShapeRatio_, meEEbunchCrossing_, meEEBunchShape_, meEEDigiMixRatiogt100ADC_, meEEDigiMixRatioOriggt40pc_, meEEShape_, meEEShapeRatio_, meESbunchCrossing_, meESBunchShape_, meESShape_, meESShapeRatio_, nBunch, ecalSimParameterMap_cff::photoelectronsToAnalogBarrel, ecalSimParameterMap_cff::photoelectronsToAnalogEndcap, ecalSimParameterMap_cff::readoutFrameSize, ecalSimParameterMap_cff::samplingFactor, ecalSimParameterMap_cff::simHitToPhotoelectronsBarrel, ecalSimParameterMap_cff::simHitToPhotoelectronsEndcap, ecalSimParameterMap_cff::syncPhase, theEBResponse, theEBShape, theEEResponse, theEEShape, theESResponse, theESShape, theMaxBunch, theMinBunch, theParameterMap, ecalSimParameterMap_cff::timePhase, and verbose_.

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  edm::InputTag(std::string("mix"), ps.getParameter<std::string>("hitsProducer") + std::string("EcalHitsEB")))),
27  edm::InputTag(std::string("mix"), ps.getParameter<std::string>("hitsProducer") + std::string("EcalHitsEE")))),
29  std::string("mix"), ps.getParameter<std::string>("hitsProducer") + std::string("EcalHitsES")))) {
30  // needed for MixingModule checks
31 
32  double simHitToPhotoelectronsBarrel = ps.getParameter<double>("simHitToPhotoelectronsBarrel");
33  double simHitToPhotoelectronsEndcap = ps.getParameter<double>("simHitToPhotoelectronsEndcap");
34  double photoelectronsToAnalogBarrel = ps.getParameter<double>("photoelectronsToAnalogBarrel");
35  double photoelectronsToAnalogEndcap = ps.getParameter<double>("photoelectronsToAnalogEndcap");
36  double samplingFactor = ps.getParameter<double>("samplingFactor");
37  double timePhase = ps.getParameter<double>("timePhase");
38  int readoutFrameSize = ps.getParameter<int>("readoutFrameSize");
39  int binOfMaximum = ps.getParameter<int>("binOfMaximum");
40  bool doPhotostatistics = ps.getParameter<bool>("doPhotostatistics");
41  bool syncPhase = ps.getParameter<bool>("syncPhase");
42 
43  doPhotostatistics = false;
44 
45  theParameterMap = new EcalSimParameterMap(simHitToPhotoelectronsBarrel,
46  simHitToPhotoelectronsEndcap,
47  photoelectronsToAnalogBarrel,
48  photoelectronsToAnalogEndcap,
49  samplingFactor,
50  timePhase,
51  readoutFrameSize,
52  binOfMaximum,
53  doPhotostatistics,
54  syncPhase);
55  //theEcalShape = new EcalShape(timePhase);
56 
57  //theEcalResponse = new CaloHitResponse(theParameterMap, theEcalShape);
58 
59  /*
60  int ESGain = ps.getParameter<int>("ESGain");
61  double ESNoiseSigma = ps.getParameter<double> ("ESNoiseSigma");
62  int ESBaseline = ps.getParameter<int>("ESBaseline");
63  double ESMIPADC = ps.getParameter<double>("ESMIPADC");
64  double ESMIPkeV = ps.getParameter<double>("ESMIPkeV");
65 */
66 
67  theESShape = new ESShape();
68  theEBShape = new EBShape(true);
69  theEEShape = new EEShape(true);
70 
74 
75  // double effwei = 1.;
76 
77  /*
78  if (ESGain == 0)
79  effwei = 1.45;
80  else if (ESGain == 1)
81  effwei = 0.9066;
82  else if (ESGain == 2)
83  effwei = 0.8815;
84 
85  esBaseline_ = (double)ESBaseline;
86  esADCtokeV_ = 1000000.*ESMIPADC/ESMIPkeV;
87  esThreshold_ = 3.*effwei*ESNoiseSigma/esADCtokeV_;
88 */
89  theMinBunch = -10;
90  theMaxBunch = 10;
91 
92  // verbosity switch
93  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
94 
95  gainConv_[1] = 1.;
96  gainConv_[2] = 2.;
97  gainConv_[3] = 12.;
98  gainConv_[0] = 12.;
99  barrelADCtoGeV_ = 0.035;
100  endcapADCtoGeV_ = 0.06;
101 
102  meEBDigiMixRatiogt100ADC_ = nullptr;
103  meEEDigiMixRatiogt100ADC_ = nullptr;
104 
105  meEBDigiMixRatioOriggt50pc_ = nullptr;
106  meEEDigiMixRatioOriggt40pc_ = nullptr;
107 
108  meEBbunchCrossing_ = nullptr;
109  meEEbunchCrossing_ = nullptr;
110  meESbunchCrossing_ = nullptr;
111 
112  for (int i = 0; i < nBunch; i++) {
113  meEBBunchShape_[i] = nullptr;
114  meEEBunchShape_[i] = nullptr;
115  meESBunchShape_[i] = nullptr;
116  }
117 
118  meEBShape_ = nullptr;
119  meEEShape_ = nullptr;
120  meESShape_ = nullptr;
121 
122  meEBShapeRatio_ = nullptr;
123  meEEShapeRatio_ = nullptr;
124  meESShapeRatio_ = nullptr;
125 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken_
MonitorElement * meEEBunchShape_[nBunch]
edm::EDGetTokenT< EBDigiCollection > EBdigiCollectionToken_
MonitorElement * meEBBunchShape_[nBunch]
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEEToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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< CrossingFrame< PCaloHit > > crossingFramePCaloHitESToken_
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
Definition: EEShape.h:6
EcalMixingModuleValidation::~EcalMixingModuleValidation ( )
override

Destructor.

Definition at line 127 of file EcalMixingModuleValidation.cc.

127 {}

Member Function Documentation

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

Analyze.

Reimplemented from DQMEDAnalyzer.

Definition at line 269 of file EcalMixingModuleValidation.cc.

References ESSample::adc(), EcalMGPASample::adc(), barrelADCtoGeV_, HLT_2018_cff::barrelHits, checkPedestals(), computeSDBunchDigi(), crossingFramePCaloHitEBToken_, crossingFramePCaloHitEEToken_, crossingFramePCaloHitESToken_, EBdigiCollectionToken_, EcalBarrel, EcalEndcap, EcalPreshower, EEdigiCollectionToken_, edm::DataFrameContainer::empty(), endcapADCtoGeV_, HLT_2018_cff::endcapHits, esADCtokeV_, esBaseline_, ESdigiCollectionToken_, esThreshold_, DQMScaleToClient_cfi::factor, dqm::impl::MonitorElement::Fill(), ESCondObjectContainer< T >::find(), findPedestal(), gainConv_, EcalMGPASample::gainId(), edm::Event::getByToken(), edm::HepMCProduct::GetEvent(), ESCondObjectContainer< T >::getMap(), HepMCToken_, mps_fire::i, ESDataFrame::id(), EEDataFrame::id(), EBDataFrame::id(), EBDetId::ieta(), createfilelist::int, EBDetId::iphi(), PixelPluginsPhase0_cfi::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(), dataAnalyzerFineBiningParameters_cff::Pmax, gedPhotons_cfi::preshowerHits, edm::Handle< T >::product(), randomEngine(), DetId::rawId(), edm::DataFrameContainer::reserve(), simplePhotonAnalyzer_cfi::sample, ESDetId::six(), ESDetId::siy(), ESDataFrame::size(), EcalDataFrame::size(), edm::DataFrameContainer::size(), edm::Event::streamID(), ESDetId::strip(), ESDetId::zside(), and EEDetId::zside().

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

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

135  {
136  Char_t histo[200];
137 
138  ibooker.setCurrentFolder("EcalDigisV/EcalDigiTask");
139 
140  sprintf(histo, "EcalDigiTask Barrel maximum Digi over sim signal ratio gt 100 ADC");
141  meEBDigiMixRatiogt100ADC_ = ibooker.book1D(histo, histo, 200, 0., 100.);
142 
143  sprintf(histo, "EcalDigiTask Endcap maximum Digi over sim signal ratio gt 100 ADC");
144  meEEDigiMixRatiogt100ADC_ = ibooker.book1D(histo, histo, 200, 0., 100.);
145 
146  sprintf(histo, "EcalDigiTask Barrel maximum Digi over sim signal ratio signal gt 50pc gun");
147  meEBDigiMixRatioOriggt50pc_ = ibooker.book1D(histo, histo, 200, 0., 100.);
148 
149  sprintf(histo, "EcalDigiTask Endcap maximum Digi over sim signal ratio signal gt 40pc gun");
150  meEEDigiMixRatioOriggt40pc_ = ibooker.book1D(histo, histo, 200, 0., 100.);
151 
152  sprintf(histo, "EcalDigiTask Barrel bunch crossing");
153  meEBbunchCrossing_ = ibooker.book1D(histo, histo, 20, -10., 10.);
154 
155  sprintf(histo, "EcalDigiTask Endcap bunch crossing");
156  meEEbunchCrossing_ = ibooker.book1D(histo, histo, 20, -10., 10.);
157 
158  sprintf(histo, "EcalDigiTask Preshower bunch crossing");
159  meESbunchCrossing_ = ibooker.book1D(histo, histo, 20, -10., 10.);
160 
161  for (int i = 0; i < nBunch; i++) {
162  sprintf(histo, "EcalDigiTask Barrel shape bunch crossing %02d", i - 10);
163  meEBBunchShape_[i] = ibooker.bookProfile(histo, histo, 10, 0, 10, 4000, 0., 400.);
164 
165  sprintf(histo, "EcalDigiTask Endcap shape bunch crossing %02d", i - 10);
166  meEEBunchShape_[i] = ibooker.bookProfile(histo, histo, 10, 0, 10, 4000, 0., 400.);
167 
168  sprintf(histo, "EcalDigiTask Preshower shape bunch crossing %02d", i - 10);
169  meESBunchShape_[i] = ibooker.bookProfile(histo, histo, 3, 0, 3, 4000, 0., 400.);
170  }
171 
172  sprintf(histo, "EcalDigiTask Barrel shape digi");
173  meEBShape_ = ibooker.bookProfile(histo, histo, 10, 0, 10, 4000, 0., 2000.);
174 
175  sprintf(histo, "EcalDigiTask Endcap shape digi");
176  meEEShape_ = ibooker.bookProfile(histo, histo, 10, 0, 10, 4000, 0., 2000.);
177 
178  sprintf(histo, "EcalDigiTask Preshower shape digi");
179  meESShape_ = ibooker.bookProfile(histo, histo, 3, 0, 3, 4000, 0., 2000.);
180 
181  sprintf(histo, "EcalDigiTask Barrel shape digi ratio");
182  meEBShapeRatio_ = ibooker.book1D(histo, histo, 10, 0, 10.);
183 
184  sprintf(histo, "EcalDigiTask Endcap shape digi ratio");
185  meEEShapeRatio_ = ibooker.book1D(histo, histo, 10, 0, 10.);
186 
187  sprintf(histo, "EcalDigiTask Preshower shape digi ratio");
188  meESShapeRatio_ = ibooker.book1D(histo, histo, 3, 0, 3.);
189 }
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 215 of file EcalMixingModuleValidation.cc.

References gather_cfg::cout, dqm::impl::MonitorElement::getBinContent(), dqm::impl::MonitorElement::getBinError(), funct::pow(), particleFlowDisplacedVertex_cfi::ratio, dqm::impl::MonitorElement::setBinContent(), dqm::impl::MonitorElement::setBinError(), mathSSE::sqrt(), theMaxBunch, theMinBunch, and dqmMemoryStats::total.

Referenced by dqmEndRun().

218  {
219  std::vector<double> bunchSum;
220  bunchSum.reserve(nSample);
221  std::vector<double> bunchSumErro;
222  bunchSumErro.reserve(nSample);
223  std::vector<double> total;
224  total.reserve(nSample);
225  std::vector<double> totalErro;
226  totalErro.reserve(nSample);
227  std::vector<double> ratio;
228  ratio.reserve(nSample);
229  std::vector<double> ratioErro;
230  ratioErro.reserve(nSample);
231 
232  for (int iEl = 0; iEl < nSample; iEl++) {
233  bunchSum[iEl] = 0.;
234  bunchSumErro[iEl] = 0.;
235  total[iEl] = 0.;
236  totalErro[iEl] = 0.;
237  ratio[iEl] = 0.;
238  ratioErro[iEl] = 0.;
239  }
240 
241  for (int iSample = 0; iSample < nSample; iSample++) {
242  total[iSample] += theTotal->getBinContent(iSample + 1);
243  totalErro[iSample] += theTotal->getBinError(iSample + 1);
244 
245  for (int iBunch = theMinBunch; iBunch <= theMaxBunch; iBunch++) {
246  int iHisto = iBunch - theMinBunch;
247 
248  bunchSum[iSample] += theBunches[iHisto]->getBinContent(iSample + 1);
249  bunchSumErro[iSample] += pow(theBunches[iHisto]->getBinError(iSample + 1), 2);
250  }
251  bunchSumErro[iSample] = sqrt(bunchSumErro[iSample]);
252 
253  if (bunchSum[iSample] > 0.) {
254  ratio[iSample] = total[iSample] / bunchSum[iSample];
255  ratioErro[iSample] =
256  sqrt(pow(totalErro[iSample] / bunchSum[iSample], 2) +
257  pow((total[iSample] * bunchSumErro[iSample]) / (bunchSum[iSample] * bunchSum[iSample]), 2));
258  }
259 
260  std::cout << " Sample = " << iSample << " Total = " << total[iSample] << " +- " << totalErro[iSample] << "\n"
261  << " Sum = " << bunchSum[iSample] << " +- " << bunchSumErro[iSample] << "\n"
262  << " Ratio = " << ratio[iSample] << " +- " << ratioErro[iSample] << std::endl;
263 
264  theRatio->setBinContent(iSample + 1, (float)ratio[iSample]);
265  theRatio->setBinError(iSample + 1, (float)ratioErro[iSample]);
266  }
267 }
virtual double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
T sqrt(T t)
Definition: SSEVec.h:19
virtual double getBinContent(int binx) const
get content of bin (1-D)
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
void EcalMixingModuleValidation::checkCalibrations ( edm::EventSetup const &  c)
private

Definition at line 605 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(), createfilelist::int, LogDebug, m_ESeffwei, m_ESgain, m_ESmips, m_ESpeds, edm::ESHandle< T >::product(), ESShape::setGain(), and theESShape.

Referenced by dqmBeginRun().

605  {
606  // ADC -> GeV Scale
608  eventSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
609  const EcalADCToGeVConstant* agc = pAgc.product();
610 
611  EcalMGPAGainRatio* defaultRatios = new EcalMGPAGainRatio();
612 
613  gainConv_[1] = 1.;
614  gainConv_[2] = defaultRatios->gain12Over6();
615  gainConv_[3] = gainConv_[2] * (defaultRatios->gain6Over1());
616  gainConv_[0] = gainConv_[2] * (defaultRatios->gain6Over1());
617 
618  LogDebug("EcalDigi") << " Gains conversions: "
619  << "\n"
620  << " g1 = " << gainConv_[1] << "\n"
621  << " g2 = " << gainConv_[2] << "\n"
622  << " g3 = " << gainConv_[3];
623 
624  delete defaultRatios;
625 
626  const double barrelADCtoGeV_ = agc->getEBValue();
627  LogDebug("EcalDigi") << " Barrel GeV/ADC = " << barrelADCtoGeV_;
628  const double endcapADCtoGeV_ = agc->getEEValue();
629  LogDebug("EcalDigi") << " Endcap GeV/ADC = " << endcapADCtoGeV_;
630 
631  // ES condition objects
632  edm::ESHandle<ESGain> esgain_;
634  edm::ESHandle<ESPedestals> esPedestals_;
636 
637  eventSetup.get<ESGainRcd>().get(esgain_);
638  eventSetup.get<ESMIPToGeVConstantRcd>().get(esMIPToGeV_);
639  eventSetup.get<ESPedestalsRcd>().get(esPedestals_);
640  eventSetup.get<ESIntercalibConstantsRcd>().get(esMIPs_);
641 
642  const ESGain* esgain = esgain_.product();
643  m_ESpeds = esPedestals_.product();
644  m_ESmips = esMIPs_.product();
645  const ESMIPToGeVConstant* esMipToGeV = esMIPToGeV_.product();
646  m_ESgain = (int)esgain->getESGain();
647  const double valESMIPToGeV = (m_ESgain == 1) ? esMipToGeV->getESValueLow() : esMipToGeV->getESValueHigh();
648 
650 
651  esADCtokeV_ = 1000000. * valESMIPToGeV;
652 
653  m_ESeffwei = (0 == m_ESgain ? 1.45 : (1 == m_ESgain ? 0.9066 : (2 == m_ESgain ? 0.8815 : 1.0)));
654 }
#define LogDebug(id)
const ESIntercalibConstants * m_ESmips
Definition: ESGain.h:7
void setGain(const int gain)
Definition: ESShape.h:23
float getESValueLow() const
float gain6Over1() const
std::map< int, double, std::less< int > > gainConv_
float getESGain() const
Definition: ESGain.h:13
float gain12Over6() const
float getESValueHigh() const
T const * product() const
Definition: ESHandle.h:86
void EcalMixingModuleValidation::checkPedestals ( const edm::EventSetup c)
private

Definition at line 656 of file EcalMixingModuleValidation.cc.

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

Referenced by analyze().

656  {
657  // Pedestals from event setup
658 
660  eventSetup.get<EcalPedestalsRcd>().get(dbPed);
661  thePedestals = dbPed.product();
662 }
T const * product() const
Definition: ESHandle.h:86
void EcalMixingModuleValidation::computeSDBunchDigi ( const edm::EventSetup eventSetup,
const MixCollection< PCaloHit > &  theHits,
MapType ebSignalSimMap,
const EcalSubdetector thisDet,
const double &  theSimThreshold,
CLHEP::HepRandomEngine *  engine 
)
private

Definition at line 695 of file EcalMixingModuleValidation.cc.

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

Referenced by analyze().

700  {
701  if (thisDet != EcalBarrel && thisDet != EcalEndcap && thisDet != EcalPreshower) {
702  edm::LogError("EcalMMValid") << "Invalid subdetector type";
703  return;
704  }
705  //bool isCrystal = true;
706  //if ( thisDet == EcalPreshower ) isCrystal = false;
707 
708  // load the geometry
709 
710  edm::ESHandle<CaloGeometry> hGeometry;
711  eventSetup.get<CaloGeometryRecord>().get(hGeometry);
712 
713  const CaloGeometry* pGeometry = &*hGeometry;
714 
715  // see if we need to update
716  if (pGeometry != theGeometry) {
717  theGeometry = pGeometry;
718  //theEcalResponse->setGeometry(theGeometry);
722  }
723 
724  // vector of DetId with energy above a fraction of the gun's energy
725 
726  const std::vector<DetId>& theSDId = theGeometry->getValidDetIds(DetId::Ecal, thisDet);
727 
728  std::vector<DetId> theOverThresholdId;
729  for (unsigned int i = 0; i < theSDId.size(); i++) {
730  int sdId = theSDId[i].rawId();
731  if (SignalSimMap[sdId] > theSimThreshold)
732  theOverThresholdId.push_back(theSDId[i]);
733  }
734 
736  if (thisDet == EcalPreshower)
737  limit = ESDataFrame::MAXSAMPLES;
738 
739  for (int iBunch = theMinBunch; iBunch <= theMaxBunch; iBunch++) {
740  //if ( isCrystal ) {
741  if (thisDet == EcalBarrel) {
742  theEBResponse->setBunchRange(iBunch, iBunch);
743  theEBResponse->clear();
744  theEBResponse->run(theHits, engine);
745  } else if (thisDet == EcalEndcap) {
746  theEEResponse->setBunchRange(iBunch, iBunch);
747  theEEResponse->clear();
748  theEEResponse->run(theHits, engine);
749  } else {
750  theESResponse->setBunchRange(iBunch, iBunch);
751  theESResponse->clear();
752  theESResponse->run(theHits, engine);
753  }
754 
755  int iHisto = iBunch - theMinBunch;
756 
757  for (std::vector<DetId>::const_iterator idItr = theOverThresholdId.begin(); idItr != theOverThresholdId.end();
758  ++idItr) {
759  CaloSamples* analogSignal;
760  //if ( isCrystal )
761  if (thisDet == EcalBarrel) {
762  analogSignal = theEBResponse->findSignal(*idItr);
763  } else if (thisDet == EcalEndcap) {
764  analogSignal = theEEResponse->findSignal(*idItr);
765  } else {
766  analogSignal = theESResponse->findSignal(*idItr);
767  }
768 
769  if (analogSignal) {
770  (*analogSignal) *= theParameterMap->simParameters(analogSignal->id()).photoelectronsToAnalog();
771 
772  for (int i = 0; i < limit; i++) {
773  if (thisDet == EcalBarrel) {
774  meEBBunchShape_[iHisto]->Fill(i, (float)(*analogSignal)[i]);
775  } else if (thisDet == EcalEndcap) {
776  meEEBunchShape_[iHisto]->Fill(i, (float)(*analogSignal)[i]);
777  } else if (thisDet == EcalPreshower) {
778  meESBunchShape_[iHisto]->Fill(i, (float)(*analogSignal)[i]);
779  }
780  }
781  }
782  }
783  }
784 }
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
static const int MAXSAMPLES
Definition: CaloSamples.h:86
MonitorElement * meEEBunchShape_[nBunch]
MonitorElement * meEBBunchShape_[nBunch]
virtual void run(const MixCollection< PCaloHit > &hits, CLHEP::HepRandomEngine *)
Complete cell digitization.
void Fill(long long x)
MonitorElement * meESBunchShape_[nBunch]
static const int MAXSAMPLES
Definition: ESDataFrame.h:30
const CaloSimParameters & simParameters(const DetId &id) const override
return the sim parameters relative to the right subdet
const EcalSimParameterMap * theParameterMap
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:75
CaloSamples * findSignal(const DetId &detId)
users can look for the signal for a given cell
void clear()
frees up memory
T get() const
Definition: EventSetup.h:73
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
void EcalMixingModuleValidation::dqmBeginRun ( edm::Run const &  ,
edm::EventSetup const &  c 
)
overrideprotectedvirtual
void EcalMixingModuleValidation::dqmEndRun ( const edm::Run r,
const edm::EventSetup c 
)
overrideprotected

Definition at line 191 of file EcalMixingModuleValidation.cc.

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

191  {
192  // add shapes for each bunch crossing and divide the digi by the result
193 
194  std::vector<MonitorElement*> theBunches;
195  for (int i = 0; i < nBunch; i++) {
196  theBunches.push_back(meEBBunchShape_[i]);
197  }
199 
200  theBunches.clear();
201 
202  for (int i = 0; i < nBunch; i++) {
203  theBunches.push_back(meEEBunchShape_[i]);
204  }
206 
207  theBunches.clear();
208 
209  for (int i = 0; i < nBunch; i++) {
210  theBunches.push_back(meESBunchShape_[i]);
211  }
213 }
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:30
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
void EcalMixingModuleValidation::findPedestal ( const DetId detId,
int  gainId,
double &  ped 
) const
private

Definition at line 664 of file EcalMixingModuleValidation.cc.

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

Referenced by analyze().

664  {
666  // should I care if it doesn't get found?
667  if (mapItr == thePedestals->getMap().end()) {
668  edm::LogError("EcalMMValid") << "Could not find pedestal for " << detId.rawId() << " among the "
669  << thePedestals->getMap().size();
670  } else {
671  EcalPedestals::Item item = (*mapItr);
672 
673  switch (gainId) {
674  case 0:
675  ped = item.mean_x1;
676  break;
677  case 1:
678  ped = item.mean_x12;
679  break;
680  case 2:
681  ped = item.mean_x6;
682  break;
683  case 3:
684  ped = item.mean_x1;
685  break;
686  default:
687  edm::LogError("EcalMMValid") << "Bad Pedestal " << gainId;
688  break;
689  }
690  LogDebug("EcalMMValid") << "Pedestals for " << detId.rawId() << " gain range " << gainId << " : \n"
691  << "Mean = " << ped;
692  }
693 }
#define LogDebug(id)
const self & getMap() const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EcalPedestalsMap::const_iterator EcalPedestalsMapIterator
Definition: EcalPedestals.h:49
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
const_iterator find(uint32_t rawId) const
const_iterator end() const
CLHEP::HepRandomEngine * EcalMixingModuleValidation::randomEngine ( edm::StreamID const &  streamID)
private

Definition at line 786 of file EcalMixingModuleValidation.cc.

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

Referenced by analyze().

786  {
787  unsigned int index = streamID.value();
788  if (index >= randomEngines_.size()) {
789  randomEngines_.resize(index + 1, nullptr);
790  }
791  CLHEP::HepRandomEngine* ptr = randomEngines_[index];
792  if (!ptr) {
794  ptr = &rng->getEngine(streamID);
795  randomEngines_[index] = ptr;
796  }
797  return ptr;
798 }
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 112 of file EcalMixingModuleValidation.h.

Referenced by analyze().

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

Definition at line 112 of file EcalMixingModuleValidation.h.

Referenced by analyze().

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

Definition at line 112 of file EcalMixingModuleValidation.h.

Referenced by analyze().

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

Definition at line 108 of file EcalMixingModuleValidation.h.

Referenced by analyze().

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

Definition at line 109 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 110 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 106 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 104 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 152 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

EBShape* EcalMixingModuleValidation::theEBShape
private

Definition at line 147 of file EcalMixingModuleValidation.h.

Referenced by dqmBeginRun(), and EcalMixingModuleValidation().

CaloHitResponse* EcalMixingModuleValidation::theEEResponse
private

Definition at line 153 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

EEShape* EcalMixingModuleValidation::theEEShape
private

Definition at line 148 of file EcalMixingModuleValidation.h.

Referenced by dqmBeginRun(), and EcalMixingModuleValidation().

CaloHitResponse* EcalMixingModuleValidation::theESResponse
private

Definition at line 151 of file EcalMixingModuleValidation.h.

Referenced by computeSDBunchDigi(), and EcalMixingModuleValidation().

ESShape* EcalMixingModuleValidation::theESShape
private

Definition at line 146 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 144 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 102 of file EcalMixingModuleValidation.h.

Referenced by EcalMixingModuleValidation().