CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Types | Private Attributes
CastorMonitorModule Class Reference

#include <CastorMonitorModule.h>

Inheritance diagram for CastorMonitorModule:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

 CastorMonitorModule (const edm::ParameterSet &ps)
 
 ~CastorMonitorModule () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Protected Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &eventSetup) override
 
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &eventSetup) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &eventSetup) override
 
void endRun (const edm::Run &run, const edm::EventSetup &eventSetup) override
 

Private Types

typedef std::vector< reco::BasicJetBasicJetCollection
 
typedef std::vector< reco::CastorTowerCastorTowerCollection
 

Private Attributes

MonitorElementCastorEventProduct
 
edm::ESHandle< CastorDbServiceconditions_
 
edm::CPUTimer cpu_timer
 
edm::ESHandle< CastorPedestalsdbPedestals
 
CastorDigiMonitorDigiMon_
 
bool digiOK_
 
int fVerbosity
 
MonitorElementhunpkrep
 
int ibunch_
 
int ievent_
 
int ievt_
 
int ilumisec_
 
edm::EDGetTokenT< CastorTowerCollectioninputTokenCastorTowers_
 
edm::EDGetTokenT< CastorDigiCollectioninputTokenDigi_
 
edm::EDGetTokenT< FEDRawDataCollectioninputTokenRaw_
 
edm::EDGetTokenT< CastorRecHitCollectioninputTokenRecHitCASTOR_
 
edm::EDGetTokenT< HcalUnpackerReportinputTokenReport_
 
int irun_
 
edm::EDGetTokenT< BasicJetCollectionJetAlgorithm
 
CastorLEDMonitorLedMon_
 
bool rawOK_
 
CastorRecHitMonitorRecHitMon_
 
bool rechitOK_
 
bool reportOK_
 
bool showTiming_
 
std::string subsystemname_
 
edm::EDGetTokenT< edm::TriggerResultstokenTriggerResults
 

Detailed Description

Definition at line 73 of file CastorMonitorModule.h.

Member Typedef Documentation

Definition at line 113 of file CastorMonitorModule.h.

Definition at line 111 of file CastorMonitorModule.h.

Constructor & Destructor Documentation

CastorMonitorModule::CastorMonitorModule ( const edm::ParameterSet ps)

Definition at line 32 of file CastorMonitorModule.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), AlCaHLTBitMon_QueryRunRegistry::string, and TrigNameIndex.

32  {
33  fVerbosity = ps.getUntrackedParameter<int>("debug", 0);
35  ps.getUntrackedParameter<std::string>("subSystemFolder", "Castor");
36  inputTokenRaw_ = consumes<FEDRawDataCollection>(
37  ps.getParameter<edm::InputTag>("rawLabel"));
38  inputTokenReport_ = consumes<HcalUnpackerReport>(
39  ps.getParameter<edm::InputTag>("unpackerReportLabel"));
40  inputTokenDigi_ = consumes<CastorDigiCollection>(
41  ps.getParameter<edm::InputTag>("digiLabel"));
42  inputTokenRecHitCASTOR_ = consumes<CastorRecHitCollection>(
43  ps.getParameter<edm::InputTag>("CastorRecHitLabel"));
44  inputTokenCastorTowers_ = consumes<CastorTowerCollection>(
45  ps.getParameter<edm::InputTag>("CastorTowerLabel"));
46  JetAlgorithm = consumes<BasicJetCollection>(
47  ps.getParameter<edm::InputTag>("CastorBasicJetsLabel"));
48  tokenTriggerResults = consumes<edm::TriggerResults>(
49  ps.getParameter<edm::InputTag>("tagTriggerResults"));
50 
51  showTiming_ = ps.getUntrackedParameter<bool>("showTiming", false);
52 
53  irun_ = ilumisec_ = ievent_ = ibunch_ = 0;
54  TrigNameIndex = 0;
55 
56  DigiMon_ = nullptr;
57  RecHitMon_ = nullptr;
58  LedMon_ = nullptr;
59 
60  if (ps.getUntrackedParameter<bool>("DigiMonitor", false))
61  DigiMon_ = new CastorDigiMonitor(ps);
62 
63  if (ps.getUntrackedParameter<bool>("RecHitMonitor", false))
65 
66  if (ps.getUntrackedParameter<bool>("LEDMonitor", false))
67  LedMon_ = new CastorLEDMonitor(ps);
68 
69  ievt_ = 0;
70 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::TriggerResults > tokenTriggerResults
edm::EDGetTokenT< FEDRawDataCollection > inputTokenRaw_
CastorLEDMonitor * LedMon_
int TrigNameIndex
edm::EDGetTokenT< CastorDigiCollection > inputTokenDigi_
edm::EDGetTokenT< CastorTowerCollection > inputTokenCastorTowers_
CastorDigiMonitor * DigiMon_
edm::EDGetTokenT< BasicJetCollection > JetAlgorithm
edm::EDGetTokenT< HcalUnpackerReport > inputTokenReport_
CastorRecHitMonitor * RecHitMon_
edm::EDGetTokenT< CastorRecHitCollection > inputTokenRecHitCASTOR_
CastorMonitorModule::~CastorMonitorModule ( )
override

Definition at line 72 of file CastorMonitorModule.cc.

72  {
73  if (DigiMon_ != nullptr) delete DigiMon_;
74  if (RecHitMon_ != nullptr) delete RecHitMon_;
75  if (LedMon_ != nullptr) delete LedMon_;
76 }
CastorLEDMonitor * LedMon_
CastorDigiMonitor * DigiMon_
CastorRecHitMonitor * RecHitMon_

Member Function Documentation

void CastorMonitorModule::analyze ( const edm::Event iEvent,
const edm::EventSetup eventSetup 
)
overrideprotected

Definition at line 143 of file CastorMonitorModule.cc.

References HcalUnpackerReport::badQualityDigis(), edm::EventBase::bunchCrossing(), HcalUnpackerReport::busySpigots(), gather_cfg::cout, DEFINE_FWK_MODULE, HcalUnpackerReport::emptyEventSpigots(), edm::EventID::event(), objects.autophobj::float, edm::Event::getByToken(), edm::EventBase::id(), edm::HandleBase::isValid(), fwrapper::jets, edm::EventBase::luminosityBlock(), ecaldqm::nTowers, HcalUnpackerReport::OFWSpigots(), edmIntegrityCheck::report, edm::EventID::run(), edm::SortedCollection< T, SORT >::size(), and HcalUnpackerReport::spigotFormatErrors().

144  {
145  if (fVerbosity > 1) LogPrint("CastorMonitorModule") << "analyze (start)";
146 
147  irun_ = iEvent.id().run();
148  ilumisec_ = iEvent.luminosityBlock();
149  ievent_ = iEvent.id().event();
150  ibunch_ = iEvent.bunchCrossing();
151 
152  ievt_++;
153 
154  bool rawOK_ = true;
155  bool digiOK_ = true;
156  bool rechitOK_ = true, towerOK_ = true, jetsOK_ = true;
157  int nDigi = 0, nrecHits = 0, nTowers = 0, nJets = 0;
158 
160  iEvent.getByToken(tokenTriggerResults, TrigResults);
161 
163  iEvent.getByToken(inputTokenRaw_, RawData);
164  if (!RawData.isValid()) rawOK_ = false;
165 
166  float fedsUnpacked = 0.;
168  iEvent.getByToken(inputTokenReport_, report);
169  if (!report.isValid())
170  rawOK_ = false;
171  else {
172  const std::vector<int> feds = (*report).getFedsUnpacked();
173  fedsUnpacked = float(feds.size());
174  hunpkrep->Fill(0, fedsUnpacked);
175  hunpkrep->Fill(1, report->spigotFormatErrors());
176  hunpkrep->Fill(2, report->emptyEventSpigots());
177  hunpkrep->Fill(3, report->busySpigots());
178  hunpkrep->Fill(4, report->OFWSpigots());
179  hunpkrep->Fill(5, report->badQualityDigis());
180  }
181 
183  iEvent.getByToken(inputTokenDigi_, CastorDigi);
184  if (CastorDigi.isValid())
185  nDigi = CastorDigi->size();
186  else
187  digiOK_ = false;
188 
190  iEvent.getByToken(inputTokenRecHitCASTOR_, CastorHits);
191  if (CastorHits.isValid())
192  nrecHits = CastorHits->size();
193  else
194  rechitOK_ = false;
195 
197  iEvent.getByToken(inputTokenCastorTowers_, castorTowers);
198  if (castorTowers.isValid())
199  nTowers = castorTowers->size();
200  else
201  towerOK_ = false;
202 
204  iEvent.getByToken(JetAlgorithm, jets);
205  if (jets.isValid())
206  nJets = jets->size();
207  else
208  jetsOK_ = false;
209 
210  if (fVerbosity > 0)
211  LogPrint("CastorMonitorModule")
212  << "CastorProductValid(size): RawDataValid=" << RawData.isValid()
213  << " Digi=" << digiOK_ << "(" << nDigi << ") Hits=" << rechitOK_ << "("
214  << nrecHits << ")"
215  << " Towers=" << towerOK_ << "(" << nTowers << ")"
216  << " Jets=" << jetsOK_ << "(" << nJets << ")";
217 
218  CastorEventProduct->Fill(0, fedsUnpacked / 3.);
219  CastorEventProduct->Fill(1, rawOK_);
220  CastorEventProduct->Fill(2, digiOK_);
221  CastorEventProduct->Fill(3, rechitOK_);
222  CastorEventProduct->Fill(4, towerOK_);
223  CastorEventProduct->Fill(5, jetsOK_);
224 
225  if (digiOK_)
226  DigiMon_->processEvent(iEvent, *CastorDigi, *TrigResults, *conditions_);
227  if (showTiming_) {
228  cpu_timer.stop();
229  if (DigiMon_ != nullptr)
230  std::cout << "TIMER:: DIGI MONITOR ->" << cpu_timer.cpuTime()
231  << std::endl;
232  cpu_timer.reset();
233  cpu_timer.start();
234  }
235 
236  if (rechitOK_) RecHitMon_->processEvent(*CastorHits);
237  if (showTiming_) {
238  cpu_timer.stop();
239  if (RecHitMon_ != nullptr)
240  std::cout << "TIMER:: RECHIT MONITOR->" << cpu_timer.cpuTime()
241  << std::endl;
242  cpu_timer.reset();
243  cpu_timer.start();
244  }
245 
246  if (towerOK_) RecHitMon_->processEventTowers(*castorTowers);
247  if (jetsOK_) RecHitMon_->processEventJets(*jets);
248 
249  if (fVerbosity > 0 && ievt_ % 100 == 0)
250  LogPrint("CastorMonitorModule") << "processed " << ievt_ << " events";
251  return;
252 }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
int spigotFormatErrors() const
edm::EDGetTokenT< edm::TriggerResults > tokenTriggerResults
void start()
Definition: CPUTimer.cc:74
int emptyEventSpigots() const
edm::EDGetTokenT< FEDRawDataCollection > inputTokenRaw_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::ESHandle< CastorDbService > conditions_
MonitorElement * hunpkrep
int bunchCrossing() const
Definition: EventBase.h:66
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
void reset()
Definition: CPUTimer.cc:107
void processEvent(edm::Event const &event, const CastorDigiCollection &cast, const edm::TriggerResults &trig, const CastorDbService &cond)
void Fill(long long x)
edm::EDGetTokenT< CastorDigiCollection > inputTokenDigi_
edm::EDGetTokenT< CastorTowerCollection > inputTokenCastorTowers_
void processEventJets(const reco::BasicJetCollection &Jets)
vector< PseudoJet > jets
CastorDigiMonitor * DigiMon_
Times stop()
Definition: CPUTimer.cc:94
bool isValid() const
Definition: HandleBase.h:74
double cpuTime() const
Definition: CPUTimer.cc:158
edm::EDGetTokenT< BasicJetCollection > JetAlgorithm
int badQualityDigis() const
MonitorElement * CastorEventProduct
edm::EventID id() const
Definition: EventBase.h:60
void processEventTowers(const reco::CastorTowerCollection &castorTowers)
size_type size() const
edm::EDGetTokenT< HcalUnpackerReport > inputTokenReport_
CastorRecHitMonitor * RecHitMon_
void processEvent(const CastorRecHitCollection &castorHits)
edm::EDGetTokenT< CastorRecHitCollection > inputTokenRecHitCASTOR_
int busySpigots() const
void CastorMonitorModule::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup eventSetup 
)
overrideprotected

Definition at line 124 of file CastorMonitorModule.cc.

References NLumiSec.

125  {
126  ++NLumiSec;
127  if (fVerbosity > 0)
128  LogPrint("CastorMonitorModule")
129  << "beginLuminosityBlock(start): " << NLumiSec << "(" << ilumisec_
130  << ")";
131 }
int NLumiSec
void CastorMonitorModule::bookHistograms ( DQMStore::IBooker ,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotected

Definition at line 86 of file CastorMonitorModule.cc.

References DQMStore::IBooker::book1DD(), DQMStore::IBooker::bookProfile(), MonitorElement::getTH1D(), MonitorElement::getTProfile(), alignCSCRings::s, and DQMStore::IBooker::setCurrentFolder().

88  {
89  if (DigiMon_ != nullptr) {
90  DigiMon_->bookHistograms(ibooker, iRun, iSetup);
91  }
92  if (RecHitMon_ != nullptr) {
93  RecHitMon_->bookHistograms(ibooker, iRun, iSetup);
94  }
95  if (LedMon_ != nullptr) {
96  LedMon_->bookHistograms(ibooker, iRun, iSetup);
97  }
98 
99  ibooker.setCurrentFolder(subsystemname_);
100  char s[60];
101  sprintf(s, "CastorEventProducts");
102  CastorEventProduct = ibooker.book1DD(s, s, 6, -0.5, 5.5);
103  CastorEventProduct->getTH1D()->GetYaxis()->SetTitle("Events");
104  TAxis* xa = CastorEventProduct->getTH1D()->GetXaxis();
105  xa->SetBinLabel(1, "FEDs/3");
106  xa->SetBinLabel(2, "RawData");
107  xa->SetBinLabel(3, "Digi");
108  xa->SetBinLabel(4, "RecHits");
109  xa->SetBinLabel(5, "Towers");
110  xa->SetBinLabel(6, "Jets");
111 
112  sprintf(s, "CASTORUnpackReport");
113  hunpkrep = ibooker.bookProfile(s, s, 6, -0.5, 5.5, 100, 0, 1.e10, "");
114  xa = hunpkrep->getTProfile()->GetXaxis();
115  xa->SetBinLabel(1, "N_FEDs");
116  xa->SetBinLabel(2, "SPIGOT_Err");
117  xa->SetBinLabel(3, "empty");
118  xa->SetBinLabel(4, "busy");
119  xa->SetBinLabel(5, "OvF");
120  xa->SetBinLabel(6, "BadDigis");
121  return;
122 }
TProfile * getTProfile() const
MonitorElement * hunpkrep
CastorLEDMonitor * LedMon_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
CastorDigiMonitor * DigiMon_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
MonitorElement * CastorEventProduct
TH1D * getTH1D() const
CastorRecHitMonitor * RecHitMon_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
void CastorMonitorModule::dqmBeginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprotected

Definition at line 78 of file CastorMonitorModule.cc.

References edm::EventSetup::get(), and NLumiSec.

79  {
80  if (fVerbosity > 0) LogPrint("CastorMonitorModule") << "dqmBeginRun(start)";
81  NLumiSec = 0;
82 
83  iSetup.get<CastorDbRecord>().get(conditions_);
84 }
edm::ESHandle< CastorDbService > conditions_
int NLumiSec
T get() const
Definition: EventSetup.h:62
void CastorMonitorModule::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup eventSetup 
)
overrideprotected

Definition at line 133 of file CastorMonitorModule.cc.

134  {}
void CastorMonitorModule::endRun ( const edm::Run run,
const edm::EventSetup eventSetup 
)
overrideprotected

Definition at line 136 of file CastorMonitorModule.cc.

137  {
138  if (DigiMon_ != nullptr) {
139  DigiMon_->endRun();
140  }
141 }
CastorDigiMonitor * DigiMon_

Member Data Documentation

MonitorElement* CastorMonitorModule::CastorEventProduct
private

Definition at line 124 of file CastorMonitorModule.h.

edm::ESHandle<CastorDbService> CastorMonitorModule::conditions_
private

Definition at line 127 of file CastorMonitorModule.h.

edm::CPUTimer CastorMonitorModule::cpu_timer
private

Definition at line 130 of file CastorMonitorModule.h.

edm::ESHandle<CastorPedestals> CastorMonitorModule::dbPedestals
private

Definition at line 131 of file CastorMonitorModule.h.

CastorDigiMonitor* CastorMonitorModule::DigiMon_
private

Definition at line 119 of file CastorMonitorModule.h.

bool CastorMonitorModule::digiOK_
private

Definition at line 98 of file CastorMonitorModule.h.

int CastorMonitorModule::fVerbosity
private

Definition at line 97 of file CastorMonitorModule.h.

MonitorElement* CastorMonitorModule::hunpkrep
private

Definition at line 125 of file CastorMonitorModule.h.

int CastorMonitorModule::ibunch_
private

Definition at line 99 of file CastorMonitorModule.h.

int CastorMonitorModule::ievent_
private

Definition at line 99 of file CastorMonitorModule.h.

int CastorMonitorModule::ievt_
private

Definition at line 102 of file CastorMonitorModule.h.

int CastorMonitorModule::ilumisec_
private

Definition at line 99 of file CastorMonitorModule.h.

edm::EDGetTokenT<CastorTowerCollection> CastorMonitorModule::inputTokenCastorTowers_
private

Definition at line 112 of file CastorMonitorModule.h.

edm::EDGetTokenT<CastorDigiCollection> CastorMonitorModule::inputTokenDigi_
private

Definition at line 109 of file CastorMonitorModule.h.

edm::EDGetTokenT<FEDRawDataCollection> CastorMonitorModule::inputTokenRaw_
private

Definition at line 107 of file CastorMonitorModule.h.

edm::EDGetTokenT<CastorRecHitCollection> CastorMonitorModule::inputTokenRecHitCASTOR_
private

Definition at line 110 of file CastorMonitorModule.h.

edm::EDGetTokenT<HcalUnpackerReport> CastorMonitorModule::inputTokenReport_
private

Definition at line 108 of file CastorMonitorModule.h.

int CastorMonitorModule::irun_
private

Definition at line 99 of file CastorMonitorModule.h.

edm::EDGetTokenT<BasicJetCollection> CastorMonitorModule::JetAlgorithm
private

Definition at line 114 of file CastorMonitorModule.h.

CastorLEDMonitor* CastorMonitorModule::LedMon_
private

Definition at line 120 of file CastorMonitorModule.h.

bool CastorMonitorModule::rawOK_
private

Definition at line 98 of file CastorMonitorModule.h.

CastorRecHitMonitor* CastorMonitorModule::RecHitMon_
private

Definition at line 118 of file CastorMonitorModule.h.

bool CastorMonitorModule::rechitOK_
private

Definition at line 98 of file CastorMonitorModule.h.

bool CastorMonitorModule::reportOK_
private

Definition at line 98 of file CastorMonitorModule.h.

bool CastorMonitorModule::showTiming_
private

Definition at line 129 of file CastorMonitorModule.h.

std::string CastorMonitorModule::subsystemname_
private

Definition at line 100 of file CastorMonitorModule.h.

edm::EDGetTokenT<edm::TriggerResults> CastorMonitorModule::tokenTriggerResults
private

Definition at line 106 of file CastorMonitorModule.h.