Skip to content

Wallace-Chen/Haa4bTools

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Haa4bTools

This tool is based on stop analysis team alpha, where i am working on for 3 years, with great colleagues.

Set up BDT training framework

cmsrel CMSSW_9_2_14_patch1
cd CMSSW_9_2_14_patch1/src
cmsenv
mkdir UserCode
cd $CMSSW_BASE/src/UserCode
git clone [email protected]:weihuacern/Haa4bTools.git

Compile Code

Note, make sure make clean before commit.

cd $CMSSW_BASE/src/UserCode/Haa4bTools/Tools
make
cd $CMSSW_BASE/src/UserCode/Haa4bTools/AnaModules
make

W/b-jets tagger with Machine learning algorithm

Input: root files and weights

ls $CMSSW_BASE/src/UserCode/Haa4bTools/AnaModules/FileList

In MVAAna.cc:

QCDSampleWeight mySGSampleWeight;
mySGSampleWeight.QCDSampleInfo_push_back( "_Wh_amass12"  , 1.37, 397600 - 0, LumiScale, 1, "FileList/MVASGMCFileList.txt", TrainMode );
//...
QCDSampleWeight myBGSampleWeight;
float TTbar_SingleLept_BR = 0.43930872; // 2*W_Lept_BR*(1-W_Lept_BR)
float TTbar_DiLept_BR = 0.10614564; // W_Lept_BR^2
myBGSampleWeight.QCDSampleInfo_push_back( "_SingleT_s_" , 3.362, 811495 - 188505, LumiScale, 1, "FileList/MVABGMCFileList.txt", TrainMode );
//...
QCDSampleWeight myDataSampleWeight;
myDataSampleWeight.QCDSampleInfo_push_back( "_SingleElectron2016B_ver2" , 1 , 1, 1, 1, "FileList/MVADataFileList.txt", TrainMode );
//...

Make sure to use correct xSec and weight, in TMVATrainer.h:

std::string dir = "root://eosuser.cern.ch//eos/user/h/hua/Haa4b/MVARes/";
std::make_pair( std::string("mva_MC13TeV_SingleT_s_2016.root" ), 0.193558)
std::make_pair( std::string("mva_MC13TeV_SingleT_atW_2016.root" ), 0.184169)
//...

To calculate xSec weight, use MVAAna.cc:

Train: boosted decision tree

./MVAAna Train TribMVA
./MVAAna Train QuabMVA

Model .xml and .C files are generated:

ls $CMSSW_BASE/src/UserCode/Haa4bTools/AnaModules/dataset/weights
Haa4bSBClassificationQuabMVA_BDT.class.C  Haa4bSBClassificationQuabMVA_BDT.weights.xml  Haa4bSBClassificationTribMVA_BDT.class.C  Haa4bSBClassificationTribMVA_BDT.weights.xml

Note, training BDT will also generate two big root files... Please make sure not include them when commit.

Application: use trained model for background suppression

Run analysis code to generate root for plot:

./MVAAna Application TribMVA
./MVAAna Application QuabMVA

Location of the root file for plot:

ls $CMSSW_BASE/src/UserCode/Haa4bTools/AnaModules/OutDir
MVACutFlowQuabMVA.root  MVACutFlowTribMVA.root

Plotting

Plots for BDT training cross section, train vs test:

./MVAOutPlots TribMVA Test
./MVAOutPlots QuabMVA Test

Inputs are from Train BDT step (big root file). Path can be customized in MVAOutPlots.h:

std::string din = "/afs/cern.ch/user/h/hua/workarea/Haa4b/TrainRes/20171130/";

Outputs will be in the Test directory.

Plots for distribution checks, and sensitivity study:

./MVACutFlowPlots TribMVA Test
./MVACutFlowPlots QuabMVA Test

Inputs are from Application step.

Outputs will be in the Test directory.
Make sure delete Test directory before commit.

Others

Generate Ntuple file list:

cd $CMSSW_BASE/src/UserCode/Haa4bTools/EOSTools
python genList.py -d /eos/cms/store/user/georgia/results_2018_03_03 -l
python genList.py -d /eos/cms/store/user/georgia/results_2018_03_03/MinBias -l

Special treat for WXJets and DYXJets when train model:

cd $CMSSW_BASE/src/UserCode/Haa4bTools/AnaModules
./LHESplit LHENJets.root 0
./LHESplit LHENJets.root 1
./LHESplit LHENJets.root 2
./LHESplit LHENJets.root 3
./LHESplit LHENJets.root 4

, where the LHENJets.root can be WJets or DY_10to50, DY_50toInf, hadd all root files from same physics process including XJets files.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 81.8%
  • C++ 16.4%
  • Python 1.2%
  • Other 0.6%