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_)
 
void dqmPlots (const EcalPedestals &newpeds, DQMStore::IBooker &ibooker)
 

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 146 of file ECALpedestalPCLHarvester.cc.

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

Referenced by dqmEndJob().

146  {
147 
149  dbstatusPtr = channelStatus_->getMap().find(id.rawId());
150  EcalChannelStatusCode::Code dbstatus = dbstatusPtr->getStatusCode();
151 
152  std::vector<int>::const_iterator res =
153  std::find( chStatusToExclude_.begin(), chStatusToExclude_.end(), dbstatus );
154  if ( res != chStatusToExclude_.end() ) return false;
155 
156  return true;
157 }
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 160 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().

161  {
162 
163  uint32_t nAnomaliesEB =0;
164  uint32_t nAnomaliesEE =0;
165 
166  for (uint16_t i =0; i< EBDetId::kSizeForDenseIndexing; ++i) {
167 
169  const EcalPedestal& newped=* newPedestals.find(id.rawId());
170  const EcalPedestal& oldped=* oldPedestals.find(id.rawId());
171 
172  if (std::abs(newped.mean_x12 -oldped.mean_x12) > nSigma_ * oldped.rms_x12) nAnomaliesEB++;
173 
174  }
175 
176  for (uint16_t i =0; i< EEDetId::kSizeForDenseIndexing; ++i) {
177 
179  const EcalPedestal& newped=* newPedestals.find(id.rawId());
180  const EcalPedestal& oldped=* oldPedestals.find(id.rawId());
181 
182  if (std::abs(newped.mean_x12 -oldped.mean_x12) > nSigma_ * oldped.rms_x12) nAnomaliesEE++;
183 
184  }
185 
186  if (nAnomaliesEB > thresholdAnomalies_ * EBDetId::kSizeForDenseIndexing ||
187  nAnomaliesEE > thresholdAnomalies_ * EEDetId::kSizeForDenseIndexing)
188  return true;
189 
190  return false;
191 
192 
193 }
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_, dqmPlots(), 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(int(i/100))+"/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(int(i/100))+"/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 
99  dqmPlots(pedestals, ibooker_);
100 
101  // check if there are large variations wrt exisiting pedstals
102 
103  if (checkAnomalies_){
104  if (checkVariation(*currentPedestals_, pedestals)) {
105  edm::LogError("Large Variations found wrt to old pedestals, no file created");
106  return;
107  }
108  }
109 
110  // write out pedestal record
112 
113  if( poolDbService.isAvailable() )
114  poolDbService->writeOne( &pedestals, poolDbService->currentTime(),
115  "EcalPedestalsRcd" );
116  else
117  throw std::runtime_error("PoolDBService required.");
118 }
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)
void dqmPlots(const EcalPedestals &newpeds, DQMStore::IBooker &ibooker)
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::dqmPlots ( const EcalPedestals newpeds,
DQMStore::IBooker ibooker 
)
private

Definition at line 198 of file ECALpedestalPCLHarvester.cc.

References DQMStore::IBooker::book2D(), DQMStore::IBooker::cd(), EBDetId::detIdFromDenseIndex(), EEDetId::detIdFromDenseIndex(), dqmDir_, MonitorElement::Fill(), cond::hash, EBDetId::ieta(), EBDetId::iphi(), EEDetId::ix(), EEDetId::iy(), EBDetId::kSizeForDenseIndexing, EEDetId::kSizeForDenseIndexing, RecoTauDiscriminantConfiguration::mean, RecoTauDiscriminantConfiguration::rms, DQMStore::IBooker::setCurrentFolder(), and EEDetId::zside().

Referenced by dqmEndJob().

198  {
199 
200  ibooker.cd();
201  ibooker.setCurrentFolder(dqmDir_+"/Summary");
202 
203  MonitorElement * pmeb = ibooker.book2D("meaneb","Pedestal Means",360, 1., 361., 171, -85., 86.);
204  MonitorElement * preb = ibooker.book2D("rmseb","Pedestal RMS",360, 1., 361., 171, -85., 86.);
205 
206  MonitorElement * pmeep = ibooker.book2D("meaneep","Pedestal Means",100,1,101,100,1,101);
207  MonitorElement * preep = ibooker.book2D("rmseep","Pedestal RMS",100,1,101,100,1,101);
208 
209  MonitorElement * pmeem = ibooker.book2D("meaneem","Pedestal Means",100,1,101,100,1,101);
210  MonitorElement * preem = ibooker.book2D("rmseem","Pedestal RMS",100,1,101,100,1,101);
211 
212  MonitorElement * pmebd = ibooker.book2D("meanebdiff","Pedestal Means Diff",360, 1., 361., 171, -85., 86.);
213  MonitorElement * prebd = ibooker.book2D("rmsebdiff","Pedestal RMS Diff",360, 1., 361., 171, -85., 86.);
214 
215  MonitorElement * pmeepd = ibooker.book2D("meaneepdiff","Pedestal Means Diff",100,1,101,100,1,101);
216  MonitorElement * preepd = ibooker.book2D("rmseepdiff","Pedestal RMS Diff",100,1,101,100,1,101);
217 
218  MonitorElement * pmeemd = ibooker.book2D("meaneemdiff","Pedestal Means Diff",100,1,101,100,1,101);
219  MonitorElement * preemd = ibooker.book2D("rmseemdiff","Pedestal RMS Diff",100,1,101,100,1,101);
220 
221 
223 
225  float mean= newpeds[di].mean_x12;
226  float rms = newpeds[di].rms_x12;
227 
228  float cmean = (*currentPedestals_)[di].mean_x12;
229  float crms = (*currentPedestals_)[di].rms_x12;
230 
231  pmeb->Fill(di.iphi(),di.ieta(),mean);
232  preb->Fill(di.iphi(),di.ieta(),rms);
233  pmebd->Fill(di.iphi(),di.ieta(),(mean-cmean)/cmean);
234  prebd->Fill(di.iphi(),di.ieta(),(rms-crms)/crms);
235 
236  }
237 
238 
240 
242  float mean= newpeds[di].mean_x12;
243  float rms = newpeds[di].rms_x12;
244  float cmean = (*currentPedestals_)[di].mean_x12;
245  float crms = (*currentPedestals_)[di].rms_x12;
246 
247  if (di.zside() >0){
248  pmeep->Fill(di.ix(),di.iy(),mean);
249  preep->Fill(di.ix(),di.iy(),rms);
250  pmeepd->Fill(di.ix(),di.iy(),(mean-cmean)/cmean);
251  preepd->Fill(di.ix(),di.iy(),(rms-crms)/crms);
252  } else{
253  pmeem->Fill(di.ix(),di.iy(),mean);
254  preem->Fill(di.ix(),di.iy(),rms);
255  pmeemd->Fill(di.ix(),di.iy(),(mean-cmean)/cmean);
256  preemd->Fill(di.ix(),di.iy(),(rms-crms)/crms);
257  }
258 
259  }
260 
261 
262 
263 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:220
int ix() const
Definition: EEDetId.h:76
void cd(void)
Definition: DQMStore.cc:269
void Fill(long long x)
int iphi() const
get the crystal iphi
Definition: EBDetId.h:53
static EBDetId detIdFromDenseIndex(uint32_t di)
Definition: EBDetId.h:111
int zside() const
Definition: EEDetId.h:70
int iy() const
Definition: EEDetId.h:82
int ieta() const
get the crystal ieta
Definition: EBDetId.h:51
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
void ECALpedestalPCLHarvester::endRun ( edm::Run const &  run,
edm::EventSetup const &  isetup 
)
virtual

Reimplemented from DQMEDHarvester.

Definition at line 133 of file ECALpedestalPCLHarvester.cc.

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

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

Definition at line 125 of file ECALpedestalPCLHarvester.cc.

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

125  {
126 
128  desc.setUnknown();
129  descriptions.addDefault(desc);
130 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

const EcalChannelStatus* ECALpedestalPCLHarvester::channelStatus_
private

Definition at line 47 of file ECALpedestalPCLHarvester.h.

Referenced by checkStatusCode(), and endRun().

bool ECALpedestalPCLHarvester::checkAnomalies_
private

Definition at line 53 of file ECALpedestalPCLHarvester.h.

Referenced by dqmEndJob(), and ECALpedestalPCLHarvester().

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

Definition at line 50 of file ECALpedestalPCLHarvester.h.

Referenced by checkStatusCode(), and ECALpedestalPCLHarvester().

const EcalPedestals* ECALpedestalPCLHarvester::currentPedestals_
private

Definition at line 46 of file ECALpedestalPCLHarvester.h.

Referenced by dqmEndJob(), and endRun().

std::string ECALpedestalPCLHarvester::dqmDir_
private

Definition at line 56 of file ECALpedestalPCLHarvester.h.

Referenced by dqmEndJob(), dqmPlots(), and ECALpedestalPCLHarvester().

int ECALpedestalPCLHarvester::minEntries_
private

Definition at line 51 of file ECALpedestalPCLHarvester.h.

Referenced by dqmEndJob(), and ECALpedestalPCLHarvester().

double ECALpedestalPCLHarvester::nSigma_
private

Definition at line 54 of file ECALpedestalPCLHarvester.h.

Referenced by checkVariation(), and ECALpedestalPCLHarvester().

double ECALpedestalPCLHarvester::thresholdAnomalies_
private

Definition at line 55 of file ECALpedestalPCLHarvester.h.

Referenced by checkVariation(), and ECALpedestalPCLHarvester().