27 for (
int i = 0;
i < 2; ++
i)
28 for (
int j = 0;
j < 2; ++
j) {
29 hESRecHitTrend_[
i][
j] =
nullptr;
30 hESRecHitTrendHr_[
i][
j] =
nullptr;
33 hESSLinkErrTrend_ =
nullptr;
34 hESFiberErrTrend_ =
nullptr;
35 hESSLinkErrTrendHr_ =
nullptr;
36 hESFiberErrTrendHr_ =
nullptr;
46 start_time_ = (
r.beginTime()).unixTime();
56 for (
int i = 0;
i < 2; ++
i)
57 for (
int j = 0;
j < 2; ++
j) {
58 int iz = (
i == 0) ? 1 : -1;
59 sprintf(
histo,
"ES Trending RH Occ per 5 mins Z %d P %d", iz,
j + 1);
62 hESRecHitTrend_[
i][
j]->setAxisTitle(
"ES RecHit Occupancy / 5 minutes", 2);
64 sprintf(
histo,
"ES Trending RH Occ per hour Z %d P %d", iz,
j + 1);
67 hESRecHitTrendHr_[
i][
j]->setAxisTitle(
"ES RecHit Occupancy / hour", 2);
70 sprintf(
histo,
"ES Trending SLink CRC Error per 5 mins");
72 hESSLinkErrTrend_->
setAxisTitle(
"Elapse time (Minutes)", 1);
73 hESSLinkErrTrend_->setAxisTitle(
"ES SLink CRC Err / 5 minutes", 2);
75 sprintf(
histo,
"ES Trending Fiber Error per 5 mins");
77 hESFiberErrTrend_->
setAxisTitle(
"Elapse time (Minutes)", 1);
78 hESFiberErrTrend_->setAxisTitle(
"ES Fiber Err / 5 minutes", 2);
80 sprintf(
histo,
"ES Trending SLink CRC Error per hour");
82 hESSLinkErrTrendHr_->
setAxisTitle(
"Elapse time (Hours)", 1);
83 hESSLinkErrTrendHr_->setAxisTitle(
"ES SLink CRC Err / hour", 2);
85 sprintf(
histo,
"ES Trending Fiber Error per hour");
87 hESFiberErrTrendHr_->
setAxisTitle(
"Elapse time (Hours)", 1);
88 hESFiberErrTrendHr_->setAxisTitle(
"ES Fiber Err / hour", 2);
97 long int diff_current_start = current_time_ - start_time_;
98 long int diff_last_start = last_time_ - start_time_;
107 int minuteBinWidth = 5;
108 long int minuteBinDiff = diff_current_start / 60 / minuteBinWidth - diff_last_start / 60 / minuteBinWidth;
109 long int minuteDiff = (current_time_ - last_time_) / 60;
112 int hourBinWidth = 1;
113 long int hourBinDiff = diff_current_start / 3600 / hourBinWidth - diff_last_start / 3600 / hourBinWidth;
114 long int hourDiff = (current_time_ - last_time_) / 3600;
116 if (minuteDiff >= minuteBinWidth) {
117 while (minuteDiff >= minuteBinWidth)
118 minuteDiff -= minuteBinWidth;
120 if (hourDiff >= hourBinWidth) {
121 while (hourDiff >= hourBinWidth)
122 hourDiff -= hourBinWidth;
126 Int_t slinkCRCErr = 0;
128 vector<int> fiberStatus;
130 if (
e.getByToken(dccCollections_, dccs)) {
138 for (
unsigned int i = 0;
i < fiberStatus.size(); ++
i) {
139 if (fiberStatus[
i] == 4 || fiberStatus[
i] == 8 || fiberStatus[
i] == 10 || fiberStatus[
i] == 11 ||
140 fiberStatus[
i] == 12)
146 shift2Right(hESSLinkErrTrend_->getTProfile(), minuteBinDiff);
147 hESSLinkErrTrend_->Fill(minuteDiff, slinkCRCErr);
149 shift2Right(hESFiberErrTrend_->getTProfile(), minuteBinDiff);
150 hESFiberErrTrend_->Fill(minuteDiff, fiberErr);
152 shift2Right(hESSLinkErrTrendHr_->getTProfile(), hourBinDiff);
153 hESSLinkErrTrendHr_->Fill(hourDiff, slinkCRCErr);
155 shift2Right(hESFiberErrTrendHr_->getTProfile(), hourBinDiff);
156 hESFiberErrTrendHr_->Fill(hourDiff, fiberErr);
161 for (
int i = 0;
i < 2;
i++)
162 for (
int j = 0;
j < 2;
j++) {
167 if (
e.getByToken(rechittoken_, ESRecHit)) {
174 int i = (
zside == 1) ? 0 : 1;
180 LogWarning(
"ESTrendTask") <<
"RecHitCollection not available";
183 for (
int i = 0;
i < 2; ++
i)
184 for (
int j = 0;
j < 2; ++
j) {
185 shift2Right(hESRecHitTrend_[
i][
j]->getTProfile(), minuteBinDiff);
186 hESRecHitTrend_[
i][
j]->Fill(minuteDiff, nrh[
i][
j] / (1072 * 32.));
188 shift2Right(hESRecHitTrendHr_[
i][
j]->getTProfile(), hourBinDiff);
189 hESRecHitTrendHr_[
i][
j]->Fill(hourDiff, nrh[
i][
j] / (1072 * 32.));
194 last_time_ = current_time_;
195 current_time_ =
e.time().unixTime();
204 int nBins =
p->GetXaxis()->GetNbins();
208 double nentries =
p->GetEntries();
210 nentries -=
p->GetBinEntries(
nBins + 1 -
bins);
211 p->SetEntries(nentries);
216 TArrayD* sumw2 =
p->GetSumw2();
220 p->SetBinContent(
i,
p->GetBinContent(
i -
bins) *
p->GetBinEntries(
i -
bins));
221 p->SetBinEntries(
i,
p->GetBinEntries(
i -
bins));
222 sumw2->SetAt(sumw2->GetAt(
i -
bins),
i);
232 int nBins =
p->GetXaxis()->GetNbins();
236 double nentries =
p->GetEntries();
238 nentries -=
p->GetBinEntries(
i);
239 p->SetEntries(nentries);
244 TArrayD* sumw2 =
p->GetSumw2();
248 p->SetBinContent(
i,
p->GetBinContent(
i +
bins) *
p->GetBinEntries(
i +
bins));
249 p->SetBinEntries(
i,
p->GetBinEntries(
i +
bins));
250 sumw2->SetAt(sumw2->GetAt(
i +
bins),
i);
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
T getParameter(std::string const &) const
virtual void setCurrentFolder(std::string const &fullpath)
#define DEFINE_FWK_MODULE(type)
std::vector< T >::const_iterator const_iterator
void shift2Right(TProfile *p, int bins=1)
T getUntrackedParameter(std::string const &, T const &) const
void shift2Left(TProfile *p, int bins=1)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
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())
const_iterator begin() const
Namespace of DDCMS conversion namespace.
const_iterator end() const
ESTrendTask(const edm::ParameterSet &ps)
Log< level::Warning, false > LogWarning
void analyze(const edm::Event &e, const edm::EventSetup &c) override
void updateTime(const edm::Event &)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)