Skip to content

Commit

Permalink
Updated STXS workflow (cms-analysis#1204)
Browse files Browse the repository at this point in the history
* Update to latest ttH MVA boundaries

* Implement ttH vs tH DNN in leptonic tagger

* Optimized THQ tagger compatible with STXS workflow

* add changes for STXS stage 1.2

* Update WHLeptonicTag with MVA and ZHLeptonicTag

* Recover TagTruth with STXS information included

* Add missing cuts on pho pT/mGG and photon ID MVA

* fully working VH hadronic BDT

* incorporate tHq leptonic tag into stage one workflow

* incorporate WH and ZH leptonic tags into stage one workflow

* add in ggH BSM splitting and additional VBF tags

* Update MVA for ZH Leptonic Tag

* update cross sections for tH

* propagate NNLOPS weights correctly

* add optional granular JEC uncertainties. Tested, behaviour seems sensible. 

Co-authored-by: Samuel May <[email protected]>
Co-authored-by: Prafulla Saha <[email protected]>
Co-authored-by: Youying <[email protected]>
Co-authored-by: Mei Hualin <[email protected]>
  • Loading branch information
5 people authored Apr 1, 2020
1 parent 6cfecbb commit 388b54e
Show file tree
Hide file tree
Showing 113 changed files with 4,268 additions and 1,842 deletions.
38 changes: 31 additions & 7 deletions DataFormats/interface/DiPhotonTagBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,39 @@ namespace flashgg {
class DiPhotonTagBase : public WeightedObject
{
public:

enum tag_t { kUndefined = 0, kUntagged, kVBF, kTTHHadronic, kTTHLeptonic, kTHQLeptonic, kTTHDiLepton, kVHTight, kVHLoose, kVHHadronic, kVHEt, kZHLeptonic, kWHLeptonic, kVHLeptonicLoose, kVHMet, kStageOneCombined };

enum stage1recoTag { LOGICERROR = -1, NOTAG = 0, RECO_0J_PTH_0_10_Tag0, RECO_0J_PTH_0_10_Tag1, RECO_0J_PTH_GT10_Tag0, RECO_0J_PTH_GT10_Tag1,
RECO_1J_PTH_0_60_Tag0, RECO_1J_PTH_0_60_Tag1, RECO_1J_PTH_60_120_Tag0, RECO_1J_PTH_60_120_Tag1,
RECO_1J_PTH_120_200_Tag0, RECO_1J_PTH_120_200_Tag1,
RECO_GE2J_PTH_0_60_Tag0, RECO_GE2J_PTH_0_60_Tag1, RECO_GE2J_PTH_60_120_Tag0, RECO_GE2J_PTH_60_120_Tag1, RECO_GE2J_PTH_120_200_Tag0, RECO_GE2J_PTH_120_200_Tag1,
RECO_PTH_GT200_Tag0, RECO_PTH_GT200_Tag1,
RECO_VBFTOPO_VHHAD, RECO_VBFTOPO_JET3VETO_LOWMJJ, RECO_VBFTOPO_JET3VETO_HIGHMJJ, RECO_VBFTOPO_JET3_LOWMJJ, RECO_VBFTOPO_JET3_HIGHMJJ, RECO_VBFTOPO_BSM, RECO_VBFLIKEGGH,
RECO_WHLEP, RECO_ZHLEP, RECO_VHLEPLOOSE, RECO_VHMET, RECO_VHHAD, RECO_TTH_LEP, RECO_TTH_HAD };
enum stage1recoTag { LOGICERROR = -1, NOTAG = 0,
RECO_0J_PTH_0_10_Tag0, RECO_0J_PTH_0_10_Tag1, RECO_0J_PTH_0_10_Tag2,
RECO_0J_PTH_GT10_Tag0, RECO_0J_PTH_GT10_Tag1, RECO_0J_PTH_GT10_Tag2,
RECO_1J_PTH_0_60_Tag0, RECO_1J_PTH_0_60_Tag1, RECO_1J_PTH_0_60_Tag2,
RECO_1J_PTH_60_120_Tag0, RECO_1J_PTH_60_120_Tag1,RECO_1J_PTH_60_120_Tag2,
RECO_1J_PTH_120_200_Tag0, RECO_1J_PTH_120_200_Tag1, RECO_1J_PTH_120_200_Tag2,
RECO_GE2J_PTH_0_60_Tag0, RECO_GE2J_PTH_0_60_Tag1, RECO_GE2J_PTH_0_60_Tag2,
RECO_GE2J_PTH_60_120_Tag0, RECO_GE2J_PTH_60_120_Tag1, RECO_GE2J_PTH_60_120_Tag2,
RECO_GE2J_PTH_120_200_Tag0, RECO_GE2J_PTH_120_200_Tag1, RECO_GE2J_PTH_120_200_Tag2,
RECO_PTH_200_300_Tag0, RECO_PTH_200_300_Tag1, RECO_PTH_300_450_Tag0, RECO_PTH_300_450_Tag1,
RECO_PTH_450_650_Tag0, RECO_PTH_GT650_Tag0,
RECO_VBFTOPO_VHHAD_Tag0, RECO_VBFTOPO_VHHAD_Tag1,
RECO_VBFTOPO_JET3VETO_LOWMJJ_Tag0, RECO_VBFTOPO_JET3VETO_LOWMJJ_Tag1,
RECO_VBFTOPO_JET3VETO_HIGHMJJ_Tag0, RECO_VBFTOPO_JET3VETO_HIGHMJJ_Tag1,
RECO_VBFTOPO_JET3_LOWMJJ_Tag0, RECO_VBFTOPO_JET3_LOWMJJ_Tag1,
RECO_VBFTOPO_JET3_HIGHMJJ_Tag0, RECO_VBFTOPO_JET3_HIGHMJJ_Tag1,
RECO_VBFTOPO_BSM_Tag0, RECO_VBFTOPO_BSM_Tag1,
RECO_VBFLIKEGGH_Tag0,RECO_VBFLIKEGGH_Tag1,
RECO_WH_LEP_LOW_Tag0, RECO_WH_LEP_LOW_Tag1, RECO_WH_LEP_LOW_Tag2,
RECO_WH_LEP_HIGH_Tag0, RECO_WH_LEP_HIGH_Tag1, RECO_WH_LEP_HIGH_Tag2,
RECO_ZH_LEP_Tag0, RECO_ZH_LEP_Tag1,
RECO_TTH_LEP_PTH_0_60_Tag0, RECO_TTH_LEP_PTH_0_60_Tag1, RECO_TTH_LEP_PTH_0_60_Tag2, RECO_TTH_LEP_PTH_0_60_Tag3,
RECO_TTH_LEP_PTH_60_120_Tag0, RECO_TTH_LEP_PTH_60_120_Tag1,
RECO_TTH_LEP_PTH_120_200_Tag0, RECO_TTH_LEP_PTH_120_200_Tag1,
RECO_TTH_LEP_PTH_GT200_Tag0, RECO_TTH_LEP_PTH_GT200_Tag1,
RECO_TTH_HAD_PTH_0_60_Tag0, RECO_TTH_HAD_PTH_0_60_Tag1, RECO_TTH_HAD_PTH_0_60_Tag2, RECO_TTH_HAD_PTH_0_60_Tag3,
RECO_TTH_HAD_PTH_60_120_Tag0, RECO_TTH_HAD_PTH_60_120_Tag1, RECO_TTH_HAD_PTH_60_120_Tag2, RECO_TTH_HAD_PTH_60_120_Tag3,
RECO_TTH_HAD_PTH_120_200_Tag0, RECO_TTH_HAD_PTH_120_200_Tag1, RECO_TTH_HAD_PTH_120_200_Tag2, RECO_TTH_HAD_PTH_120_200_Tag3,
RECO_TTH_HAD_PTH_GT200_Tag0, RECO_TTH_HAD_PTH_GT200_Tag1, RECO_TTH_HAD_PTH_GT200_Tag2, RECO_TTH_HAD_PTH_GT200_Tag3,
RECO_THQ_LEP };

DiPhotonTagBase();
virtual ~DiPhotonTagBase();
Expand Down
15 changes: 5 additions & 10 deletions DataFormats/interface/StageOneCombinedTag.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,10 @@
#include "flashgg/DataFormats/interface/DiPhotonTagBase.h"
#include "flashgg/DataFormats/interface/DiPhotonMVAResult.h"
#include "flashgg/DataFormats/interface/VBFMVAResult.h"
#include "flashgg/DataFormats/interface/VHhadMVAResult.h"
#include "flashgg/DataFormats/interface/Jet.h"

namespace flashgg {
enum stage1recoTag { LOGICERROR = -1, NOTAG = 0, RECO_0J_PTH_0_10_Tag0, RECO_0J_PTH_0_10_Tag1, RECO_0J_PTH_GT10_Tag0, RECO_0J_PTH_GT10_Tag1,
RECO_1J_PTH_0_60_Tag0, RECO_1J_PTH_0_60_Tag1, RECO_1J_PTH_60_120_Tag0, RECO_1J_PTH_60_120_Tag1,
RECO_1J_PTH_120_200_Tag0, RECO_1J_PTH_120_200_Tag1,
RECO_GE2J_PTH_0_60_Tag0, RECO_GE2J_PTH_0_60_Tag1, RECO_GE2J_PTH_60_120_Tag0, RECO_GE2J_PTH_60_120_Tag1, RECO_GE2J_PTH_120_200_Tag0, RECO_GE2J_PTH_120_200_Tag1,
RECO_PTH_GT200_Tag0, RECO_PTH_GT200_Tag1,
RECO_VBFTOPO_VHHAD, RECO_VBFTOPO_JET3VETO_LOWMJJ, RECO_VBFTOPO_JET3VETO_HIGHMJJ, RECO_VBFTOPO_JET3_LOWMJJ, RECO_VBFTOPO_JET3_HIGHMJJ, RECO_VBFTOPO_BSM, RECO_VBFLIKEGGH,
RECO_WHLEP, RECO_ZHLEP, RECO_VHLEPLOOSE, RECO_VHMET, RECO_VHHAD, RECO_TTH_LEP, RECO_TTH_HAD };

class StageOneCombinedTag: public DiPhotonTagBase
{
Expand All @@ -23,17 +17,18 @@ namespace flashgg {

StageOneCombinedTag( edm::Ptr<DiPhotonCandidate>, edm::Ptr<DiPhotonMVAResult> );
StageOneCombinedTag( edm::Ptr<DiPhotonCandidate>, DiPhotonMVAResult );
StageOneCombinedTag( edm::Ptr<DiPhotonCandidate>, edm::Ptr<DiPhotonMVAResult>, edm::Ptr<VBFMVAResult> );
StageOneCombinedTag( edm::Ptr<DiPhotonCandidate>, DiPhotonMVAResult, VBFMVAResult );
StageOneCombinedTag( edm::Ptr<DiPhotonCandidate>, edm::Ptr<DiPhotonMVAResult>, edm::Ptr<VBFMVAResult>, edm::Ptr<VHhadMVAResult> );
StageOneCombinedTag( edm::Ptr<DiPhotonCandidate>, DiPhotonMVAResult, VBFMVAResult, VHhadMVAResult );

StageOneCombinedTag *clone() const override { return ( new StageOneCombinedTag( *this ) ); }

DiPhotonTagBase::tag_t tagEnum() const override {return DiPhotonTagBase::kStageOneCombined; }

const VBFMVAResult VBFMVA() const;
const VHhadMVAResult VHhadMVA() const;
private:
int stage1recoTag_;
VBFMVAResult vbfmva_result_;
VHhadMVAResult vhhadmva_result_;

};

Expand Down
46 changes: 36 additions & 10 deletions DataFormats/interface/THQLeptonicTag.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,21 +146,33 @@ namespace flashgg {
float getlepton_ch() const{
return lepton_ch_;
}
float getlepton_leadPt() const{
return lepton_leadPt_;
}
float getlepton_leadEta() const{
return lepton_leadEta_;
}
float getmvaresult() const{
return mvaresult_;
}
float getthq_mvaresult() const{
return thq_mvaresult_;
}

float getthq_mvaresult_ForNonPeakingBkg() const{
return thq_mvaresult_ForNonPeakingBkg_;
}
double getlikelihood() const{
return likelihood_result_;
}
const std::vector<float> bDiscriminatorValue() const{
return bDiscriminatorValue_;
const std::vector<float> bDiscriminatorValue_bjets() const{
return bDiscriminatorValue_bjets_;
}
const std::vector<float> bDiscriminatorValue_jets() const{
return bDiscriminatorValue_jets_;
}
const std::vector<float> bDiscriminatorValue_fwdjets() const{
return bDiscriminatorValue_fwdjets_;
}


//

float thqleptonicMvaRes(string label) const {
Expand Down Expand Up @@ -413,7 +425,6 @@ namespace flashgg {
MET_Px.push_back(metPx) ; MET_Py.push_back(metPy) ; MET_Pz.push_back(metPz) ; MET_E.push_back(metE);
}

//void setTHQLeptonicMVA( THQLeptonicMVAResult THQLeptonicMVA ) {THQLeptonicMVA_ = THQLeptonicMVA;}
void setLeptonType(int val){ LeptonType_ = val; }

void setrho(float rho){
Expand Down Expand Up @@ -460,6 +471,12 @@ namespace flashgg {
void setlepton_ch(float lepton_ch){
lepton_ch_ = lepton_ch;
}
void setlepton_leadPt(float lepton_leadPt){
lepton_leadPt_ = lepton_leadPt;
}
void setlepton_leadEta(float lepton_leadEta){
lepton_leadEta_ = lepton_leadEta;
}
void setmvaresult( float mvaresult ){
mvaresult_ = mvaresult;
}
Expand All @@ -469,8 +486,13 @@ namespace flashgg {
void setthq_mvaresult( float thq_mvaresult ){
thq_mvaresult_ = thq_mvaresult;
}
void setbDiscriminatorValue( std::vector<float> bDiscriminatorValue ){
bDiscriminatorValue_ = bDiscriminatorValue;
void setthq_mvaresult_ForNonPeakingBkg( float thq_mvaresult_ForNonPeakingBkg ){
thq_mvaresult_ForNonPeakingBkg_ = thq_mvaresult_ForNonPeakingBkg;
}
void setbDiscriminatorValue( std::vector<float> bDiscriminatorValue_bjets, std::vector<float> bDiscriminatorValue_jets, std::vector<float> bDiscriminatorValue_fwdjets ){
bDiscriminatorValue_bjets_ = bDiscriminatorValue_bjets;
bDiscriminatorValue_jets_ = bDiscriminatorValue_jets;
bDiscriminatorValue_fwdjets_ = bDiscriminatorValue_fwdjets;
}


Expand Down Expand Up @@ -532,7 +554,6 @@ namespace flashgg {
std::map <std::string, std::vector<float> > vtx_dxy_; std::map <std::string, std::vector<float> > vtx_dz_;
std::map <std::string, std::vector<float> > diphovtx_dxy_; std::map <std::string, std::vector<float> > diphovtx_dz_;
std::vector<float> eleMisHits_;
//THQLeptonicMVAResult THQLeptonicMVA_;
float rho_;
float dRtHchainfwdjet_=0;
float dRbjetfwdjet_;
Expand All @@ -546,10 +567,15 @@ namespace flashgg {
float top_mt_;
float top_mass_;
float lepton_ch_;
float lepton_leadPt_;
float lepton_leadEta_;
float mvaresult_;
float thq_mvaresult_;
float thq_mvaresult_ForNonPeakingBkg_;
double likelihood_result_;
std::vector<float> bDiscriminatorValue_;
std::vector<float> bDiscriminatorValue_bjets_;
std::vector<float> bDiscriminatorValue_jets_;
std::vector<float> bDiscriminatorValue_fwdjets_;
float dRmyfunval_;
int LeptonType_;
std::vector< std::string > bAssignmentLabels;
Expand Down
10 changes: 9 additions & 1 deletion DataFormats/interface/TagTruthBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@ namespace flashgg {
int HTXSstage1bin() const { return stage1bin_; }
int HTXSstage1p1bin() const { return stage1p1bin_; }
int HTXSstage1p1binFine() const { return stage1p1binFine_; }
int HTXSstage1p2bin() const { return stage1p2bin_; }
int HTXSstage1p2binFine() const { return stage1p2binFine_; }
int HTXSstage0orderedBin() const;
int HTXSstage1orderedBin() const;
int HTXSstage1p1orderedBin() const;
int HTXSstage1p1orderedBinFine() const;
int HTXSstage1p2orderedBin() const;
int HTXSstage1p2orderedBinFine() const;
int HTXSnjets() const { return njets_; }
float HTXSpTH() const { return pTH_; }
float HTXSpTV() const { return pTV_; }
void setHTXSInfo( int stage0bin, int stage1bin, int stage1p1bin, int stage1p1binFine, int njets, float pTH, float pTV );
void setHTXSInfo( int stage0bin, int stage1bin, int stage1p1bin, int stage1p1binFine, int stage1p2bin, int stage1p2binFine, int njets, float pTH, float pTV );
void setGluonFusionWeights( int , float , int );
void copyBaseInfo( const TagTruthBase &b );
virtual TagTruthBase *clone() const;
Expand All @@ -45,10 +49,14 @@ namespace flashgg {
int stage1bin_;
int stage1p1bin_;
int stage1p1binFine_;
int stage1p2bin_;
int stage1p2binFine_;
std::map<int,int> stage0map_;
std::map<int,int> stage1map_;
std::map<int,int> stage1p1map_;
std::map<int,int> stage1p1mapFine_;
std::map<int,int> stage1p2map_;
std::map<int,int> stage1p2mapFine_;
int njets_;
float pTH_;
float pTV_;
Expand Down
99 changes: 99 additions & 0 deletions DataFormats/interface/VHhadMVAResult.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#ifndef FLASHgg_VHhadMVAResult_h
#define FLASHgg_VHhadMVAResult_h

#include "DataFormats/Common/interface/Ptr.h"
#include "flashgg/DataFormats/interface/DiPhotonCandidate.h"
#include "flashgg/DataFormats/interface/Jet.h"

namespace flashgg {

class VHhadMVAResult
{

public:
VHhadMVAResult();
VHhadMVAResult( edm::Ptr<VHhadMVAResult> );
virtual ~VHhadMVAResult() {}
// diJet Info
//flashgg::Jet leadJet;
//flashgg::Jet subleadJet;
// 3rd jet
//flashgg::Jet subsubleadJet;
reco::Candidate::LorentzVector leadJet;
reco::Candidate::LorentzVector subleadJet;
reco::Candidate::LorentzVector subsubleadJet;

edm::Ptr<flashgg::Jet> leadJet_ptr;
edm::Ptr<flashgg::Jet> subleadJet_ptr;
// 3rd jet
edm::Ptr<flashgg::Jet> subsubleadJet_ptr;
// 4-vec of the 3 jets

bool hasValidVHhadTriJet;

// di-photon info
// flashgg::DiPhotonCandidate diphoton;

// event based variables
int n_rec_jets;
int n_gen_jets;
int n_diphotons;

// Input variables
float dijet_leadEta ;
float dijet_subleadEta;
float dijet_abs_dEta;
float dijet_LeadJPt ;
float dijet_pt ;
float dijet_SubJPt;
float dijet_Zep;
float dijet_dphi_trunc;
float dijet_dipho_dphi;
float dijet_dphi;
float dijet_Mjj;
float dijet_dy;
float dijet_leady ;
float dijet_subleady;
float dijet_dipho_pt;
float dijet_minDRJetPho;
float dijet_centrality_gg;
float dijet_centrality_j3;
float dijet_centrality_g ;

float cosThetaStar;

float dipho_PToM;
float leadPho_PToM;
float sublPho_PToM;

// some 3-jet based variables

float VHhadMVAValue() const {return vhHadMvaResult_value;}
float prob_VHhad_value() const {return vhHadMvaResult_prob_VHhad;}
float prob_ggH_value() const {return vhHadMvaResult_prob_ggH;}
float prob_bkg_value() const {return vhHadMvaResult_prob_bkg;}
// needed to go to native XGBoost score from TMVA version, inverting this https://github.com/jpata/mlglue/blob/master/mlglue/tree.py#L400-L409
float transformedMvaValue(float result) const {return 1. / ( 1. + exp( 0.5*log( 2./(result+1.) - 1 ) ) );}

// Output
float vhHadMvaResult_value;
float vhHadMvaResult_value_bdt;
float vhHadMvaResult_value_bdtg;
float vhHadMvaResult_prob_VHhad;
float vhHadMvaResult_prob_ggH;
float vhHadMvaResult_prob_bkg;
};

typedef std::map<edm::Ptr<DiPhotonCandidate>, VHhadMVAResult> VHhadMVAResultMap;

}

#endif
// Local Variables:
// mode:c++
// indent-tabs-mode:nil
// tab-width:4
// c-basic-offset:4
// End:
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4

Loading

0 comments on commit 388b54e

Please sign in to comment.