CMS 3D CMS Logo

SiPixelPhase1Base.h
Go to the documentation of this file.
1 #ifndef SiPixel_DefaultTemplates_h
2 #define SiPixel_DefaultTemplates_h
3 //
4 // This defines two classes, one that has to be extended to make a new plugin,
5 // and one that can be used as-is for the Harvesting.
6 //
7 // As with the entire SiPixelPhase1Common framework, you do not have to use
8 // this but can still use the other helpers. However, the HistogramManager
9 // needs to run in step1 and step2 of the DQM, and need to have exactly the
10 // same spec to work properly. This has to be guranteed by the configuration.
11 //
12 // Original Author: Marcel Schneider
13 //
14 
20 
22 
23 #include <utility>
24 #include <vector>
25 
26 // used as a mixin for Analyzer and Harvester.
28 public:
32  : geometryInterface(iConfig.getParameter<edm::ParameterSet>("geometry"), std::move(iC), transition) {
33  auto histograms = iConfig.getParameter<edm::VParameterSet>("histograms");
34  for (const auto& histoconf : histograms) {
35  histo.emplace_back(HistogramManager(histoconf, geometryInterface));
36  }
37  };
38 
39 protected:
40  std::vector<HistogramManager> histo;
42 };
43 
44 // This is the base class your plugin may derive from. You are not required to
45 // use it but if you just need some normal HistogramManager this should be perfect.
47 public:
48  SiPixelPhase1Base(const edm::ParameterSet& iConfig);
49 
50  // You should analyze something, and call histoman.fill(...). Setting to pure virtual function
51  void analyze(edm::Event const& e, edm::EventSetup const&) override = 0;
52 
53  // This booking is usually fine.
54  // Also used to store the required triggers
55  void bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& run, edm::EventSetup const&) override;
56 
57  ~SiPixelPhase1Base() override {}
58 
59 protected:
60  // Returns a value of whether the trigger stored at position "trgidx" is properly fired.
61  bool checktrigger(const edm::Event& iEvent, const edm::EventSetup&, const unsigned trgidx) const;
62 
63  // must match order in TriggerEventFlag_cfi.py
64  enum { DCS };
65 
66 private:
67  // Storing the trigger objects per plugin instance
68  std::vector<std::unique_ptr<GenericTriggerEventFlag>> triggerlist;
69 };
70 
71 // This wraps the Histogram Managers into a DQMEDHarvester. It
72 // provides sane default implementations, so most plugins don't care about this.
73 // However, you have to instantiate one with the same config as your Analyzer
74 // to get the Harvesting done.
75 // For custom harvesting, you have to derive from this.
77 public:
79  : DQMEDHarvester(), HistogramManagerHolder(iConfig, consumesCollector(), edm::Transition::EndLuminosityBlock) {}
80 
82  DQMStore::IGetter& iGetter,
83  edm::LuminosityBlock const& lumiBlock,
84  edm::EventSetup const&) override;
85  void dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) override;
86 };
87 #endif
~SiPixelPhase1Base() override
void dqmEndLuminosityBlock(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &) override
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
HistogramManagerHolder(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC, edm::Transition transition=edm::Transition::BeginRun)
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:35
std::vector< std::unique_ptr< GenericTriggerEventFlag > > triggerlist
SiPixelPhase1Base(const edm::ParameterSet &iConfig)
GeometryInterface geometryInterface
int iEvent
Definition: GenABIO.cc:224
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
SiPixelPhase1Harvester(const edm::ParameterSet &iConfig)
Transition
Definition: Transition.h:12
void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &) override
void dqmEndJob(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter) override
void analyze(edm::Event const &e, edm::EventSetup const &) override=0
std::vector< HistogramManager > histo
HLT enums.
bool checktrigger(const edm::Event &iEvent, const edm::EventSetup &, const unsigned trgidx) const
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45