CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
ESTrendTask Class Reference

#include <ESTrendTask.h>

Inheritance diagram for ESTrendTask:
DQMEDAnalyzer edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ESTrendTask (const edm::ParameterSet &ps)
 
 ~ESTrendTask () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &r, const edm::EventSetup &c) override
 
void endJob (void) override
 
void shift2Left (TProfile *p, int bins=1)
 
void shift2Right (TProfile *p, int bins=1)
 
void updateTime (const edm::Event &)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Attributes

long int current_time_
 
edm::EDGetTokenT< ESRawDataCollectiondccCollections_
 
MonitorElementhESFiberErrTrend_
 
MonitorElementhESFiberErrTrendHr_
 
MonitorElementhESRecHitTrend_ [2][2]
 
MonitorElementhESRecHitTrendHr_ [2][2]
 
MonitorElementhESSLinkErrTrend_
 
MonitorElementhESSLinkErrTrendHr_
 
int ievt_
 
long int last_time_
 
std::string prefixME_
 
edm::EDGetTokenT< ESRecHitCollectionrechittoken_
 
long int start_time_
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 16 of file ESTrendTask.h.

Constructor & Destructor Documentation

ESTrendTask::ESTrendTask ( const edm::ParameterSet ps)

Definition at line 22 of file ESTrendTask.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, and dqmiolumiharvest::j.

22  {
23  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "EcalPreshower");
24  rechittoken_ = consumes<ESRecHitCollection>(ps.getParameter<InputTag>("RecHitLabel"));
25  dccCollections_ = consumes<ESRawDataCollection>(ps.getParameter<InputTag>("ESDCCCollections"));
26 
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;
31  }
32 
33  hESSLinkErrTrend_ = nullptr;
34  hESFiberErrTrend_ = nullptr;
35  hESSLinkErrTrendHr_ = nullptr;
36  hESFiberErrTrendHr_ = nullptr;
37 
38  start_time_ = 0;
39  current_time_ = 0;
40  last_time_ = 0;
41 
42  ievt_ = 0;
43 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * hESRecHitTrendHr_[2][2]
Definition: ESTrendTask.h:57
edm::EDGetTokenT< ESRecHitCollection > rechittoken_
Definition: ESTrendTask.h:50
std::string prefixME_
Definition: ESTrendTask.h:48
MonitorElement * hESSLinkErrTrendHr_
Definition: ESTrendTask.h:58
long int current_time_
Definition: ESTrendTask.h:62
edm::EDGetTokenT< ESRawDataCollection > dccCollections_
Definition: ESTrendTask.h:51
long int start_time_
Definition: ESTrendTask.h:61
MonitorElement * hESRecHitTrend_[2][2]
Definition: ESTrendTask.h:53
MonitorElement * hESFiberErrTrend_
Definition: ESTrendTask.h:55
long int last_time_
Definition: ESTrendTask.h:63
MonitorElement * hESFiberErrTrendHr_
Definition: ESTrendTask.h:59
MonitorElement * hESSLinkErrTrend_
Definition: ESTrendTask.h:54
ESTrendTask::~ESTrendTask ( )
inlineoverride

Member Function Documentation

void ESTrendTask::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotected

Definition at line 93 of file ESTrendTask.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), edm::Event::getByToken(), ESDCCHeaderBlock::getDCCErrors(), ESDCCHeaderBlock::getFEChannelStatus(), mps_fire::i, dqmiolumiharvest::j, ESDetId::zside(), and ecaldqm::zside().

Referenced by ~ESTrendTask().

93  {
94  ievt_++;
95 
96  // Collect time information
97  updateTime(e);
98 
99  long int diff_current_start = current_time_ - start_time_;
100  long int diff_last_start = last_time_ - start_time_;
101  //LogInfo("ESTrendTask") << "time difference is negative in " << ievt_ << " events\n"
102  //<< "\tcurrent - start time = " << diff_current_start
103  //<< ", \tlast - start time = " << diff_last_start << endl;
104 
105  // std::cout << "current_time : " << current_time_ << ", diff : " << diff_current_start << std::endl;
106 
107  // Calculate time interval and bin width
108  // int minuteBinWidth = int(nBasicClusterMinutely_->getTProfile()->GetXaxis()->GetBinWidth(1));
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;
112 
113  // int hourBinWidth = int(nBasicClusterHourly_->getTProfile()->GetXaxis()->GetBinWidth(1));
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;
117 
118  if (minuteDiff >= minuteBinWidth) {
119  while (minuteDiff >= minuteBinWidth)
120  minuteDiff -= minuteBinWidth;
121  }
122  if (hourDiff >= hourBinWidth) {
123  while (hourDiff >= hourBinWidth)
124  hourDiff -= hourBinWidth;
125  }
126 
127  // ES DCC
128  Int_t slinkCRCErr = 0;
129  Int_t fiberErr = 0;
130  vector<int> fiberStatus;
132  if (e.getByToken(dccCollections_, dccs)) {
133  for (ESRawDataCollection::const_iterator dccItr = dccs->begin(); dccItr != dccs->end(); ++dccItr) {
134  ESDCCHeaderBlock dcc = (*dccItr);
135 
136  if (dcc.getDCCErrors() == 101)
137  slinkCRCErr++;
138 
139  fiberStatus = dcc.getFEChannelStatus();
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)
143  fiberErr++;
144  }
145  }
146  }
147 
148  shift2Right(hESSLinkErrTrend_->getTProfile(), minuteBinDiff);
149  hESSLinkErrTrend_->Fill(minuteDiff, slinkCRCErr);
150 
151  shift2Right(hESFiberErrTrend_->getTProfile(), minuteBinDiff);
152  hESFiberErrTrend_->Fill(minuteDiff, fiberErr);
153 
155  hESSLinkErrTrendHr_->Fill(hourDiff, slinkCRCErr);
156 
158  hESFiberErrTrendHr_->Fill(hourDiff, fiberErr);
159 
160  // ES RecHits
161  int zside, plane;
162  int nrh[2][2];
163  for (int i = 0; i < 2; i++)
164  for (int j = 0; j < 2; j++) {
165  nrh[i][j] = 0;
166  }
167 
169  if (e.getByToken(rechittoken_, ESRecHit)) {
170  for (ESRecHitCollection::const_iterator hitItr = ESRecHit->begin(); hitItr != ESRecHit->end(); ++hitItr) {
171  ESDetId id = ESDetId(hitItr->id());
172 
173  zside = id.zside();
174  plane = id.plane();
175 
176  int i = (zside == 1) ? 0 : 1;
177  int j = plane - 1;
178 
179  nrh[i][j]++;
180  }
181  } else {
182  LogWarning("ESTrendTask") << "RecHitCollection not available";
183  }
184 
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.));
189 
190  shift2Right(hESRecHitTrendHr_[i][j]->getTProfile(), hourBinDiff);
191  hESRecHitTrendHr_[i][j]->Fill(hourDiff, nrh[i][j] / (1072 * 32.));
192  }
193 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
MonitorElement * hESRecHitTrendHr_[2][2]
Definition: ESTrendTask.h:57
edm::EDGetTokenT< ESRecHitCollection > rechittoken_
Definition: ESTrendTask.h:50
std::vector< T >::const_iterator const_iterator
void shift2Right(TProfile *p, int bins=1)
Definition: ESTrendTask.cc:200
MonitorElement * hESSLinkErrTrendHr_
Definition: ESTrendTask.h:58
int zside(DetId const &)
long int current_time_
Definition: ESTrendTask.h:62
edm::EDGetTokenT< ESRawDataCollection > dccCollections_
Definition: ESTrendTask.h:51
const std::vector< int > & getFEChannelStatus() const
void Fill(long long x)
long int start_time_
Definition: ESTrendTask.h:61
MonitorElement * hESRecHitTrend_[2][2]
Definition: ESTrendTask.h:53
MonitorElement * hESFiberErrTrend_
Definition: ESTrendTask.h:55
long int last_time_
Definition: ESTrendTask.h:63
int zside() const
Definition: ESDetId.h:39
virtual TProfile * getTProfile()
const_iterator end() const
MonitorElement * hESFiberErrTrendHr_
Definition: ESTrendTask.h:59
int getDCCErrors() const
void updateTime(const edm::Event &)
Definition: ESTrendTask.cc:195
const_iterator begin() const
MonitorElement * hESSLinkErrTrend_
Definition: ESTrendTask.h:54
void ESTrendTask::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 51 of file ESTrendTask.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::bookProfile(), timingPdfMaker::histo, mps_fire::i, dqmiolumiharvest::j, dqm::impl::MonitorElement::setAxisTitle(), and dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder().

Referenced by ~ESTrendTask().

51  {
52  char histo[200];
53 
54  iBooker.setCurrentFolder(prefixME_ + "/ESTrendTask");
55 
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");
61  hESRecHitTrend_[i][j]->setAxisTitle("Elapse time (Minutes)", 1);
62  hESRecHitTrend_[i][j]->setAxisTitle("ES RecHit Occupancy / 5 minutes", 2);
63 
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");
66  hESRecHitTrendHr_[i][j]->setAxisTitle("Elapse time (Hours)", 1);
67  hESRecHitTrendHr_[i][j]->setAxisTitle("ES RecHit Occupancy / hour", 2);
68  }
69 
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);
74 
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);
79 
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);
84 
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);
89 }
MonitorElement * hESRecHitTrendHr_[2][2]
Definition: ESTrendTask.h:57
std::string prefixME_
Definition: ESTrendTask.h:48
MonitorElement * hESSLinkErrTrendHr_
Definition: ESTrendTask.h:58
MonitorElement * hESRecHitTrend_[2][2]
Definition: ESTrendTask.h:53
MonitorElement * hESFiberErrTrend_
Definition: ESTrendTask.h:55
MonitorElement * hESFiberErrTrendHr_
Definition: ESTrendTask.h:59
MonitorElement * hESSLinkErrTrend_
Definition: ESTrendTask.h:54
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void ESTrendTask::dqmBeginRun ( const edm::Run r,
const edm::EventSetup c 
)
overrideprotected

Definition at line 45 of file ESTrendTask.cc.

References edm::RunBase::beginTime().

Referenced by ~ESTrendTask().

45  {
46  start_time_ = (r.beginTime()).unixTime();
47 
48  //std::cout << "start time : " << start_time_ << std::endl;
49 }
long int start_time_
Definition: ESTrendTask.h:61
Timestamp const & beginTime() const
Definition: RunBase.h:41
void ESTrendTask::endJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 91 of file ESTrendTask.cc.

Referenced by ~ESTrendTask().

91 { LogInfo("ESTrendTask") << "analyzed " << ievt_ << " events"; }
void ESTrendTask::shift2Left ( TProfile *  p,
int  bins = 1 
)
protected

Definition at line 228 of file ESTrendTask.cc.

References trigObjTnPSource_cfi::bins, DEFINE_FWK_MODULE, mps_fire::i, and seedmultiplicitymonitor_newtracking_cfi::nBins.

Referenced by ~ESTrendTask().

228  {
229  if (bins <= 0)
230  return;
231 
232  if (!p->GetSumw2())
233  p->Sumw2();
234  int nBins = p->GetXaxis()->GetNbins();
235 
236  // by shifting n bin to the left, the number of entries are
237  // reduced by the number in n bins including the underflow bin.
238  double nentries = p->GetEntries();
239  for (int i = 0; i < bins; i++)
240  nentries -= p->GetBinEntries(i);
241  p->SetEntries(nentries);
242 
243  // the first bin goes to underflow
244  // each bin moves to the right
245 
246  TArrayD* sumw2 = p->GetSumw2();
247 
248  for (int i = 0; i <= nBins + 1 - bins; i++) {
249  // GetBinContent return binContent/binEntries
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);
253  }
254 }
void ESTrendTask::shift2Right ( TProfile *  p,
int  bins = 1 
)
protected

Definition at line 200 of file ESTrendTask.cc.

References trigObjTnPSource_cfi::bins, mps_fire::i, and seedmultiplicitymonitor_newtracking_cfi::nBins.

Referenced by ~ESTrendTask().

200  {
201  if (bins <= 0)
202  return;
203 
204  if (!p->GetSumw2())
205  p->Sumw2();
206  int nBins = p->GetXaxis()->GetNbins();
207 
208  // by shifting n bin to the right, the number of entries are
209  // reduced by the number in n bins including the overflow bin.
210  double nentries = p->GetEntries();
211  for (int i = 0; i < bins; i++)
212  nentries -= p->GetBinEntries(nBins + 1 - bins);
213  p->SetEntries(nentries);
214 
215  // the last bin goes to overflow
216  // each bin moves to the right
217 
218  TArrayD* sumw2 = p->GetSumw2();
219 
220  for (int i = nBins + 1; i > bins; i--) {
221  // GetBinContent return binContent/binEntries
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);
225  }
226 }
void ESTrendTask::updateTime ( const edm::Event e)
protected

Definition at line 195 of file ESTrendTask.cc.

References edm::EventBase::time(), and edm::Timestamp::unixTime().

Referenced by ~ESTrendTask().

195  {
197  current_time_ = e.time().unixTime();
198 }
long int current_time_
Definition: ESTrendTask.h:62
unsigned int unixTime() const
Time in seconds since January 1, 1970.
Definition: Timestamp.h:40
long int last_time_
Definition: ESTrendTask.h:63
edm::Timestamp time() const
Definition: EventBase.h:60

Member Data Documentation

long int ESTrendTask::current_time_
private

Definition at line 62 of file ESTrendTask.h.

edm::EDGetTokenT<ESRawDataCollection> ESTrendTask::dccCollections_
private

Definition at line 51 of file ESTrendTask.h.

MonitorElement* ESTrendTask::hESFiberErrTrend_
private

Definition at line 55 of file ESTrendTask.h.

MonitorElement* ESTrendTask::hESFiberErrTrendHr_
private

Definition at line 59 of file ESTrendTask.h.

MonitorElement* ESTrendTask::hESRecHitTrend_[2][2]
private

Definition at line 53 of file ESTrendTask.h.

MonitorElement* ESTrendTask::hESRecHitTrendHr_[2][2]
private

Definition at line 57 of file ESTrendTask.h.

MonitorElement* ESTrendTask::hESSLinkErrTrend_
private

Definition at line 54 of file ESTrendTask.h.

MonitorElement* ESTrendTask::hESSLinkErrTrendHr_
private

Definition at line 58 of file ESTrendTask.h.

int ESTrendTask::ievt_
private

Definition at line 46 of file ESTrendTask.h.

long int ESTrendTask::last_time_
private

Definition at line 63 of file ESTrendTask.h.

std::string ESTrendTask::prefixME_
private

Definition at line 48 of file ESTrendTask.h.

edm::EDGetTokenT<ESRecHitCollection> ESTrendTask::rechittoken_
private

Definition at line 50 of file ESTrendTask.h.

long int ESTrendTask::start_time_
private

Definition at line 61 of file ESTrendTask.h.