CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
43  edm::EventSetup const& context)
44 {
45  edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::beginLuminosityBlock" << std::endl;
46 }
47 
49  edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::analyze" << std::endl;
50 
51 
52  //-------------------------------
53  //--- MET
54  //-------------------------------
55  edm::Handle<reco::PFMETCollection> pfMETCollection;
56  e.getByToken(thePfMETCollection_, pfMETCollection);
57  if ( !pfMETCollection.isValid() ){
58  edm::LogError ("SUSY_HLT_InclusiveHT") << "invalid collection: PFMET" << "\n";
59  return;
60  }
61  //-------------------------------
62  //--- Jets
63  //-------------------------------
64  edm::Handle<reco::PFJetCollection> pfJetCollection;
65  e.getByToken (thePfJetCollection_,pfJetCollection);
66  if ( !pfJetCollection.isValid() ){
67  edm::LogError ("SUSY_HLT_InclusiveHT") << "invalid collection: PFJets" << "\n";
68  return;
69  }
70  edm::Handle<reco::CaloJetCollection> caloJetCollection;
71  e.getByToken (theCaloJetCollection_,caloJetCollection);
72  if ( !caloJetCollection.isValid() ){
73  edm::LogError ("SUSY_HLT_InclusiveHT") << "invalid collection: CaloJets" << "\n";
74  return;
75  }
76 
77  //check what is in the menu
79  e.getByToken(triggerResults_,hltresults);
80  if(!hltresults.isValid()){
81  edm::LogError ("SUSY_HLT_InclusiveHT") << "invalid collection: TriggerResults" << "\n";
82  return;
83  }
84 
85  //-------------------------------
86  //--- Trigger
87  //-------------------------------
89  e.getByToken(theTrigSummary_, triggerSummary);
90  if(!triggerSummary.isValid()) {
91  edm::LogError ("SUSY_HLT_InclusiveHT") << "invalid collection: TriggerSummary" << "\n";
92  return;
93  }
94 
95  //get online objects
96  size_t filterIndex = triggerSummary->filterIndex( triggerFilter_ );
97  trigger::TriggerObjectCollection triggerObjects = triggerSummary->getObjects();
98  if( !(filterIndex >= triggerSummary->sizeFilters()) ){
99  const trigger::Keys& keys = triggerSummary->filterKeys( filterIndex );
100  for( size_t j = 0; j < keys.size(); ++j ){
101  trigger::TriggerObject foundObject = triggerObjects[keys[j]];
102  //if(foundObject.id() == 85 && foundObject.pt() > 40.0 && fabs(foundObject.eta()) < 3.0){
103  // h_triggerJetPt->Fill(foundObject.pt());
104  // h_triggerJetEta->Fill(foundObject.eta());
105  // h_triggerJetPhi->Fill(foundObject.phi());
106  //}
107  if(foundObject.id() == 87){
108  h_triggerMetPt->Fill(foundObject.pt());
109  h_triggerMetPhi->Fill(foundObject.phi());
110  }
111  if(foundObject.id() == 89){
112  h_triggerHT->Fill(foundObject.pt());
113  }
114  }
115  }
116 
117  bool hasFired = false, hasFiredAuxiliaryForHadronicLeg=false;
118  const edm::TriggerNames& trigNames = e.triggerNames(*hltresults);
119  unsigned int numTriggers = trigNames.size();
120  for( unsigned int hltIndex=0; hltIndex<numTriggers; ++hltIndex ){
121  if (trigNames.triggerName(hltIndex).find(triggerPath_) != std::string::npos && hltresults->wasrun(hltIndex) && hltresults->accept(hltIndex)) hasFired = true;
122  if (trigNames.triggerName(hltIndex).find(triggerPathAuxiliaryForHadronic_) != std::string::npos && hltresults->wasrun(hltIndex) && hltresults->accept(hltIndex)) hasFiredAuxiliaryForHadronicLeg = true;
123  }
124 
125  if(hasFiredAuxiliaryForHadronicLeg || !e.isRealData()) {
126  float caloHT = 0.0;
127  float pfHT = 0.0;
128  for (reco::PFJetCollection::const_iterator i_pfjet = pfJetCollection->begin(); i_pfjet != pfJetCollection->end(); ++i_pfjet){
129  if (i_pfjet->pt() < ptThrJet_) continue;
130  if (fabs(i_pfjet->eta()) > etaThrJet_) continue;
131  pfHT += i_pfjet->pt();
132  }
133 
134  if(hasFired){
135  for (reco::CaloJetCollection::const_iterator i_calojet = caloJetCollection->begin(); i_calojet != caloJetCollection->end(); ++i_calojet){
136  if (i_calojet->pt() < ptThrJet_) continue;
137  if (fabs(i_calojet->eta()) > etaThrJet_) continue;
138  h_caloJetPt ->Fill(i_calojet->pt());
139  h_caloJetEta ->Fill(i_calojet->eta());
140  h_caloJetPhi ->Fill(i_calojet->phi());
141  caloHT += i_calojet->pt();
142  }
143  for (reco::PFJetCollection::const_iterator i_pfjet = pfJetCollection->begin(); i_pfjet != pfJetCollection->end(); ++i_pfjet){
144  if (i_pfjet->pt() < ptThrJet_) continue;
145  if (fabs(i_pfjet->eta()) > etaThrJet_) continue;
146  h_pfJetPt ->Fill(i_pfjet->pt());
147  h_pfJetEta ->Fill(i_pfjet->eta());
148  h_pfJetPhi ->Fill(i_pfjet->phi());
149  }
150  h_pfMet -> Fill(pfMETCollection->begin()->et());
151  h_pfMetPhi -> Fill(pfMETCollection->begin()->phi());
152  h_pfHT -> Fill(pfHT);
153  h_caloHT -> Fill(caloHT);
154 
155  h_pfMetTurnOn_num -> Fill(pfMETCollection->begin()->et());
156  h_pfHTTurnOn_num -> Fill(pfHT);
157  }
158  //fill denominator histograms for all events, used for turn on curves
159  h_pfMetTurnOn_den -> Fill(pfMETCollection->begin()->et());
160  h_pfHTTurnOn_den -> Fill(pfHT);
161  }
162 }
163 
164 
166 {
167  edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::endLuminosityBlock" << std::endl;
168 }
169 
170 
172 {
173  edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::endRun" << std::endl;
174 }
175 
177 {
178  ibooker_.cd();
179  ibooker_.setCurrentFolder("HLT/SUSYBSM/" + triggerPath_);
180 
181  //offline quantities
182  h_pfMet = ibooker_.book1D("pfMet", "PF Missing E_{T}; GeV", 20, 0.0, 500.0 );
183  h_pfMetPhi = ibooker_.book1D("pfMetPhi", "PF MET Phi", 20, -3.5, 3.5 );
184  h_pfHT = ibooker_.book1D("pfHT", "PF H_{T}; GeV", 30, 0.0, 1500.0);
185  h_caloHT = ibooker_.book1D("caloHT", "Calo H_{T}; GeV", 30, 0.0, 1500.0);
186  h_pfJetPt = ibooker_.book1D("pfJetPt", "PFJet P_{T}; GeV", 20, 0.0, 500.0 );
187  h_pfJetEta = ibooker_.book1D("pfJetEta", "PFJet Eta", 20, -3.0, 3.0 );
188  h_pfJetPhi = ibooker_.book1D("pfJetPhi", "PFJet Phi", 20, -3.5, 3.5 );
189  h_caloJetPt = ibooker_.book1D("caloJetPt", "CaloJet P_{T}; GeV", 20, 0.0, 500.0 );
190  h_caloJetEta = ibooker_.book1D("caloJetEta", "CaloJet Eta", 20, -3.0, 3.0 );
191  h_caloJetPhi = ibooker_.book1D("caloJetPhi", "CaloJet Phi", 20, -3.5, 3.5 );
192 
193  //online quantities
194  //h_triggerJetPt = ibooker_.book1D("triggerJetPt", "Trigger Jet Pt; GeV", 20, 0.0, 500.0);
195  //h_triggerJetEta = ibooker_.book1D("triggerJetEta", "Trigger Jet Eta", 20, -3.0, 3.0);
196  //h_triggerJetPhi = ibooker_.book1D("triggerJetPhi", "Trigger Jet Phi", 20, -3.5, 3.5);
197  h_triggerMetPt = ibooker_.book1D("triggerMetPt", "Trigger Met Pt; GeV", 20, 0.0, 500.0);
198  h_triggerMetPhi = ibooker_.book1D("triggerMetPhi", "Trigger Met Phi", 20, -3.5, 3.5);
199  h_triggerHT = ibooker_.book1D("triggerHT", "Trigger HT; GeV", 30, 0.0, 1500.0);
200 
201  //num and den hists to be divided in harvesting step to make turn on curves
202  h_pfMetTurnOn_num = ibooker_.book1D("pfMetTurnOn_num", "PF MET Turn On Numerator", 20, 0.0, 500.0 );
203  h_pfMetTurnOn_den = ibooker_.book1D("pfMetTurnOn_den", "PF MET Turn OnDenominator", 20, 0.0, 500.0 );
204  h_pfHTTurnOn_num = ibooker_.book1D("pfHTTurnOn_num", "PF HT Turn On Numerator", 30, 0.0, 1500.0 );
205  h_pfHTTurnOn_den = ibooker_.book1D("pfHTTurnOn_den", "PF HT Turn On Denominator", 30, 0.0, 1500.0 );
206 
207  ibooker_.cd();
208 }
209 
210  //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
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:208
int id() const
getters
Definition: TriggerObject.h:55
std::string triggerPathAuxiliaryForHadronic_
MonitorElement * h_caloHT
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
float phi() const
Definition: TriggerObject.h:58
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup)
void cd(void)
Definition: DQMStore.cc:266
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
MonitorElement * h_pfJetEta
MonitorElement * h_pfHTTurnOn_den
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
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
edm::EDGetTokenT< trigger::TriggerEvent > theTrigSummary_
int j
Definition: DBlmapReader.cc:9
void endRun(edm::Run const &run, edm::EventSetup const &eSetup)
bool isValid() const
Definition: HandleBase.h:75
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
void analyze(edm::Event const &e, edm::EventSetup const &eSetup)
MonitorElement * h_pfJetPhi
edm::EDGetTokenT< reco::CaloJetCollection > theCaloJetCollection_
edm::EDGetTokenT< reco::PFMETCollection > thePfMETCollection_
void endLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup)
Definition: Run.h:41