![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
27 declareProperty(
"WorkingPoint",
m_wkpt =
"",
"If specified, name of working point is added to the variable names" );
37 "Flag to use TRUTH3 containers. If false, TRUTH1 format is used." );
39 "Name of truth-particle container (with UseTRUTH3=false). TruthParticles by default" );
41 "Name of truth-boson container (with UseTRUTH3=true). TruthBosonWithDecayParticles by default" );
43 "Name of truth-top container (with UseTRUTH3=true). TruthTopQuarkWithDecayParticles by default" );
47 "Path to json file to configure ML-taggers (Keras)" );
49 "Name of json file to configure ML-taggers (Keras)" );
51 "Name of output variable by the ML-tagger (Keras)" );
55 "Path to xml file to configure ML-taggers (TMVA)" );
57 "Name of xml file to configure ML-taggers (TMVA)" );
61 "Name of SF variable decorated to xAOD::Jet" );
63 "Name of config ROOT file for SF calculation" );
65 "Name of SF histograms in the ROOT file" );
67 "Name of efficiency histograms in the ROOT file" );
69 "List of jet flavours for which the SF is available. Divided by comma" );
78 return StatusCode::FAILURE;
89 m_acceptInfo.
addCut(
"ValidJetContent" ,
"True if the jet is alright technically (e.g. all attributes necessary for tag)" );
90 m_acceptInfo.
addCut(
"ValidEventContent" ,
"True if the event is alright technically (e.g. primary vertices)" );
93 ATH_MSG_INFO(
"Decorators that will be attached to jet :" );
238 #ifndef XAOD_STANDALONE
263 return StatusCode::FAILURE;
269 while ( std::getline(
ss, flavor,
',') ) {
274 ATH_MSG_INFO(
"Tagging SF histogram for " << flavor <<
" is installed." );
284 return StatusCode::SUCCESS;
291 for (
const auto *
jet :
jets ) {
295 return StatusCode::SUCCESS;
305 std::string configPath;
310 else if (
m_calibArea.find(
"eos") != std::string::npos) {
319 int fSuccess = gSystem->GetPathInfo(configPath.c_str(), fStats);
322 return StatusCode::FAILURE;
325 ATH_MSG_DEBUG(
"Recommendations file was found : " << configPath );
328 if (
m_configReader.ReadFile( configPath.c_str(), EEnvLevel(0) ) ) {
329 ATH_MSG_ERROR(
"Error while reading config file : "<< configPath );
330 return StatusCode::FAILURE;
333 return StatusCode::SUCCESS;
351 return StatusCode::SUCCESS;
404 decValidPtRangeHigh(
jet) = acceptData.
getCutResult(
"ValidPtRangeHigh" );
405 decValidPtRangeLow(
jet) = acceptData.
getCutResult(
"ValidPtRangeLow" );
409 return StatusCode::SUCCESS;
449 float tau21_wta = -999.0;
450 float tau32_wta = -999.0;
451 float tau42_wta = -999.0;
453 float tau1_wta = readTau1WTA(
jet);
454 float tau2_wta = readTau2WTA(
jet);
455 float tau3_wta = readTau3WTA(
jet);
456 float tau4_wta = -999.0;
458 tau4_wta = readTau4WTA(
jet);
461 if ( tau1_wta > 1
e-8 ) {
462 tau21_wta = tau2_wta / tau1_wta;
466 if ( tau2_wta > 1
e-8 ) {
467 tau32_wta = tau3_wta / tau2_wta;
469 tau42_wta = tau4_wta / tau2_wta;
474 decTau21WTA(
jet) = tau21_wta;
475 decTau32WTA(
jet) = tau32_wta;
476 decTau42WTA(
jet) = tau42_wta;
483 float ECF1 = readECF1(
jet);
484 float ECF2 = readECF2(
jet);
485 float ECF3 = readECF3(
jet);
488 C2 = ECF3 * ECF1 /
std::pow( ECF2, 2.0 );
505 if(readECFG212(
jet) > 1
e-8){
506 L2 = readECFG331(
jet) /
pow(readECFG212(
jet), (3.0/2.0));
515 if(readECFG331(
jet) > 1
e-8){
516 L3 = readECFG311(
jet) /
pow(readECFG331(
jet), (1.0/3.0));
535 ATH_MSG_WARNING(
"Unable to retrieve primary vertex container PrimaryVertices" );
539 for (
const auto *vx : *vxCont ) {
541 indexPV = vtx_counter;
559 const xAOD::Jet * ungroomedJet =
nullptr;
562 if ( linkToUngroomed.
isValid() ) {
563 ungroomedJet = *linkToUngroomed;
569 const std::vector<int>& NTrkPt500 = acc_Ntrk(*ungroomedJet);
571 int jet_ntrk = NTrkPt500.at(indexPV);
572 decNtrk500(
jet) = jet_ntrk;
576 ATH_MSG_ERROR(
"WARNING: Unable to retrieve Ntrk of the ungroomed parent jet. Please make sure this variable is in your derivations!!!");
577 return StatusCode::FAILURE;
581 ATH_MSG_ERROR(
"WARNING: Unable to retrieve the parent ungroomed jet. Please make sure this variable is in your derivations!!!");
582 return StatusCode::FAILURE;
586 ATH_MSG_ERROR(
"WARNING: Unable to retrieve the link to the parent ungroomed jet. Please make sure this variable is in your derivations!!!");
587 return StatusCode::FAILURE;
590 return StatusCode::SUCCESS;
597 if ( !
m_calcSF )
return StatusCode::SUCCESS;
601 float sigeffSF = 1.0;
611 sigeffSF =
getSF(
jet,
"t_qqb").first;
613 sigeffSF =
getSF(
jet,
"V_qq").first;
662 decEffSF(
jet) = effSF;
663 decSigeffSF(
jet) = sigeffSF;
665 return StatusCode::SUCCESS;
679 const double WtoZmassShift = 10803;
683 if ( logmOverPt > 0 ) logmOverPt = 0;
700 std::string signal_truthLabel=
"";
702 signal_truthLabel=
"t_qqb";
704 signal_truthLabel=
"V_qq";
706 signal_truthLabel=
"t";
713 return std::make_pair( 1.0,
eff );
717 ATH_MSG_DEBUG(
"(pt, m/pt) (" <<
jet.pt()/1.e3 <<
", " <<
jet.m()/
jet.pt() <<
") is out of range for SF calculation. Returning 1.0" );
718 return std::make_pair( 1.0, 1.0 );
721 return std::make_pair(
SF,
eff );
730 std::string truthLabelStr;
741 truthLabelStr =
"t_qqb";
754 truthLabelStr =
"t_";
758 truthLabelStr =
"V_qq_";
762 truthLabelStr =
"q_";
767 truthLabelStr +=
"passMpassD2";
771 truthLabelStr +=
"failMpassD2";
775 truthLabelStr +=
"passMfailD2";
779 truthLabelStr +=
"failMfailD2";
793 truthLabelStr =
"V_qq";
814 return truthLabelStr;
818 ATH_MSG_INFO(
"After tagging, you will have access to the following cuts as an asg::AcceptData : (<NCut>) <cut> : <description>)" );
820 for (
int iCut=0; iCut < nCuts; iCut++ ) {
821 std::string cut_string =
"";
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readParentKey
def retrieve(aClass, aKey=None)
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readTau4WTAKey
bool m_suppressOutputDependence
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readSplit23Key
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readECF1Key
std::string getTruthLabelStr(const xAOD::Jet &jet, asg::AcceptData &acceptData) const
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decScoreCutKey
std::string m_strMassCutLow
Strings for cut functions.
std::unique_ptr< TF1 > m_funcScoreCut
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readTau32WTAKey
StatusCode resetCuts(asg::AcceptData &acceptData) const
Reset cuts.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readNtrk500Key
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readECFG311Key
SG::ReadHandleKey< xAOD::JetContainer > m_jetContainer_key
std::atomic< int > m_nWarnVar
Warning counters.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readTau42WTAKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decValidEtaRangeKey
std::string m_kerasCalibArea
std::map< std::string, std::unique_ptr< TH2D > > m_efficiencyHistograms
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
std::string m_configFile
Configuration file name.
TEnv m_configReader
TEnv instance to read config files.
std::string m_tmvaCalibArea
Int_t FindBin(const TAxis *axis, const double x)
std::string m_weightFileName
virtual StatusCode tag(const xAOD::Jet &jet) const =0
Decorate single jet with tagging info.
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decPassScoreKey
StatusCode getWeight(const xAOD::Jet &jet, bool passSel, asg::AcceptData &acceptData) const
Get SF weight.
const float SF[NF]
Cross sections for Fluor.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readTau2WTAKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readSplit12Key
float m_jetPtMin
Kinematic bounds for the jet - the units are controlled by m_ptGeV.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decL3Key
Helper class to provide constant type-safe access to aux data.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decCutMLowKey
WriteDecorHandle keys for cut values.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decC2Key
std::string m_decorationName
Decoration name.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readECFG331Key
#define ATH_MSG_VERBOSE(x)
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readTau21WTAKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decValidPtRangeHighKey
bool isValid() const
Test to see if the link can be dereferenced.
std::unique_ptr< TF1 > m_funcMassCutHigh
std::string m_weightHistogramName
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decValidJetContentKey
const std::string & getCutName(unsigned int cutPosition) const
Get the name of a cut, based on the cut position (slow, avoid usage)
std::string m_calibArea
Location where config files live on cvmfs.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decWeightKey
WriteDecorHandle keys for SF.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readTruthLabelKey
Truth label ReadDecorHandle key.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decSigeffSFKey
std::string m_truthLabelName
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decEfficiencyKey
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decE3Key
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decCutMHighKey
bool m_ptGeV
Flag to indicate units pT is defined in Set to false by default.
void efficiency(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decTau32WTAKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readQwKey
Handle class for reading a decoration on an object.
virtual StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate jet collection with tagging info.
std::pair< double, double > getSF(const xAOD::Jet &jet, const std::string &truthLabelStr) const
Get scale factor and efficiency.
std::unique_ptr< TFile > m_weightConfig
Histograms for scale factors.
std::string m_kerasConfigOutputName
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readECFG212Key
std::string m_tmvaConfigFileName
TMVA configurations for BDT taggers.
::StatusCode StatusCode
StatusCode definition for legacy code.
unsigned int getNCuts() const
Get the number of cuts defined.
StatusCode checkKinRange(const xAOD::Jet &jet, asg::AcceptData &acceptData) const
Check and record if jet passes kinematic constraints.
Handle class for adding a decoration to an object.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readL3Key
std::string m_efficiencyHistogramName
std::string m_strScoreCut
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decTau42WTAKey
int calculateJSSRatios(const xAOD::Jet &jet) const
Calculate JSS moment ratios in case they are not already saved TODO: Remove this once JSSMomentTools ...
std::string m_truthBosonContainerName
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decEffSFKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decNtrk500Key
std::string m_wkpt
Tagger information.
bool m_calcSF
Flag to calculate scale factor.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decValidEventContentKey
StatusCode GetUnGroomTracks(const xAOD::Jet &jet, int indexPV) const
Retrieve Ntrk variable from the ungroomed parent jet.
int findPV() const
Find the PV (to be used for Ntrk)
ElementLink implementation for ROOT usage.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decD2Key
std::string m_truthTopQuarkContainerName
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readThrustMajKey
virtual StatusCode initialize() override
Initialize the tool.
asg::AcceptInfo m_acceptInfo
Object that stores the results for a jet.
std::string to_string(const DetectorType &type)
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decTau21WTAKey
WriteDecorHandle keys for JSS moments.
bool m_truthLabelUseTRUTH3
Truth label options.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decScoreValueKey
void printCuts() const
Print configured cuts.
std::string m_weightDecorationName
String for scale factor decoration names.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decValidKinRangeKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readTau1WTAKey
ReadDecorHandle keys for JSS moments.
std::map< std::string, std::unique_ptr< TH2D > > m_weightHistograms
void setCutResult(const std::string &cutName, bool cutResult)
Set the result of a cut, based on the cut name (safer)
bool passKinRange(const xAOD::Jet &jet) const
Check if jet passes kinematic constraints.
void clear()
Clear all bits.
bool getCutResult(const std::string &cutName) const
Get the result of a cut, based on the cut name (safer)
#define ATH_MSG_WARNING(x)
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decValidPtRangeLowKey
std::string m_truthParticleContainerName
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readSphericityKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readTau3WTAKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readD2Key
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readECF2Key
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readECF3Key
StatusCode getConfigReader()
Get configReader StatusCode.
TypeEnum intToEnum(const int type)
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decPassMassKey
JSSTaggerBase(const std::string &name)
Default constructor - to be used in all derived classes.
std::unique_ptr< TF1 > m_funcMassCutLow
TF1 for cut functions.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
std::string m_strMassCutHigh
std::string m_kerasConfigFileName
Keras configurations for ML taggers.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decL2Key
std::string m_weightConfigPath
Path to the SF configuration root file.
std::string m_weightFlavors
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readE3Key
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readL2Key
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readC2Key
const std::string & getCutDescription(const std::string &cutName) const
Get the description of a cut, based on the cut name.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decTaggedKey
WriteDecorHandle keys for tagging bools.
int addCut(const std::string &cutName, const std::string &cutDescription)
Add a cut; returning the cut position.
std::string m_containerName
Configurable members.