CMS 3D CMS Logo

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

#include <ECALpedestalPCLworker.h>

Inheritance diagram for ECALpedestalPCLworker:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

 ECALpedestalPCLworker (const edm::ParameterSet &)
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 

Static Private Member Functions

static bool adc_compare (uint16_t a, uint16_t b)
 

Private Attributes

bool checkSignal_
 
edm::EDGetTokenT< EBDigiCollectiondigiTokenEB_
 
edm::EDGetTokenT< EEDigiCollectiondigiTokenEE_
 
std::string dqmDir_
 
bool dynamicBooking_
 
int fixedBookingCenterBin_
 
std::vector< MonitorElement * > meEB_
 
std::vector< MonitorElement * > meEE_
 
int nBins_
 
uint32_t pedestalSamples_
 
const edm::ESGetToken< EcalPedestals, EcalPedestalsRcdpedestalToken_
 
bool requireStableBeam_
 
uint32_t sThresholdEB_
 
uint32_t sThresholdEE_
 
edm::EDGetTokenT< TCDSRecordtcdsToken_
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

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

Definition at line 35 of file ECALpedestalPCLworker.h.

Constructor & Destructor Documentation

◆ ECALpedestalPCLworker()

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

Definition at line 8 of file ECALpedestalPCLworker.cc.

References checkSignal_, digiTokenEB_, digiTokenEE_, dqmDir_, dynamicBooking_, fixedBookingCenterBin_, edm::ParameterSet::getParameter(), nBins_, pedestalSamples_, requireStableBeam_, sThresholdEB_, sThresholdEE_, AlCaHLTBitMon_QueryRunRegistry::string, BeamMonitor_cff::tcdsRecord, and tcdsToken_.

9  : pedestalToken_(esConsumes<edm::Transition::BeginRun>()) {
10  edm::InputTag digiTagEB = iConfig.getParameter<edm::InputTag>("BarrelDigis");
11  edm::InputTag digiTagEE = iConfig.getParameter<edm::InputTag>("EndcapDigis");
12 
13  digiTokenEB_ = consumes<EBDigiCollection>(digiTagEB);
14  digiTokenEE_ = consumes<EEDigiCollection>(digiTagEE);
15 
16  pedestalSamples_ = iConfig.getParameter<uint32_t>("pedestalSamples");
17  checkSignal_ = iConfig.getParameter<bool>("checkSignal");
18  sThresholdEB_ = iConfig.getParameter<uint32_t>("sThresholdEB");
19  sThresholdEE_ = iConfig.getParameter<uint32_t>("sThresholdEE");
20 
21  dynamicBooking_ = iConfig.getParameter<bool>("dynamicBooking");
22  fixedBookingCenterBin_ = iConfig.getParameter<int>("fixedBookingCenterBin");
23  nBins_ = iConfig.getParameter<int>("nBins");
24  dqmDir_ = iConfig.getParameter<std::string>("dqmDir");
25 
26  edm::InputTag tcdsRecord = iConfig.getParameter<edm::InputTag>("tcdsRecord");
27  tcdsToken_ = consumes<TCDSRecord>(tcdsRecord);
28  requireStableBeam_ = iConfig.getParameter<bool>("requireStableBeam");
29 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< EEDigiCollection > digiTokenEE_
const edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > pedestalToken_
edm::EDGetTokenT< EBDigiCollection > digiTokenEB_
edm::EDGetTokenT< TCDSRecord > tcdsToken_

Member Function Documentation

◆ adc_compare()

static bool ECALpedestalPCLworker::adc_compare ( uint16_t  a,
uint16_t  b 
)
inlinestaticprivate

Definition at line 68 of file ECALpedestalPCLworker.h.

References a, and b.

Referenced by analyze().

68 { return (a & 0xFFF) < (b & 0xFFF); }
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119

◆ analyze()

void ECALpedestalPCLworker::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 32 of file ECALpedestalPCLworker.cc.

References adc_compare(), HLT_2022v15_cff::beamMode, edm::DataFrame::begin(), edm::DataFrameContainer::begin(), checkSignal_, digiTokenEB_, digiTokenEE_, edm::DataFrame::end(), edm::DataFrameContainer::end(), HcalObjRepresent::Fill(), EcalDataFrame::frame(), BSTRecord::getBeamMode(), TCDSRecord::getBST(), EBDetId::hashedIndex(), EEDetId::hashedIndex(), iEvent, meEB_, meEE_, pedestalSamples_, requireStableBeam_, sThresholdEB_, sThresholdEE_, and tcdsToken_.

32  {
33  using namespace edm;
34 
36  iEvent.getByToken(digiTokenEB_, pDigiEB);
37 
39  iEvent.getByToken(digiTokenEE_, pDigiEE);
40 
41  // Only Events with stable beam
42 
43  if (requireStableBeam_) {
44  edm::Handle<TCDSRecord> tcdsData;
45  iEvent.getByToken(tcdsToken_, tcdsData);
46  int beamMode = tcdsData->getBST().getBeamMode();
47  if (beamMode != BSTRecord::BeamMode::STABLE)
48  return;
49  }
50 
51  for (EBDigiCollection::const_iterator pDigi = pDigiEB->begin(); pDigi != pDigiEB->end(); ++pDigi) {
52  EBDetId id = pDigi->id();
53  uint32_t hashedId = id.hashedIndex();
54 
55  EBDataFrame digi(*pDigi);
56 
57  if (checkSignal_) {
58  uint16_t maxdiff = *std::max_element(digi.frame().begin(), digi.frame().end(), adc_compare) -
59  *std::min_element(digi.frame().begin(), digi.frame().end(), adc_compare);
60  if (maxdiff > sThresholdEB_)
61  continue; // assume there is signal in this frame
62  }
63 
64  //for (auto& mgpasample : digi.frame()) meEB_[hashedId]->Fill(mgpasample&0xFFF);
65  for (edm::DataFrame::iterator mgpasample = digi.frame().begin();
66  mgpasample != digi.frame().begin() + pedestalSamples_;
67  ++mgpasample)
68  meEB_[hashedId]->Fill(*mgpasample & 0xFFF);
69 
70  } // eb digis
71 
72  for (EEDigiCollection::const_iterator pDigi = pDigiEE->begin(); pDigi != pDigiEE->end(); ++pDigi) {
73  EEDetId id = pDigi->id();
74  uint32_t hashedId = id.hashedIndex();
75 
76  EEDataFrame digi(*pDigi);
77 
78  if (checkSignal_) {
79  uint16_t maxdiff = *std::max_element(digi.frame().begin(), digi.frame().end(), adc_compare) -
80  *std::min_element(digi.frame().begin(), digi.frame().end(), adc_compare);
81  if (maxdiff > sThresholdEE_)
82  continue; // assume there is signal in this frame
83  }
84 
85  //for (auto& mgpasample : digi.frame()) meEE_[hashedId]->Fill(mgpasample&0xFFF);
86  for (edm::DataFrame::iterator mgpasample = digi.frame().begin();
87  mgpasample != digi.frame().begin() + pedestalSamples_;
88  ++mgpasample)
89  meEE_[hashedId]->Fill(*mgpasample & 0xFFF);
90 
91  } // ee digis
92 }
edm::EDGetTokenT< EEDigiCollection > digiTokenEE_
std::vector< MonitorElement * > meEE_
int iEvent
Definition: GenABIO.cc:224
static bool adc_compare(uint16_t a, uint16_t b)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
const BSTRecord & getBST() const
Definition: TCDSRecord.h:100
const_iterator end() const
uint16_t const getBeamMode() const
Definition: BSTRecord.h:70
const_iterator begin() const
The iterator returned can not safely be used across threads.
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
edm::EDGetTokenT< EBDigiCollection > digiTokenEB_
std::vector< MonitorElement * > meEB_
HLT enums.
data_type * iterator
Definition: DataFrame.h:20
edm::EDGetTokenT< TCDSRecord > tcdsToken_
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
int hashedIndex() const
Definition: EEDetId.h:183

◆ bookHistograms()

void ECALpedestalPCLworker::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  run,
edm::EventSetup const &  es 
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 100 of file ECALpedestalPCLworker.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::NavigatorBase::cd(), EBDetId::detIdFromDenseIndex(), EEDetId::detIdFromDenseIndex(), dqmDir_, dynamicBooking_, fixedBookingCenterBin_, edm::EventSetup::getData(), mps_fire::i, createfilelist::int, EBDetId::kSizeForDenseIndexing, EEDetId::kSizeForDenseIndexing, SiStripPI::max, meEB_, meEE_, SiStripPI::min, nBins_, pedestalToken_, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::impl::to_string().

100  {
101  ibooker.cd();
102  ibooker.setCurrentFolder(dqmDir_);
103 
104  const auto& peds = es.getData(pedestalToken_);
105 
106  for (uint32_t i = 0; i < EBDetId::kSizeForDenseIndexing; ++i) {
107  ibooker.setCurrentFolder(dqmDir_ + "/EB/" + std::to_string(int(i / 100)));
108 
109  std::string hname = "eb_" + std::to_string(i);
111  int centralBin = fixedBookingCenterBin_;
112 
113  if (dynamicBooking_) {
114  centralBin = int((peds.find(id))->mean_x12);
115  }
116 
117  int min = centralBin - nBins_ / 2;
118  int max = centralBin + nBins_ / 2;
119 
120  meEB_.push_back(ibooker.book1D(hname, hname, nBins_, min, max));
121  }
122 
123  for (uint32_t i = 0; i < EEDetId::kSizeForDenseIndexing; ++i) {
124  ibooker.setCurrentFolder(dqmDir_ + "/EE/" + std::to_string(int(i / 100)));
125 
126  std::string hname = "ee_" + std::to_string(i);
127 
129  int centralBin = fixedBookingCenterBin_;
130 
131  if (dynamicBooking_) {
132  centralBin = int((peds.find(id))->mean_x12);
133  }
134 
135  int min = centralBin - nBins_ / 2;
136  int max = centralBin + nBins_ / 2;
137 
138  meEE_.push_back(ibooker.book1D(hname, hname, nBins_, min, max));
139  }
140 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:220
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
const edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > pedestalToken_
std::string to_string(const V &value)
Definition: OMSAccess.h:71
static EBDetId detIdFromDenseIndex(uint32_t di)
Definition: EBDetId.h:107
std::vector< MonitorElement * > meEE_
Definition: DetId.h:17
std::vector< MonitorElement * > meEB_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ fillDescriptions()

void ECALpedestalPCLworker::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 94 of file ECALpedestalPCLworker.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

94  {
96  desc.setUnknown();
97  descriptions.addDefault(desc);
98 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ checkSignal_

bool ECALpedestalPCLworker::checkSignal_
private

Definition at line 54 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().

◆ digiTokenEB_

edm::EDGetTokenT<EBDigiCollection> ECALpedestalPCLworker::digiTokenEB_
private

Definition at line 45 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().

◆ digiTokenEE_

edm::EDGetTokenT<EEDigiCollection> ECALpedestalPCLworker::digiTokenEE_
private

Definition at line 46 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().

◆ dqmDir_

std::string ECALpedestalPCLworker::dqmDir_
private

Definition at line 63 of file ECALpedestalPCLworker.h.

Referenced by bookHistograms(), and ECALpedestalPCLworker().

◆ dynamicBooking_

bool ECALpedestalPCLworker::dynamicBooking_
private

Definition at line 60 of file ECALpedestalPCLworker.h.

Referenced by bookHistograms(), and ECALpedestalPCLworker().

◆ fixedBookingCenterBin_

int ECALpedestalPCLworker::fixedBookingCenterBin_
private

Definition at line 61 of file ECALpedestalPCLworker.h.

Referenced by bookHistograms(), and ECALpedestalPCLworker().

◆ meEB_

std::vector<MonitorElement *> ECALpedestalPCLworker::meEB_
private

Definition at line 50 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and bookHistograms().

◆ meEE_

std::vector<MonitorElement *> ECALpedestalPCLworker::meEE_
private

Definition at line 51 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and bookHistograms().

◆ nBins_

int ECALpedestalPCLworker::nBins_
private

Definition at line 62 of file ECALpedestalPCLworker.h.

Referenced by bookHistograms(), and ECALpedestalPCLworker().

◆ pedestalSamples_

uint32_t ECALpedestalPCLworker::pedestalSamples_
private

Definition at line 53 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().

◆ pedestalToken_

const edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> ECALpedestalPCLworker::pedestalToken_
private

Definition at line 48 of file ECALpedestalPCLworker.h.

Referenced by bookHistograms().

◆ requireStableBeam_

bool ECALpedestalPCLworker::requireStableBeam_
private

Definition at line 65 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().

◆ sThresholdEB_

uint32_t ECALpedestalPCLworker::sThresholdEB_
private

Definition at line 55 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().

◆ sThresholdEE_

uint32_t ECALpedestalPCLworker::sThresholdEE_
private

Definition at line 58 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().

◆ tcdsToken_

edm::EDGetTokenT<TCDSRecord> ECALpedestalPCLworker::tcdsToken_
private

Definition at line 47 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().