35 for (
int i=0;
i<2; ++
i)
36 for (
int j=0;
j<2; ++
j) {
37 hESRecHitTrend_[
i][
j] = 0;
38 hESRecHitTrendHr_[
i][
j] = 0;
41 hESSLinkErrTrend_ = 0;
42 hESFiberErrTrend_ = 0;
43 hESSLinkErrTrendHr_ = 0;
44 hESFiberErrTrendHr_ = 0;
60 dqmStore_->setCurrentFolder(prefixME_ +
"/ESTrendTask");
61 dqmStore_->rmdir(prefixME_ +
"/ESTrendTask");
68 if ( ! mergeRuns_ ) this->
reset();
82 for (
int i=0 ;
i<2; ++
i)
83 for (
int j=0 ;
j<2; ++
j) {
84 if (hESRecHitTrend_[
i][
j]) hESRecHitTrend_[
i][
j]->Reset();
85 if (hESRecHitTrendHr_[
i][j]) hESRecHitTrendHr_[
i][
j]->Reset();
88 if (hESSLinkErrTrend_) hESSLinkErrTrend_->Reset();
89 if (hESFiberErrTrend_) hESFiberErrTrend_->Reset();
90 if (hESSLinkErrTrendHr_) hESSLinkErrTrendHr_->Reset();
91 if (hESFiberErrTrendHr_) hESFiberErrTrendHr_->Reset();
102 dqmStore_->setCurrentFolder(prefixME_ +
"/ESTrendTask");
104 for (
int i=0 ;
i<2; ++
i)
105 for (
int j=0 ;
j<2; ++
j) {
106 int iz = (
i==0)? 1:-1;
107 sprintf(histo,
"ES Trending RH Occ per 5 mins Z %d P %d", iz,
j+1);
108 hESRecHitTrend_[
i][
j] = dqmStore_->bookProfile(histo, histo, 36, 0.0, 180.0, 100, 0.0, 1.0e6,
"s");
109 hESRecHitTrend_[
i][
j]->setAxisTitle(
"Elapse time (Minutes)", 1);
110 hESRecHitTrend_[
i][
j]->setAxisTitle(
"ES RecHit Occupancy / 5 minutes", 2);
112 sprintf(histo,
"ES Trending RH Occ per hour Z %d P %d", iz,
j+1);
113 hESRecHitTrendHr_[
i][
j] = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6,
"s");
114 hESRecHitTrendHr_[
i][
j]->setAxisTitle(
"Elapse time (Hours)", 1);
115 hESRecHitTrendHr_[
i][
j]->setAxisTitle(
"ES RecHit Occupancy / hour", 2);
118 sprintf(histo,
"ES Trending SLink CRC Error per 5 mins");
119 hESSLinkErrTrend_ = dqmStore_->bookProfile(histo, histo, 36, 0.0, 180.0, 100, 0.0, 1.0e6,
"s");
120 hESSLinkErrTrend_->setAxisTitle(
"Elapse time (Minutes)", 1);
121 hESSLinkErrTrend_->setAxisTitle(
"ES SLink CRC Err / 5 minutes", 2);
123 sprintf(histo,
"ES Trending Fiber Error per 5 mins");
124 hESFiberErrTrend_ = dqmStore_->bookProfile(histo, histo, 36, 0.0, 180.0, 100, 0.0, 1.0e6,
"s");
125 hESFiberErrTrend_->setAxisTitle(
"Elapse time (Minutes)", 1);
126 hESFiberErrTrend_->setAxisTitle(
"ES Fiber Err / 5 minutes", 2);
128 sprintf(histo,
"ES Trending SLink CRC Error per hour");
129 hESSLinkErrTrendHr_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6,
"s");
130 hESSLinkErrTrendHr_->setAxisTitle(
"Elapse time (Hours)", 1);
131 hESSLinkErrTrendHr_->setAxisTitle(
"ES SLink CRC Err / hour", 2);
133 sprintf(histo,
"ES Trending Fiber Error per hour");
134 hESFiberErrTrendHr_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6,
"s");
135 hESFiberErrTrendHr_->setAxisTitle(
"Elapse time (Hours)", 1);
136 hESFiberErrTrendHr_->setAxisTitle(
"ES Fiber Err / hour", 2);
143 if ( ! init_ )
return;
146 dqmStore_->setCurrentFolder(prefixME_ +
"/ESTrendTask");
148 for (
int i=0 ;
i<2; ++
i)
149 for (
int j=0 ;
j<2; ++
j) {
150 if (hESRecHitTrend_[
i][
j]) dqmStore_->removeElement(hESRecHitTrend_[
i][j]->getName());
151 hESRecHitTrend_[
i][
j] = 0;
152 if (hESRecHitTrendHr_[
i][j]) dqmStore_->removeElement(hESRecHitTrendHr_[
i][j]->getName());
153 hESRecHitTrendHr_[
i][
j] = 0;
156 if (hESSLinkErrTrend_) dqmStore_->removeElement(hESSLinkErrTrend_->getName());
157 hESSLinkErrTrend_ = 0;
158 if (hESFiberErrTrend_) dqmStore_->removeElement(hESFiberErrTrend_->getName());
159 hESFiberErrTrend_ = 0;
160 if (hESSLinkErrTrendHr_) dqmStore_->removeElement(hESSLinkErrTrendHr_->getName());
161 hESSLinkErrTrendHr_ = 0;
162 if (hESFiberErrTrendHr_) dqmStore_->removeElement(hESFiberErrTrendHr_->getName());
163 hESFiberErrTrendHr_ = 0;
172 LogInfo(
"ESTrendTask") <<
"analyzed " << ievt_ <<
" events";
174 if ( enableCleanup_ ) this->
cleanup();
180 if ( ! init_ ) this->
setup();
187 long int diff_current_start = current_time_ - start_time_;
188 long int diff_last_start = last_time_ - start_time_;
197 int minuteBinWidth = 5;
198 long int minuteBinDiff = diff_current_start/60/minuteBinWidth - diff_last_start/60/minuteBinWidth;
199 long int minuteDiff = (current_time_ - last_time_)/60;
202 int hourBinWidth = 1;
203 long int hourBinDiff = diff_current_start/3600/hourBinWidth - diff_last_start/3600/hourBinWidth;
204 long int hourDiff = (current_time_ - last_time_)/3600;
206 if (minuteDiff >= minuteBinWidth) {
207 while (minuteDiff >= minuteBinWidth) minuteDiff -= minuteBinWidth;
209 if (hourDiff >= hourBinWidth) {
210 while (hourDiff >= hourBinWidth) hourDiff -= hourBinWidth;
214 Int_t slinkCRCErr = 0;
216 vector<int> fiberStatus;
225 for (
unsigned int i=0;
i<fiberStatus.size(); ++
i) {
226 if (fiberStatus[
i]==4 || fiberStatus[
i]==8 || fiberStatus[
i]==10 || fiberStatus[
i]==11 || fiberStatus[
i]==12)
233 shift2Right(hESSLinkErrTrend_->getTProfile(), minuteBinDiff);
234 hESSLinkErrTrend_->Fill(minuteDiff, slinkCRCErr);
236 shift2Right(hESFiberErrTrend_->getTProfile(), minuteBinDiff);
237 hESFiberErrTrend_->Fill(minuteDiff, fiberErr);
239 shift2Right(hESSLinkErrTrendHr_->getTProfile(), hourBinDiff);
240 hESSLinkErrTrendHr_->Fill(hourDiff, slinkCRCErr);
242 shift2Right(hESFiberErrTrendHr_->getTProfile(), hourBinDiff);
243 hESFiberErrTrendHr_->Fill(hourDiff, fiberErr);
248 for (
int i = 0;
i < 2;
i++ )
249 for(
int j = 0;
j < 2;
j++) {
263 int i = (zside==1)? 0:1;
269 LogWarning(
"ESTrendTask") <<
"RecHitCollection not available";
272 for (
int i=0;
i<2; ++
i)
273 for (
int j=0;
j<2; ++
j) {
275 hESRecHitTrend_[
i][
j]->Fill(minuteDiff, nrh[
i][
j]/(1072*32.));
278 hESRecHitTrendHr_[
i][
j]->Fill(hourDiff, nrh[
i][
j]/(1072*32.));
285 last_time_ = current_time_;
292 if(bins <= 0)
return;
294 if(!p->GetSumw2()) p->Sumw2();
295 int nBins = p->GetXaxis()->GetNbins();
299 double nentries = p->GetEntries();
300 for(
int i=0;
i<bins;
i++) nentries -= p->GetBinEntries(nBins+1-bins);
301 p->SetEntries(nentries);
306 TArrayD* sumw2 = p->GetSumw2();
308 for(
int i=nBins+1;
i>bins;
i--) {
310 p->SetBinContent(
i, p->GetBinContent(
i-bins)*p->GetBinEntries(
i-bins));
311 p->SetBinEntries(
i,p->GetBinEntries(
i-bins));
312 sumw2->SetAt(sumw2->GetAt(
i-bins),
i);
319 if(bins <= 0)
return;
321 if(!p->GetSumw2()) p->Sumw2();
322 int nBins = p->GetXaxis()->GetNbins();
326 double nentries = p->GetEntries();
327 for(
int i=0;
i<bins;
i++) nentries -= p->GetBinEntries(
i);
328 p->SetEntries(nentries);
333 TArrayD* sumw2 = p->GetSumw2();
335 for(
int i=0;
i<=nBins+1-bins;
i++) {
337 p->SetBinContent(
i, p->GetBinContent(
i+bins)*p->GetBinEntries(
i+bins));
338 p->SetBinEntries(
i,p->GetBinEntries(
i+bins));
339 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)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< ESDCCHeaderBlock >::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)
unsigned int unixTime() const
Time in seconds since January 1, 1970.
DEFINE_FWK_MODULE(CaloMETProducer)
void endRun(const edm::Run &r, const edm::EventSetup &c)
ESTrendTask(const edm::ParameterSet &ps)
Timestamp const & beginTime() const
void shift2Right(TH1 *h, int bins)
void reset(double vett[256])
void updateTime(const edm::Event &)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
edm::Timestamp time() const