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 
19 
21 
22 #include <vector>
23 
24 // used as a mixin for Analyzer and Harvester.
26  public:
28  : geometryInterface(iConfig.getParameter<edm::ParameterSet>("geometry")) {
29  auto histograms = iConfig.getParameter<edm::VParameterSet>("histograms");
30  for (auto histoconf : histograms) {
31  histo.emplace_back(HistogramManager(histoconf, geometryInterface));
32  }
33  };
34 
35  protected:
36  std::vector<HistogramManager> histo;
38 };
39 
40 // This is the base class your plugin may derive from. You are not required to
41 // use it but if you just need some normal HistogramManager this should be perfect.
43  public:
44  SiPixelPhase1Base(const edm::ParameterSet& iConfig);
45 
46  // You should analyze something, and call histoman.fill(...). Setting to pure virtual function
47  void analyze(edm::Event const& e, edm::EventSetup const& eSetup) override = 0;
48 
49  // This booking is usually fine.
50  // Also used to store the required triggers
51  void bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& run, edm::EventSetup const& iSetup) override;
52 
53  ~SiPixelPhase1Base() override {};
54 
55  protected:
56  // Returns a value of whether the trigger stored at position "trgidx" is properly fired.
57  bool checktrigger( const edm::Event& iEvent, const edm::EventSetup& iSetup, const unsigned trgidx ) const;
58 
59  // must match order in TriggerEventFlag_cfi.py
60  enum { DCS };
61 
62  private:
63  // Storing the trigger objects per plugin instance
64  std::vector<std::unique_ptr<GenericTriggerEventFlag>> triggerlist;
65 };
66 
67 // This wraps the Histogram Managers into a DQMEDHarvester. It
68 // provides sane default implementations, so most plugins don't care about this.
69 // However, you have to instantiate one with the same config as your Analyzer
70 // to get the Harvesting done.
71 // For custom harvesting, you have to derive from this.
73  public:
75  : DQMEDHarvester(), HistogramManagerHolder(iConfig) {};
76 
77  void dqmEndLuminosityBlock(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter, edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& eSetup) override ;
78  void dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) override;
79 };
80 #endif
~SiPixelPhase1Base() override
T getParameter(std::string const &) const
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
std::vector< std::unique_ptr< GenericTriggerEventFlag > > triggerlist
GeometryInterface geometryInterface
int iEvent
Definition: GenABIO.cc:230
virtual example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
SiPixelPhase1Harvester(const edm::ParameterSet &iConfig)
HistogramManagerHolder(const edm::ParameterSet &iConfig)
std::vector< HistogramManager > histo
HLT enums.
Definition: Run.h:44