36 for (
int i=0;
i<2; ++
i)
37 for (
int j=0;
j<2; ++
j) {
38 hESRecHitTrend_[
i][
j] = 0;
39 hESRecHitTrendHr_[
i][
j] = 0;
42 hESSLinkErrTrend_ = 0;
43 hESFiberErrTrend_ = 0;
44 hESSLinkErrTrendHr_ = 0;
45 hESFiberErrTrendHr_ = 0;
61 dqmStore_->setCurrentFolder(prefixME_ +
"/ESTrendTask");
62 dqmStore_->rmdir(prefixME_ +
"/ESTrendTask");
69 if ( ! mergeRuns_ ) this->
reset();
83 for (
int i=0 ;
i<2; ++
i)
84 for (
int j=0 ;
j<2; ++
j) {
85 if (hESRecHitTrend_[
i][
j]) hESRecHitTrend_[
i][
j]->Reset();
86 if (hESRecHitTrendHr_[
i][j]) hESRecHitTrendHr_[
i][
j]->Reset();
89 if (hESSLinkErrTrend_) hESSLinkErrTrend_->Reset();
90 if (hESFiberErrTrend_) hESFiberErrTrend_->Reset();
91 if (hESSLinkErrTrendHr_) hESSLinkErrTrendHr_->Reset();
92 if (hESFiberErrTrendHr_) hESFiberErrTrendHr_->Reset();
103 dqmStore_->setCurrentFolder(prefixME_ +
"/ESTrendTask");
105 for (
int i=0 ;
i<2; ++
i)
106 for (
int j=0 ;
j<2; ++
j) {
107 int iz = (
i==0)? 1:-1;
108 sprintf(histo,
"ES Trending RH Occ per 5 mins Z %d P %d", iz,
j+1);
109 hESRecHitTrend_[
i][
j] = dqmStore_->bookProfile(histo, histo, 36, 0.0, 180.0, 100, 0.0, 1.0e6,
"s");
110 hESRecHitTrend_[
i][
j]->setAxisTitle(
"Elapse time (Minutes)", 1);
111 hESRecHitTrend_[
i][
j]->setAxisTitle(
"ES RecHit Occupancy / 5 minutes", 2);
113 sprintf(histo,
"ES Trending RH Occ per hour Z %d P %d", iz,
j+1);
114 hESRecHitTrendHr_[
i][
j] = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6,
"s");
115 hESRecHitTrendHr_[
i][
j]->setAxisTitle(
"Elapse time (Hours)", 1);
116 hESRecHitTrendHr_[
i][
j]->setAxisTitle(
"ES RecHit Occupancy / hour", 2);
119 sprintf(histo,
"ES Trending SLink CRC Error per 5 mins");
120 hESSLinkErrTrend_ = dqmStore_->bookProfile(histo, histo, 36, 0.0, 180.0, 100, 0.0, 1.0e6,
"s");
121 hESSLinkErrTrend_->setAxisTitle(
"Elapse time (Minutes)", 1);
122 hESSLinkErrTrend_->setAxisTitle(
"ES SLink CRC Err / 5 minutes", 2);
124 sprintf(histo,
"ES Trending Fiber Error per 5 mins");
125 hESFiberErrTrend_ = dqmStore_->bookProfile(histo, histo, 36, 0.0, 180.0, 100, 0.0, 1.0e6,
"s");
126 hESFiberErrTrend_->setAxisTitle(
"Elapse time (Minutes)", 1);
127 hESFiberErrTrend_->setAxisTitle(
"ES Fiber Err / 5 minutes", 2);
129 sprintf(histo,
"ES Trending SLink CRC Error per hour");
130 hESSLinkErrTrendHr_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6,
"s");
131 hESSLinkErrTrendHr_->setAxisTitle(
"Elapse time (Hours)", 1);
132 hESSLinkErrTrendHr_->setAxisTitle(
"ES SLink CRC Err / hour", 2);
134 sprintf(histo,
"ES Trending Fiber Error per hour");
135 hESFiberErrTrendHr_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6,
"s");
136 hESFiberErrTrendHr_->setAxisTitle(
"Elapse time (Hours)", 1);
137 hESFiberErrTrendHr_->setAxisTitle(
"ES Fiber Err / hour", 2);
144 if ( ! init_ )
return;
147 dqmStore_->setCurrentFolder(prefixME_ +
"/ESTrendTask");
149 for (
int i=0 ;
i<2; ++
i)
150 for (
int j=0 ;
j<2; ++
j) {
151 if (hESRecHitTrend_[
i][
j]) dqmStore_->removeElement(hESRecHitTrend_[
i][j]->
getName());
152 hESRecHitTrend_[
i][
j] = 0;
153 if (hESRecHitTrendHr_[
i][j]) dqmStore_->removeElement(hESRecHitTrendHr_[
i][j]->
getName());
154 hESRecHitTrendHr_[
i][
j] = 0;
157 if (hESSLinkErrTrend_) dqmStore_->removeElement(hESSLinkErrTrend_->getName());
158 hESSLinkErrTrend_ = 0;
159 if (hESFiberErrTrend_) dqmStore_->removeElement(hESFiberErrTrend_->getName());
160 hESFiberErrTrend_ = 0;
161 if (hESSLinkErrTrendHr_) dqmStore_->removeElement(hESSLinkErrTrendHr_->getName());
162 hESSLinkErrTrendHr_ = 0;
163 if (hESFiberErrTrendHr_) dqmStore_->removeElement(hESFiberErrTrendHr_->getName());
164 hESFiberErrTrendHr_ = 0;
173 LogInfo(
"ESTrendTask") <<
"analyzed " << ievt_ <<
" events";
175 if ( enableCleanup_ ) this->
cleanup();
181 if ( ! init_ ) this->
setup();
188 long int diff_current_start = current_time_ - start_time_;
189 long int diff_last_start = last_time_ - start_time_;
198 int minuteBinWidth = 5;
199 long int minuteBinDiff = diff_current_start/60/minuteBinWidth - diff_last_start/60/minuteBinWidth;
200 long int minuteDiff = (current_time_ - last_time_)/60;
203 int hourBinWidth = 1;
204 long int hourBinDiff = diff_current_start/3600/hourBinWidth - diff_last_start/3600/hourBinWidth;
205 long int hourDiff = (current_time_ - last_time_)/3600;
207 if (minuteDiff >= minuteBinWidth) {
208 while (minuteDiff >= minuteBinWidth) minuteDiff -= minuteBinWidth;
210 if (hourDiff >= hourBinWidth) {
211 while (hourDiff >= hourBinWidth) hourDiff -= hourBinWidth;
215 Int_t slinkCRCErr = 0;
217 vector<int> fiberStatus;
226 for (
unsigned int i=0;
i<fiberStatus.size(); ++
i) {
227 if (fiberStatus[
i]==4 || fiberStatus[
i]==8 || fiberStatus[
i]==10 || fiberStatus[
i]==11 || fiberStatus[
i]==12)
234 shift2Right(hESSLinkErrTrend_->getTProfile(), minuteBinDiff);
235 hESSLinkErrTrend_->Fill(minuteDiff, slinkCRCErr);
237 shift2Right(hESFiberErrTrend_->getTProfile(), minuteBinDiff);
238 hESFiberErrTrend_->Fill(minuteDiff, fiberErr);
240 shift2Right(hESSLinkErrTrendHr_->getTProfile(), hourBinDiff);
241 hESSLinkErrTrendHr_->Fill(hourDiff, slinkCRCErr);
243 shift2Right(hESFiberErrTrendHr_->getTProfile(), hourBinDiff);
244 hESFiberErrTrendHr_->Fill(hourDiff, fiberErr);
247 int zside, plane, ix, iy,
strip;
249 for (
int i = 0;
i < 2;
i++ )
250 for(
int j = 0;
j < 2;
j++) {
267 int i = (zside==1)? 0:1;
273 LogWarning(
"ESTrendTask") << rechitlabel_ <<
" not available";
276 for (
int i=0;
i<2; ++
i)
277 for (
int j=0;
j<2; ++
j) {
279 hESRecHitTrend_[
i][
j]->Fill(minuteDiff, nrh[
i][
j]/(1072*32.));
282 hESRecHitTrendHr_[
i][
j]->Fill(hourDiff, nrh[
i][
j]/(1072*32.));
289 last_time_ = current_time_;
296 if(bins <= 0)
return;
298 if(!p->GetSumw2()) p->Sumw2();
299 int nBins = p->GetXaxis()->GetNbins();
303 double nentries = p->GetEntries();
304 for(
int i=0;
i<bins;
i++) nentries -= p->GetBinEntries(nBins+1-bins);
305 p->SetEntries(nentries);
310 TArrayD* sumw2 = p->GetSumw2();
312 for(
int i=nBins+1;
i>bins;
i--) {
314 p->SetBinContent(
i, p->GetBinContent(
i-bins)*p->GetBinEntries(
i-bins));
315 p->SetBinEntries(
i,p->GetBinEntries(
i-bins));
316 sumw2->SetAt(sumw2->GetAt(
i-bins),
i);
323 if(bins <= 0)
return;
325 if(!p->GetSumw2()) p->Sumw2();
326 int nBins = p->GetXaxis()->GetNbins();
330 double nentries = p->GetEntries();
331 for(
int i=0;
i<bins;
i++) nentries -= p->GetBinEntries(
i);
332 p->SetEntries(nentries);
337 TArrayD* sumw2 = p->GetSumw2();
339 for(
int i=0;
i<=nBins+1-bins;
i++) {
341 p->SetBinContent(
i, p->GetBinContent(
i+bins)*p->GetBinEntries(
i+bins));
342 p->SetBinEntries(
i,p->GetBinEntries(
i+bins));
343 sumw2->SetAt(sumw2->GetAt(
i+bins),
i);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
TProfile * getTProfile(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
#define DEFINE_FWK_MODULE(type)
std::vector< T >::const_iterator const_iterator
static void cleanup(const Factory::MakerMap::value_type &v)
void shift2Right(TProfile *p, int bins=1)
void shift2Left(TProfile *p, int bins=1)
void beginRun(const edm::Run &r, const edm::EventSetup &c)
void analyze(const edm::Event &e, const edm::EventSetup &c)
std::string getName(Reflex::Type &cc)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void endRun(const edm::Run &r, const edm::EventSetup &c)
ESTrendTask(const edm::ParameterSet &ps)
void shift2Right(TH1 *h, int bins)
void reset(double vett[256])
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")