Skip to content
Snippets Groups Projects
Commit 1697c36e authored by Johannes Balz's avatar Johannes Balz Committed by Attila Krasznahorkay
Browse files

Linear pT dependent cut for the BDT QG Tagger

Former-commit-id: 1174246f4d9e1656e8c011da76b402d81f122c8e
parent 84950c74
No related branches found
No related tags found
No related merge requests found
......@@ -75,7 +75,11 @@ class JetQGTaggerBDT : public JSSTaggerBase {
std::string m_tmvaConfigFileName;
std::string m_tmvaConfigFilePath;
mutable float m_ScoreCut;
//string for cut function
std::string m_strScoreCut;
//TF1 for pT dependent cut
std::unique_ptr<TF1> m_funcScoreCut;
// variables for TMVA
mutable float m_pt;
......
......@@ -74,9 +74,9 @@ StatusCode JetQGTaggerBDT::initialize(){
// get the name/path of the JSON config
m_tmvaConfigFileName = configReader.GetValue("TMVAConfigFile" ,"");
m_ScoreCut = configReader.GetValue("ScoreCut" ,-1.);
m_strScoreCut = configReader.GetValue("ScoreCut" ,"");
ATH_MSG_INFO( "scoreCut: "<<m_ScoreCut );
ATH_MSG_INFO( "scoreCut: "<<m_strScoreCut );
}
// if the calibarea is specified to be "Local" then it looks in the same place as the top level configs
......@@ -97,6 +97,14 @@ StatusCode JetQGTaggerBDT::initialize(){
m_tmvaConfigFilePath = PathResolverFindCalibFile( (m_calibarea+m_tmvaConfigFileName).c_str() );
}
//transform string to TF1
if(m_strScoreCut.empty()){
ATH_MSG_ERROR( "Score cut function is empty!" );
return StatusCode::FAILURE;
}
else{
m_funcScoreCut = std::unique_ptr<TF1> (new TF1("strScoreCut", m_strScoreCut.c_str(), 0, 14000));
}
// set up InDet selection tool
ANA_CHECK( ASG_MAKE_ANA_TOOL( m_trkSelectionTool, InDet::InDetTrackSelectionTool ) );
ANA_CHECK( m_trkSelectionTool.setProperty( "CutLevel", "Loose" ) );
......@@ -165,7 +173,9 @@ Root::TAccept JetQGTaggerBDT::tag(const xAOD::Jet& jet) const {
// get BDT score
float jet_score = getScore(jet);
ATH_MSG_DEBUG(TString::Format("jet score %g",jet_score) );
float cut = m_ScoreCut;
//get cut from cut function
float cut = m_funcScoreCut->Eval(jet.pt()/1000.);
if(jet_score < cut) m_accept.setCutResult("QuarkJetTag", true);
......@@ -193,8 +203,6 @@ float JetQGTaggerBDT::getScore(const xAOD::Jet& jet) const{
void JetQGTaggerBDT::getJetProperties(const xAOD::Jet& jet) const{
/* Update the jet substructure variables for this jet */
//mass and pT
//it is assumed that these are the combined and calibrated mass and pT
m_pt = jet.pt()/1000.0;
m_eta = jet.eta();
......
......@@ -4,4 +4,4 @@ CalibArea: BoostedJetTaggers/JetQGTaggerBDT/Oct18/
TMVAConfigFile: TMVAClassification_BDTQGTagger_Oct18_BDT.weights.xml
ScoreCut: 0.135
\ No newline at end of file
ScoreCut: (x<100)*(0.0012*x+0.02) + (x>=100)*0.14
......@@ -4,4 +4,4 @@ CalibArea: BoostedJetTaggers/JetQGTaggerBDT/Oct18/
TMVAConfigFile: TMVAClassification_BDTQGTagger_Oct18_BDT.weights.xml
ScoreCut: -0.14
\ No newline at end of file
ScoreCut: (x<200)*(-0.000714*x-0.0121) + (x>=200)*-0.155
......@@ -158,7 +158,7 @@ int main( int argc, char* argv[] ) {
m_Tagger.setType("JetQGTaggerBDT");
m_Tagger.setName("MyTagger");
if(verbose) m_Tagger.setProperty("OutputLevel", MSG::DEBUG);
m_Tagger.setProperty( "ConfigFile", "JetQGTaggerBDT/JetQGTaggerBDT90Gluon.dat");
m_Tagger.setProperty( "ConfigFile", "JetQGTaggerBDT/JetQGTaggerBDT50Gluon.dat");
m_Tagger.retrieve();
////////////////////////////////////////////////////
......@@ -199,7 +199,7 @@ int main( int argc, char* argv[] ) {
// Loop over jet container
for(const xAOD::Jet* jet : * myJets ){
int truthlabel = jet->getAttribute<int>("PartonTruthLabelID");
if(jet->pt()<30000 || TMath::Abs(jet->eta())>2.5 || truthlabel==-1 || truthlabel==5)
if(jet->pt()<20000 || TMath::Abs(jet->eta())>2.5 || truthlabel==-1 || truthlabel==5)
continue;
if(verbose) std::cout<<std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment