CMS 3D CMS Logo

SUSY_HLT_InclusiveHT.cc
Go to the documentation of this file.
7 
8 
10 {
11  edm::LogInfo("SUSY_HLT_InclusiveHT") << "Constructor SUSY_HLT_InclusiveHT::SUSY_HLT_InclusiveHT " << std::endl;
12  // Get parameters from configuration file
13  theTrigSummary_ = consumes<trigger::TriggerEvent>(ps.getParameter<edm::InputTag>("trigSummary"));
14  thePfMETCollection_ = consumes<reco::PFMETCollection>(ps.getParameter<edm::InputTag>("pfMETCollection"));
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  triggerPath_ = ps.getParameter<std::string>("TriggerPath");
19  triggerPathAuxiliaryForHadronic_ = ps.getParameter<std::string>("TriggerPathAuxiliaryForHadronic");
20  triggerFilter_ = ps.getParameter<edm::InputTag>("TriggerFilter");
21  ptThrJet_ = ps.getUntrackedParameter<double>("PtThrJet");
22  etaThrJet_ = ps.getUntrackedParameter<double>("EtaThrJet");
23 }
24 
26 {
27  edm::LogInfo("SUSY_HLT_InclusiveHT") << "Destructor SUSY_HLT_InclusiveHT::~SUSY_HLT_InclusiveHT " << std::endl;
28 }
29 
31 {
32  edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::beginRun" << std::endl;
33 }
34 
36 {
37  edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::bookHistograms" << std::endl;
38  //book at beginRun
39  bookHistos(ibooker_);
40 }
41 
42 
44  edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::analyze" << std::endl;
45 
46 
47  //-------------------------------
48  //--- MET
49  //-------------------------------
50  edm::Handle<reco::PFMETCollection> pfMETCollection;
51  e.getByToken(thePfMETCollection_, pfMETCollection);
52  if ( !pfMETCollection.isValid() ){
53  edm::LogError ("SUSY_HLT_InclusiveHT") << "invalid collection: PFMET" << "\n";
54  return;
55  }
56  //-------------------------------
57  //--- Jets
58  //-------------------------------
59  edm::Handle<reco::PFJetCollection> pfJetCollection;
60  e.getByToken (thePfJetCollection_,pfJetCollection);
61  if ( !pfJetCollection.isValid() ){
62  edm::LogError ("SUSY_HLT_InclusiveHT") << "invalid collection: PFJets" << "\n";
63  return;
64  }
65  edm::Handle<reco::CaloJetCollection> caloJetCollection;
66  e.getByToken (theCaloJetCollection_,caloJetCollection);
67  if ( !caloJetCollection.isValid() ){
68  edm::LogError ("SUSY_HLT_InclusiveHT") << "invalid collection: CaloJets" << "\n";
69  return;
70  }
71 
72  //check what is in the menu
74  e.getByToken(triggerResults_,hltresults);
75  if(!hltresults.isValid()){
76  edm::LogError ("SUSY_HLT_InclusiveHT") << "invalid collection: TriggerResults" << "\n";
77  return;
78  }
79 
80  //-------------------------------
81  //--- Trigger
82  //-------------------------------
84  e.getByToken(theTrigSummary_, triggerSummary);
85  if(!triggerSummary.isValid()) {
86  edm::LogError ("SUSY_HLT_InclusiveHT") << "invalid collection: TriggerSummary" << "\n";
87  return;
88  }
89 
90  //get online objects
91  size_t filterIndex = triggerSummary->filterIndex( triggerFilter_ );
93  if( !(filterIndex >= triggerSummary->sizeFilters()) ){
94  const trigger::Keys& keys = triggerSummary->filterKeys( filterIndex );
95  for( size_t j = 0; j < keys.size(); ++j ){
96  trigger::TriggerObject foundObject = triggerObjects[keys[j]];
97  //if(foundObject.id() == 85 && foundObject.pt() > 40.0 && fabs(foundObject.eta()) < 3.0){
98  // h_triggerJetPt->Fill(foundObject.pt());
99  // h_triggerJetEta->Fill(foundObject.eta());
100  // h_triggerJetPhi->Fill(foundObject.phi());
101  //}
102  if(foundObject.id() == 87){
103  h_triggerMetPt->Fill(foundObject.pt());
104  h_triggerMetPhi->Fill(foundObject.phi());
105  }
106  if(foundObject.id() == 89){
107  h_triggerHT->Fill(foundObject.pt());
108  }
109  }
110  }
111 
112  bool hasFired = false, hasFiredAuxiliaryForHadronicLeg=false;
113  const edm::TriggerNames& trigNames = e.triggerNames(*hltresults);
114  unsigned int numTriggers = trigNames.size();
115  for( unsigned int hltIndex=0; hltIndex<numTriggers; ++hltIndex ){
116  if (trigNames.triggerName(hltIndex).find(triggerPath_) != std::string::npos && hltresults->wasrun(hltIndex) && hltresults->accept(hltIndex)) hasFired = true;
117  if (trigNames.triggerName(hltIndex).find(triggerPathAuxiliaryForHadronic_) != std::string::npos && hltresults->wasrun(hltIndex) && hltresults->accept(hltIndex)) hasFiredAuxiliaryForHadronicLeg = true;
118  }
119 
120  if(hasFiredAuxiliaryForHadronicLeg || !e.isRealData()) {
121  float caloHT = 0.0;
122  float pfHT = 0.0;
123  for (reco::PFJetCollection::const_iterator i_pfjet = pfJetCollection->begin(); i_pfjet != pfJetCollection->end(); ++i_pfjet){
124  if (i_pfjet->pt() < ptThrJet_) continue;
125  if (fabs(i_pfjet->eta()) > etaThrJet_) continue;
126  pfHT += i_pfjet->pt();
127  }
128 
129  if(hasFired){
130  for (reco::CaloJetCollection::const_iterator i_calojet = caloJetCollection->begin(); i_calojet != caloJetCollection->end(); ++i_calojet){
131  if (i_calojet->pt() < ptThrJet_) continue;
132  if (fabs(i_calojet->eta()) > etaThrJet_) continue;
133  h_caloJetPt ->Fill(i_calojet->pt());
134  h_caloJetEta ->Fill(i_calojet->eta());
135  h_caloJetPhi ->Fill(i_calojet->phi());
136  caloHT += i_calojet->pt();
137  }
138  for (reco::PFJetCollection::const_iterator i_pfjet = pfJetCollection->begin(); i_pfjet != pfJetCollection->end(); ++i_pfjet){
139  if (i_pfjet->pt() < ptThrJet_) continue;
140  if (fabs(i_pfjet->eta()) > etaThrJet_) continue;
141  h_pfJetPt ->Fill(i_pfjet->pt());
142  h_pfJetEta ->Fill(i_pfjet->eta());
143  h_pfJetPhi ->Fill(i_pfjet->phi());
144  }
145  h_pfMet -> Fill(pfMETCollection->begin()->et());
146  h_pfMetPhi -> Fill(pfMETCollection->begin()->phi());
147  h_pfHT -> Fill(pfHT);
148  h_caloHT -> Fill(caloHT);
149 
150  h_pfMetTurnOn_num -> Fill(pfMETCollection->begin()->et());
151  h_pfHTTurnOn_num -> Fill(pfHT);
152  }
153  //fill denominator histograms for all events, used for turn on curves
154  h_pfMetTurnOn_den -> Fill(pfMETCollection->begin()->et());
155  h_pfHTTurnOn_den -> Fill(pfHT);
156  }
157 }
158 
159 
160 
161 
163 {
164  edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::endRun" << std::endl;
165 }
166 
168 {
169  ibooker_.cd();
170  ibooker_.setCurrentFolder("HLT/SUSYBSM/" + triggerPath_);
171 
172  //offline quantities
173  h_pfMet = ibooker_.book1D("pfMet", "PF Missing E_{T}; GeV", 20, 0.0, 500.0 );
174  h_pfMetPhi = ibooker_.book1D("pfMetPhi", "PF MET Phi", 20, -3.5, 3.5 );
175  h_pfHT = ibooker_.book1D("pfHT", "PF H_{T}; GeV", 30, 0.0, 1500.0);
176  h_caloHT = ibooker_.book1D("caloHT", "Calo H_{T}; GeV", 30, 0.0, 1500.0);
177  h_pfJetPt = ibooker_.book1D("pfJetPt", "PFJet P_{T}; GeV", 20, 0.0, 500.0 );
178  h_pfJetEta = ibooker_.book1D("pfJetEta", "PFJet Eta", 20, -3.0, 3.0 );
179  h_pfJetPhi = ibooker_.book1D("pfJetPhi", "PFJet Phi", 20, -3.5, 3.5 );
180  h_caloJetPt = ibooker_.book1D("caloJetPt", "CaloJet P_{T}; GeV", 20, 0.0, 500.0 );
181  h_caloJetEta = ibooker_.book1D("caloJetEta", "CaloJet Eta", 20, -3.0, 3.0 );
182  h_caloJetPhi = ibooker_.book1D("caloJetPhi", "CaloJet Phi", 20, -3.5, 3.5 );
183 
184  //online quantities
185  //h_triggerJetPt = ibooker_.book1D("triggerJetPt", "Trigger Jet Pt; GeV", 20, 0.0, 500.0);
186  //h_triggerJetEta = ibooker_.book1D("triggerJetEta", "Trigger Jet Eta", 20, -3.0, 3.0);
187  //h_triggerJetPhi = ibooker_.book1D("triggerJetPhi", "Trigger Jet Phi", 20, -3.5, 3.5);
188  h_triggerMetPt = ibooker_.book1D("triggerMetPt", "Trigger Met Pt; GeV", 20, 0.0, 500.0);
189  h_triggerMetPhi = ibooker_.book1D("triggerMetPhi", "Trigger Met Phi", 20, -3.5, 3.5);
190  h_triggerHT = ibooker_.book1D("triggerHT", "Trigger HT; GeV", 30, 0.0, 1500.0);
191 
192  //num and den hists to be divided in harvesting step to make turn on curves
193  h_pfMetTurnOn_num = ibooker_.book1D("pfMetTurnOn_num", "PF MET Turn On Numerator", 20, 0.0, 500.0 );
194  h_pfMetTurnOn_den = ibooker_.book1D("pfMetTurnOn_den", "PF MET Turn OnDenominator", 20, 0.0, 500.0 );
195  h_pfHTTurnOn_num = ibooker_.book1D("pfHTTurnOn_num", "PF HT Turn On Numerator", 30, 0.0, 1500.0 );
196  h_pfHTTurnOn_den = ibooker_.book1D("pfHTTurnOn_den", "PF HT Turn On Denominator", 30, 0.0, 1500.0 );
197 
198  ibooker_.cd();
199 }
200 
201  //define this as a plug-in
MonitorElement * h_pfHTTurnOn_num
SUSY_HLT_InclusiveHT(const edm::ParameterSet &ps)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool wasrun() const
Was at least one path run?
int id() const
getters
Definition: TriggerObject.h:55
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:135
std::string triggerPathAuxiliaryForHadronic_
MonitorElement * h_caloHT
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
float phi() const
Definition: TriggerObject.h:58
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
bool accept() const
Has at least one path accepted the event?
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_pfJetEta
MonitorElement * h_pfHTTurnOn_den
void endRun(edm::Run const &run, edm::EventSetup const &eSetup) override
Strings::size_type size() const
Definition: TriggerNames.cc:39
bool isRealData() const
Definition: EventBase.h:64
edm::EDGetTokenT< reco::PFJetCollection > thePfJetCollection_
void Fill(long long x)
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:98
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
edm::EDGetTokenT< trigger::TriggerEvent > theTrigSummary_
bool isValid() const
Definition: HandleBase.h:74
MonitorElement * h_pfMetPhi
MonitorElement * h_pfMetTurnOn_num
edm::EDGetTokenT< edm::TriggerResults > triggerResults_
MonitorElement * h_caloJetEta
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
MonitorElement * h_pfJetPt
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:74
MonitorElement * h_triggerMetPt
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * h_triggerHT
void bookHistos(DQMStore::IBooker &)
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
std::vector< size_type > Keys
MonitorElement * h_caloJetPt
MonitorElement * h_pfMetTurnOn_den
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
MonitorElement * h_pfMet
MonitorElement * h_caloJetPhi
MonitorElement * h_triggerMetPhi
MonitorElement * h_pfJetPhi
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:301
edm::EDGetTokenT< reco::CaloJetCollection > theCaloJetCollection_
edm::EDGetTokenT< reco::PFMETCollection > thePfMETCollection_
Definition: Run.h:44