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;
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);
60 hESRecHitTrend_[
i][
j] = iBooker.
bookProfile(histo, histo, 36, 0.0, 180.0, 100, 0.0, 1.0e6,
"s");
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);
65 hESRecHitTrendHr_[
i][
j] = iBooker.
bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6,
"s");
67 hESRecHitTrendHr_[
i][
j]->setAxisTitle(
"ES RecHit Occupancy / hour", 2);
70 sprintf(histo,
"ES Trending SLink CRC Error per 5 mins");
71 hESSLinkErrTrend_ = iBooker.
bookProfile(histo, histo, 36, 0.0, 180.0, 100, 0.0, 1.0e6,
"s");
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");
76 hESFiberErrTrend_ = iBooker.
bookProfile(histo, histo, 36, 0.0, 180.0, 100, 0.0, 1.0e6,
"s");
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");
81 hESSLinkErrTrendHr_ = iBooker.
bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6,
"s");
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");
86 hESFiberErrTrendHr_ = iBooker.
bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6,
"s");
87 hESFiberErrTrendHr_->
setAxisTitle(
"Elapse time (Hours)", 1);
88 hESFiberErrTrendHr_->setAxisTitle(
"ES Fiber Err / hour", 2);
99 long int diff_current_start = current_time_ - start_time_;
100 long int diff_last_start = last_time_ - start_time_;
109 int minuteBinWidth = 5;
110 long int minuteBinDiff = diff_current_start / 60 / minuteBinWidth - diff_last_start / 60 / minuteBinWidth;
111 long int minuteDiff = (current_time_ - last_time_) / 60;
114 int hourBinWidth = 1;
115 long int hourBinDiff = diff_current_start / 3600 / hourBinWidth - diff_last_start / 3600 / hourBinWidth;
116 long int hourDiff = (current_time_ - last_time_) / 3600;
118 if (minuteDiff >= minuteBinWidth) {
119 while (minuteDiff >= minuteBinWidth)
120 minuteDiff -= minuteBinWidth;
122 if (hourDiff >= hourBinWidth) {
123 while (hourDiff >= hourBinWidth)
124 hourDiff -= hourBinWidth;
128 Int_t slinkCRCErr = 0;
130 vector<int> fiberStatus;
140 for (
unsigned int i = 0;
i < fiberStatus.size(); ++
i) {
141 if (fiberStatus[
i] == 4 || fiberStatus[
i] == 8 || fiberStatus[
i] == 10 || fiberStatus[
i] == 11 ||
142 fiberStatus[
i] == 12)
148 shift2Right(hESSLinkErrTrend_->getTProfile(), minuteBinDiff);
149 hESSLinkErrTrend_->Fill(minuteDiff, slinkCRCErr);
151 shift2Right(hESFiberErrTrend_->getTProfile(), minuteBinDiff);
152 hESFiberErrTrend_->Fill(minuteDiff, fiberErr);
154 shift2Right(hESSLinkErrTrendHr_->getTProfile(), hourBinDiff);
155 hESSLinkErrTrendHr_->Fill(hourDiff, slinkCRCErr);
157 shift2Right(hESFiberErrTrendHr_->getTProfile(), hourBinDiff);
158 hESFiberErrTrendHr_->Fill(hourDiff, fiberErr);
163 for (
int i = 0;
i < 2;
i++)
164 for (
int j = 0;
j < 2;
j++) {
176 int i = (zside == 1) ? 0 : 1;
182 LogWarning(
"ESTrendTask") <<
"RecHitCollection not available";
185 for (
int i = 0;
i < 2; ++
i)
186 for (
int j = 0;
j < 2; ++
j) {
187 shift2Right(hESRecHitTrend_[
i][
j]->getTProfile(), minuteBinDiff);
188 hESRecHitTrend_[
i][
j]->Fill(minuteDiff, nrh[
i][
j] / (1072 * 32.));
190 shift2Right(hESRecHitTrendHr_[
i][
j]->getTProfile(), hourBinDiff);
191 hESRecHitTrendHr_[
i][
j]->Fill(hourDiff, nrh[
i][
j] / (1072 * 32.));
196 last_time_ = current_time_;
206 int nBins = p->GetXaxis()->GetNbins();
210 double nentries = p->GetEntries();
212 nentries -= p->GetBinEntries(nBins + 1 - bins);
213 p->SetEntries(nentries);
218 TArrayD* sumw2 = p->GetSumw2();
220 for (
int i = nBins + 1;
i >
bins;
i--) {
222 p->SetBinContent(
i, p->GetBinContent(
i - bins) * p->GetBinEntries(
i - bins));
223 p->SetBinEntries(
i, p->GetBinEntries(
i - bins));
224 sumw2->SetAt(sumw2->GetAt(
i - bins),
i);
234 int nBins = p->GetXaxis()->GetNbins();
238 double nentries = p->GetEntries();
240 nentries -= p->GetBinEntries(
i);
241 p->SetEntries(nentries);
246 TArrayD* sumw2 = p->GetSumw2();
248 for (
int i = 0;
i <= nBins + 1 -
bins;
i++) {
250 p->SetBinContent(
i, p->GetBinContent(
i + bins) * p->GetBinEntries(
i + bins));
251 p->SetBinEntries(
i, p->GetBinEntries(
i + bins));
252 sumw2->SetAt(sumw2->GetAt(
i + bins),
i);
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setCurrentFolder(std::string const &fullpath)
std::vector< T >::const_iterator const_iterator
void shift2Right(TProfile *p, int bins=1)
void shift2Left(TProfile *p, int bins=1)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
#define DEFINE_FWK_MODULE(type)
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
unsigned int unixTime() const
Time in seconds since January 1, 1970.
Namespace of DDCMS conversion namespace.
const_iterator end() const
ESTrendTask(const edm::ParameterSet &ps)
Timestamp const & beginTime() const
void analyze(const edm::Event &e, const edm::EventSetup &c) override
void updateTime(const edm::Event &)
edm::Timestamp time() const
const_iterator begin() const
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void endJob(void) override