7 #include "TLorentzVector.h"
12 #include "GaudiKernel/IChronoStatSvc.h"
19 const std::string&
name,
22 m_trackClassificator(
"InDet::InDetTrkInJetType/TrackClassificationTool",this),
23 m_deltaRConeSize(0.4),
24 m_useFivePtJetBinTCT(false),
25 m_calibFileName(
"CTT_calib_v00.root"),
26 m_jetCollection(
"AntiKt4EMPFlowJets")
41 "CTTtrainedWithRetrainedTCT" :
"CTTtrainedWithDefaultTCT";
43 std::unique_ptr<TFile>
rootFile(TFile::Open(fullPathToFile.c_str(),
"READ"));
45 ATH_MSG_ERROR(
"Can not retrieve ClassifiedTrackTagger calibration root file: " << fullPathToFile);
46 return StatusCode::FAILURE;
48 std::unique_ptr<TTree> training( (TTree*)
rootFile->Get(strBDTName.c_str()) );
49 m_CTTBDT = std::make_unique<MVAUtils::BDT>(training.get());
54 ATH_MSG_DEBUG(
"Could not find InDet::InDetTrkInJetType - TrackClassificationTool");
55 return StatusCode::FAILURE;
57 ATH_MSG_DEBUG(
"InDet::InDetTrkInJetType - TrackClassificationTool found");
64 ATH_MSG_ERROR(
"FivePtJetBin TCT tool is not used, but required by CTT!");
69 ATH_MSG_ERROR(
"FivePtJetBin TCT tool is used, but default version required by CTT!");
81 return StatusCode::SUCCESS;
88 return StatusCode::SUCCESS;
93 std::vector<std::vector<float>> TCTweights;
96 for (
const auto &itrk : InpTrk) {
99 bool b_zeroTCTScore = std::all_of(v_tctScore.begin(), v_tctScore.end(), [](
float i) { return i==0; });
100 if(!b_zeroTCTScore) { TCTweights.push_back(v_tctScore); }
104 ATH_MSG_DEBUG(
"[ClassifiedTrackTagger]: retrieved TCT score");
105 int ntrk = TCTweights.size();
106 if(ntrk< 3) {
return -5; }
110 ATH_MSG_DEBUG(
"[ClassifiedTrackTagger]: ntrk = " << ntrk <<
" in jet");
112 float ptjet =
Jet.Pt();
113 float trackMultiplicity = ( ((
float)ntrk) / ptjet) * 1.
e3;
120 int iwgtB=0, iwgtL=1, iwgtG=2;
121 ATH_MSG_DEBUG(
"[ClassifiedTrackTagger]: ordered signal TCT weights = " << TCTweights[sorted_indices[0]][iwgtB] <<
"," << TCTweights[sorted_indices[1]][iwgtB] <<
"," << TCTweights[sorted_indices[2]][iwgtB]);
124 std::vector<float> bdt_vars = {
125 TCTweights[sorted_indices[0]][iwgtB], TCTweights[sorted_indices[0]][iwgtG], TCTweights[sorted_indices[0]][iwgtL],
126 TCTweights[sorted_indices[1]][iwgtB], TCTweights[sorted_indices[1]][iwgtG], TCTweights[sorted_indices[1]][iwgtL],
127 TCTweights[sorted_indices[2]][iwgtB], TCTweights[sorted_indices[2]][iwgtG], TCTweights[sorted_indices[2]][iwgtL],
141 for(
const auto curjet :
jets){
142 ATH_MSG_DEBUG(
" Jet pt: " << curjet->pt()<<
" eta: "<<curjet->eta()<<
" phi: "<< curjet->phi() );
143 float CTTScore =
bJetWgts(InpTrk, primVertex, curjet->p4());
144 jetWriteDecorHandle(*curjet) = CTTScore;
151 int ntrk = unordered_vec.size();