CMS 3D CMS Logo

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

#include <EcalPFRecHitThresholdsMaker.h>

Inheritance diagram for EcalPFRecHitThresholdsMaker:
edm::EDAnalyzer 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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

double m_nsigma
 
std::string m_timetype
 

Additional Inherited Members

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

Detailed Description

Definition at line 18 of file EcalPFRecHitThresholdsMaker.h.

Constructor & Destructor Documentation

◆ EcalPFRecHitThresholdsMaker()

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

◆ ~EcalPFRecHitThresholdsMaker()

EcalPFRecHitThresholdsMaker::~EcalPFRecHitThresholdsMaker ( )
override

Definition at line 103 of file EcalPFRecHitThresholdsMaker.cc.

103 {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 105 of file EcalPFRecHitThresholdsMaker.cc.

105  {
107  if (!dbOutput.isAvailable()) {
108  throw cms::Exception("PoolDBOutputService is not available");
109  }
110 
112  evtSetup.get<EcalPedestalsRcd>().get(handle1);
113  const EcalPedestals* ped_db = handle1.product();
114  std::cout << "ped pointer is: " << ped_db << std::endl;
115 
117  evtSetup.get<EcalADCToGeVConstantRcd>().get(handle2);
118  const EcalADCToGeVConstant* adc_db = handle2.product();
119  std::cout << "adc pointer is: " << adc_db << std::endl;
120 
122  evtSetup.get<EcalIntercalibConstantsRcd>().get(handle3);
123  const EcalIntercalibConstants* ical_db = handle3.product();
124  std::cout << "inter pointer is: " << ical_db << std::endl;
125 
127  evtSetup.get<EcalLaserDbRecord>().get(laser);
128 
130 
131  // const EcalIntercalibConstantMap& icalMap = ical_db->getMap();
132 
133  float adc_EB = float(adc_db->getEEValue());
134  float adc_EE = float(adc_db->getEBValue());
135 
136  //edm::Timestamp tsince;
137 
138  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
139  if (iEta == 0)
140  continue;
141  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
142  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
143  if (EBDetId::validDetId(iEta, iPhi)) {
144  EBDetId ebdetid(iEta, iPhi, EBDetId::ETAPHIMODE);
145  EcalPedestals::const_iterator it = ped_db->find(ebdetid.rawId());
146  EcalPedestals::Item aped = (*it);
147 
148  EcalIntercalibConstants::const_iterator itc = ical_db->find(ebdetid.rawId());
149  float calib = (*itc);
150 
151  // get laser coefficient
152  float lasercalib = 1.;
153  lasercalib = laser->getLaserCorrection(ebdetid, evt.time()); // TODO correct time
154 
155  EcalPFRecHitThreshold thresh = aped.rms_x12 * calib * adc_EB * lasercalib * m_nsigma;
156 
157  if (iPhi == 100)
158  std::cout << "Thresh(GeV)=" << thresh << std::endl;
159 
160  pfthresh->insert(std::make_pair(ebdetid.rawId(), thresh));
161  }
162  }
163  }
164 
165  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
166  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
167  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
168  if (EEDetId::validDetId(iX, iY, 1)) {
169  EEDetId eedetid(iX, iY, 1);
170 
171  EcalPedestals::const_iterator it = ped_db->find(eedetid.rawId());
172  EcalPedestals::Item aped = (*it);
173 
174  EcalIntercalibConstants::const_iterator itc = ical_db->find(eedetid.rawId());
175  float calib = (*itc);
176 
177  // get laser coefficient
178  float lasercalib = 1.;
179  lasercalib = laser->getLaserCorrection(eedetid, evt.time()); // TODO correct time
180 
181  EcalPFRecHitThreshold thresh = aped.rms_x12 * calib * adc_EE * lasercalib * m_nsigma;
182  pfthresh->insert(std::make_pair(eedetid.rawId(), thresh));
183  }
184  if (EEDetId::validDetId(iX, iY, -1)) {
185  EEDetId eedetid(iX, iY, -1);
186 
187  EcalPedestals::const_iterator it = ped_db->find(eedetid.rawId());
188  EcalPedestals::Item aped = (*it);
189 
190  EcalIntercalibConstants::const_iterator itc = ical_db->find(eedetid.rawId());
191  float calib = (*itc);
192 
193  // get laser coefficient
194  float lasercalib = 1.;
195  lasercalib = laser->getLaserCorrection(eedetid, evt.time()); // TODO correct time
196 
197  EcalPFRecHitThreshold thresh = aped.rms_x12 * calib * adc_EE * lasercalib * m_nsigma;
198  pfthresh->insert(std::make_pair(eedetid.rawId(), thresh));
199 
200  if (iX == 50)
201  std::cout << "Thresh(GeV)=" << thresh << std::endl;
202  }
203  }
204  }
205 
206  dbOutput->createNewIOV<const EcalPFRecHitThresholds>(
207  pfthresh, dbOutput->beginOfTime(), dbOutput->endOfTime(), "EcalPFRecHitThresholdsRcd");
208 
209  std::cout << "EcalPFRecHitThresholdsMaker wrote it " << std::endl;
210 }

References cond::service::PoolDBOutputService::beginOfTime(), gather_cfg::cout, cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::endOfTime(), EBDetId::ETAPHIMODE, Exception, EcalCondObjectContainer< T >::find(), dqmMemoryStats::float, edm::EventSetup::get(), get, EcalADCToGeVConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), L1TowerCalibrationProducer_cfi::iEta, EcalCondObjectContainer< T >::insert(), edm::Service< T >::isAvailable(), 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, edm::ESHandle< T >::product(), DetId::rawId(), GOODCOLL_filter_cfg::thresh, edm::EventBase::time(), EBDetId::validDetId(), and EEDetId::validDetId().

Member Data Documentation

◆ m_nsigma

double EcalPFRecHitThresholdsMaker::m_nsigma
private

Definition at line 27 of file EcalPFRecHitThresholdsMaker.h.

Referenced by analyze(), and EcalPFRecHitThresholdsMaker().

◆ m_timetype

std::string EcalPFRecHitThresholdsMaker::m_timetype
private

Definition at line 26 of file EcalPFRecHitThresholdsMaker.h.

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
EBDetId
Definition: EBDetId.h:17
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EEDetId::IX_MIN
static const int IX_MIN
Definition: EEDetId.h:290
EcalPFRecHitThresholds
EcalPFRecHitThresholdsMap EcalPFRecHitThresholds
Definition: EcalPFRecHitThresholds.h:12
EcalADCToGeVConstant
Definition: EcalADCToGeVConstant.h:13
EEDetId::IY_MIN
static const int IY_MIN
Definition: EEDetId.h:294
edm::EventBase::time
edm::Timestamp time() const
Definition: EventBase.h:60
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
EcalPFRecHitThresholdsMaker::m_nsigma
double m_nsigma
Definition: EcalPFRecHitThresholdsMaker.h:27
EcalPFRecHitThresholdsMaker::m_timetype
std::string m_timetype
Definition: EcalPFRecHitThresholdsMaker.h:26
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:116
edm::ESHandle
Definition: DTSurvey.h:22
EcalPFRecHitThreshold
float EcalPFRecHitThreshold
Definition: EcalPFRecHitThresholds.h:10
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
EBDetId::MAX_IPHI
static const int MAX_IPHI
Definition: EBDetId.h:137
EEDetId::IY_MAX
static const int IY_MAX
Definition: EEDetId.h:302
EcalLaserDbRecord
Definition: EcalLaserDbRecord.h:19
EEDetId
Definition: EEDetId.h:14
calib
Definition: CalibElectron.h:12
EBDetId::ETAPHIMODE
static const int ETAPHIMODE
Definition: EBDetId.h:158
EcalADCToGeVConstant::getEEValue
float getEEValue() const
Definition: EcalADCToGeVConstant.h:21
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
EcalCondObjectContainer::Item
T Item
Definition: EcalCondObjectContainer.h:15
EEDetId::IX_MAX
static const int IX_MAX
Definition: EEDetId.h:298
edm::Service< cond::service::PoolDBOutputService >
AlCaHarvesting_cff.record
record
Definition: AlCaHarvesting_cff.py:42
get
#define get
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GOODCOLL_filter_cfg.thresh
thresh
Definition: GOODCOLL_filter_cfg.py:74
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:213
EBDetId::validDetId
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
EcalCondObjectContainer::insert
void insert(std::pair< uint32_t, Item > const &a)
Definition: EcalCondObjectContainer.h:38
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EEDetId::validDetId
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
L1TowerCalibrationProducer_cfi.iEta
iEta
Definition: L1TowerCalibrationProducer_cfi.py:60
EcalCondObjectContainer::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondObjectContainer.h:19
EcalPedestalsRcd
Definition: EcalPedestalsRcd.h:5
EcalADCToGeVConstant::getEBValue
float getEBValue() const
Definition: EcalADCToGeVConstant.h:20
EcalIntercalibConstantsRcd
Definition: EcalIntercalibConstantsRcd.h:5
EcalADCToGeVConstantRcd
Definition: EcalADCToGeVConstantRcd.h:5
EcalCondDBWriter_cfi.laser
laser
Definition: EcalCondDBWriter_cfi.py:46
EBDetId::MAX_IETA
static const int MAX_IETA
Definition: EBDetId.h:136
EBDetId::MIN_IPHI
static const int MIN_IPHI
Definition: EBDetId.h:135