CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalPFRecHitThresholdsMaker Class Reference

#include <EcalPFRecHitThresholdsMaker.h>

Inheritance diagram for EcalPFRecHitThresholdsMaker:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &evtSetup) override
 
 EcalPFRecHitThresholdsMaker (const edm::ParameterSet &iConfig)
 
 ~EcalPFRecHitThresholdsMaker () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcdecalADCToGeVConstantToken_
 
edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcdecalIntercalibConstantsToken_
 
edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecordecalLaserDbServiceToken_
 
edm::ESGetToken< EcalPedestals, EcalPedestalsRcdecalPedestalsToken_
 
double m_nsigma
 
std::string m_timetype
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 24 of file EcalPFRecHitThresholdsMaker.h.

Constructor & Destructor Documentation

◆ EcalPFRecHitThresholdsMaker()

EcalPFRecHitThresholdsMaker::EcalPFRecHitThresholdsMaker ( const edm::ParameterSet iConfig)
explicit

Definition at line 19 of file EcalPFRecHitThresholdsMaker.cc.

References edm::ParameterSet::getParameter(), and m_nsigma.

20  : m_timetype(iConfig.getParameter<std::string>("timetype")),
25  m_nsigma = iConfig.getParameter<double>("NSigma");
26 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > ecalPedestalsToken_
edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecord > ecalLaserDbServiceToken_
edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcd > ecalIntercalibConstantsToken_
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > ecalADCToGeVConstantToken_

◆ ~EcalPFRecHitThresholdsMaker()

EcalPFRecHitThresholdsMaker::~EcalPFRecHitThresholdsMaker ( )
override

Definition at line 28 of file EcalPFRecHitThresholdsMaker.cc.

28 {}

Member Function Documentation

◆ analyze()

void EcalPFRecHitThresholdsMaker::analyze ( const edm::Event evt,
const edm::EventSetup evtSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 30 of file EcalPFRecHitThresholdsMaker.cc.

References cond::service::PoolDBOutputService::beginOfTime(), cond::service::PoolDBOutputService::createOneIOV(), ecalADCToGeVConstantToken_, ecalIntercalibConstantsToken_, ecalLaserDbServiceToken_, ecalPedestalsToken_, EBDetId::ETAPHIMODE, Exception, EcalCondObjectContainer< T >::find(), nano_mu_digi_cff::float, edm::EventSetup::getData(), EcalADCToGeVConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), edm::EventSetup::getHandle(), l1tPhase2CaloJetEmulator_cfi::iEta, EcalCondObjectContainer< T >::insert(), edm::Service< T >::isAvailable(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, EEDetId::IX_MAX, EEDetId::IX_MIN, EEDetId::IY_MAX, EEDetId::IY_MIN, EcalCondDBWriter_cfi::laser, m_nsigma, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, DetId::rawId(), DMR_cfg::thresh, edm::EventBase::time(), EBDetId::validDetId(), and EEDetId::validDetId().

30  {
32  if (!dbOutput.isAvailable()) {
33  throw cms::Exception("PoolDBOutputService is not available");
34  }
35 
36  const EcalPedestals* ped_db = &evtSetup.getData(ecalPedestalsToken_);
37  edm::LogInfo("EcalPFRecHitThresholdsMaker") << "ped pointer is: " << ped_db << std::endl;
38 
39  const EcalADCToGeVConstant* adc_db = &evtSetup.getData(ecalADCToGeVConstantToken_);
40  edm::LogInfo("EcalPFRecHitThresholdsMaker") << "adc pointer is: " << adc_db << std::endl;
41 
43  edm::LogInfo("EcalPFRecHitThresholdsMaker") << "inter pointer is: " << ical_db << std::endl;
44 
45  const auto laser = evtSetup.getHandle(ecalLaserDbServiceToken_);
46 
47  EcalPFRecHitThresholds pfthresh;
48 
49  // const EcalIntercalibConstantMap& icalMap = ical_db->getMap();
50 
51  float adc_EB = float(adc_db->getEEValue());
52  float adc_EE = float(adc_db->getEBValue());
53 
54  //edm::Timestamp tsince;
55 
56  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
57  if (iEta == 0)
58  continue;
59  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
60  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
61  if (EBDetId::validDetId(iEta, iPhi)) {
62  EBDetId ebdetid(iEta, iPhi, EBDetId::ETAPHIMODE);
63  EcalPedestals::const_iterator it = ped_db->find(ebdetid.rawId());
64  EcalPedestals::Item aped = (*it);
65 
66  EcalIntercalibConstants::const_iterator itc = ical_db->find(ebdetid.rawId());
67  float calib = (*itc);
68 
69  // get laser coefficient
70  float lasercalib = 1.;
71  lasercalib = laser->getLaserCorrection(ebdetid, evt.time()); // TODO correct time
72 
73  EcalPFRecHitThreshold thresh = aped.rms_x12 * calib * adc_EB * lasercalib * m_nsigma;
74 
75  if (iPhi == 100)
76  edm::LogInfo("EcalPFRecHitThresholdsMaker") << "Thresh(GeV)=" << thresh << std::endl;
77 
78  pfthresh.insert(std::make_pair(ebdetid.rawId(), thresh));
79  }
80  }
81  }
82 
83  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
84  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
85  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
86  if (EEDetId::validDetId(iX, iY, 1)) {
87  EEDetId eedetid(iX, iY, 1);
88 
89  EcalPedestals::const_iterator it = ped_db->find(eedetid.rawId());
90  EcalPedestals::Item aped = (*it);
91 
92  EcalIntercalibConstants::const_iterator itc = ical_db->find(eedetid.rawId());
93  float calib = (*itc);
94 
95  // get laser coefficient
96  float lasercalib = 1.;
97  lasercalib = laser->getLaserCorrection(eedetid, evt.time()); // TODO correct time
98 
99  EcalPFRecHitThreshold thresh = aped.rms_x12 * calib * adc_EE * lasercalib * m_nsigma;
100  pfthresh.insert(std::make_pair(eedetid.rawId(), thresh));
101  }
102  if (EEDetId::validDetId(iX, iY, -1)) {
103  EEDetId eedetid(iX, iY, -1);
104 
105  EcalPedestals::const_iterator it = ped_db->find(eedetid.rawId());
106  EcalPedestals::Item aped = (*it);
107 
108  EcalIntercalibConstants::const_iterator itc = ical_db->find(eedetid.rawId());
109  float calib = (*itc);
110 
111  // get laser coefficient
112  float lasercalib = 1.;
113  lasercalib = laser->getLaserCorrection(eedetid, evt.time()); // TODO correct time
114 
115  EcalPFRecHitThreshold thresh = aped.rms_x12 * calib * adc_EE * lasercalib * m_nsigma;
116  pfthresh.insert(std::make_pair(eedetid.rawId(), thresh));
117 
118  if (iX == 50)
119  edm::LogInfo("EcalPFRecHitThresholdsMaker") << "Thresh(GeV)=" << thresh << std::endl;
120  }
121  }
122  }
123 
124  dbOutput->createOneIOV<const EcalPFRecHitThresholds>(pfthresh, dbOutput->beginOfTime(), "EcalPFRecHitThresholdsRcd");
125 
126  edm::LogInfo("EcalPFRecHitThresholdsMaker") << "EcalPFRecHitThresholdsMaker wrote it " << std::endl;
127 }
static const int MIN_IPHI
Definition: EBDetId.h:135
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
static const int IX_MIN
Definition: EEDetId.h:290
static const int IY_MIN
Definition: EEDetId.h:294
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
edm::Timestamp time() const
Definition: EventBase.h:64
float EcalPFRecHitThreshold
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > ecalPedestalsToken_
edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecord > ecalLaserDbServiceToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
static const int ETAPHIMODE
Definition: EBDetId.h:158
const_iterator find(uint32_t rawId) const
edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcd > ecalIntercalibConstantsToken_
void insert(std::pair< uint32_t, Item > const &a)
static const int IX_MAX
Definition: EEDetId.h:298
Log< level::Info, false > LogInfo
static const int MAX_IPHI
Definition: EBDetId.h:137
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
std::vector< Item >::const_iterator const_iterator
static const int MAX_IETA
Definition: EBDetId.h:136
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > ecalADCToGeVConstantToken_
static const int IY_MAX
Definition: EEDetId.h:302
bool isAvailable() const
Definition: Service.h:40

Member Data Documentation

◆ ecalADCToGeVConstantToken_

edm::ESGetToken<EcalADCToGeVConstant, EcalADCToGeVConstantRcd> EcalPFRecHitThresholdsMaker::ecalADCToGeVConstantToken_
private

Definition at line 35 of file EcalPFRecHitThresholdsMaker.h.

Referenced by analyze().

◆ ecalIntercalibConstantsToken_

edm::ESGetToken<EcalIntercalibConstants, EcalIntercalibConstantsRcd> EcalPFRecHitThresholdsMaker::ecalIntercalibConstantsToken_
private

Definition at line 36 of file EcalPFRecHitThresholdsMaker.h.

Referenced by analyze().

◆ ecalLaserDbServiceToken_

edm::ESGetToken<EcalLaserDbService, EcalLaserDbRecord> EcalPFRecHitThresholdsMaker::ecalLaserDbServiceToken_
private

Definition at line 37 of file EcalPFRecHitThresholdsMaker.h.

Referenced by analyze().

◆ ecalPedestalsToken_

edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> EcalPFRecHitThresholdsMaker::ecalPedestalsToken_
private

Definition at line 34 of file EcalPFRecHitThresholdsMaker.h.

Referenced by analyze().

◆ m_nsigma

double EcalPFRecHitThresholdsMaker::m_nsigma
private

Definition at line 33 of file EcalPFRecHitThresholdsMaker.h.

Referenced by analyze(), and EcalPFRecHitThresholdsMaker().

◆ m_timetype

std::string EcalPFRecHitThresholdsMaker::m_timetype
private

Definition at line 32 of file EcalPFRecHitThresholdsMaker.h.