CMS 3D CMS Logo

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 bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &, const edm::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::CPUTimer cpu_timer
 
std::unique_ptr< CastorDigiMonitorDigiMon_
 
int fVerbosity
 
MonitorElementhunpkrep
 
int ievt_
 
edm::EDGetTokenT< CastorTowerCollectioninputTokenCastorTowers_
 
edm::EDGetTokenT< CastorDigiCollectioninputTokenDigi_
 
edm::EDGetTokenT< FEDRawDataCollectioninputTokenRaw_
 
edm::EDGetTokenT< CastorRecHitCollectioninputTokenRecHitCASTOR_
 
edm::EDGetTokenT< HcalUnpackerReportinputTokenReport_
 
edm::EDGetTokenT< BasicJetCollectionJetAlgorithm
 
std::unique_ptr< CastorLEDMonitorLedMon_
 
std::unique_ptr< CastorRecHitMonitorRecHitMon_
 
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 102 of file CastorMonitorModule.h.

Definition at line 100 of file CastorMonitorModule.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file CastorMonitorModule.cc.

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

29  {
30  fVerbosity = ps.getUntrackedParameter<int>("debug", 0);
31  subsystemname_ = ps.getUntrackedParameter<std::string>("subSystemFolder", "Castor");
32  inputTokenRaw_ = consumes<FEDRawDataCollection>(ps.getParameter<edm::InputTag>("rawLabel"));
33  inputTokenReport_ = consumes<HcalUnpackerReport>(ps.getParameter<edm::InputTag>("unpackerReportLabel"));
34  inputTokenDigi_ = consumes<CastorDigiCollection>(ps.getParameter<edm::InputTag>("digiLabel"));
35  inputTokenRecHitCASTOR_ = consumes<CastorRecHitCollection>(ps.getParameter<edm::InputTag>("CastorRecHitLabel"));
36  inputTokenCastorTowers_ = consumes<CastorTowerCollection>(ps.getParameter<edm::InputTag>("CastorTowerLabel"));
37  JetAlgorithm = consumes<BasicJetCollection>(ps.getParameter<edm::InputTag>("CastorBasicJetsLabel"));
38  tokenTriggerResults = consumes<edm::TriggerResults>(ps.getParameter<edm::InputTag>("tagTriggerResults"));
39 
40  showTiming_ = ps.getUntrackedParameter<bool>("showTiming", false);
41 
42  if (ps.getUntrackedParameter<bool>("DigiMonitor", false))
43  DigiMon_ = std::make_unique<CastorDigiMonitor>(ps);
44 
45  if (ps.getUntrackedParameter<bool>("RecHitMonitor", false))
46  RecHitMon_ = std::make_unique<CastorRecHitMonitor>(ps);
47 
48  if (ps.getUntrackedParameter<bool>("LEDMonitor", false))
49  LedMon_ = std::make_unique<CastorLEDMonitor>(ps);
50 
51  ievt_ = 0;
52 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::TriggerResults > tokenTriggerResults
std::unique_ptr< CastorLEDMonitor > LedMon_
edm::EDGetTokenT< FEDRawDataCollection > inputTokenRaw_
edm::EDGetTokenT< CastorDigiCollection > inputTokenDigi_
edm::EDGetTokenT< CastorTowerCollection > inputTokenCastorTowers_
std::unique_ptr< CastorDigiMonitor > DigiMon_
edm::EDGetTokenT< BasicJetCollection > JetAlgorithm
edm::EDGetTokenT< HcalUnpackerReport > inputTokenReport_
std::unique_ptr< CastorRecHitMonitor > RecHitMon_
edm::EDGetTokenT< CastorRecHitCollection > inputTokenRecHitCASTOR_
CastorMonitorModule::~CastorMonitorModule ( )
override

Definition at line 54 of file CastorMonitorModule.cc.

54 {}

Member Function Documentation

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

Definition at line 105 of file CastorMonitorModule.cc.

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

105  {
106  if (fVerbosity > 1)
107  LogPrint("CastorMonitorModule") << "analyze (start)";
108 
109  ievt_++;
110 
111  bool rawOK_ = true;
112  bool digiOK_ = true;
113  bool rechitOK_ = true, towerOK_ = true, jetsOK_ = true;
114  int nDigi = 0, nrecHits = 0, nTowers = 0, nJets = 0;
115 
117  iEvent.getByToken(tokenTriggerResults, TrigResults);
118 
120  iEvent.getByToken(inputTokenRaw_, RawData);
121  if (!RawData.isValid())
122  rawOK_ = false;
123 
124  float fedsUnpacked = 0.;
126  iEvent.getByToken(inputTokenReport_, report);
127  if (!report.isValid())
128  rawOK_ = false;
129  else {
130  const std::vector<int> feds = (*report).getFedsUnpacked();
131  fedsUnpacked = float(feds.size());
132  hunpkrep->Fill(0, fedsUnpacked);
133  hunpkrep->Fill(1, report->spigotFormatErrors());
134  hunpkrep->Fill(2, report->emptyEventSpigots());
135  hunpkrep->Fill(3, report->busySpigots());
136  hunpkrep->Fill(4, report->OFWSpigots());
137  hunpkrep->Fill(5, report->badQualityDigis());
138  }
139 
141  iEvent.getByToken(inputTokenDigi_, CastorDigi);
142  if (CastorDigi.isValid())
143  nDigi = CastorDigi->size();
144  else
145  digiOK_ = false;
146 
148  iEvent.getByToken(inputTokenRecHitCASTOR_, CastorHits);
149  if (CastorHits.isValid())
150  nrecHits = CastorHits->size();
151  else
152  rechitOK_ = false;
153 
155  iEvent.getByToken(inputTokenCastorTowers_, castorTowers);
156  if (castorTowers.isValid())
157  nTowers = castorTowers->size();
158  else
159  towerOK_ = false;
160 
162  iEvent.getByToken(JetAlgorithm, jets);
163  if (jets.isValid())
164  nJets = jets->size();
165  else
166  jetsOK_ = false;
167 
168  if (fVerbosity > 0)
169  LogPrint("CastorMonitorModule") << "CastorProductValid(size): RawDataValid=" << RawData.isValid()
170  << " Digi=" << digiOK_ << "(" << nDigi << ") Hits=" << rechitOK_ << "(" << nrecHits
171  << ")"
172  << " Towers=" << towerOK_ << "(" << nTowers << ")"
173  << " Jets=" << jetsOK_ << "(" << nJets << ")";
174 
175  CastorEventProduct->Fill(0, fedsUnpacked / 3.);
176  CastorEventProduct->Fill(1, rawOK_);
177  CastorEventProduct->Fill(2, digiOK_);
178  CastorEventProduct->Fill(3, rechitOK_);
179  CastorEventProduct->Fill(4, towerOK_);
180  CastorEventProduct->Fill(5, jetsOK_);
181 
182  if (digiOK_) {
184  iSetup.get<CastorDbRecord>().get(conditions);
185 
186  DigiMon_->processEvent(iEvent, *CastorDigi, *TrigResults, *conditions);
187  }
188  if (showTiming_) {
189  cpu_timer.stop();
190  if (DigiMon_ != nullptr)
191  std::cout << "TIMER:: DIGI MONITOR ->" << cpu_timer.cpuTime() << std::endl;
192  cpu_timer.reset();
193  cpu_timer.start();
194  }
195 
196  if (rechitOK_)
197  RecHitMon_->processEvent(*CastorHits);
198  if (showTiming_) {
199  cpu_timer.stop();
200  if (RecHitMon_ != nullptr)
201  std::cout << "TIMER:: RECHIT MONITOR->" << cpu_timer.cpuTime() << std::endl;
202  cpu_timer.reset();
203  cpu_timer.start();
204  }
205 
206  if (towerOK_)
207  RecHitMon_->processEventTowers(*castorTowers);
208  if (jetsOK_)
209  RecHitMon_->processEventJets(*jets);
210 
211  if (fVerbosity > 0 && ievt_ % 100 == 0)
212  LogPrint("CastorMonitorModule") << "processed " << ievt_ << " events";
213  return;
214 }
int spigotFormatErrors() const
edm::EDGetTokenT< edm::TriggerResults > tokenTriggerResults
void start()
Definition: CPUTimer.cc:68
int emptyEventSpigots() const
edm::EDGetTokenT< FEDRawDataCollection > inputTokenRaw_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
MonitorElement * hunpkrep
void reset()
Definition: CPUTimer.cc:99
void Fill(long long x)
edm::EDGetTokenT< CastorDigiCollection > inputTokenDigi_
edm::EDGetTokenT< CastorTowerCollection > inputTokenCastorTowers_
std::unique_ptr< CastorDigiMonitor > DigiMon_
vector< PseudoJet > jets
Times stop()
Definition: CPUTimer.cc:87
bool isValid() const
Definition: HandleBase.h:74
double cpuTime() const
Definition: CPUTimer.cc:146
edm::EDGetTokenT< BasicJetCollection > JetAlgorithm
int badQualityDigis() const
MonitorElement * CastorEventProduct
size_type size() const
edm::EDGetTokenT< HcalUnpackerReport > inputTokenReport_
std::unique_ptr< CastorRecHitMonitor > RecHitMon_
edm::EDGetTokenT< CastorRecHitCollection > inputTokenRecHitCASTOR_
int busySpigots() const
void CastorMonitorModule::bookHistograms ( DQMStore::IBooker ,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotected

Definition at line 61 of file CastorMonitorModule.cc.

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

63  {
64  if (DigiMon_) {
65  DigiMon_->bookHistograms(ibooker, iRun, iSetup);
66  }
67  if (RecHitMon_) {
68  RecHitMon_->bookHistograms(ibooker, iRun, iSetup);
69  }
70  if (LedMon_) {
71  LedMon_->bookHistograms(ibooker, iRun, iSetup);
72  }
73 
74  ibooker.setCurrentFolder(subsystemname_);
75  char s[60];
76  sprintf(s, "CastorEventProducts");
77  CastorEventProduct = ibooker.book1DD(s, s, 6, -0.5, 5.5);
78  CastorEventProduct->getTH1D()->GetYaxis()->SetTitle("Events");
79  TAxis *xa = CastorEventProduct->getTH1D()->GetXaxis();
80  xa->SetBinLabel(1, "FEDs/3");
81  xa->SetBinLabel(2, "RawData");
82  xa->SetBinLabel(3, "Digi");
83  xa->SetBinLabel(4, "RecHits");
84  xa->SetBinLabel(5, "Towers");
85  xa->SetBinLabel(6, "Jets");
86 
87  sprintf(s, "CASTORUnpackReport");
88  hunpkrep = ibooker.bookProfile(s, s, 6, -0.5, 5.5, 100, 0, 1.e10, "");
89  xa = hunpkrep->getTProfile()->GetXaxis();
90  xa->SetBinLabel(1, "N_FEDs");
91  xa->SetBinLabel(2, "SPIGOT_Err");
92  xa->SetBinLabel(3, "empty");
93  xa->SetBinLabel(4, "busy");
94  xa->SetBinLabel(5, "OvF");
95  xa->SetBinLabel(6, "BadDigis");
96  return;
97 }
TProfile * getTProfile() const
std::unique_ptr< CastorLEDMonitor > LedMon_
MonitorElement * hunpkrep
std::unique_ptr< CastorDigiMonitor > DigiMon_
MonitorElement * CastorEventProduct
TH1D * getTH1D() const
std::unique_ptr< CastorRecHitMonitor > RecHitMon_
void CastorMonitorModule::dqmBeginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprotected

Definition at line 56 of file CastorMonitorModule.cc.

56  {
57  if (fVerbosity > 0)
58  LogPrint("CastorMonitorModule") << "dqmBeginRun(start)";
59 }
void CastorMonitorModule::endRun ( const edm::Run run,
const edm::EventSetup eventSetup 
)
overrideprotected

Definition at line 99 of file CastorMonitorModule.cc.

99  {
100  if (DigiMon_) {
101  DigiMon_->endRun();
102  }
103 }
std::unique_ptr< CastorDigiMonitor > DigiMon_

Member Data Documentation

MonitorElement* CastorMonitorModule::CastorEventProduct
private

Definition at line 113 of file CastorMonitorModule.h.

edm::CPUTimer CastorMonitorModule::cpu_timer
private

Definition at line 117 of file CastorMonitorModule.h.

std::unique_ptr<CastorDigiMonitor> CastorMonitorModule::DigiMon_
private

Definition at line 108 of file CastorMonitorModule.h.

int CastorMonitorModule::fVerbosity
private

Definition at line 87 of file CastorMonitorModule.h.

MonitorElement* CastorMonitorModule::hunpkrep
private

Definition at line 114 of file CastorMonitorModule.h.

int CastorMonitorModule::ievt_
private

Definition at line 90 of file CastorMonitorModule.h.

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

Definition at line 101 of file CastorMonitorModule.h.

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

Definition at line 98 of file CastorMonitorModule.h.

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

Definition at line 96 of file CastorMonitorModule.h.

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

Definition at line 99 of file CastorMonitorModule.h.

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

Definition at line 97 of file CastorMonitorModule.h.

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

Definition at line 103 of file CastorMonitorModule.h.

std::unique_ptr<CastorLEDMonitor> CastorMonitorModule::LedMon_
private

Definition at line 109 of file CastorMonitorModule.h.

std::unique_ptr<CastorRecHitMonitor> CastorMonitorModule::RecHitMon_
private

Definition at line 107 of file CastorMonitorModule.h.

bool CastorMonitorModule::showTiming_
private

Definition at line 116 of file CastorMonitorModule.h.

std::string CastorMonitorModule::subsystemname_
private

Definition at line 88 of file CastorMonitorModule.h.

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

Definition at line 95 of file CastorMonitorModule.h.