CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTMuonMatchAndPlotContainer.cc
Go to the documentation of this file.
1 
6 
9 
10 using namespace std;
11 using namespace edm;
12 using namespace reco;
13 using namespace trigger;
14 
17 
20 {
21 
22  plotters_.clear();
23 
24  string hltProcessName = pset.getParameter<string>("hltProcessName");
25 
26  ParameterSet inputTags = pset.getParameter<ParameterSet>("inputTags");
27 
28  InputTag resTag = inputTags.getParameter<InputTag>("triggerResults");
29  InputTag sumTag = inputTags.getParameter<InputTag>("triggerSummary");
30  resTag = InputTag(resTag.label(), resTag.instance(), hltProcessName);
31  sumTag = InputTag(sumTag.label(), sumTag.instance(), hltProcessName);
32 
33  trigSummaryToken_ = iC.consumes<TriggerEvent>(sumTag);
34  trigResultsToken_ = iC.consumes<TriggerResults>(resTag);
35 
36  bsToken_ = iC.consumes<BeamSpot>(inputTags.getParameter<InputTag>("beamSpot"));
37  muonToken_ = iC.consumes<MuonCollection>(inputTags.getParameter<InputTag>("recoMuon"));
38  pvToken_ = iC.consumes<VertexCollection>(inputTags.getParameter<InputTag>("offlinePVs"));
39 
40 }
41 
42 
45  const std::vector<std::string>& labels)
46 {
47 
48  plotters_.push_back(HLTMuonMatchAndPlot(pset,path,labels));
49 
50 }
51 
52 
54  const edm::Run & iRun,
55  const edm::EventSetup & iSetup)
56 {
57 
58  vector<HLTMuonMatchAndPlot>::iterator iter = plotters_.begin();
59  vector<HLTMuonMatchAndPlot>::iterator end = plotters_.end();
60 
61  for (; iter != end; ++iter)
62  {
63  iter->beginRun(iBooker, iRun, iSetup);
64  }
65 
66 }
67 
68 
70  const edm::EventSetup & iSetup)
71 {
72 
73  vector<HLTMuonMatchAndPlot>::iterator iter = plotters_.begin();
74  vector<HLTMuonMatchAndPlot>::iterator end = plotters_.end();
75 
76  for (; iter != end; ++iter)
77  {
78  iter->endRun(iRun, iSetup);
79  }
80 
81 }
82 
83 
85  const edm::EventSetup & iSetup)
86 {
87 
88  // Get objects from the event.
89  Handle<TriggerEvent> triggerSummary;
90  iEvent.getByToken(trigSummaryToken_, triggerSummary);
91 
92  if(!triggerSummary.isValid())
93  {
94  LogError("HLTMuonMatchAndPlot")<<"Missing triggerSummary collection" << endl;
95  return;
96  }
97 
99  iEvent.getByToken(trigResultsToken_, triggerResults);
100 
101  if(!triggerResults.isValid())
102  {
103  LogError("HLTMuonMatchAndPlot")<<"Missing triggerResults collection" << endl;
104  return;
105  }
106 
108  iEvent.getByToken(muonToken_, allMuons);
109 
110  if(!allMuons.isValid())
111  {
112  LogError("HLTMuonMatchAndPlot")<<"Missing muon collection " << endl;
113  return;
114  }
115 
117  iEvent.getByToken(bsToken_, beamSpot);
118 
119  if(!beamSpot.isValid())
120  {
121  LogError("HLTMuonMatchAndPlot")<<"Missing beam spot collection " << endl;
122  return;
123  }
124 
125  Handle<VertexCollection> vertices;
126  iEvent.getByToken(pvToken_, vertices);
127 
128  if(!vertices.isValid())
129  {
130  LogError("HLTMuonMatchAndPlot")<<"Missing vertices collection " << endl;
131  return;
132  }
133 
134 
135  vector<HLTMuonMatchAndPlot>::iterator iter = plotters_.begin();
136  vector<HLTMuonMatchAndPlot>::iterator end = plotters_.end();
137 
138  for (; iter != end; ++iter)
139  {
140  iter->analyze(allMuons, beamSpot, vertices, triggerSummary, triggerResults);
141  }
142 
143 }
144 
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:446
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
int iEvent
Definition: GenABIO.cc:230
tuple path
else: Piece not in the list, fine.
tuple allMuons
Definition: allMuons_cfi.py:3
#define end
Definition: vmac.h:37
static std::string const triggerResults
Definition: EdmProvDump.cc:41
bool isValid() const
Definition: HandleBase.h:76
void analyze(const edm::Event &, const edm::EventSetup &)
void addPlotter(const edm::ParameterSet &, std::string, const std::vector< std::string > &)
Add a HLTMuonMatchAndPlot for a given path.
std::string const & label() const
Definition: InputTag.h:42
void beginRun(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &)
std::string const & instance() const
Definition: InputTag.h:43
Definition: Run.h:41