29 for (
int i=0;
i<2; ++
i)
30 for (
int j=0; j<2; ++j) {
31 hESRecHitTrend_[
i][j] =
nullptr;
32 hESRecHitTrendHr_[
i][j] =
nullptr;
35 hESSLinkErrTrend_ =
nullptr;
36 hESFiberErrTrend_ =
nullptr;
37 hESSLinkErrTrendHr_ =
nullptr;
38 hESFiberErrTrendHr_ =
nullptr;
61 for (
int i=0 ;
i<2; ++
i)
62 for (
int j=0 ; j<2; ++j) {
63 int iz = (
i==0)? 1:-1;
64 sprintf(histo,
"ES Trending RH Occ per 5 mins Z %d P %d", iz, j+1);
65 hESRecHitTrend_[
i][j] = iBooker.
bookProfile(histo, histo, 36, 0.0, 180.0, 100, 0.0, 1.0e6,
"s");
66 hESRecHitTrend_[
i][j]->
setAxisTitle(
"Elapse time (Minutes)", 1);
67 hESRecHitTrend_[
i][j]->setAxisTitle(
"ES RecHit Occupancy / 5 minutes", 2);
69 sprintf(histo,
"ES Trending RH Occ per hour Z %d P %d", iz, j+1);
70 hESRecHitTrendHr_[
i][j] = iBooker.
bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6,
"s");
71 hESRecHitTrendHr_[
i][j]->
setAxisTitle(
"Elapse time (Hours)", 1);
72 hESRecHitTrendHr_[
i][j]->setAxisTitle(
"ES RecHit Occupancy / hour", 2);
75 sprintf(histo,
"ES Trending SLink CRC Error per 5 mins");
76 hESSLinkErrTrend_ = iBooker.
bookProfile(histo, histo, 36, 0.0, 180.0, 100, 0.0, 1.0e6,
"s");
77 hESSLinkErrTrend_->
setAxisTitle(
"Elapse time (Minutes)", 1);
78 hESSLinkErrTrend_->setAxisTitle(
"ES SLink CRC Err / 5 minutes", 2);
80 sprintf(histo,
"ES Trending Fiber Error per 5 mins");
81 hESFiberErrTrend_ = iBooker.
bookProfile(histo, histo, 36, 0.0, 180.0, 100, 0.0, 1.0e6,
"s");
82 hESFiberErrTrend_->
setAxisTitle(
"Elapse time (Minutes)", 1);
83 hESFiberErrTrend_->setAxisTitle(
"ES Fiber Err / 5 minutes", 2);
85 sprintf(histo,
"ES Trending SLink CRC Error per hour");
86 hESSLinkErrTrendHr_ = iBooker.
bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6,
"s");
87 hESSLinkErrTrendHr_->
setAxisTitle(
"Elapse time (Hours)", 1);
88 hESSLinkErrTrendHr_->setAxisTitle(
"ES SLink CRC Err / hour", 2);
90 sprintf(histo,
"ES Trending Fiber Error per hour");
91 hESFiberErrTrendHr_ = iBooker.
bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6,
"s");
92 hESFiberErrTrendHr_->
setAxisTitle(
"Elapse time (Hours)", 1);
93 hESFiberErrTrendHr_->setAxisTitle(
"ES Fiber Err / hour", 2);
98 LogInfo(
"ESTrendTask") <<
"analyzed " << ievt_ <<
" events";
109 long int diff_current_start = current_time_ - start_time_;
110 long int diff_last_start = last_time_ - start_time_;
119 int minuteBinWidth = 5;
120 long int minuteBinDiff = diff_current_start/60/minuteBinWidth - diff_last_start/60/minuteBinWidth;
121 long int minuteDiff = (current_time_ - last_time_)/60;
124 int hourBinWidth = 1;
125 long int hourBinDiff = diff_current_start/3600/hourBinWidth - diff_last_start/3600/hourBinWidth;
126 long int hourDiff = (current_time_ - last_time_)/3600;
128 if (minuteDiff >= minuteBinWidth) {
129 while (minuteDiff >= minuteBinWidth) minuteDiff -= minuteBinWidth;
131 if (hourDiff >= hourBinWidth) {
132 while (hourDiff >= hourBinWidth) hourDiff -= hourBinWidth;
136 Int_t slinkCRCErr = 0;
138 vector<int> fiberStatus;
147 for (
unsigned int i=0;
i<fiberStatus.size(); ++
i) {
148 if (fiberStatus[
i]==4 || fiberStatus[
i]==8 || fiberStatus[
i]==10 || fiberStatus[
i]==11 || fiberStatus[
i]==12)
155 shift2Right(hESSLinkErrTrend_->getTProfile(), minuteBinDiff);
156 hESSLinkErrTrend_->Fill(minuteDiff, slinkCRCErr);
158 shift2Right(hESFiberErrTrend_->getTProfile(), minuteBinDiff);
159 hESFiberErrTrend_->Fill(minuteDiff, fiberErr);
161 shift2Right(hESSLinkErrTrendHr_->getTProfile(), hourBinDiff);
162 hESSLinkErrTrendHr_->Fill(hourDiff, slinkCRCErr);
164 shift2Right(hESFiberErrTrendHr_->getTProfile(), hourBinDiff);
165 hESFiberErrTrendHr_->Fill(hourDiff, fiberErr);
170 for (
int i = 0;
i < 2;
i++ )
171 for(
int j = 0; j < 2; j++) {
185 int i = (zside==1)? 0:1;
191 LogWarning(
"ESTrendTask") <<
"RecHitCollection not available";
194 for (
int i=0;
i<2; ++
i)
195 for (
int j=0; j<2; ++j) {
196 shift2Right(hESRecHitTrend_[
i][j]->getTProfile(), minuteBinDiff);
197 hESRecHitTrend_[
i][j]->Fill(minuteDiff, nrh[
i][j]/(1072*32.));
199 shift2Right(hESRecHitTrendHr_[
i][j]->getTProfile(), hourBinDiff);
200 hESRecHitTrendHr_[
i][j]->Fill(hourDiff, nrh[
i][j]/(1072*32.));
207 last_time_ = current_time_;
214 if(bins <= 0)
return;
216 if(!p->GetSumw2()) p->Sumw2();
217 int nBins = p->GetXaxis()->GetNbins();
221 double nentries = p->GetEntries();
222 for(
int i=0;
i<
bins;
i++) nentries -= p->GetBinEntries(nBins+1-bins);
223 p->SetEntries(nentries);
228 TArrayD* sumw2 = p->GetSumw2();
230 for(
int i=nBins+1;
i>
bins;
i--) {
232 p->SetBinContent(
i, p->GetBinContent(
i-bins)*p->GetBinEntries(
i-bins));
233 p->SetBinEntries(
i,p->GetBinEntries(
i-bins));
234 sumw2->SetAt(sumw2->GetAt(
i-bins),
i);
241 if(bins <= 0)
return;
243 if(!p->GetSumw2()) p->Sumw2();
244 int nBins = p->GetXaxis()->GetNbins();
248 double nentries = p->GetEntries();
249 for(
int i=0;
i<
bins;
i++) nentries -= p->GetBinEntries(
i);
250 p->SetEntries(nentries);
255 TArrayD* sumw2 = p->GetSumw2();
257 for(
int i=0;
i<=nBins+1-
bins;
i++) {
259 p->SetBinContent(
i, p->GetBinContent(
i+bins)*p->GetBinEntries(
i+bins));
260 p->SetBinEntries(
i,p->GetBinEntries(
i+bins));
261 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
MonitorElement * bookProfile(Args &&...args)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< ESDCCHeaderBlock >::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
void setCurrentFolder(std::string const &fullpath)
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 setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void analyze(const edm::Event &e, const edm::EventSetup &c) override
void updateTime(const edm::Event &)
edm::Timestamp time() const
const_iterator begin() const