CMS 3D CMS Logo

HLTMuonMatchAndPlotContainer.cc
Go to the documentation of this file.
1 
5 #include <utility>
6 
8 
11 
12 using namespace std;
13 using namespace edm;
14 using namespace reco;
15 using namespace trigger;
16 
19 
22 {
23 
24  plotters_.clear();
25 
26  string hltProcessName = pset.getParameter<string>("hltProcessName");
27 
28  ParameterSet inputTags = pset.getParameter<ParameterSet>("inputTags");
29 
30  InputTag resTag = inputTags.getParameter<InputTag>("triggerResults");
31  InputTag sumTag = inputTags.getParameter<InputTag>("triggerSummary");
32  resTag = InputTag(resTag.label(), resTag.instance(), hltProcessName);
33  sumTag = InputTag(sumTag.label(), sumTag.instance(), hltProcessName);
34 
35  trigSummaryToken_ = iC.consumes<TriggerEvent>(sumTag);
36  trigResultsToken_ = iC.consumes<TriggerResults>(resTag);
37 
38  bsToken_ = iC.consumes<BeamSpot>(inputTags.getParameter<InputTag>("beamSpot"));
39  muonToken_ = iC.consumes<MuonCollection>(inputTags.getParameter<InputTag>("recoMuon"));
40  pvToken_ = iC.consumes<VertexCollection>(inputTags.getParameter<InputTag>("offlinePVs"));
41 
42 }
43 
44 
47  std::string label, bool islastfilter)
48 {
49 
50  plotters_.emplace_back(pset,std::move(path),std::move(label),islastfilter);
51 
52 }
53 
54 
56  const edm::Run & iRun,
57  const edm::EventSetup & iSetup)
58 {
59 
60  auto iter = plotters_.begin();
61  auto end = plotters_.end();
62 
63  for (; iter != end; ++iter)
64  {
65  iter->beginRun(iBooker, iRun, iSetup);
66  }
67 
68 }
69 
70 
72  const edm::EventSetup & iSetup)
73 {
74 
75  auto iter = plotters_.begin();
76  auto end = plotters_.end();
77 
78  for (; iter != end; ++iter)
79  {
80  iter->endRun(iRun, iSetup);
81  }
82 
83 }
84 
85 
87  const edm::EventSetup & iSetup)
88 {
89 
90  // Get objects from the event.
91  Handle<TriggerEvent> triggerSummary;
92  iEvent.getByToken(trigSummaryToken_, triggerSummary);
93 
94  if(!triggerSummary.isValid())
95  {
96  LogError("HLTMuonMatchAndPlot")<<"Missing triggerSummary collection" << endl;
97  return;
98  }
99 
101  iEvent.getByToken(trigResultsToken_, triggerResults);
102  const edm::TriggerNames& trigNames = iEvent.triggerNames(*triggerResults);
103 
104  if(!triggerResults.isValid())
105  {
106  LogError("HLTMuonMatchAndPlot")<<"Missing triggerResults collection" << endl;
107  return;
108  }
109 
111  iEvent.getByToken(muonToken_, allMuons);
112 
113  if(!allMuons.isValid())
114  {
115  LogError("HLTMuonMatchAndPlot")<<"Missing muon collection " << endl;
116  return;
117  }
118 
120  iEvent.getByToken(bsToken_, beamSpot);
121 
122  if(!beamSpot.isValid())
123  {
124  LogError("HLTMuonMatchAndPlot")<<"Missing beam spot collection " << endl;
125  return;
126  }
127 
129  iEvent.getByToken(pvToken_, vertices);
130 
131  if(!vertices.isValid())
132  {
133  LogError("HLTMuonMatchAndPlot")<<"Missing vertices collection " << endl;
134  return;
135  }
136 
137 
138  auto iter = plotters_.begin();
139  auto end = plotters_.end();
140 
141  for (; iter != end; ++iter)
142  {
143  iter->analyze(allMuons, beamSpot, vertices, triggerSummary, triggerResults, trigNames);
144  }
145 
146 }
147 
T getParameter(std::string const &) const
void endRun(const edm::Run &, const edm::EventSetup &)
HLTMuonMatchAndPlotContainer(edm::ConsumesCollector &&, const edm::ParameterSet &)
Constructor.
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:25
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
char const * label
int iEvent
Definition: GenABIO.cc:224
#define end
Definition: vmac.h:39
static std::string const triggerResults
Definition: EdmProvDump.cc:45
bool isValid() const
Definition: HandleBase.h:74
void analyze(const edm::Event &, const edm::EventSetup &)
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:74
std::string const & label() const
Definition: InputTag.h:36
void beginRun(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &)
fixed size matrix
HLT enums.
void addPlotter(const edm::ParameterSet &, std::string, std::string, bool)
Add a HLTMuonMatchAndPlot for a given path.
std::string const & instance() const
Definition: InputTag.h:37
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:256
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45