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  private:
60  // Storing the trigger objects per plugin instance
61  std::vector<std::unique_ptr<GenericTriggerEventFlag>> triggerlist;
62 };
63 
64 // This wraps the Histogram Managers into a DQMEDHarvester. It
65 // provides sane default implementations, so most plugins don't care about this.
66 // However, you have to instantiate one with the same config as your Analyzer
67 // to get the Harvesting done.
68 // For custom harvesting, you have to derive from this.
70  public:
72  : DQMEDHarvester(), HistogramManagerHolder(iConfig) {};
73 
74  void dqmEndLuminosityBlock(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter, edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& eSetup) override ;
75  void dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) override;
76 };
77 #endif
~SiPixelPhase1Base() override
T getParameter(std::string const &) const
def analyze(function, filename, filter=None)
Definition: Profiling.py:11
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
std::vector< std::unique_ptr< GenericTriggerEventFlag > > triggerlist
void bookHistograms(fwlite::EventContainer &eventCont)
GeometryInterface geometryInterface
int iEvent
Definition: GenABIO.cc:230
SiPixelPhase1Harvester(const edm::ParameterSet &iConfig)
HistogramManagerHolder(const edm::ParameterSet &iConfig)
std::vector< HistogramManager > histo
HLT enums.
Definition: Run.h:43