Skip to content

Commit

Permalink
Merge pull request #5196 from jgran/SUSY_HLT_From7_2_0_pre5
Browse files Browse the repository at this point in the history
HLTriggerOffline/SUSYBSM -- Susy hlt from7 2 0 pre5
  • Loading branch information
nclopezo committed Sep 8, 2014
2 parents 287d35a + 202714e commit 795724a
Show file tree
Hide file tree
Showing 9 changed files with 365 additions and 4 deletions.
2 changes: 1 addition & 1 deletion HLTriggerOffline/Common/python/HLTValidationHarvest_cff.py
Expand Up @@ -43,7 +43,7 @@
+heavyFlavorValidationHarvestingSequence
+JetMETPostVal
#+HLTAlCaPostVal
+SusyExoPostVal
+SusyExoPostVal_fastsim
+HLTHiggsPostVal
+b2gHLTriggerValidationHarvest
)
Expand Down
82 changes: 82 additions & 0 deletions HLTriggerOffline/SUSYBSM/interface/SUSY_HLT_InclusiveHT.h
@@ -0,0 +1,82 @@
#ifndef SUSY_HLT_InclusiveHT_H
#define SUSY_HLT_InclusiveHT_H

//event
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"

//DQM
#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/MonitorElement.h"

// MET
#include "DataFormats/METReco/interface/PFMET.h"
#include "DataFormats/METReco/interface/PFMETCollection.h"

// Jets
#include "DataFormats/JetReco/interface/PFJet.h"
#include "DataFormats/JetReco/interface/CaloJet.h"

// Trigger
#include "DataFormats/Common/interface/TriggerResults.h"
#include "DataFormats/HLTReco/interface/TriggerObject.h"
#include "DataFormats/HLTReco/interface/TriggerEvent.h"
#include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h"


class SUSY_HLT_InclusiveHT: public DQMEDAnalyzer{

public:
SUSY_HLT_InclusiveHT(const edm::ParameterSet& ps);
virtual ~SUSY_HLT_InclusiveHT();

protected:
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override;
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
void analyze(edm::Event const& e, edm::EventSetup const& eSetup);
void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& eSetup) ;
void endLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& eSetup);
void endRun(edm::Run const& run, edm::EventSetup const& eSetup);

private:
//histos booking function
void bookHistos(DQMStore::IBooker &);

//variables from config file
edm::EDGetTokenT<reco::PFMETCollection> thePfMETCollection_;
edm::EDGetTokenT<reco::PFJetCollection> thePfJetCollection_;
edm::EDGetTokenT<reco::CaloJetCollection> theCaloJetCollection_;
edm::EDGetTokenT<edm::TriggerResults> triggerResults_;
edm::EDGetTokenT<trigger::TriggerEvent> theTrigSummary_;

std::string triggerPath_;
edm::InputTag triggerFilter_;
double ptThrJet_;
double etaThrJet_;

// Histograms
MonitorElement* h_pfMet;
MonitorElement* h_pfMetPhi;
MonitorElement* h_pfHT;
MonitorElement* h_caloHT;
MonitorElement* h_pfJetPt;
MonitorElement* h_pfJetEta;
MonitorElement* h_pfJetPhi;
MonitorElement* h_caloJetPt;
MonitorElement* h_caloJetEta;
MonitorElement* h_caloJetPhi;
MonitorElement* h_triggerJetPt;
MonitorElement* h_triggerJetEta;
MonitorElement* h_triggerJetPhi;
MonitorElement* h_triggerMetPt;
MonitorElement* h_triggerMetPhi;
MonitorElement* h_triggerHT;
MonitorElement* h_pfMetTurnOn_num;
MonitorElement* h_pfMetTurnOn_den;
MonitorElement* h_pfHTTurnOn_num;
MonitorElement* h_pfHTTurnOn_den;

};

#endif
14 changes: 14 additions & 0 deletions HLTriggerOffline/SUSYBSM/python/SUSYBSM_HT_MET_cff.py
@@ -0,0 +1,14 @@
import FWCore.ParameterSet.Config as cms

SUSY_HLT_HT_MET = cms.EDAnalyzer("SUSY_HLT_InclusiveHT",
trigSummary = cms.InputTag("hltTriggerSummaryAOD"),
pfMETCollection = cms.InputTag("pfMet"),
pfJetCollection = cms.InputTag("ak4PFJetsCHS"),
caloJetCollection = cms.InputTag("ak4CaloJets"),
TriggerResults = cms.InputTag('TriggerResults','','HLT'),
TriggerPath = cms.string('HLT_PFHT350_PFMET120_NoiseCleaned_v1'),
TriggerFilter = cms.InputTag('hltPFHT350', '', 'HLT'), #the last filter in the path
PtThrJet = cms.untracked.double(40.0),
EtaThrJet = cms.untracked.double(3.0)
)

14 changes: 14 additions & 0 deletions HLTriggerOffline/SUSYBSM/python/SUSYBSM_MET_BTAG_cff.py
@@ -0,0 +1,14 @@
import FWCore.ParameterSet.Config as cms

SUSY_HLT_MET_BTAG = cms.EDAnalyzer("SUSY_HLT_InclusiveHT",
trigSummary = cms.InputTag("hltTriggerSummaryAOD"),
pfMETCollection = cms.InputTag("pfMet"),
pfJetCollection = cms.InputTag("ak4PFJetsCHS"),
caloJetCollection = cms.InputTag("ak4CaloJets"),
TriggerResults = cms.InputTag('TriggerResults','','HLT'),
TriggerPath = cms.string('HLT_PFMET120_NoiseCleaned_BTagCSV07_v1'),
TriggerFilter = cms.InputTag('hltPFMET120Filter', '', 'HLT'), #the last filter in the path
PtThrJet = cms.untracked.double(40.0),
EtaThrJet = cms.untracked.double(3.0)
)

14 changes: 14 additions & 0 deletions HLTriggerOffline/SUSYBSM/python/SUSYBSM_inclusiveHT_cff.py
@@ -0,0 +1,14 @@
import FWCore.ParameterSet.Config as cms

SUSY_HLT_InclusiveHT = cms.EDAnalyzer("SUSY_HLT_InclusiveHT",
trigSummary = cms.InputTag("hltTriggerSummaryAOD"),
pfMETCollection = cms.InputTag("pfMet"),
pfJetCollection = cms.InputTag("ak4PFJetsCHS"),
caloJetCollection = cms.InputTag("ak4CaloJets"),
TriggerResults = cms.InputTag('TriggerResults','','HLT'),
TriggerPath = cms.string('HLT_PFHT900_v1'),
TriggerFilter = cms.InputTag('hltPFHT900', '', 'HLT'), #the last filter in the path
PtThrJet = cms.untracked.double(40.0),
EtaThrJet = cms.untracked.double(3.0)
)

14 changes: 14 additions & 0 deletions HLTriggerOffline/SUSYBSM/python/SUSYBSM_inclusiveMET_cff.py
@@ -0,0 +1,14 @@
import FWCore.ParameterSet.Config as cms

SUSY_HLT_InclusiveMET = cms.EDAnalyzer("SUSY_HLT_InclusiveHT",
trigSummary = cms.InputTag("hltTriggerSummaryAOD"),
pfMETCollection = cms.InputTag("pfMet"),
pfJetCollection = cms.InputTag("ak4PFJetsCHS"),
caloJetCollection = cms.InputTag("ak4CaloJets"),
TriggerResults = cms.InputTag('TriggerResults','','HLT'),
TriggerPath = cms.string('HLT_PFMET170_NoiseCleaned_v1'),
TriggerFilter = cms.InputTag('hltPFMET170Filter', '', 'HLT'), #the last filter in the path
PtThrJet = cms.untracked.double(40.0),
EtaThrJet = cms.untracked.double(3.0)
)

15 changes: 14 additions & 1 deletion HLTriggerOffline/SUSYBSM/python/SUSYBSM_postProcessor_cff.py
@@ -1,9 +1,22 @@
import FWCore.ParameterSet.Config as cms
import HLTriggerOffline.SUSYBSM.SUSYBSM_triggerValidation_cff as dir_source

SusyExoPostVal = cms.EDAnalyzer("HltSusyExoPostProcessor",
SusyExoPostVal_fastsim = cms.EDAnalyzer("HltSusyExoPostProcessor",
subDir = dir_source.HLTSusyExoVal.dirname,
mc_flag = dir_source.HLTSusyExoVal.mc_flag,
reco_parametersets = dir_source.HLTSusyExoVal.reco_parametersets,
mc_parametersets = dir_source.HLTSusyExoVal.mc_parametersets
)

SusyExoPostVal = cms.EDAnalyzer("DQMGenericClient",
subDirs = cms.untracked.vstring("HLTriggerOffline/SUSYBSM/HLT_PFHT900_v1",
"HLTriggerOffline/SUSYBSM/HLT_PFHT350_PFMET120_NoiseCleaned_v1",
"HLTriggerOffline/SUSYBSM/HLT_PFMET170_NoiseCleaned_v1",
"HLTriggerOffline/SUSYBSM/HLT_PFMET120_NoiseCleaned_BTagCSV07_v1"
),
efficiency = cms.vstring(
"pfMetTurnOn_eff 'Efficiency vs PFMET' pfMetTurnOn_num pfMetTurnOn_den",
"pfHTTurnOn_eff 'Efficiency vs PFHT' pfHTTurnOn_num pfHTTurnOn_den"
),
resolution = cms.vstring("")
)
7 changes: 5 additions & 2 deletions HLTriggerOffline/SUSYBSM/python/SusyExoValidation_cff.py
@@ -1,5 +1,8 @@
from HLTriggerOffline.SUSYBSM.SUSYBSM_triggerValidation_cff import *
from HLTriggerOffline.SUSYBSM.SUSYBSM_triggerValidation_fastSim_cff import *
from HLTriggerOffline.SUSYBSM.SUSYBSM_HT_MET_cff import *
from HLTriggerOffline.SUSYBSM.SUSYBSM_MET_BTAG_cff import *
from HLTriggerOffline.SUSYBSM.SUSYBSM_inclusiveHT_cff import *
from HLTriggerOffline.SUSYBSM.SUSYBSM_inclusiveMET_cff import *

HLTSusyExoValSeq = cms.Sequence(HLTSusyExoVal)
HLTSusyExoValSeq_FastSim = cms.Sequence(HLTSusyExoValFastSim)
HLTSusyExoValSeq = cms.Sequence(SUSY_HLT_HT_MET+SUSY_HLT_InclusiveHT+SUSY_HLT_InclusiveMET+SUSY_HLT_MET_BTAG)
207 changes: 207 additions & 0 deletions HLTriggerOffline/SUSYBSM/src/SUSY_HLT_InclusiveHT.cc
@@ -0,0 +1,207 @@
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Common/interface/TriggerNames.h"
#include "DataFormats/HLTReco/interface/TriggerObject.h"
#include "HLTriggerOffline/SUSYBSM/interface/SUSY_HLT_InclusiveHT.h"


SUSY_HLT_InclusiveHT::SUSY_HLT_InclusiveHT(const edm::ParameterSet& ps)
{
edm::LogInfo("SUSY_HLT_InclusiveHT") << "Constructor SUSY_HLT_InclusiveHT::SUSY_HLT_InclusiveHT " << std::endl;
// Get parameters from configuration file
theTrigSummary_ = consumes<trigger::TriggerEvent>(ps.getParameter<edm::InputTag>("trigSummary"));
thePfMETCollection_ = consumes<reco::PFMETCollection>(ps.getParameter<edm::InputTag>("pfMETCollection"));
thePfJetCollection_ = consumes<reco::PFJetCollection>(ps.getParameter<edm::InputTag>("pfJetCollection"));
theCaloJetCollection_ = consumes<reco::CaloJetCollection>(ps.getParameter<edm::InputTag>("caloJetCollection"));
triggerResults_ = consumes<edm::TriggerResults>(ps.getParameter<edm::InputTag>("TriggerResults"));
triggerPath_ = ps.getParameter<std::string>("TriggerPath");
triggerFilter_ = ps.getParameter<edm::InputTag>("TriggerFilter");
ptThrJet_ = ps.getUntrackedParameter<double>("PtThrJet");
etaThrJet_ = ps.getUntrackedParameter<double>("EtaThrJet");
}

SUSY_HLT_InclusiveHT::~SUSY_HLT_InclusiveHT()
{
edm::LogInfo("SUSY_HLT_InclusiveHT") << "Destructor SUSY_HLT_InclusiveHT::~SUSY_HLT_InclusiveHT " << std::endl;
}

void SUSY_HLT_InclusiveHT::dqmBeginRun(edm::Run const &, edm::EventSetup const &)
{
edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::beginRun" << std::endl;
}

void SUSY_HLT_InclusiveHT::bookHistograms(DQMStore::IBooker & ibooker_, edm::Run const &, edm::EventSetup const &)
{
edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::bookHistograms" << std::endl;
//book at beginRun
bookHistos(ibooker_);
}

void SUSY_HLT_InclusiveHT::beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg,
edm::EventSetup const& context)
{
edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::beginLuminosityBlock" << std::endl;
}

void SUSY_HLT_InclusiveHT::analyze(edm::Event const& e, edm::EventSetup const& eSetup){
edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::analyze" << std::endl;


//-------------------------------
//--- MET
//-------------------------------
edm::Handle<reco::PFMETCollection> pfMETCollection;
e.getByToken(thePfMETCollection_, pfMETCollection);
if ( !pfMETCollection.isValid() ){
edm::LogError ("SUSY_HLT_InclusiveHT") << "invalid collection: PFMET" << "\n";
return;
}
//-------------------------------
//--- Jets
//-------------------------------
edm::Handle<reco::PFJetCollection> pfJetCollection;
e.getByToken (thePfJetCollection_,pfJetCollection);
if ( !pfJetCollection.isValid() ){
edm::LogError ("SUSY_HLT_InclusiveHT") << "invalid collection: PFJets" << "\n";
return;
}
edm::Handle<reco::CaloJetCollection> caloJetCollection;
e.getByToken (theCaloJetCollection_,caloJetCollection);
if ( !caloJetCollection.isValid() ){
edm::LogError ("SUSY_HLT_InclusiveHT") << "invalid collection: CaloJets" << "\n";
return;
}

//check what is in the menu
edm::Handle<edm::TriggerResults> hltresults;
e.getByToken(triggerResults_,hltresults);
if(!hltresults.isValid()){
edm::LogError ("SUSY_HLT_InclusiveHT") << "invalid collection: TriggerResults" << "\n";
return;
}

//-------------------------------
//--- Trigger
//-------------------------------
edm::Handle<trigger::TriggerEvent> triggerSummary;
e.getByToken(theTrigSummary_, triggerSummary);
if(!triggerSummary.isValid()) {
edm::LogError ("SUSY_HLT_InclusiveHT") << "invalid collection: TriggerSummary" << "\n";
return;
}

//get online objects
size_t filterIndex = triggerSummary->filterIndex( triggerFilter_ );
trigger::TriggerObjectCollection triggerObjects = triggerSummary->getObjects();
if( !(filterIndex >= triggerSummary->sizeFilters()) ){
const trigger::Keys& keys = triggerSummary->filterKeys( filterIndex );
for( size_t j = 0; j < keys.size(); ++j ){
trigger::TriggerObject foundObject = triggerObjects[keys[j]];
if(foundObject.id() == 85 && foundObject.pt() > 40.0 && fabs(foundObject.eta()) < 3.0){
h_triggerJetPt->Fill(foundObject.pt());
h_triggerJetEta->Fill(foundObject.eta());
h_triggerJetPhi->Fill(foundObject.phi());
}
if(foundObject.id() == 87){
h_triggerMetPt->Fill(foundObject.pt());
h_triggerMetPhi->Fill(foundObject.phi());
}
if(foundObject.id() == 89){
h_triggerHT->Fill(foundObject.pt());
}
}
}

bool hasFired = false;
const edm::TriggerNames& trigNames = e.triggerNames(*hltresults);
unsigned int numTriggers = trigNames.size();
for( unsigned int hltIndex=0; hltIndex<numTriggers; ++hltIndex ){
if (trigNames.triggerName(hltIndex)==triggerPath_ && hltresults->wasrun(hltIndex) && hltresults->accept(hltIndex)) hasFired = true;
}

float caloHT = 0.0;
float pfHT = 0.0;
for (reco::PFJetCollection::const_iterator i_pfjet = pfJetCollection->begin(); i_pfjet != pfJetCollection->end(); ++i_pfjet){
if (i_pfjet->pt() < ptThrJet_) continue;
if (fabs(i_pfjet->eta()) > etaThrJet_) continue;
pfHT += i_pfjet->pt();
}

if(hasFired){
for (reco::CaloJetCollection::const_iterator i_calojet = caloJetCollection->begin(); i_calojet != caloJetCollection->end(); ++i_calojet){
if (i_calojet->pt() < ptThrJet_) continue;
if (fabs(i_calojet->eta()) > etaThrJet_) continue;
h_caloJetPt ->Fill(i_calojet->pt());
h_caloJetEta ->Fill(i_calojet->eta());
h_caloJetPhi ->Fill(i_calojet->phi());
caloHT += i_calojet->pt();
}
for (reco::PFJetCollection::const_iterator i_pfjet = pfJetCollection->begin(); i_pfjet != pfJetCollection->end(); ++i_pfjet){
if (i_pfjet->pt() < ptThrJet_) continue;
if (fabs(i_pfjet->eta()) > etaThrJet_) continue;
h_pfJetPt ->Fill(i_pfjet->pt());
h_pfJetEta ->Fill(i_pfjet->eta());
h_pfJetPhi ->Fill(i_pfjet->phi());
}
h_pfMet -> Fill(pfMETCollection->begin()->et());
h_pfMetPhi -> Fill(pfMETCollection->begin()->phi());
h_pfHT -> Fill(pfHT);
h_caloHT -> Fill(caloHT);

h_pfMetTurnOn_num -> Fill(pfMETCollection->begin()->et());
h_pfHTTurnOn_num -> Fill(pfHT);
}
//fill denominator histograms for all events, used for turn on curves
h_pfMetTurnOn_den -> Fill(pfMETCollection->begin()->et());
h_pfHTTurnOn_den -> Fill(pfHT);
}


void SUSY_HLT_InclusiveHT::endLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& eSetup)
{
edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::endLuminosityBlock" << std::endl;
}


void SUSY_HLT_InclusiveHT::endRun(edm::Run const& run, edm::EventSetup const& eSetup)
{
edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::endRun" << std::endl;
}

void SUSY_HLT_InclusiveHT::bookHistos(DQMStore::IBooker & ibooker_)
{
ibooker_.cd();
ibooker_.setCurrentFolder("HLTriggerOffline/SUSYBSM/" + triggerPath_);

//offline quantities
h_pfMet = ibooker_.book1D("pfMet", "PF Missing E_{T}; GeV", 20, 0.0, 500.0 );
h_pfMetPhi = ibooker_.book1D("pfMetPhi", "PF MET Phi", 20, -3.5, 3.5 );
h_pfHT = ibooker_.book1D("pfHT", "PF H_{T}; GeV", 30, 0.0, 1500.0);
h_caloHT = ibooker_.book1D("caloHT", "Calo H_{T}; GeV", 30, 0.0, 1500.0);
h_pfJetPt = ibooker_.book1D("pfJetPt", "PFJet P_{T}; GeV", 20, 0.0, 500.0 );
h_pfJetEta = ibooker_.book1D("pfJetEta", "PFJet Eta", 20, -3.0, 3.0 );
h_pfJetPhi = ibooker_.book1D("pfJetPhi", "PFJet Phi", 20, -3.5, 3.5 );
h_caloJetPt = ibooker_.book1D("caloJetPt", "CaloJet P_{T}; GeV", 20, 0.0, 500.0 );
h_caloJetEta = ibooker_.book1D("caloJetEta", "CaloJet Eta", 20, -3.0, 3.0 );
h_caloJetPhi = ibooker_.book1D("caloJetPhi", "CaloJet Phi", 20, -3.5, 3.5 );

//online quantities
h_triggerJetPt = ibooker_.book1D("triggerJetPt", "Trigger Jet Pt; GeV", 20, 0.0, 500.0);
h_triggerJetEta = ibooker_.book1D("triggerJetEta", "Trigger Jet Eta", 20, -3.0, 3.0);
h_triggerJetPhi = ibooker_.book1D("triggerJetPhi", "Trigger Jet Phi", 20, -3.5, 3.5);
h_triggerMetPt = ibooker_.book1D("triggerMetPt", "Trigger Met Pt; GeV", 20, 0.0, 500.0);
h_triggerMetPhi = ibooker_.book1D("triggerMetPhi", "Trigger Met Phi", 20, -3.5, 3.5);
h_triggerHT = ibooker_.book1D("triggerHT", "Trigger HT; GeV", 30, 0.0, 1500.0);

//num and den hists to be divided in harvesting step to make turn on curves
h_pfMetTurnOn_num = ibooker_.book1D("pfMetTurnOn_num", "PF MET Turn On Numerator", 20, 0.0, 500.0 );
h_pfMetTurnOn_den = ibooker_.book1D("pfMetTurnOn_den", "PF MET Turn OnDenominator", 20, 0.0, 500.0 );
h_pfHTTurnOn_num = ibooker_.book1D("pfHTTurnOn_num", "PF HT Turn On Numerator", 30, 0.0, 1500.0 );
h_pfHTTurnOn_den = ibooker_.book1D("pfHTTurnOn_den", "PF HT Turn On Denominator", 30, 0.0, 1500.0 );

ibooker_.cd();
}

//define this as a plug-in
DEFINE_FWK_MODULE(SUSY_HLT_InclusiveHT);

0 comments on commit 795724a

Please sign in to comment.