CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
CSCMonitorModule Class Reference

Common CSC DQM Module that uses CSCDQM Framework. More...

#include <CSCMonitorModule.h>

Inheritance diagram for CSCMonitorModule:
DQMEDAnalyzer cscdqm::MonitorObjectProvider edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

cscdqm::MonitorObjectbookMonitorObject (const cscdqm::HistoBookRequest &p_req) override
 Book Monitor Object on Request. More...
 
 CSCMonitorModule (const edm::ParameterSet &ps)
 Constructor. More...
 
bool getCSCDetId (const unsigned int crateId, const unsigned int dmbId, CSCDetId &detId) const override
 
virtual ~CSCMonitorModule ()
 Destructor. More...
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 & itemsToGetFromEvent () 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)
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 Begin the run. More...
 
void beginJob ()
 
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 Book Histograms in the beginRun. More...
 
void endJob ()
 
void endRun (const edm::Run &r, const edm::EventSetup &c) override
 
void setup ()
 
- 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)
 

Private Attributes

cscdqm::Configuration config
 
cscdqm::Dispatcherdispatcher
 
DQMStore::IBookeribooker
 
edm::InputTag inputTag
 
std::vector< std::string > maskedHW
 
const CSCCrateMappcrate
 
bool prebookEffParams
 
bool processDcsScalers
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Common CSC DQM Module that uses CSCDQM Framework.

Definition at line 77 of file CSCMonitorModule.h.

Constructor & Destructor Documentation

CSCMonitorModule::CSCMonitorModule ( const edm::ParameterSet ps)

Constructor.

Global stuff

Parameters
psParameters.

Definition at line 25 of file CSCMonitorModule.cc.

References edm::EDConsumerBase::consumesCollector(), dispatcher, edm::ParameterSet::exists(), edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), cscdqm::Dispatcher::init(), INPUT_TAG_LABEL, inputTag, maskedHW, prebookEffParams, and processDcsScalers.

25  {
26 
27  edm::FileInPath fp;
28 
30  prebookEffParams = ps.getUntrackedParameter<bool>("PREBOOK_EFF_PARAMS", false);
31  processDcsScalers = ps.getUntrackedParameter<bool>("PROCESS_DCS_SCALERS", true);
32  edm::ParameterSet params = ps.getUntrackedParameter<edm::ParameterSet>("EventProcessor");
33  config.load(params);
34 
35  fp = ps.getParameter<edm::FileInPath>("BOOKING_XML_FILE");
36  config.setBOOKING_XML_FILE(fp.fullPath());
37 
38  // dbe = edm::Service<DQMStore>().operator->();
39 
40 #ifdef DQMLOCAL
41  dispatcher = new cscdqm::Dispatcher(&config, const_cast<CSCMonitorModule*>(this));
42 #endif
43 #ifdef DQMGLOBAL
44  // edm::ConsumesCollector coco( consumesCollector() );
45  dispatcher = new cscdqm::Dispatcher(&config, const_cast<CSCMonitorModule*>(this),
47  dcstoken = consumes<DcsStatusCollection>(edm::InputTag("scalersRawToDigi") );
48 
49 #endif
50 
51  dispatcher->init();
52 
53  if (ps.exists("MASKEDHW")) {
54  maskedHW = ps.getUntrackedParameter<std::vector<std::string> >("MASKEDHW");
55  //dispatcher->maskHWElements(maskedHW);
56  }
57 
58 }
void init()
Initialize Dispatcher: book histograms, init processor, etc.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
cscdqm::Dispatcher * dispatcher
std::vector< std::string > maskedHW
Definition: config.py:1
CSCDQM Framework frontend and Histogram Cache controller.
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
static const char INPUT_TAG_LABEL[]
Global stuff.
edm::InputTag inputTag
CSCMonitorModule::~CSCMonitorModule ( )
virtual

Destructor.

Definition at line 63 of file CSCMonitorModule.cc.

References dispatcher.

63  {
64  if (dispatcher) delete dispatcher;
65 }
cscdqm::Dispatcher * dispatcher

Member Function Documentation

void CSCMonitorModule::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotected

Begin the run.

Parameters
rRun object
cEvent setup Analyze Event.
eEvent to analyze
cEvent Setup

Definition at line 88 of file CSCMonitorModule.cc.

References cscdqm::HWStandbyType::applyMeM(), cscdqm::HWStandbyType::applyMeP(), DcsStatus::CSCm, DcsStatus::CSCp, dispatcher, edm::EventSetup::get(), edm::Event::getByToken(), inputTag, pcrate, cscdqm::HWStandbyType::process, processDcsScalers, and edm::ESHandle< T >::product().

Referenced by setup().

88  {
89 
90  // Get crate mapping from database
92  c.get<CSCCrateMapRcd>().get(hcrate);
93  pcrate = hcrate.product();
94 
95  cscdqm::HWStandbyType standby;
96 
97  // Get DCS status scalers
98  if (processDcsScalers) {
100 #ifdef DQMLOCAL
101  if (e.getByToken(dcstoken, dcsStatus)) {
102 #endif
103 #ifdef DQMGLOBAL
104  if (e.getByToken(dcstoken, dcsStatus) ) {
105 #endif
106  DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin();
107  for (; dcsStatusItr != dcsStatus->end(); ++dcsStatusItr) {
108  standby.applyMeP(dcsStatusItr->ready(DcsStatus::CSCp));
109  standby.applyMeM(dcsStatusItr->ready(DcsStatus::CSCm));
110  }
111  }
112  standby.process = true;
113  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
const CSCCrateMap * pcrate
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
void CSCMonitorModule::beginJob ( void  )
inlineprotected

EDAnalyzer Implementation

Definition at line 130 of file CSCMonitorModule.h.

130 { }
void CSCMonitorModule::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
inlineoverrideprotected

Definition at line 134 of file CSCMonitorModule.h.

134 { }
void CSCMonitorModule::bookHistograms ( DQMStore::IBooker ib,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Book Histograms in the beginRun.

Parameters
ib- DQMStore::IBooker interface access object
edm::Runconst & - not used
edm::EventSetupconst & - not used

Store pointer to IBooker to use it in ::bookMonitorObject() callback function used by the Dispatcher::book() method

Call Dispatcher histogram booking method to pre-boook all available histograms before processing data. New PREBOOK_ALL_HISTOS config option should be set to true (default). That should disable original CSC on-the-fly histo booking during data processing. Changed for multi-threaded framework compatibility. (pre-booking of all histos is not most efficient way for CSCi DQM).

Implements DQMEDAnalyzer.

Definition at line 125 of file CSCMonitorModule.cc.

References cscdqm::Dispatcher::book(), dispatcher, cuy::ib, ibooker, maskedHW, cscdqm::Dispatcher::maskHWElements(), prebookEffParams, and cscdqm::Dispatcher::updateFractionAndEfficiencyHistos().

Referenced by endJob().

126 {
128  ibooker = &ib;
129 
138  dispatcher->book();
139 
140  if (maskedHW.size() != 0)
142  if (prebookEffParams) {
144  }
145 
146 }
void updateFractionAndEfficiencyHistos()
On demand update fraction and efficiency MOs.
cscdqm::Dispatcher * dispatcher
std::vector< std::string > maskedHW
unsigned int maskHWElements(std::vector< std::string > &tokens)
Mask HW elements from the efficiency calculations. Can be applied on runtime!
DQMStore::IBooker * ibooker
ib
Definition: cuy.py:660
cscdqm::MonitorObject * CSCMonitorModule::bookMonitorObject ( const cscdqm::HistoBookRequest req)
overridevirtual

Book Monitor Object on Request.

Parameters
reqRequest.
Returns
MonitorObject created.

Implements cscdqm::MonitorObjectProvider.

Definition at line 154 of file CSCMonitorModule.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), DQMStore::IBooker::book3D(), DQMStore::IBooker::bookFloat(), DQMStore::IBooker::bookInt(), DQMStore::IBooker::bookProfile(), DQMStore::IBooker::bookProfile2D(), DQMStore::IBooker::bookString(), DQMStore::IBooker::cd(), cscdqm::HistoBookRequest::default_float, cscdqm::HistoBookRequest::default_int, cscdqm::HistoBookRequest::default_string, DIR_CRTINFO, DIR_DAQINFO, DIR_DCSINFO, DIR_EVENTINFO, cscdqm::h::EMU_CSC_STATS_SUMMARY, cscdqm::MonitorObject::Fill(), cscdqm::FLOAT, cscdqm::HistoBookRequest::folder, cscdqm::HistoDef::getId(), cscdqm::HistoDef::getName(), cscdqm::HistoDef::getPath(), cscdqm::H1D, cscdqm::H2D, cscdqm::H3D, cscdqm::HistoBookRequest::hdef, cscdqm::HistoBookRequest::highX, cscdqm::HistoBookRequest::highY, cscdqm::HistoBookRequest::highZ, cscdqm::HistoBookRequest::htype, ibooker, cscdqm::INT, cscdqm::h::keys, cscdqm::HistoBookRequest::lowX, cscdqm::HistoBookRequest::lowY, cscdqm::HistoBookRequest::lowZ, dataset::name, cscdqm::HistoBookRequest::nchX, cscdqm::HistoBookRequest::nchY, cscdqm::HistoBookRequest::nchZ, NULL, cscdqm::HistoBookRequest::option, cscdqm::h::PAR_CRT_SUMMARY, cscdqm::h::PAR_DAQ_SUMMARY, cscdqm::h::PAR_DCS_SUMMARY, cscdqm::h::PAR_REPORT_SUMMARY, callgraph::path, cscdqm::PROFILE, cscdqm::PROFILE2D, cscdqm::Utility::regexMatch(), DQMStore::IBooker::setCurrentFolder(), cscdqm::STRING, AlCaHLTBitMon_QueryRunRegistry::string, and cscdqm::HistoBookRequest::title.

Referenced by getCSCDetId().

154  {
155 
157  std::string name = req.hdef->getName();
158 
159  std::string path = req.folder;
160  if (req.hdef->getPath().size() > 0) {
161  path = path + req.hdef->getPath() + "/";
162  }
163 
164  //std::cout << "Moving to " << path << " for name = " << name << " with fullPath = " << req.hdef->getFullPath() << "\n";
165 
166  //dbe->setCurrentFolder(path);
167  ibooker->cd();
168  ibooker->setCurrentFolder(path);
169 
170  if (req.htype == cscdqm::INT) {
171  me = new CSCMonitorObject(ibooker->bookInt(name));
172  me->Fill(req.default_int);
173  } else
174  if (req.htype == cscdqm::FLOAT) {
175  if (req.hdef->getId() == cscdqm::h::PAR_REPORT_SUMMARY ||
179  ibooker->cd();
181  } else if (cscdqm::Utility::regexMatch("^PAR_DCS_", cscdqm::h::keys[req.hdef->getId()])) {
182  ibooker->cd();
184  } else if (cscdqm::Utility::regexMatch("^PAR_DAQ_", cscdqm::h::keys[req.hdef->getId()])) {
185  ibooker->cd();
187  } else if (cscdqm::Utility::regexMatch("^PAR_CRT_", cscdqm::h::keys[req.hdef->getId()])) {
188  ibooker->cd();
190  }
191  me = new CSCMonitorObject(ibooker->bookFloat(name));
192  me->Fill(req.default_float);
193  } else
194  if (req.htype == cscdqm::STRING) {
195  me = new CSCMonitorObject(ibooker->bookString(name, req.default_string));
196  } else
197  if (req.htype == cscdqm::H1D) {
198  me = new CSCMonitorObject(ibooker->book1D(name, req.title, req.nchX, req.lowX, req.highX));
199  } else
200  if (req.htype == cscdqm::H2D) {
202  ibooker->cd();
204  name = "reportSummaryMap";
205  }
206  me = new CSCMonitorObject(ibooker->book2D(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY));
207  } else
208  if (req.htype == cscdqm::H3D) {
209  me = new CSCMonitorObject(ibooker->book3D(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY, req.nchZ, req.lowZ, req.highZ));
210  } else
211  if (req.htype == cscdqm::PROFILE) {
212  me = new CSCMonitorObject(ibooker->bookProfile(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY, req.option.c_str()));
213  } else
214  if (req.htype == cscdqm::PROFILE2D) {
215  me = new CSCMonitorObject(ibooker->bookProfile2D(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY, req.nchZ, req.lowZ, req.highZ, req.option.c_str()));
216  }
217 
218  return me;
219 
220 }
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
static const char DIR_DAQINFO[]
cscdqm::MonitorObject implementation used in CSCMonitorModuleCmn
void cd(void)
Definition: DQMStore.cc:269
virtual void Fill(float x)=0
Monitoring Object interface used to cover Root object and provide common interface to EventProcessor ...
MonitorElement * bookInt(Args &&...args)
Definition: DQMStore.h:103
MonitorElement * bookString(Args &&...args)
Definition: DQMStore.h:97
#define NULL
Definition: scimark2.h:8
static bool regexMatch(const std::string &expression, const std::string &message)
Match RegExp expression string against string message and return result.
const HistoId getId() const
Get Histogram ID.
static const char DIR_DCSINFO[]
MonitorElement * bookProfile2D(Args &&...args)
Definition: DQMStore.h:163
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
static const char DIR_EVENTINFO[]
virtual const std::string getPath() const
Get path part of the histogram (used only for DDUs and CSCs)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
static const char DIR_CRTINFO[]
DQMStore::IBooker * ibooker
virtual const std::string getName() const
Get processed histogram name. It can include additional parameter in formated name. This Name is being constructed from raw name and additional parameter.
MonitorElement * bookFloat(Args &&...args)
Definition: DQMStore.h:109
MonitorElement * book3D(Args &&...args)
Definition: DQMStore.h:151
static const HistoName keys[]
void CSCMonitorModule::endJob ( void  )
inlineprotected

Definition at line 136 of file CSCMonitorModule.h.

References bookHistograms().

136 { }
void CSCMonitorModule::endRun ( const edm::Run r,
const edm::EventSetup c 
)
inlineoverrideprotected

Definition at line 135 of file CSCMonitorModule.h.

135 { }
bool CSCMonitorModule::getCSCDetId ( const unsigned int  crateId,
const unsigned int  dmbId,
CSCDetId detId 
) const
inlineoverridevirtual

MonitorObjectProvider Implementation

Implements cscdqm::MonitorObjectProvider.

Definition at line 113 of file CSCMonitorModule.h.

References bookMonitorObject(), CSCCrateMap::detId(), MAX_CRATE_ID, MAX_DMB_SLOT, and DetId::rawId().

113  {
114  // Check parameter values
115  if (crateId < MIN_CRATE_ID || crateId > MAX_CRATE_ID || dmbId < MIN_DMB_SLOT || dmbId > MAX_DMB_SLOT) {
116  return false;
117  }
118  detId = pcrate->detId(crateId, dmbId, 0, 0);
119  return (detId.rawId() != 0);
120  }
static const unsigned int MAX_CRATE_ID
CSCDetId detId(int vme, int dmb, int cfeb, int layer=0) const
Definition: CSCCrateMap.cc:11
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const CSCCrateMap * pcrate
static const unsigned int MAX_DMB_SLOT
void CSCMonitorModule::setup ( )
inlineprotected

Definition at line 132 of file CSCMonitorModule.h.

References analyze(), EnergyCorrector::c, and MillePedeFileConverter_cfg::e.

132 { }

Member Data Documentation

cscdqm::Configuration CSCMonitorModule::config
private

Definition at line 90 of file CSCMonitorModule.h.

cscdqm::Dispatcher* CSCMonitorModule::dispatcher
private

Definition at line 91 of file CSCMonitorModule.h.

Referenced by analyze(), bookHistograms(), CSCMonitorModule(), and ~CSCMonitorModule().

DQMStore::IBooker* CSCMonitorModule::ibooker
private

Definition at line 93 of file CSCMonitorModule.h.

Referenced by bookHistograms(), and bookMonitorObject().

edm::InputTag CSCMonitorModule::inputTag
private

Definition at line 94 of file CSCMonitorModule.h.

Referenced by analyze(), and CSCMonitorModule().

std::vector<std::string> CSCMonitorModule::maskedHW
private

Definition at line 101 of file CSCMonitorModule.h.

Referenced by bookHistograms(), and CSCMonitorModule().

const CSCCrateMap* CSCMonitorModule::pcrate
private

Pointer to crate mapping from database

Definition at line 99 of file CSCMonitorModule.h.

Referenced by analyze().

bool CSCMonitorModule::prebookEffParams
private

Definition at line 95 of file CSCMonitorModule.h.

Referenced by bookHistograms(), and CSCMonitorModule().

bool CSCMonitorModule::processDcsScalers
private

Definition at line 96 of file CSCMonitorModule.h.

Referenced by analyze(), and CSCMonitorModule().