CMS 3D CMS Logo

CastorMonitorModule.cc
Go to the documentation of this file.
7 //#include "CondFormats/CastorObjects/interface/CastorChannelQuality.h"
8 #include <string>
9 
10 //**************************************************************//
11 //***************** CastorMonitorModule ******************//
12 //***************** Author: Dmytro Volyanskyy ******************//
13 //***************** Date : 22.11.2008 (first version) *********//
19 //**************************************************************//
20 
21 //---- critical revision 26.06.2014 (Vladimir Popov)
22 
23 //**************************************************************//
24 
25 using namespace std;
26 using namespace edm;
27 
29  : castorDbServiceToken_{esConsumes<CastorDbService, CastorDbRecord>()} {
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, consumesCollector());
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 }
53 
55 
57  if (fVerbosity > 0)
58  LogPrint("CastorMonitorModule") << "dqmBeginRun(start)";
59 }
60 
62  const edm::Run &iRun,
63  const edm::EventSetup &iSetup) {
64  if (DigiMon_) {
65  // Run histos only since there is endRun processing.
66  auto scope = DQMStore::IBooker::UseRunScope(ibooker);
67  DigiMon_->bookHistograms(ibooker, iRun, iSetup);
68  }
69  if (RecHitMon_) {
70  RecHitMon_->bookHistograms(ibooker, iRun);
71  }
72  if (LedMon_) {
73  LedMon_->bookHistograms(ibooker, iRun);
74  }
75 
77  char s[60];
78  sprintf(s, "CastorEventProducts");
79  CastorEventProduct = ibooker.book1DD(s, s, 6, -0.5, 5.5);
80  CastorEventProduct->setAxisTitle("Events", /* axis */ 2);
81  CastorEventProduct->setBinLabel(1, "FEDs/3");
82  CastorEventProduct->setBinLabel(2, "RawData");
83  CastorEventProduct->setBinLabel(3, "Digi");
84  CastorEventProduct->setBinLabel(4, "RecHits");
85  CastorEventProduct->setBinLabel(5, "Towers");
86  CastorEventProduct->setBinLabel(6, "Jets");
87 
88  sprintf(s, "CASTORUnpackReport");
89  hunpkrep = ibooker.bookProfile(s, s, 6, -0.5, 5.5, 100, 0, 1.e10, "");
90  hunpkrep->setBinLabel(1, "N_FEDs");
91  hunpkrep->setBinLabel(2, "SPIGOT_Err");
92  hunpkrep->setBinLabel(3, "empty");
93  hunpkrep->setBinLabel(4, "busy");
94  hunpkrep->setBinLabel(5, "OvF");
95  hunpkrep->setBinLabel(6, "BadDigis");
96  return;
97 }
98 
100  if (DigiMon_) {
101  DigiMon_->endRun();
102  }
103 }
104 
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 
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  DigiMon_->processEvent(iEvent, *CastorDigi, *TrigResults, conditions);
185  }
186  if (showTiming_) {
187  cpu_timer.stop();
188  if (DigiMon_ != nullptr)
189  std::cout << "TIMER:: DIGI MONITOR ->" << cpu_timer.cpuTime() << std::endl;
190  cpu_timer.reset();
191  cpu_timer.start();
192  }
193 
194  if (rechitOK_)
195  RecHitMon_->processEvent(*CastorHits);
196  if (showTiming_) {
197  cpu_timer.stop();
198  if (RecHitMon_ != nullptr)
199  std::cout << "TIMER:: RECHIT MONITOR->" << cpu_timer.cpuTime() << std::endl;
200  cpu_timer.reset();
201  cpu_timer.start();
202  }
203 
204  if (towerOK_)
205  RecHitMon_->processEventTowers(*castorTowers);
206  if (jetsOK_)
207  RecHitMon_->processEventJets(*jets);
208 
209  if (fVerbosity > 0 && ievt_ % 100 == 0)
210  LogPrint("CastorMonitorModule") << "processed " << ievt_ << " events";
211  return;
212 }
213 
FEDNumbering.h
l1tstage2emulator_dqm_sourceclient-live_cfg.feds
feds
Definition: l1tstage2emulator_dqm_sourceclient-live_cfg.py:153
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
CastorMonitorModule::~CastorMonitorModule
~CastorMonitorModule() override
Definition: CastorMonitorModule.cc:54
CastorMonitorModule::hunpkrep
MonitorElement * hunpkrep
Definition: CastorMonitorModule.h:111
CastorMonitorModule::LedMon_
std::unique_ptr< CastorLEDMonitor > LedMon_
Definition: CastorMonitorModule.h:106
edm::Run
Definition: Run.h:45
CastorMonitorModule::fVerbosity
int fVerbosity
Definition: CastorMonitorModule.h:82
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::LogPrint
Log< level::Warning, true > LogPrint
Definition: MessageLogger.h:130
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
CastorMonitorModule::ievt_
int ievt_
Definition: CastorMonitorModule.h:85
DQMStore.h
edm::SortedCollection::size
size_type size() const
Definition: SortedCollection.h:215
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
CastorMonitorModule::inputTokenRaw_
edm::EDGetTokenT< FEDRawDataCollection > inputTokenRaw_
Definition: CastorMonitorModule.h:91
edm::Handle< edm::TriggerResults >
CastorMonitorModule::inputTokenDigi_
edm::EDGetTokenT< CastorDigiCollection > inputTokenDigi_
Definition: CastorMonitorModule.h:93
MakerMacros.h
alignCSCRings.s
s
Definition: alignCSCRings.py:92
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
CastorMonitorModule::CastorMonitorModule
CastorMonitorModule(const edm::ParameterSet &ps)
Definition: CastorMonitorModule.cc:28
CastorMonitorModule::inputTokenRecHitCASTOR_
edm::EDGetTokenT< CastorRecHitCollection > inputTokenRecHitCASTOR_
Definition: CastorMonitorModule.h:94
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
dqm::implementation::IBooker::bookProfile
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
CastorMonitorModule::dqmBeginRun
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Definition: CastorMonitorModule.cc:56
edm::CPUTimer::start
void start()
Definition: CPUTimer.cc:68
CastorMonitorModule::CastorEventProduct
MonitorElement * CastorEventProduct
Definition: CastorMonitorModule.h:110
edm::CPUTimer::reset
void reset()
Definition: CPUTimer.cc:99
dqm::implementation::IBooker::book1DD
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:155
CastorMonitorModule::dqmEndRun
void dqmEndRun(const edm::Run &run, const edm::EventSetup &) override
Definition: CastorMonitorModule.cc:99
CastorMonitorModule::inputTokenReport_
edm::EDGetTokenT< HcalUnpackerReport > inputTokenReport_
Definition: CastorMonitorModule.h:92
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
CastorMonitorModule
Definition: CastorMonitorModule.h:68
dqm::impl::MonitorElement::setBinLabel
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:762
CastorMonitorModule::JetAlgorithm
edm::EDGetTokenT< BasicJetCollection > JetAlgorithm
Definition: CastorMonitorModule.h:98
CastorDbService
Definition: CastorDbService.h:25
CastorMonitorModule::analyze
void analyze(const edm::Event &iEvent, const edm::EventSetup &) override
Definition: CastorMonitorModule.cc:105
edm::CPUTimer::stop
Times stop()
Definition: CPUTimer.cc:87
edm::EventSetup
Definition: EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CastorMonitorModule::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, const edm::EventSetup &) override
Definition: CastorMonitorModule.cc:61
edmIntegrityCheck.report
report
Definition: edmIntegrityCheck.py:348
CastorMonitorModule::tokenTriggerResults
edm::EDGetTokenT< edm::TriggerResults > tokenTriggerResults
Definition: CastorMonitorModule.h:90
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
alignCSCRings.r
r
Definition: alignCSCRings.py:93
EgHLTOfflineSource_cfi.TrigResults
TrigResults
Definition: EgHLTOfflineSource_cfi.py:18
CastorMonitorModule::castorDbServiceToken_
edm::ESGetToken< CastorDbService, CastorDbRecord > castorDbServiceToken_
Definition: CastorMonitorModule.h:100
SummaryClient_cfi.RawData
RawData
Definition: SummaryClient_cfi.py:27
submitPVValidationJobs.conditions
list conditions
Definition: submitPVValidationJobs.py:674
std
Definition: JetResolutionObject.h:76
CastorMonitorModule::showTiming_
bool showTiming_
Definition: CastorMonitorModule.h:113
CastorMonitorModule::DigiMon_
std::unique_ptr< CastorDigiMonitor > DigiMon_
Definition: CastorMonitorModule.h:105
CastorMonitorModule::subsystemname_
std::string subsystemname_
Definition: CastorMonitorModule.h:83
edm::CPUTimer::cpuTime
double cpuTime() const
Definition: CPUTimer.cc:146
dqm::implementation::IBooker::UseRunScope
UseScope< MonitorElementData::Scope::RUN > UseRunScope
Definition: DQMStore.h:464
EventSetup.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
CastorMonitorModule::inputTokenCastorTowers_
edm::EDGetTokenT< CastorTowerCollection > inputTokenCastorTowers_
Definition: CastorMonitorModule.h:96
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
CastorMonitorModule::RecHitMon_
std::unique_ptr< CastorRecHitMonitor > RecHitMon_
Definition: CastorMonitorModule.h:104
CastorMonitorModule::cpu_timer
edm::CPUTimer cpu_timer
Definition: CastorMonitorModule.h:114
edm::Event
Definition: Event.h:73
ecaldqm::nTowers
Definition: EcalDQMCommonUtils.h:114
CastorMonitorModule.h
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:791
edm::InputTag
Definition: InputTag.h:15