CMS 3D CMS Logo

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

#include <ECALpedestalPCLHarvester.h>

Inheritance diagram for ECALpedestalPCLHarvester:
DQMEDHarvester edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ECALpedestalPCLHarvester (const edm::ParameterSet &ps)
 
virtual void endRun (edm::Run const &run, edm::EventSetup const &isetup)
 
- Public Member Functions inherited from DQMEDHarvester
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester (void)
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endJob () final
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) override final
 
virtual void produce (edm::Event &, edm::EventSetup const &) override final
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

bool checkStatusCode (const DetId &id)
 
bool checkVariation (const EcalPedestalsMap &oldPedestals, const EcalPedestalsMap &newPedestals)
 
virtual void dqmEndJob (DQMStore::IBooker &ibooker_, DQMStore::IGetter &igetter_)
 

Private Attributes

const EcalChannelStatuschannelStatus_
 
bool checkAnomalies_
 
std::vector< int > chStatusToExclude_
 
const EcalPedestalscurrentPedestals_
 
std::string dqmDir_
 
int minEntries_
 
double nSigma_
 
double thresholdAnomalies_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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

Description: Fill DQM histograms with pedestals. Intended to be used on laser data from the TestEnablesEcalHcal dataset

Definition at line 33 of file ECALpedestalPCLHarvester.h.

Constructor & Destructor Documentation

ECALpedestalPCLHarvester::ECALpedestalPCLHarvester ( const edm::ParameterSet ps)
explicit

Definition at line 20 of file ECALpedestalPCLHarvester.cc.

References checkAnomalies_, chStatusToExclude_, dqmDir_, edm::ParameterSet::getParameter(), minEntries_, nSigma_, AlCaHLTBitMon_QueryRunRegistry::string, and thresholdAnomalies_.

20  :
22 
23  chStatusToExclude_= StringToEnumValue<EcalChannelStatusCode::Code>(ps.getParameter<std::vector<std::string> >("ChannelStatusToExclude"));
24  minEntries_=ps.getParameter<int>("MinEntries");
25  checkAnomalies_ = ps.getParameter<bool>("checkAnomalies");
26  nSigma_ = ps.getParameter<double>("nSigma");
27  thresholdAnomalies_ = ps.getParameter<double>("thresholdAnomalies");
28  dqmDir_ = ps.getParameter<std::string>("dqmDir");
29 }
T getParameter(std::string const &) const
std::vector< int > chStatusToExclude_
const EcalChannelStatus * channelStatus_
const EcalPedestals * currentPedestals_

Member Function Documentation

bool ECALpedestalPCLHarvester::checkStatusCode ( const DetId id)
private

Definition at line 143 of file ECALpedestalPCLHarvester.cc.

References channelStatus_, chStatusToExclude_, spr::find(), EcalCondObjectContainer< T >::find(), and EcalCondObjectContainer< T >::getMap().

Referenced by dqmEndJob().

143  {
144 
146  dbstatusPtr = channelStatus_->getMap().find(id.rawId());
147  EcalChannelStatusCode::Code dbstatus = dbstatusPtr->getStatusCode();
148 
149  std::vector<int>::const_iterator res =
150  std::find( chStatusToExclude_.begin(), chStatusToExclude_.end(), dbstatus );
151  if ( res != chStatusToExclude_.end() ) return false;
152 
153  return true;
154 }
const self & getMap() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
Definition: Electron.h:4
std::vector< int > chStatusToExclude_
const EcalChannelStatus * channelStatus_
std::vector< Item >::const_iterator const_iterator
const_iterator find(uint32_t rawId) const
bool ECALpedestalPCLHarvester::checkVariation ( const EcalPedestalsMap oldPedestals,
const EcalPedestalsMap newPedestals 
)
private

Definition at line 157 of file ECALpedestalPCLHarvester.cc.

References funct::abs(), EBDetId::detIdFromDenseIndex(), EEDetId::detIdFromDenseIndex(), EcalCondObjectContainer< T >::find(), mps_fire::i, EBDetId::kSizeForDenseIndexing, EEDetId::kSizeForDenseIndexing, EcalPedestal::mean_x12, nSigma_, EcalPedestal::rms_x12, and thresholdAnomalies_.

Referenced by dqmEndJob().

158  {
159 
160  uint32_t nAnomaliesEB =0;
161  uint32_t nAnomaliesEE =0;
162 
163  for (uint16_t i =0; i< EBDetId::kSizeForDenseIndexing; ++i) {
164 
166  const EcalPedestal& newped=* newPedestals.find(id.rawId());
167  const EcalPedestal& oldped=* oldPedestals.find(id.rawId());
168 
169  if (std::abs(newped.mean_x12 -oldped.mean_x12) > nSigma_ * oldped.rms_x12) nAnomaliesEB++;
170 
171  }
172 
173  for (uint16_t i =0; i< EEDetId::kSizeForDenseIndexing; ++i) {
174 
176  const EcalPedestal& newped=* newPedestals.find(id.rawId());
177  const EcalPedestal& oldped=* oldPedestals.find(id.rawId());
178 
179  if (std::abs(newped.mean_x12 -oldped.mean_x12) > nSigma_ * oldped.rms_x12) nAnomaliesEE++;
180 
181  }
182 
183  if (nAnomaliesEB > thresholdAnomalies_ * EBDetId::kSizeForDenseIndexing ||
184  nAnomaliesEE > thresholdAnomalies_ * EEDetId::kSizeForDenseIndexing)
185  return true;
186 
187  return false;
188 
189 
190 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:220
static EBDetId detIdFromDenseIndex(uint32_t di)
Definition: EBDetId.h:111
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: DetId.h:18
const_iterator find(uint32_t rawId) const
void ECALpedestalPCLHarvester::dqmEndJob ( DQMStore::IBooker ibooker_,
DQMStore::IGetter igetter_ 
)
privatevirtual

Implements DQMEDHarvester.

Definition at line 31 of file ECALpedestalPCLHarvester.cc.

References checkAnomalies_, checkStatusCode(), checkVariation(), currentPedestals_, cond::service::PoolDBOutputService::currentTime(), EBDetId::detIdFromDenseIndex(), EEDetId::detIdFromDenseIndex(), dqmDir_, EcalCondObjectContainer< T >::find(), DQMStore::IGetter::get(), MonitorElement::getEntries(), MonitorElement::getMean(), MonitorElement::getRMS(), mps_fire::i, edm::Service< T >::isAvailable(), EBDetId::kSizeForDenseIndexing, EEDetId::kSizeForDenseIndexing, RecoTauDiscriminantConfiguration::mean, EcalPedestal::mean_x1, EcalPedestal::mean_x12, EcalPedestal::mean_x6, minEntries_, RecoTauDiscriminantConfiguration::rms, EcalPedestal::rms_x1, EcalPedestal::rms_x12, EcalPedestal::rms_x6, EcalCondObjectContainer< T >::setValue(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::service::PoolDBOutputService::writeOne().

31  {
32 
33 
34  // calculate pedestals and fill db record
35  EcalPedestals pedestals;
36 
37 
38  for (uint16_t i =0; i< EBDetId::kSizeForDenseIndexing; ++i) {
39  std::string hname = dqmDir_+"/eb_" + std::to_string(i);
40  MonitorElement* ch= igetter_.get(hname);
41  double mean = ch->getMean();
42  double rms = ch->getRMS();
43 
45  EcalPedestal ped;
46  EcalPedestal oldped=* currentPedestals_->find(id.rawId());
47 
48  ped.mean_x12=mean;
49  ped.rms_x12=rms;
50 
51  // if bad channel or low stat skip
52  if(ch->getEntries()< minEntries_ || !checkStatusCode(id)){
53 
54  ped.mean_x12=oldped.mean_x12;
55  ped.rms_x12=oldped.rms_x12;
56 
57  }
58 
59  ped.mean_x6=oldped.mean_x6;
60  ped.rms_x6=oldped.rms_x6;
61  ped.mean_x1=oldped.mean_x1;
62  ped.rms_x1=oldped.rms_x1;
63 
64  pedestals.setValue(id.rawId(),ped);
65  }
66 
67 
68  for (uint16_t i =0; i< EEDetId::kSizeForDenseIndexing; ++i) {
69 
70  std::string hname = dqmDir_+"/ee_" + std::to_string(i);
71 
72  MonitorElement* ch= igetter_.get(hname);
73  double mean = ch->getMean();
74  double rms = ch->getRMS();
75 
77  EcalPedestal ped;
78  EcalPedestal oldped= *currentPedestals_->find(id.rawId());
79 
80  ped.mean_x12=mean;
81  ped.rms_x12=rms;
82 
83  // if bad channel or low stat skip
84  if(ch->getEntries()< minEntries_ || !checkStatusCode(id)){
85  ped.mean_x12=oldped.mean_x12;
86  ped.rms_x12=oldped.rms_x12;
87  }
88 
89  ped.mean_x6=oldped.mean_x6;
90  ped.rms_x6=oldped.rms_x6;
91  ped.mean_x1=oldped.mean_x1;
92  ped.rms_x1=oldped.rms_x1;
93 
94  pedestals.setValue(id.rawId(),ped);
95  }
96 
97 
98  // check if there are large variations wrt exisiting pedstals
99 
100  if (checkAnomalies_){
101  if (checkVariation(*currentPedestals_, pedestals)) {
102  edm::LogError("Large Variations found wrt to old pedestals, no file created");
103  return;
104  }
105  }
106 
107  // write out pedestal record
109 
110  if( poolDbService.isAvailable() )
111  poolDbService->writeOne( &pedestals, poolDbService->currentTime(),
112  "EcalPedestalsRcd" );
113  else
114  throw std::runtime_error("PoolDBService required.");
115 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:220
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:305
bool checkVariation(const EcalPedestalsMap &oldPedestals, const EcalPedestalsMap &newPedestals)
double getEntries(void) const
get # of entries
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
static EBDetId detIdFromDenseIndex(uint32_t di)
Definition: EBDetId.h:111
void setValue(const uint32_t id, const Item &item)
bool isAvailable() const
Definition: Service.h:46
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
Definition: DetId.h:18
bool checkStatusCode(const DetId &id)
const EcalPedestals * currentPedestals_
double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
const_iterator find(uint32_t rawId) const
void ECALpedestalPCLHarvester::endRun ( edm::Run const &  run,
edm::EventSetup const &  isetup 
)
virtual

Reimplemented from DQMEDHarvester.

Definition at line 130 of file ECALpedestalPCLHarvester.cc.

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

130  {
131 
132 
134  isetup.get<EcalChannelStatusRcd>().get(chStatus);
135  channelStatus_=chStatus.product();
136 
138  isetup.get<EcalPedestalsRcd>().get(peds);
139  currentPedestals_=peds.product();
140 
141 }
const EcalChannelStatus * channelStatus_
const EcalPedestals * currentPedestals_
T const * product() const
Definition: ESHandle.h:86
void ECALpedestalPCLHarvester::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 122 of file ECALpedestalPCLHarvester.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

122  {
123 
125  desc.setUnknown();
126  descriptions.addDefault(desc);
127 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

const EcalChannelStatus* ECALpedestalPCLHarvester::channelStatus_
private

Definition at line 44 of file ECALpedestalPCLHarvester.h.

Referenced by checkStatusCode(), and endRun().

bool ECALpedestalPCLHarvester::checkAnomalies_
private

Definition at line 50 of file ECALpedestalPCLHarvester.h.

Referenced by dqmEndJob(), and ECALpedestalPCLHarvester().

std::vector<int> ECALpedestalPCLHarvester::chStatusToExclude_
private

Definition at line 47 of file ECALpedestalPCLHarvester.h.

Referenced by checkStatusCode(), and ECALpedestalPCLHarvester().

const EcalPedestals* ECALpedestalPCLHarvester::currentPedestals_
private

Definition at line 43 of file ECALpedestalPCLHarvester.h.

Referenced by dqmEndJob(), and endRun().

std::string ECALpedestalPCLHarvester::dqmDir_
private

Definition at line 53 of file ECALpedestalPCLHarvester.h.

Referenced by dqmEndJob(), and ECALpedestalPCLHarvester().

int ECALpedestalPCLHarvester::minEntries_
private

Definition at line 48 of file ECALpedestalPCLHarvester.h.

Referenced by dqmEndJob(), and ECALpedestalPCLHarvester().

double ECALpedestalPCLHarvester::nSigma_
private

Definition at line 51 of file ECALpedestalPCLHarvester.h.

Referenced by checkVariation(), and ECALpedestalPCLHarvester().

double ECALpedestalPCLHarvester::thresholdAnomalies_
private

Definition at line 52 of file ECALpedestalPCLHarvester.h.

Referenced by checkVariation(), and ECALpedestalPCLHarvester().