CMS 3D CMS Logo

HotlineDQM.cc
Go to the documentation of this file.
7 
9  edm::LogInfo("HotlineDQM") << "Constructor HotlineDQM::HotlineDQM " << std::endl;
10  // Get parameters from configuration file
11  theMuonCollection_ = consumes<reco::MuonCollection>(ps.getParameter<edm::InputTag>("muonCollection"));
12  thePfMETCollection_ = consumes<reco::PFMETCollection>(ps.getParameter<edm::InputTag>("pfMetCollection"));
13  theMETCollection_ = consumes<reco::CaloMETCollection>(ps.getParameter<edm::InputTag>("caloMetCollection"));
14  theCaloJetCollection_ = consumes<reco::CaloJetCollection>(ps.getParameter<edm::InputTag>("caloJetCollection"));
15  thePhotonCollection_ = consumes<reco::PhotonCollection>(ps.getParameter<edm::InputTag>("photonCollection"));
16  theTrigSummary_ = consumes<trigger::TriggerEvent>(ps.getParameter<edm::InputTag>("trigSummary"));
17  triggerResults_ = consumes<edm::TriggerResults>(ps.getParameter<edm::InputTag>("triggerResults"));
18  triggerPath_ = ps.getParameter<std::string>("triggerPath");
19  triggerFilter_ = ps.getParameter<edm::InputTag>("triggerFilter");
20  useMuons = ps.getParameter<bool>("useMuons");
21  useMet = ps.getParameter<bool>("useMet");
22  usePFMet = ps.getParameter<bool>("usePFMet");
23  useHT = ps.getParameter<bool>("useHT");
24  usePhotons = ps.getParameter<bool>("usePhotons");
25 }
26 
27 HotlineDQM::~HotlineDQM() { edm::LogInfo("HotlineDQM") << "Destructor HotlineDQM::~HotlineDQM " << std::endl; }
28 
30  edm::LogInfo("HotlineDQM") << "HotlineDQM::bookHistograms" << std::endl;
31 
32  ibooker_.cd();
33  ibooker_.setCurrentFolder("HLT/Hotline/" + triggerPath_);
34 
35  //online quantities
36  h_MuPt = ibooker_.book1D("MuPt", "Muon Pt; GeV", 20, 0.0, 2000.0);
37  h_PhotonPt = ibooker_.book1D("PhotonPt", "Photon Pt; GeV", 20, 0.0, 4000.0);
38  h_HT = ibooker_.book1D("HT", "HT; GeV", 20, 0.0, 6000.0);
39  h_MetPt = ibooker_.book1D("MetPt", "Calo MET; GeV", 20, 0.0, 2000);
40  h_PFMetPt = ibooker_.book1D("PFMetPt", "PF MET; GeV", 20, 0.0, 2000);
41 
42  if (useMuons)
43  h_OnlineMuPt = ibooker_.book1D("OnlineMuPt", "Online Muon Pt; GeV", 20, 0.0, 2000.0);
44  if (usePhotons)
45  h_OnlinePhotonPt = ibooker_.book1D("OnlinePhotonPt", "Online Photon Pt; GeV", 20, 0.0, 4000.0);
46  if (useHT)
47  h_OnlineHT = ibooker_.book1D("OnlineHT", "Online HT; GeV", 20, 0.0, 6000.0);
48  if (useMet)
49  h_OnlineMetPt = ibooker_.book1D("OnlineMetPt", "Online Calo MET; GeV", 20, 0.0, 2000);
50  if (usePFMet)
51  h_OnlinePFMetPt = ibooker_.book1D("OnlinePFMetPt", "Online PF MET; GeV", 20, 0.0, 2000);
52 
53  ibooker_.cd();
54 }
55 
56 void HotlineDQM::analyze(edm::Event const& e, edm::EventSetup const& eSetup) {
57  edm::LogInfo("HotlineDQM") << "HotlineDQM::analyze" << std::endl;
58 
59  //-------------------------------
60  //--- MET
61  //-------------------------------
64  if (!pfMETCollection.isValid()) {
65  edm::LogError("HotlineDQM") << "invalid collection: PFMET"
66  << "\n";
67  return;
68  }
71  if (!caloMETCollection.isValid()) {
72  edm::LogError("HotlineDQM") << "invalid collection: CaloMET"
73  << "\n";
74  return;
75  }
76 
77  //-------------------------------
78  //--- Jets
79  //-------------------------------
82  if (!caloJetCollection.isValid()) {
83  edm::LogError("HotlineDQM") << "invalid collection: CaloJets"
84  << "\n";
85  return;
86  }
87 
88  //-------------------------------
89  //--- Muon
90  //-------------------------------
92  e.getByToken(theMuonCollection_, MuonCollection);
93  if (!MuonCollection.isValid()) {
94  edm::LogError("HotlineDQM") << "invalid collection: Muons "
95  << "\n";
96  return;
97  }
98 
99  //-------------------------------
100  //--- Photon
101  //-------------------------------
104  if (!PhotonCollection.isValid()) {
105  edm::LogError("HotlineDQM") << "invalid collection: Photons "
106  << "\n";
107  return;
108  }
109 
110  //-------------------------------
111  //--- Trigger
112  //-------------------------------
114  e.getByToken(triggerResults_, hltresults);
115  if (!hltresults.isValid()) {
116  edm::LogError("HotlineDQM") << "invalid collection: TriggerResults"
117  << "\n";
118  return;
119  }
121  e.getByToken(theTrigSummary_, triggerSummary);
122  if (!triggerSummary.isValid()) {
123  edm::LogError("HotlineDQM") << "invalid collection: TriggerSummary"
124  << "\n";
125  return;
126  }
127 
128  bool hasFired = false;
129  const edm::TriggerNames& trigNames = e.triggerNames(*hltresults);
130  unsigned int numTriggers = trigNames.size();
131  for (unsigned int hltIndex = 0; hltIndex < numTriggers; ++hltIndex) {
132  if (trigNames.triggerName(hltIndex).find(triggerPath_) != std::string::npos && hltresults->wasrun(hltIndex) &&
133  hltresults->accept(hltIndex)) {
134  hasFired = true;
135  }
136  }
137 
138  //get online objects
139  float ptMuon = -1, ptPhoton = -1, met = -1, pfMet = -1, ht = 0;
140  size_t filterIndex = triggerSummary->filterIndex(triggerFilter_);
142  if (!(filterIndex >= triggerSummary->sizeFilters())) {
143  const trigger::Keys& keys = triggerSummary->filterKeys(filterIndex);
144  for (unsigned short key : keys) {
146  if (useMuons && fabs(foundObject.id()) == 13) { //muon
147  if (foundObject.pt() > ptMuon)
148  ptMuon = foundObject.pt();
149  } else if (usePhotons && fabs(foundObject.id()) == 0) { //photon
150  if (foundObject.pt() > ptPhoton)
151  ptPhoton = foundObject.pt();
152  } else if (useMet && fabs(foundObject.id()) == 0) { //MET
153  met = foundObject.pt();
154  } else if (usePFMet && fabs(foundObject.id()) == 0) { //PFMET
155  pfMet = foundObject.pt();
156  } else if (useHT && fabs(foundObject.id()) == 89) { //HT
157  ht = foundObject.pt();
158  }
159  }
160  }
161 
162  if (hasFired) {
163  //fill appropriate online histogram
164  if (useMuons)
165  h_OnlineMuPt->Fill(ptMuon);
166  if (usePhotons)
167  h_OnlinePhotonPt->Fill(ptPhoton);
168  if (useMet)
170  if (usePFMet)
172  if (useHT)
173  h_OnlineHT->Fill(ht);
174 
175  //fill muon pt histogram
176  if (!MuonCollection->empty()) {
177  float maxMuPt = -1.0;
178  for (auto& mu : *MuonCollection) {
179  if (mu.pt() > maxMuPt)
180  maxMuPt = mu.pt();
181  }
182  h_MuPt->Fill(maxMuPt);
183  }
184 
185  //fill photon pt histogram
186  if (!PhotonCollection->empty()) {
187  float maxPhoPt = -1.0;
188  for (auto& pho : *PhotonCollection) {
189  if (pho.pt() > maxPhoPt)
190  maxPhoPt = pho.pt();
191  }
192  h_PhotonPt->Fill(maxPhoPt);
193  }
194 
195  //fill HT histogram
196  float caloHT = 0.0;
197  for (auto const& i_calojet : *caloJetCollection) {
198  if (i_calojet.pt() < 40)
199  continue;
200  if (fabs(i_calojet.eta()) > 3.0)
201  continue;
202  caloHT += i_calojet.pt();
203  }
204  h_HT->Fill(caloHT);
205 
206  //fill CaloMET histogram
207  h_MetPt->Fill(caloMETCollection->front().et());
208 
209  //fill PFMET histogram
210  h_PFMetPt->Fill(pfMETCollection->front().et());
211  }
212 }
213 
216  desc.add<edm::InputTag>("photonCollection", edm::InputTag("photons"));
217  desc.add<edm::InputTag>("muonCollection", edm::InputTag("muons"));
218  desc.add<edm::InputTag>("caloJetCollection", edm::InputTag("ak4CaloJets"));
219  desc.add<edm::InputTag>("pfMetCollection", edm::InputTag("pfMet"));
220  desc.add<edm::InputTag>("caloMetCollection", edm::InputTag("caloMet"));
221  desc.add<edm::InputTag>("triggerResults", edm::InputTag("TriggerResults", "", "HLT"));
222  desc.add<edm::InputTag>("trigSummary", edm::InputTag("hltTriggerSummaryAOD"));
223  desc.add<std::string>("triggerPath", "HLT_HT2000_v")->setComment("trigger path name");
224  desc.add<edm::InputTag>("triggerFilter", edm::InputTag("hltHt2000", "", "HLT"))
225  ->setComment("name of the last filter in the path");
226  desc.add<bool>("useMuons", false);
227  desc.add<bool>("usePhotons", false);
228  desc.add<bool>("useMet", false);
229  desc.add<bool>("usePFMet", false);
230  desc.add<bool>("useHT", false);
231  descriptions.add("HotlineDQM", desc);
232 }
233 
234 //define this as a plug-in
HotlineDQM::useMuons
bool useMuons
Definition: HotlineDQM.h:62
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
HotlineDQM::h_OnlineMetPt
MonitorElement * h_OnlineMetPt
Definition: HotlineDQM.h:74
HotlineDQM::triggerFilter_
edm::InputTag triggerFilter_
Definition: HotlineDQM.h:60
MessageLogger.h
HotlineDQM::thePfMETCollection_
edm::EDGetTokenT< reco::PFMETCollection > thePfMETCollection_
Definition: HotlineDQM.h:52
trigNames
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:57
triggerMatchMonitor_cfi.triggerObjects
triggerObjects
Definition: triggerMatchMonitor_cfi.py:15
HLTBitAnalyser_cfi.hltresults
hltresults
Definition: HLTBitAnalyser_cfi.py:13
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
edm::Run
Definition: Run.h:45
HotlineDQM::theTrigSummary_
edm::EDGetTokenT< trigger::TriggerEvent > theTrigSummary_
Definition: HotlineDQM.h:57
HotlineDQM::theMETCollection_
edm::EDGetTokenT< reco::CaloMETCollection > theMETCollection_
Definition: HotlineDQM.h:53
edm::LogInfo
Definition: MessageLogger.h:254
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
HotlineDQM::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: HotlineDQM.cc:29
HotlineDQM
Definition: HotlineDQM.h:38
HotlineDQM::h_OnlinePFMetPt
MonitorElement * h_OnlinePFMetPt
Definition: HotlineDQM.h:75
HotlineDQM::useHT
bool useHT
Definition: HotlineDQM.h:62
HotlineDQM::h_HT
MonitorElement * h_HT
Definition: HotlineDQM.h:67
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
HLTMuonOfflineAnalyzer_cfi.triggerSummary
triggerSummary
Definition: HLTMuonOfflineAnalyzer_cfi.py:86
edm::Handle< reco::PFMETCollection >
BTaggingMonitor_cfi.met
met
Definition: BTaggingMonitor_cfi.py:84
HotlineDQM::useMet
bool useMet
Definition: HotlineDQM.h:62
MakerMacros.h
HotlineDQM::usePFMet
bool usePFMet
Definition: HotlineDQM.h:62
trigger::TriggerObject::pt
float pt() const
Definition: TriggerObject.h:52
HotlineDQM::analyze
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
Definition: HotlineDQM.cc:56
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HotlineDQM::~HotlineDQM
~HotlineDQM() override
Definition: HotlineDQM.cc:27
HotlineDQM::h_PFMetPt
MonitorElement * h_PFMetPt
Definition: HotlineDQM.h:69
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
reco::MuonCollection
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
HotlineDQM.h
trigger::TriggerObject
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
RecoPFMET_cff.pfMet
pfMet
Definition: RecoPFMET_cff.py:15
HotlineDQM::thePhotonCollection_
edm::EDGetTokenT< reco::PhotonCollection > thePhotonCollection_
Definition: HotlineDQM.h:55
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
trigger::TriggerObjectCollection
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
trigger::TriggerObject::id
int id() const
getters
Definition: TriggerObject.h:51
TriggerNames.h
HotlineDQM::HotlineDQM
HotlineDQM(const edm::ParameterSet &ps)
Definition: HotlineDQM.cc:8
HotlineDQM::usePhotons
bool usePhotons
Definition: HotlineDQM.h:62
HotlineDQM::h_PhotonPt
MonitorElement * h_PhotonPt
Definition: HotlineDQM.h:66
trigger::Keys
std::vector< size_type > Keys
Definition: TriggerTypeDefs.h:19
HotlineDQM::theMuonCollection_
edm::EDGetTokenT< reco::MuonCollection > theMuonCollection_
Definition: HotlineDQM.h:51
edm::EventSetup
Definition: EventSetup.h:57
ewkDQM_cfi.caloMETCollection
caloMETCollection
Definition: ewkDQM_cfi.py:14
HotlineDQM::theCaloJetCollection_
edm::EDGetTokenT< reco::CaloJetCollection > theCaloJetCollection_
Definition: HotlineDQM.h:54
TriggerObject.h
HotlineDQM::h_OnlinePhotonPt
MonitorElement * h_OnlinePhotonPt
Definition: HotlineDQM.h:72
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
B2GDQM_cfi.pfMETCollection
pfMETCollection
Definition: B2GDQM_cfi.py:27
HotlineDQM::h_MuPt
MonitorElement * h_MuPt
Definition: HotlineDQM.h:65
Frameworkfwd.h
HotlineDQM::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HotlineDQM.cc:214
edm::TriggerNames
Definition: TriggerNames.h:55
dqm::implementation::IBooker
Definition: DQMStore.h:43
HotlineDQM::triggerPath_
std::string triggerPath_
Definition: HotlineDQM.h:59
reco::PhotonCollection
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
HotlineDQM::h_OnlineHT
MonitorElement * h_OnlineHT
Definition: HotlineDQM.h:73
edm::Event
Definition: Event.h:73
crabWrapper.key
key
Definition: crabWrapper.py:19
pdwgLeptonRecoSkim_cfi.caloJetCollection
caloJetCollection
Definition: pdwgLeptonRecoSkim_cfi.py:8
edm::InputTag
Definition: InputTag.h:15
HotlineDQM::h_MetPt
MonitorElement * h_MetPt
Definition: HotlineDQM.h:68
HotlineDQM::triggerResults_
edm::EDGetTokenT< edm::TriggerResults > triggerResults_
Definition: HotlineDQM.h:56
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
HotlineDQM::h_OnlineMuPt
MonitorElement * h_OnlineMuPt
Definition: HotlineDQM.h:71
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37