CMS 3D CMS Logo

SUSY_HLT_Muon_BJet.cc
Go to the documentation of this file.
8 
10  edm::LogInfo("SUSY_HLT_Muon_BJet") << "Constructor SUSY_HLT_Muon_BJet::SUSY_HLT_Muon_BJet " << std::endl;
11  // Get parameters from configuration file
12  theTrigSummary_ = consumes<trigger::TriggerEvent>(ps.getParameter<edm::InputTag>("trigSummary"));
13  theMuonCollection_ = consumes<reco::MuonCollection>(ps.getParameter<edm::InputTag>("MuonCollection"));
14  thePfJetCollection_ = consumes<reco::PFJetCollection>(ps.getParameter<edm::InputTag>("pfJetCollection"));
15  theCaloJetCollection_ = consumes<reco::CaloJetCollection>(ps.getParameter<edm::InputTag>("caloJetCollection"));
16  triggerResults_ = consumes<edm::TriggerResults>(ps.getParameter<edm::InputTag>("TriggerResults"));
17  HLTProcess_ = ps.getParameter<std::string>("HLTProcess");
18  triggerPath_ = ps.getParameter<std::string>("TriggerPath");
19  triggerFilterMuon_ = ps.getParameter<edm::InputTag>("TriggerFilterMuon");
20  triggerFilterJet_ = ps.getParameter<edm::InputTag>("TriggerFilterJet");
21  ptThrJet_ = ps.getUntrackedParameter<double>("PtThrJet");
22  etaThrJet_ = ps.getUntrackedParameter<double>("EtaThrJet");
23 }
24 
26  edm::LogInfo("SUSY_HLT_Muon_BJet") << "Destructor SUSY_HLT_Muon_BJet::~SUSY_HLT_Muon_BJet " << std::endl;
27 }
28 
30  edm::EventSetup const &e) //
31 {
32  bool changed;
33 
34  if (!fHltConfig.init(run, e, HLTProcess_, changed)) {
35  edm::LogError("SUSY_HLT_Muon_BJet") << "Initialization of HLTConfigProvider failed!!";
36  return;
37  }
38 
39  bool pathFound = false;
40  const std::vector<std::string> allTrigNames = fHltConfig.triggerNames();
41  for (size_t j = 0; j < allTrigNames.size(); ++j) {
42  if (allTrigNames[j].find(triggerPath_) != std::string::npos) {
43  pathFound = true;
44  }
45  }
46 
47  if (!pathFound) {
48  LogDebug("SUSY_HLT_Muon_BJet") << "Path not found"
49  << "\n";
50  return;
51  }
52 
53  edm::LogInfo("SUSY_HLT_Muon_BJet") << "SUSY_HLT_Muon_BJet::beginRun" << std::endl;
54 }
55 
57  edm::LogInfo("SUSY_HLT_Muon_BJet") << "SUSY_HLT_Muon_BJet::bookHistograms" << std::endl;
58  // book at beginRun
59  bookHistos(ibooker_);
60 }
61 
63  edm::LogInfo("SUSY_HLT_Muon_BJet") << "SUSY_HLT_Muon_BJet::analyze" << std::endl;
64 
65  //-------------------------------
66  //--- Trigger
67  //-------------------------------
69  e.getByToken(triggerResults_, hltresults);
70  if (!hltresults.isValid()) {
71  edm::LogError("SUSY_HLT_Muon_BJet") << "invalid collection: TriggerResults"
72  << "\n";
73  return;
74  }
76  e.getByToken(theTrigSummary_, triggerSummary);
77  if (!triggerSummary.isValid()) {
78  edm::LogError("SUSY_HLT_Muon_BJet") << "invalid collection: TriggerSummary"
79  << "\n";
80  return;
81  }
82 
83  // get online objects
84  // std::vector<float> ptMuon, etaMuon, phiMuon;
85  size_t filterIndex = triggerSummary->filterIndex(triggerFilterMuon_);
87  if (!(filterIndex >= triggerSummary->sizeFilters())) {
88  const trigger::Keys &keys = triggerSummary->filterKeys(filterIndex);
89  for (size_t j = 0; j < keys.size(); ++j) {
90  trigger::TriggerObject foundObject = triggerObjects[keys[j]];
91  if (fabs(foundObject.id()) == 13) { // It's a muon
92  h_triggerMuPt->Fill(foundObject.pt());
93  h_triggerMuEta->Fill(foundObject.eta());
94  h_triggerMuPhi->Fill(foundObject.phi());
95  // ptMuon.push_back(foundObject.pt());
96  // etaMuon.push_back(foundObject.eta());
97  // phiMuon.push_back(foundObject.phi());
98  }
99  }
100  }
101 
102  size_t filterIndex2 = triggerSummary->filterIndex(triggerFilterJet_);
103  if (!(filterIndex2 >= triggerSummary->sizeFilters())) {
104  const trigger::Keys &keys = triggerSummary->filterKeys(filterIndex2);
105  for (size_t j = 0; j < keys.size(); ++j) {
106  trigger::TriggerObject foundObject = triggerObjects[keys[j]];
107  h_triggerJetPt->Fill(foundObject.pt());
108  h_triggerJetEta->Fill(foundObject.eta());
109  h_triggerJetPhi->Fill(foundObject.phi());
110  }
111  }
112 }
113 
115  edm::LogInfo("SUSY_HLT_Muon_BJet") << "SUSY_HLT_Muon_BJet::endRun" << std::endl;
116 }
117 
119  ibooker_.cd();
120  ibooker_.setCurrentFolder("HLT/SUSYBSM/" + triggerPath_);
121 
122  // offline quantities
123 
124  // online quantities
125  h_triggerMuPt = ibooker_.book1D("triggerMuPt", "Trigger Muon Pt; GeV", 50, 0.0, 500.0);
126  h_triggerMuEta = ibooker_.book1D("triggerMuEta", "Trigger Muon Eta", 20, -3.0, 3.0);
127  h_triggerMuPhi = ibooker_.book1D("triggerMuPhi", "Trigger Muon Phi", 20, -3.5, 3.5);
128 
129  h_triggerJetPt = ibooker_.book1D("triggerJetPt", "Trigger Jet Pt; GeV", 50, 0.0, 500.0);
130  h_triggerJetEta = ibooker_.book1D("triggerJetEta", "Trigger Jet Eta", 20, -3.0, 3.0);
131  h_triggerJetPhi = ibooker_.book1D("triggerJetPhi", "Trigger Jet Phi", 20, -3.5, 3.5);
132 
133  ibooker_.cd();
134 }
135 
136 // define this as a plug-in
#define LogDebug(id)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::TriggerResults > triggerResults_
T getUntrackedParameter(std::string const &, T const &) const
int id() const
getters
Definition: TriggerObject.h:55
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:135
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
float phi() const
Definition: TriggerObject.h:58
const std::vector< std::string > & triggerNames() const
names of trigger paths
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:111
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:123
MonitorElement * h_triggerJetPt
edm::EDGetTokenT< reco::MuonCollection > theMuonCollection_
void endRun(edm::Run const &run, edm::EventSetup const &eSetup) override
float eta() const
Definition: TriggerObject.h:57
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
MonitorElement * h_triggerJetPhi
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
void Fill(long long x)
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
HLTConfigProvider fHltConfig
edm::InputTag triggerFilterJet_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:98
void bookHistos(DQMStore::IBooker &)
SUSY_HLT_Muon_BJet(const edm::ParameterSet &ps)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
MonitorElement * h_triggerMuEta
MonitorElement * h_triggerMuPt
edm::EDGetTokenT< reco::PFJetCollection > thePfJetCollection_
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< trigger::TriggerEvent > theTrigSummary_
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
std::vector< size_type > Keys
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
MonitorElement * h_triggerJetEta
~SUSY_HLT_Muon_BJet() override
edm::InputTag triggerFilterMuon_
edm::EDGetTokenT< reco::CaloJetCollection > theCaloJetCollection_
MonitorElement * h_triggerMuPhi
Definition: Run.h:45