test
CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiPixelPhase1OnlineHarvester.cc
Go to the documentation of this file.
1 // Harvester with a custom step to reset histograms.
2 
5 
7  // Note: for the current setup of onlineblocks (for overlaid curves,
8  // e.g. useful for detector commisioning), this plugin is NOT needed.
9 
10  public:
12  : SiPixelPhase1Harvester(iConfig) {
13 
14  int onlineblock = iConfig.getParameter<edm::ParameterSet>("geometry").getParameter<int>("onlineblock");
15  int n_onlineblocks = iConfig.getParameter<edm::ParameterSet>("geometry").getParameter<int>("n_onlineblocks");
16 
17  for (auto& h : histo) {
18  h.setCustomHandler([&h, onlineblock, n_onlineblocks] (SummationStep& s, HistogramManager::Table & t,
20  if (!h.lumisection) return; // not online
21  uint32_t ls = h.lumisection->id().luminosityBlock();
22 
23  // TODO: this is hard to get right if we don't see all LS.
24  uint32_t block = (ls / onlineblock) % n_onlineblocks;
25  uint32_t next_block = ((ls / onlineblock)+1) % n_onlineblocks;
26  if (block == next_block) return;
27 
28  for (auto& e : t) {
29  TH1* th1 = e.second.th1;
30  if (std::string(th1->GetYaxis()->GetTitle()).find("OnlineBlock") != std::string::npos) {
31  for (int i = 1; i <= th1->GetNbinsX(); i++) {
32  th1->SetBinContent(i, next_block+1, 0);
33  }
34  } else {
35  // TODO: do sth.like exponential decay here.
36  }
37  }
38  });
39  }
40  }
41 
42 };
43 
45 
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
def ls
Definition: eostools.py:348
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::map< GeometryInterface::Values, AbstractHistogram > Table
std::vector< HistogramManager > histo
SiPixelPhase1OnlineHarvester(const edm::ParameterSet &iConfig)