37 for (
int i=0;
i<2; ++
i)
38 for (
int j=0;
j<2; ++
j) {
39 hESRecHitTrend_[
i][
j] = 0;
40 hESRecHitTrendHr_[
i][
j] = 0;
43 hESSLinkErrTrend_ = 0;
44 hESFiberErrTrend_ = 0;
45 hESSLinkErrTrendHr_ = 0;
46 hESFiberErrTrendHr_ = 0;
62 dqmStore_->setCurrentFolder(prefixME_ +
"/ESTrendTask");
63 dqmStore_->rmdir(prefixME_ +
"/ESTrendTask");
70 if ( ! mergeRuns_ ) this->
reset();
84 for (
int i=0 ;
i<2; ++
i)
85 for (
int j=0 ;
j<2; ++
j) {
86 if (hESRecHitTrend_[
i][
j]) hESRecHitTrend_[
i][
j]->Reset();
87 if (hESRecHitTrendHr_[
i][j]) hESRecHitTrendHr_[
i][
j]->Reset();
90 if (hESSLinkErrTrend_) hESSLinkErrTrend_->Reset();
91 if (hESFiberErrTrend_) hESFiberErrTrend_->Reset();
92 if (hESSLinkErrTrendHr_) hESSLinkErrTrendHr_->Reset();
93 if (hESFiberErrTrendHr_) hESFiberErrTrendHr_->Reset();
104 dqmStore_->setCurrentFolder(prefixME_ +
"/ESTrendTask");
106 for (
int i=0 ;
i<2; ++
i)
107 for (
int j=0 ;
j<2; ++
j) {
108 int iz = (
i==0)? 1:-1;
109 sprintf(histo,
"ES Trending RH Occ per 5 mins Z %d P %d", iz,
j+1);
110 hESRecHitTrend_[
i][
j] = dqmStore_->bookProfile(histo, histo, 36, 0.0, 180.0, 100, 0.0, 1.0e6,
"s");
111 hESRecHitTrend_[
i][
j]->setAxisTitle(
"Elapse time (Minutes)", 1);
112 hESRecHitTrend_[
i][
j]->setAxisTitle(
"ES RecHit Occupancy / 5 minutes", 2);
114 sprintf(histo,
"ES Trending RH Occ per hour Z %d P %d", iz,
j+1);
115 hESRecHitTrendHr_[
i][
j] = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6,
"s");
116 hESRecHitTrendHr_[
i][
j]->setAxisTitle(
"Elapse time (Hours)", 1);
117 hESRecHitTrendHr_[
i][
j]->setAxisTitle(
"ES RecHit Occupancy / hour", 2);
120 sprintf(histo,
"ES Trending SLink CRC Error per 5 mins");
121 hESSLinkErrTrend_ = dqmStore_->bookProfile(histo, histo, 36, 0.0, 180.0, 100, 0.0, 1.0e6,
"s");
122 hESSLinkErrTrend_->setAxisTitle(
"Elapse time (Minutes)", 1);
123 hESSLinkErrTrend_->setAxisTitle(
"ES SLink CRC Err / 5 minutes", 2);
125 sprintf(histo,
"ES Trending Fiber Error per 5 mins");
126 hESFiberErrTrend_ = dqmStore_->bookProfile(histo, histo, 36, 0.0, 180.0, 100, 0.0, 1.0e6,
"s");
127 hESFiberErrTrend_->setAxisTitle(
"Elapse time (Minutes)", 1);
128 hESFiberErrTrend_->setAxisTitle(
"ES Fiber Err / 5 minutes", 2);
130 sprintf(histo,
"ES Trending SLink CRC Error per hour");
131 hESSLinkErrTrendHr_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6,
"s");
132 hESSLinkErrTrendHr_->setAxisTitle(
"Elapse time (Hours)", 1);
133 hESSLinkErrTrendHr_->setAxisTitle(
"ES SLink CRC Err / hour", 2);
135 sprintf(histo,
"ES Trending Fiber Error per hour");
136 hESFiberErrTrendHr_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6,
"s");
137 hESFiberErrTrendHr_->setAxisTitle(
"Elapse time (Hours)", 1);
138 hESFiberErrTrendHr_->setAxisTitle(
"ES Fiber Err / hour", 2);
145 if ( ! init_ )
return;
148 dqmStore_->setCurrentFolder(prefixME_ +
"/ESTrendTask");
150 for (
int i=0 ;
i<2; ++
i)
151 for (
int j=0 ;
j<2; ++
j) {
152 if (hESRecHitTrend_[
i][
j]) dqmStore_->removeElement(hESRecHitTrend_[
i][j]->
getName());
153 hESRecHitTrend_[
i][
j] = 0;
154 if (hESRecHitTrendHr_[
i][j]) dqmStore_->removeElement(hESRecHitTrendHr_[
i][j]->
getName());
155 hESRecHitTrendHr_[
i][
j] = 0;
158 if (hESSLinkErrTrend_) dqmStore_->removeElement(hESSLinkErrTrend_->getName());
159 hESSLinkErrTrend_ = 0;
160 if (hESFiberErrTrend_) dqmStore_->removeElement(hESFiberErrTrend_->getName());
161 hESFiberErrTrend_ = 0;
162 if (hESSLinkErrTrendHr_) dqmStore_->removeElement(hESSLinkErrTrendHr_->getName());
163 hESSLinkErrTrendHr_ = 0;
164 if (hESFiberErrTrendHr_) dqmStore_->removeElement(hESFiberErrTrendHr_->getName());
165 hESFiberErrTrendHr_ = 0;
174 LogInfo(
"ESTrendTask") <<
"analyzed " << ievt_ <<
" events";
176 if ( enableCleanup_ ) this->
cleanup();
182 if ( ! init_ ) this->
setup();
189 long int diff_current_start = current_time_ - start_time_;
190 long int diff_last_start = last_time_ - start_time_;
199 int minuteBinWidth = 5;
200 long int minuteBinDiff = diff_current_start/60/minuteBinWidth - diff_last_start/60/minuteBinWidth;
201 long int minuteDiff = (current_time_ - last_time_)/60;
204 int hourBinWidth = 1;
205 long int hourBinDiff = diff_current_start/3600/hourBinWidth - diff_last_start/3600/hourBinWidth;
206 long int hourDiff = (current_time_ - last_time_)/3600;
208 if (minuteDiff >= minuteBinWidth) {
209 while (minuteDiff >= minuteBinWidth) minuteDiff -= minuteBinWidth;
211 if (hourDiff >= hourBinWidth) {
212 while (hourDiff >= hourBinWidth) hourDiff -= hourBinWidth;
216 Int_t slinkCRCErr = 0;
218 vector<int> fiberStatus;
227 for (
unsigned int i=0;
i<fiberStatus.size(); ++
i) {
228 if (fiberStatus[
i]==4 || fiberStatus[
i]==8 || fiberStatus[
i]==10 || fiberStatus[
i]==11 || fiberStatus[
i]==12)
235 shift2Right(hESSLinkErrTrend_->getTProfile(), minuteBinDiff);
236 hESSLinkErrTrend_->Fill(minuteDiff, slinkCRCErr);
238 shift2Right(hESFiberErrTrend_->getTProfile(), minuteBinDiff);
239 hESFiberErrTrend_->Fill(minuteDiff, fiberErr);
241 shift2Right(hESSLinkErrTrendHr_->getTProfile(), hourBinDiff);
242 hESSLinkErrTrendHr_->Fill(hourDiff, slinkCRCErr);
244 shift2Right(hESFiberErrTrendHr_->getTProfile(), hourBinDiff);
245 hESFiberErrTrendHr_->Fill(hourDiff, fiberErr);
250 for (
int i = 0;
i < 2;
i++ )
251 for(
int j = 0;
j < 2;
j++) {
265 int i = (zside==1)? 0:1;
271 LogWarning(
"ESTrendTask") << rechitlabel_ <<
" not available";
274 for (
int i=0;
i<2; ++
i)
275 for (
int j=0;
j<2; ++
j) {
277 hESRecHitTrend_[
i][
j]->Fill(minuteDiff, nrh[
i][
j]/(1072*32.));
280 hESRecHitTrendHr_[
i][
j]->Fill(hourDiff, nrh[
i][
j]/(1072*32.));
287 last_time_ = current_time_;
294 if(bins <= 0)
return;
296 if(!p->GetSumw2()) p->Sumw2();
297 int nBins = p->GetXaxis()->GetNbins();
301 double nentries = p->GetEntries();
302 for(
int i=0;
i<
bins;
i++) nentries -= p->GetBinEntries(nBins+1-bins);
303 p->SetEntries(nentries);
308 TArrayD* sumw2 = p->GetSumw2();
310 for(
int i=nBins+1;
i>
bins;
i--) {
312 p->SetBinContent(
i, p->GetBinContent(
i-bins)*p->GetBinEntries(
i-bins));
313 p->SetBinEntries(
i,p->GetBinEntries(
i-bins));
314 sumw2->SetAt(sumw2->GetAt(
i-bins),
i);
321 if(bins <= 0)
return;
323 if(!p->GetSumw2()) p->Sumw2();
324 int nBins = p->GetXaxis()->GetNbins();
328 double nentries = p->GetEntries();
329 for(
int i=0;
i<
bins;
i++) nentries -= p->GetBinEntries(
i);
330 p->SetEntries(nentries);
335 TArrayD* sumw2 = p->GetSumw2();
337 for(
int i=0;
i<=nBins+1-
bins;
i++) {
339 p->SetBinContent(
i, p->GetBinContent(
i+bins)*p->GetBinEntries(
i+bins));
340 p->SetBinEntries(
i,p->GetBinEntries(
i+bins));
341 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)
unsigned int unixTime() const
Time in seconds since January 1, 1970.
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)
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