CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SUSY_HLT_Muon_BJet.cc
Go to the documentation of this file.
8 
10 {
11  edm::LogInfo("SUSY_HLT_Muon_BJet") << "Constructor SUSY_HLT_Muon_BJet::SUSY_HLT_Muon_BJet " << std::endl;
12  // Get parameters from configuration file
13  theTrigSummary_ = consumes<trigger::TriggerEvent>(ps.getParameter<edm::InputTag>("trigSummary"));
14  theMuonCollection_ = consumes<reco::MuonCollection>(ps.getParameter<edm::InputTag>("MuonCollection"));
15  thePfJetCollection_ = consumes<reco::PFJetCollection>(ps.getParameter<edm::InputTag>("pfJetCollection"));
16  theCaloJetCollection_ = consumes<reco::CaloJetCollection>(ps.getParameter<edm::InputTag>("caloJetCollection"));
17  triggerResults_ = consumes<edm::TriggerResults>(ps.getParameter<edm::InputTag>("TriggerResults"));
18  HLTProcess_ = ps.getParameter<std::string>("HLTProcess");
19  triggerPath_ = ps.getParameter<std::string>("TriggerPath");
20  triggerFilterMuon_ = ps.getParameter<edm::InputTag>("TriggerFilterMuon");
21  triggerFilterJet_ = ps.getParameter<edm::InputTag>("TriggerFilterJet");
22  ptThrJet_ = ps.getUntrackedParameter<double>("PtThrJet");
23  etaThrJet_ = ps.getUntrackedParameter<double>("EtaThrJet");
24 }
25 
27 {
28  edm::LogInfo("SUSY_HLT_Muon_BJet") << "Destructor SUSY_HLT_Muon_BJet::~SUSY_HLT_Muon_BJet " << std::endl;
29 }
30 
32 {
33 
34  bool changed;
35 
36  if (!fHltConfig.init(run, e, HLTProcess_, changed)) {
37  edm::LogError("SUSY_HLT_Muon_BJet") << "Initialization of HLTConfigProvider failed!!";
38  return;
39  }
40 
41  bool pathFound = false;
42  const std::vector<std::string> allTrigNames = fHltConfig.triggerNames();
43  for(size_t j = 0; j <allTrigNames.size(); ++j) {
44  if(allTrigNames[j].find(triggerPath_) != std::string::npos) {
45  pathFound = true;
46  }
47  }
48 
49  if(!pathFound) {
50  LogDebug("SUSY_HLT_Muon_BJet") << "Path not found" << "\n";
51  return;
52  }
53 
54  edm::LogInfo("SUSY_HLT_Muon_BJet") << "SUSY_HLT_Muon_BJet::beginRun" << std::endl;
55 }
56 
58 {
59  edm::LogInfo("SUSY_HLT_Muon_BJet") << "SUSY_HLT_Muon_BJet::bookHistograms" << std::endl;
60  //book at beginRun
61  bookHistos(ibooker_);
62 }
63 
65  edm::EventSetup const& context)
66 {
67  edm::LogInfo("SUSY_HLT_Muon_BJet") << "SUSY_HLT_Muon_BJet::beginLuminosityBlock" << std::endl;
68 }
69 
70 
71 
73  edm::LogInfo("SUSY_HLT_Muon_BJet") << "SUSY_HLT_Muon_BJet::analyze" << std::endl;
74 
75 
76  //-------------------------------
77  //--- Trigger
78  //-------------------------------
80  e.getByToken(triggerResults_,hltresults);
81  if(!hltresults.isValid()){
82  edm::LogError ("SUSY_HLT_Muon_BJet") << "invalid collection: TriggerResults" << "\n";
83  return;
84  }
86  e.getByToken(theTrigSummary_, triggerSummary);
87  if(!triggerSummary.isValid()) {
88  edm::LogError ("SUSY_HLT_Muon_BJet") << "invalid collection: TriggerSummary" << "\n";
89  return;
90  }
91 
92  //get online objects
93  //std::vector<float> ptMuon, etaMuon, phiMuon;
94  size_t filterIndex = triggerSummary->filterIndex( triggerFilterMuon_ );
95  trigger::TriggerObjectCollection triggerObjects = triggerSummary->getObjects();
96  if( !(filterIndex >= triggerSummary->sizeFilters()) ){
97  const trigger::Keys& keys = triggerSummary->filterKeys( filterIndex );
98  for( size_t j = 0; j < keys.size(); ++j ){
99  trigger::TriggerObject foundObject = triggerObjects[keys[j]];
100  if(fabs(foundObject.id()) == 13){ //It's a muon
101  h_triggerMuPt->Fill(foundObject.pt());
102  h_triggerMuEta->Fill(foundObject.eta());
103  h_triggerMuPhi->Fill(foundObject.phi());
104  // ptMuon.push_back(foundObject.pt());
105  // etaMuon.push_back(foundObject.eta());
106  // phiMuon.push_back(foundObject.phi());
107  }
108  }
109  }
110 
111  size_t filterIndex2 = triggerSummary->filterIndex( triggerFilterJet_ );
112  if( !(filterIndex2 >= triggerSummary->sizeFilters()) ){
113  const trigger::Keys& keys = triggerSummary->filterKeys( filterIndex2 );
114  for( size_t j = 0; j < keys.size(); ++j ){
115  trigger::TriggerObject foundObject = triggerObjects[keys[j]];
116  h_triggerJetPt->Fill(foundObject.pt());
117  h_triggerJetEta->Fill(foundObject.eta());
118  h_triggerJetPhi->Fill(foundObject.phi());
119  }
120  }
121 
122 }
123 
124 
126 {
127  edm::LogInfo("SUSY_HLT_Muon_BJet") << "SUSY_HLT_Muon_BJet::endLuminosityBlock" << std::endl;
128 }
129 
130 
132 {
133  edm::LogInfo("SUSY_HLT_Muon_BJet") << "SUSY_HLT_Muon_BJet::endRun" << std::endl;
134 }
135 
137 {
138  ibooker_.cd();
139  ibooker_.setCurrentFolder("HLT/SUSYBSM/" + triggerPath_);
140 
141  //offline quantities
142 
143  //online quantities
144  h_triggerMuPt = ibooker_.book1D("triggerMuPt", "Trigger Muon Pt; GeV", 50, 0.0, 500.0);
145  h_triggerMuEta = ibooker_.book1D("triggerMuEta", "Trigger Muon Eta", 20, -3.0, 3.0);
146  h_triggerMuPhi = ibooker_.book1D("triggerMuPhi", "Trigger Muon Phi", 20, -3.5, 3.5);
147 
148  h_triggerJetPt = ibooker_.book1D("triggerJetPt", "Trigger Jet Pt; GeV", 50, 0.0, 500.0);
149  h_triggerJetEta = ibooker_.book1D("triggerJetEta", "Trigger Jet Eta", 20, -3.0, 3.0);
150  h_triggerJetPhi = ibooker_.book1D("triggerJetPhi", "Trigger Jet Phi", 20, -3.5, 3.5);
151 
152  ibooker_.cd();
153 }
154 
155 //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
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup)
int id() const
getters
Definition: TriggerObject.h:55
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
float phi() const
Definition: TriggerObject.h:58
void cd(void)
Definition: DQMStore.cc:266
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
const std::vector< std::string > & triggerNames() const
names of trigger paths
MonitorElement * h_triggerJetPt
edm::EDGetTokenT< reco::MuonCollection > theMuonCollection_
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:7
MonitorElement * h_triggerJetPhi
void Fill(long long x)
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
HLTConfigProvider fHltConfig
edm::InputTag triggerFilterJet_
void bookHistos(DQMStore::IBooker &)
SUSY_HLT_Muon_BJet(const edm::ParameterSet &ps)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
MonitorElement * h_triggerMuEta
int j
Definition: DBlmapReader.cc:9
MonitorElement * h_triggerMuPt
edm::EDGetTokenT< reco::PFJetCollection > thePfJetCollection_
bool isValid() const
Definition: HandleBase.h:75
edm::EDGetTokenT< trigger::TriggerEvent > theTrigSummary_
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
std::vector< size_type > Keys
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
void endLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup)
MonitorElement * h_triggerJetEta
void analyze(edm::Event const &e, edm::EventSetup const &eSetup)
edm::InputTag triggerFilterMuon_
edm::EDGetTokenT< reco::CaloJetCollection > theCaloJetCollection_
MonitorElement * h_triggerMuPhi
Definition: Run.h:43
void endRun(edm::Run const &run, edm::EventSetup const &eSetup)