![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
109 ATH_MSG_ERROR(
"No config file provided OR you haven't manually specified all needed parameters" ) ;
111 return StatusCode::FAILURE;
122 ATH_MSG_ERROR(
"You need to specify where the calibarea is as either being Local or on CVMFS" );
123 return StatusCode::FAILURE;
126 std::string localCalibArea =
"BoostedJetTaggers/JSSWTopTaggerDNN/";
127 ATH_MSG_INFO(
"Using Local calibarea " << localCalibArea );
147 if ( !input_cfg.is_open() ) {
149 ATH_MSG_ERROR(
"Are you sure that the file exists at this path?" );
150 return StatusCode::FAILURE;
157 m_lwnn = std::make_unique<lwt::LightweightNeuralNetwork>(
cfg.inputs,
cfg.layers,
cfg.outputs);
164 else if ( !
m_tagType.compare(
"WBoson") ) {
168 else if ( !
m_tagType.compare(
"ZBoson") ) {
173 ATH_MSG_ERROR(
"I can't tell what kind of tagger your configuration is for." );
174 return StatusCode::FAILURE;
190 #ifndef XAOD_STANDALONE
204 return StatusCode::SUCCESS;
223 float jet_pt =
jet.pt()/1000.0;
224 float jet_mass =
jet.m()/1000.0;
235 ATH_MSG_VERBOSE(
"Cut values : Mass window = [" << cut_mass_low <<
"," << cut_mass_high <<
"], score cut = " << cut_score );
236 ATH_MSG_VERBOSE(
"Jet values : Mass = " << jet_mass <<
", score = " << jet_score );
254 decCutMLow(
jet) = cut_mass_low;
255 decCutMHigh(
jet) = cut_mass_high;
256 decScoreCut(
jet) = cut_score;
257 decScoreValue(
jet) = jet_score;
260 bool passCuts =
true;
265 if ( jet_mass > cut_mass_low ) acceptData.
setCutResult(
"PassMassLow",
true );
266 if ( jet_mass < cut_mass_high ) acceptData.
setCutResult(
"PassMassHigh",
true );
267 if ( jet_score > cut_score ) acceptData.
setCutResult(
"PassScore",
true );
271 else if (
m_tagClass == TAGCLASS::TopQuark ) {
273 if ( jet_mass > cut_mass_low ) acceptData.
setCutResult(
"PassMassLow",
true );
274 if ( jet_score > cut_score ) acceptData.
setCutResult(
"PassScore",
true );
276 passCuts = passCuts && acceptData.
getCutResult(
"PassMassLow" );
281 passCuts = passCuts && acceptData.
getCutResult(
"PassScore" );
283 decTagged(
jet) = passCuts;
285 return StatusCode::SUCCESS;
298 double DNNscore = -666.;
301 bool validVars =
true;
303 if ( readTau21WTA(
jet) < 0.0 ) validVars =
false;
306 if ( readTau32WTA(
jet) < 0.0 ) validVars =
false;
312 else ATH_MSG_DEBUG(
"One (or more) tagger input variable has an out-of-range value, setting score to -666" );
327 std::map<std::string,double> DNN_inputValues;
342 DNN_inputValues[
"CaloTACombinedMassUncorrelated"] =
jet.m();
343 DNN_inputValues[
"JetpTCorrByCombinedMass"] =
jet.pt();
346 DNN_inputValues[
"Split12"] = readSplit12(
jet);
349 DNN_inputValues[
"C2"] = readC2(
jet);
350 DNN_inputValues[
"D2"] = readD2(
jet);
353 DNN_inputValues[
"Tau21_wta"] = readTau21WTA(
jet);
360 DNN_inputValues[
"FoxWolfram20"] =
jet.getAttribute<
float>(
"FoxWolfram2") /
jet.getAttribute<
float>(
"FoxWolfram0");
361 DNN_inputValues[
"PlanarFlow"] =
jet.getAttribute<
float>(
"PlanarFlow");
362 DNN_inputValues[
"Angularity"] =
jet.getAttribute<
float>(
"Angularity");
363 DNN_inputValues[
"Aplanarity"] =
jet.getAttribute<
float>(
"Aplanarity");
364 DNN_inputValues[
"ZCut12"] =
jet.getAttribute<
float>(
"ZCut12");
365 DNN_inputValues[
"KtDR"] =
jet.getAttribute<
float>(
"KtDR");
367 int pv_location =
findPV();
369 if(pv_location != -1){
373 DNN_inputValues[
"Ntrk500"] = readNtrk500(
jet);
376 ATH_MSG_ERROR(
"Either the ungroomed parent jet doesn't have 'NumTrkPt500' as an attribute or the parent link is broken");
377 DNN_inputValues[
"Ntrk500"] = -999;
382 DNN_inputValues[
"Ntrk500"] = -999;
388 else if (
m_tagClass == TAGCLASS::TopQuark ) {
409 DNN_inputValues[
"m"] =
jet.m();
410 DNN_inputValues[
"pt"] =
jet.pt();
413 DNN_inputValues[
"Split23"] = readSplit23(
jet);
416 DNN_inputValues[
"e3"] = readE3(
jet);
419 DNN_inputValues[
"Tau1_wta"] = readTau1WTA(
jet);
420 DNN_inputValues[
"Tau2_wta"] = readTau2WTA(
jet);
421 DNN_inputValues[
"Tau3_wta"] = readTau3WTA(
jet);
423 DNN_inputValues[
"Tau4_wta"] = readTau4WTA(
jet);
424 DNN_inputValues[
"Tau42_wta"] = readTau42WTA(
jet);
427 DNN_inputValues[
"Tau32_wta"] = readTau32WTA(
jet);
430 DNN_inputValues[
"Qw"] = readQw(
jet);
433 DNN_inputValues[
"ThrustMaj"] = readThrustMaj(
jet);
436 DNN_inputValues[
"L2"] = readL2(
jet);
439 DNN_inputValues[
"L3"] = readL3(
jet);
444 ATH_MSG_ERROR(
"Loading variables failed because the tagger type is not supported" );
447 return DNN_inputValues;
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readTau4WTAKey
bool m_suppressOutputDependence
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readSplit23Key
JSSWTopTaggerDNN(const std::string &name)
Constructor.
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
std::atomic< int > m_nWarnVar
Warning counters.
bool m_useMassCut
Flag to indicate if mass window cut is used.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readTau42WTAKey
std::string m_kerasCalibArea
std::string m_configFile
Configuration file name.
bool m_useScoreCut
Flag to indicate if a discriminant score is used.
TEnv m_configReader
TEnv instance to read config files.
const int m_nWarnMax
Maximum number of warnings.
std::string m_weightFileName
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.
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_decCutMLowKey
WriteDecorHandle keys for cut values.
std::string m_decorationName
Decoration name.
#define ATH_MSG_VERBOSE(x)
virtual StatusCode initialize() override
Run once at the start of the job to setup everything.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readTau21WTAKey
JSONConfig parse_json(std::istream &json)
std::unique_ptr< TF1 > m_funcMassCutHigh
std::string m_weightHistogramName
std::string m_truthLabelName
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decCutMHighKey
bool m_ptGeV
Flag to indicate units pT is defined in Set to false by default.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readQwKey
Handle class for reading a decoration on an object.
std::string m_kerasConfigOutputName
::StatusCode StatusCode
StatusCode definition for legacy code.
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
int calculateJSSRatios(const xAOD::Jet &jet) const
Calculate JSS moment ratios in case they are not already saved TODO: Remove this once JSSMomentTools ...
bool m_calcSF
Flag to calculate scale factor.
std::unique_ptr< lwt::LightweightNeuralNetwork > m_lwnn
DNN tools.
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)
std::string m_kerasConfigFilePath
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.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decScoreValueKey
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
void printCuts() const
Print configured cuts.
std::string m_weightDecorationName
String for scale factor decoration names.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readTau1WTAKey
ReadDecorHandle keys for JSS moments.
void setCutResult(const std::string &cutName, bool cutResult)
Set the result of a cut, based on the cut name (safer)
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::ReadDecorHandleKey< xAOD::JetContainer > m_readTau3WTAKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readD2Key
StatusCode getConfigReader()
Get configReader StatusCode.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decPassMassKey
std::unique_ptr< TF1 > m_funcMassCutLow
TF1 for cut functions.
std::string m_strMassCutHigh
double getScore(const xAOD::Jet &jet) const
Retrieve score for a given DNN type (top/W)
std::string m_kerasConfigFileName
Keras configurations for ML taggers.
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
std::map< std::string, double > ValueMap
std::map< std::string, double > getJetProperties(const xAOD::Jet &jet) const
Update the jet substructure variables for each jet to use in DNN.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_readC2Key
virtual StatusCode tag(const xAOD::Jet &jet) const override
Decorate single jet with tagging info.
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.