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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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)
 
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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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)
 

Detailed Description

Definition at line 18 of file EcalPFRecHitThresholdsMaker.h.

Constructor & Destructor Documentation

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

Definition at line 108 of file EcalPFRecHitThresholdsMaker.cc.

109 {
110 
111 }

Member Function Documentation

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

Definition at line 113 of file EcalPFRecHitThresholdsMaker.cc.

References cond::service::PoolDBOutputService::beginOfTime(), gather_cfg::cout, cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::endOfTime(), EBDetId::ETAPHIMODE, Exception, EcalCondObjectContainer< T >::find(), objects.autophobj::float, edm::EventSetup::get(), EcalADCToGeVConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), EcalLaserDbService::getLaserCorrection(), EcalCondObjectContainer< T >::insert(), edm::Service< T >::isAvailable(), EEDetId::IX_MAX, EEDetId::IX_MIN, EEDetId::IY_MAX, EEDetId::IY_MIN, m_nsigma, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, edm::ESHandle< T >::product(), DetId::rawId(), EcalPedestal::rms_x12, scrapingFilter_cfi::thresh, edm::EventBase::time(), EBDetId::validDetId(), and EEDetId::validDetId().

113  {
114 
116  if ( !dbOutput.isAvailable() ) {
117  throw cms::Exception("PoolDBOutputService is not available");
118  }
119 
120 
121 
123  evtSetup.get<EcalPedestalsRcd>().get(handle1);
124  const EcalPedestals* ped_db = handle1.product();
125  std::cout << "ped pointer is: "<< ped_db<< std::endl;
126 
127 
129  evtSetup.get<EcalADCToGeVConstantRcd>().get(handle2);
130  const EcalADCToGeVConstant* adc_db = handle2.product();
131  std::cout << "adc pointer is: "<< adc_db<< std::endl;
132 
134  evtSetup.get<EcalIntercalibConstantsRcd>().get(handle3);
135  const EcalIntercalibConstants* ical_db = handle3.product();
136  std::cout << "inter pointer is: "<< ical_db<< std::endl;
137 
138 
140  evtSetup.get<EcalLaserDbRecord>().get(laser);
141 
143 
144  // const EcalIntercalibConstantMap& icalMap = ical_db->getMap();
145 
146 
147  float adc_EB= float(adc_db->getEEValue()) ;
148  float adc_EE=float(adc_db->getEBValue());
149 
150 
151  //edm::Timestamp tsince;
152 
153 
154 
155  for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
156  if(iEta==0) continue;
157  for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
158  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
159  if (EBDetId::validDetId(iEta,iPhi)) {
160  EBDetId ebdetid(iEta,iPhi,EBDetId::ETAPHIMODE);
161  EcalPedestals::const_iterator it =ped_db->find(ebdetid.rawId());
162  EcalPedestals::Item aped = (*it);
163 
164  EcalIntercalibConstants::const_iterator itc =ical_db->find(ebdetid.rawId());
165  float calib = (*itc);
166 
167  // get laser coefficient
168  float lasercalib = 1.;
169  lasercalib = laser->getLaserCorrection( ebdetid, evt.time()); // TODO correct time
170 
171  EcalPFRecHitThreshold thresh= aped.rms_x12 * calib * adc_EB * lasercalib * m_nsigma;
172 
173  if(iPhi==100) std::cout<<"Thresh(GeV)="<<thresh<<std::endl;
174 
175  pfthresh->insert(std::make_pair(ebdetid.rawId(),thresh));
176  }
177  }
178  }
179 
180  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
181  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
182  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
183  if (EEDetId::validDetId(iX,iY,1)) {
184  EEDetId eedetid(iX,iY,1);
185 
186  EcalPedestals::const_iterator it =ped_db->find(eedetid.rawId());
187  EcalPedestals::Item aped = (*it);
188 
189  EcalIntercalibConstants::const_iterator itc =ical_db->find(eedetid.rawId());
190  float calib = (*itc);
191 
192  // get laser coefficient
193  float lasercalib = 1.;
194  lasercalib = laser->getLaserCorrection( eedetid, evt.time()); // TODO correct time
195 
196  EcalPFRecHitThreshold thresh= aped.rms_x12 * calib * adc_EE * lasercalib * m_nsigma;
197  pfthresh->insert(std::make_pair(eedetid.rawId(),thresh));
198  }
199  if(EEDetId::validDetId(iX,iY,-1)) {
200 
201  EEDetId eedetid(iX,iY,-1);
202 
203  EcalPedestals::const_iterator it =ped_db->find(eedetid.rawId());
204  EcalPedestals::Item aped = (*it);
205 
206  EcalIntercalibConstants::const_iterator itc =ical_db->find(eedetid.rawId());
207  float calib = (*itc);
208 
209  // get laser coefficient
210  float lasercalib = 1.;
211  lasercalib = laser->getLaserCorrection( eedetid, evt.time()); // TODO correct time
212 
213  EcalPFRecHitThreshold thresh= aped.rms_x12 * calib * adc_EE * lasercalib * m_nsigma;
214  pfthresh->insert(std::make_pair(eedetid.rawId(),thresh));
215 
216  if(iX==50) std::cout<<"Thresh(GeV)="<<thresh<<std::endl;
217 
218 
219  }
220 
221  }
222  }
223 
224 
225 
226 
227  dbOutput->createNewIOV<const EcalPFRecHitThresholds>( pfthresh , dbOutput->beginOfTime(), dbOutput->endOfTime(),"EcalPFRecHitThresholdsRcd");
228 
229 
230 
231  std::cout<< "EcalPFRecHitThresholdsMaker wrote it " << std::endl;
232 }
static const int MIN_IPHI
Definition: EBDetId.h:142
EcalPFRecHitThresholdsMap EcalPFRecHitThresholds
float getLaserCorrection(DetId const &xid, edm::Timestamp const &iTime) const
static const int IX_MIN
Definition: EEDetId.h:294
static const int IY_MIN
Definition: EEDetId.h:298
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:124
float EcalPFRecHitThreshold
bool isAvailable() const
Definition: Service.h:46
static const int ETAPHIMODE
Definition: EBDetId.h:166
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
void insert(std::pair< uint32_t, Item > const &a)
static const int IX_MAX
Definition: EEDetId.h:302
static const int MAX_IPHI
Definition: EBDetId.h:144
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
const T & get() const
Definition: EventSetup.h:59
std::vector< Item >::const_iterator const_iterator
static const int MAX_IETA
Definition: EBDetId.h:143
const_iterator find(uint32_t rawId) const
static const int IY_MAX
Definition: EEDetId.h:306
T const * product() const
Definition: ESHandle.h:86
edm::Timestamp time() const
Definition: EventBase.h:61

Member Data Documentation

double EcalPFRecHitThresholdsMaker::m_nsigma
private

Definition at line 28 of file EcalPFRecHitThresholdsMaker.h.

Referenced by analyze(), and EcalPFRecHitThresholdsMaker().

std::string EcalPFRecHitThresholdsMaker::m_timetype
private

Definition at line 27 of file EcalPFRecHitThresholdsMaker.h.