ATLAS Offline Software
Classes | Functions
DiTauRecTools Namespace Reference

Implementation of boosted di-tau ID. More...

Classes

class  DiTauDiscriminantTool
 
class  DiTauIDVarCalculator
 
class  IDiTauToolBase
 

Functions

std::unique_ptr< MVAUtils::BDTconfigureMVABDT (std::map< TString, float * > &availableVars, const TString &weightFile)
 
std::vector< TString > parseString (const TString &str, const TString &delim=",")
 
std::vector< TString > parseStringMVAUtilsBDT (const TString &str, const TString &delim=",")
 

Detailed Description

Implementation of boosted di-tau ID.

Tool to calculate and decorate ID variables for boosted di-tau candidates.

Author
David Kirchmeier (david.nosp@m..kir.nosp@m.chmei.nosp@m.er@c.nosp@m.ern.c.nosp@m.h)

Function Documentation

◆ configureMVABDT()

std::unique_ptr< MVAUtils::BDT > DiTauRecTools::configureMVABDT ( std::map< TString, float * > &  availableVars,
const TString &  weightFile 
)

Definition at line 46 of file Reconstruction/DiTauRecTools/Root/HelperFunctions.cxx.

46  {
47  using namespace DiTauRecTools::msgHelperFunction;
48  std::unique_ptr<TFile> fBDT(TFile::Open(weightFile));
49  if(!fBDT){
50  ANA_MSG_ERROR("configureMVABDT: Cannot find tau input BDT file: " << weightFile );
51  return nullptr;
52  }
53 
54  TTree* tBDT = dynamic_cast<TTree*> (fBDT->Get("BDT"));
55  if(!tBDT){
56  ANA_MSG_ERROR("configureMVABDT: Cannot find tau input BDT tree");
57  return nullptr;
58  }
59 
60  ANA_MSG_INFO("configureMVABDT: opened file: " << weightFile);
61 
62  std::vector<float*> vars;
63 
64  //parsing of variables done here from TNamed object
65  TNamed* n_varList = dynamic_cast<TNamed*> (fBDT->Get("varList"));
66  if(!n_varList) {
67  ANA_MSG_ERROR("configureMVABDT: no Variable List in file: " << weightFile );
68  return nullptr;
69  }
70  std::vector<TString> varList_ar = DiTauRecTools::parseStringMVAUtilsBDT(n_varList->GetTitle());
71  delete n_varList;
72 
73  for(const TString& str : varList_ar){
74  if(str.Length()==0) continue;
75  std::map<TString, float*>::iterator itr = availableVars.find(str);
76  if(itr==availableVars.end()){
77  ANA_MSG_ERROR("configureMVABDT: Variable : " << str << " is not available" );
78  return nullptr;
79  }
80  vars.push_back( itr->second );
81  }
82 
83  auto reader = std::make_unique<MVAUtils::BDT>(tBDT);
84  reader->SetPointers( vars );
85 
86  fBDT->Close();
87  return reader;
88 }

◆ parseString()

std::vector< TString > DiTauRecTools::parseString ( const TString &  str,
const TString &  delim = "," 
)

Definition at line 19 of file Reconstruction/DiTauRecTools/Root/HelperFunctions.cxx.

19  {
20  std::vector<TString> parsed_strings;
21  TObjArray* varList_ar = str.Tokenize(delim);
22  for(int i = 0; i != varList_ar->GetEntries(); ++i){
23  if (auto *tos = dynamic_cast<TObjString*> (varList_ar->At(i))) {
24  TString var = tos->String();
25  if(var.Length()==0) continue;
26  parsed_strings.push_back(var);
27  }
28  }
29  delete varList_ar;
30  return parsed_strings;
31 }

◆ parseStringMVAUtilsBDT()

std::vector< TString > DiTauRecTools::parseStringMVAUtilsBDT ( const TString &  str,
const TString &  delim = "," 
)

Definition at line 34 of file Reconstruction/DiTauRecTools/Root/HelperFunctions.cxx.

34  {
35  std::vector<TString> parsed_strings = parseString(str, delim);
36  for( TString& str : parsed_strings ){
37  str.ReplaceAll(" ", "");
38  if(str.Contains(":=")){
39  str=str(str.Index(":=")+2, str.Length()-str.Index(":=")-2);
40  }
41  }
42  return parsed_strings;
43 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
DiTauRecTools::parseStringMVAUtilsBDT
std::vector< TString > parseStringMVAUtilsBDT(const TString &str, const TString &delim=",")
Definition: Reconstruction/DiTauRecTools/Root/HelperFunctions.cxx:34
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
lumiFormat.i
int i
Definition: lumiFormat.py:85
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:290
DiTauRecTools::parseString
std::vector< TString > parseString(const TString &str, const TString &delim=",")
Definition: Reconstruction/DiTauRecTools/Root/HelperFunctions.cxx:19
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
str
Definition: BTagTrackIpAccessor.cxx:11
collisions.reader
reader
read the goodrunslist xml file(s)
Definition: collisions.py:22