CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< DQMEDAnalyzerGlobalCache
initializeGlobalCache (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
< EBDigiCollection
digiTokenEB_
 
edm::EDGetTokenT
< EEDigiCollection
digiTokenEE_
 
std::string dqmDir_
 
bool dynamicBooking_
 
int fixedBookingCenterBin_
 
std::vector< MonitorElement * > meEB_
 
std::vector< MonitorElement * > meEE_
 
int nBins_
 
uint32_t pedestalSamples_
 
const edm::ESGetToken
< EcalPedestals,
EcalPedestalsRcd
pedestalToken_
 
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 ( 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, 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 }
edm::EDGetTokenT< EEDigiCollection > digiTokenEE_
const edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > pedestalToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< EBDigiCollection > digiTokenEB_
edm::EDGetTokenT< TCDSRecord > tcdsToken_

Member Function Documentation

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

Definition at line 68 of file ECALpedestalPCLworker.h.

Referenced by analyze().

68 { return (a & 0xFFF) < (b & 0xFFF); }
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
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_Fake1_cff::beamMode, edm::DataFrame::begin(), checkSignal_, digiTokenEB_, digiTokenEE_, edm::DataFrame::end(), HcalObjRepresent::Fill(), EcalDataFrame::frame(), edm::Event::getByToken(), EBDetId::hashedIndex(), EEDetId::hashedIndex(), 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 }
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< EEDigiCollection > digiTokenEE_
std::vector< MonitorElement * > meEE_
static bool adc_compare(uint16_t a, uint16_t b)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int hashedIndex() const
Definition: EEDetId.h:183
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
edm::EDGetTokenT< EBDigiCollection > digiTokenEB_
std::vector< MonitorElement * > meEB_
data_type * iterator
Definition: DataFrame.h:20
edm::EDGetTokenT< TCDSRecord > tcdsToken_
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, 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:32
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
void ECALpedestalPCLworker::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Member Data Documentation

bool ECALpedestalPCLworker::checkSignal_
private

Definition at line 54 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().

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

Definition at line 45 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().

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

Definition at line 46 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().

std::string ECALpedestalPCLworker::dqmDir_
private

Definition at line 63 of file ECALpedestalPCLworker.h.

Referenced by bookHistograms(), and ECALpedestalPCLworker().

bool ECALpedestalPCLworker::dynamicBooking_
private

Definition at line 60 of file ECALpedestalPCLworker.h.

Referenced by bookHistograms(), and ECALpedestalPCLworker().

int ECALpedestalPCLworker::fixedBookingCenterBin_
private

Definition at line 61 of file ECALpedestalPCLworker.h.

Referenced by bookHistograms(), and ECALpedestalPCLworker().

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

Definition at line 50 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 51 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and bookHistograms().

int ECALpedestalPCLworker::nBins_
private

Definition at line 62 of file ECALpedestalPCLworker.h.

Referenced by bookHistograms(), and ECALpedestalPCLworker().

uint32_t ECALpedestalPCLworker::pedestalSamples_
private

Definition at line 53 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().

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

Definition at line 48 of file ECALpedestalPCLworker.h.

Referenced by bookHistograms().

bool ECALpedestalPCLworker::requireStableBeam_
private

Definition at line 65 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().

uint32_t ECALpedestalPCLworker::sThresholdEB_
private

Definition at line 55 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().

uint32_t ECALpedestalPCLworker::sThresholdEE_
private

Definition at line 58 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().

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

Definition at line 47 of file ECALpedestalPCLworker.h.

Referenced by analyze(), and ECALpedestalPCLworker().