ATLAS Offline Software
Loading...
Searching...
No Matches
PanTau::Tool_FeatureExtractor Class Reference

Tool to extract jet features from tau seeds. More...

#include <Tool_FeatureExtractor.h>

Inheritance diagram for PanTau::Tool_FeatureExtractor:
Collaboration diagram for PanTau::Tool_FeatureExtractor:

Public Member Functions

 Tool_FeatureExtractor (const std::string &name)
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
virtual StatusCode execute (PanTau::PanTauSeed *inSeed) const override
bool isInitialized () override
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

StatusCode calculateBasicFeatures (PanTau::PanTauSeed *inSeed) const
StatusCode calculateFeatures (PanTau::PanTauSeed *inSeed, int tauConstituentType, const std::map< std::string, double > &variants_SeedEt) const
StatusCode addConstituentMomenta (PanTau::PanTauSeed *inSeed) const
StatusCode addCombinedFeatures (PanTau::PanTauSeed *inSeed) const
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
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)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Static Protected Member Functions

static void fillVariantsSeedEt (const std::vector< PanTau::TauConstituent * > &tauConstituents, std::map< std::string, double > &variants_SeedEt)
static void addFeatureWrtSeedEnergy (PanTau::TauFeature *targetMap, const std::string &featName, double numerator, const std::map< std::string, double > &denominatorMap)
static const std::string varTypeName_Ratio ()
static const std::string varTypeName_Mean ()
static const std::string varTypeName_StdDev ()
static const std::string varTypeName_HLV ()
static const std::string varTypeName_DeltaR ()
static const std::string varTypeName_JetMoment ()
static const std::string varTypeName_Combined ()
static const std::string varTypeName_Basic ()
static const std::string varTypeName_PID ()
static const std::string varTypeName_Shots ()

Protected Attributes

PanTau::HelperFunctions m_HelperFunctions
ToolHandle< PanTau::ITool_InformationStorem_Tool_InformationStore {this, "Tool_InformationStore", "PanTau::Tool_InformationStore/Tool_InformationStore","Tool handle to the information store tool"}
Gaudi::Property< std::string > m_Tool_InformationStoreName {this, "Tool_InformationStoreName", "", "Tool handle to the information store tool"}
int m_Config_UseEmptySeeds = 0
std::vector< double > m_Config_BinEdges_Eta
 Helper members.
std::vector< double > m_Config_CellBased_EtaBinned_Pi0MVACut_1prong
std::vector< double > m_Config_CellBased_EtaBinned_Pi0MVACut_3prong
std::string m_varTypeName_Ratio
std::string m_varTypeName_StdDev
std::string m_varTypeName_HLV
std::string m_varTypeName_JetMoment
std::string m_varTypeName_Combined
std::string m_varTypeName_Basic
std::string m_varTypeName_PID
bool m_init =false

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Tool to extract jet features from tau seeds.

Author
Christian Limbach
Sebastian Fleischmann

Definition at line 31 of file Tool_FeatureExtractor.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ Tool_FeatureExtractor()

PanTau::Tool_FeatureExtractor::Tool_FeatureExtractor ( const std::string & name)

Definition at line 22 of file Tool_FeatureExtractor.cxx.

22 :
23 asg::AsgTool(name)
24{}

Member Function Documentation

◆ addCombinedFeatures()

StatusCode PanTau::Tool_FeatureExtractor::addCombinedFeatures ( PanTau::PanTauSeed * inSeed) const
protected

Definition at line 345 of file Tool_FeatureExtractor.cxx.

345 {
346
347 // Prepare some short notations for variables
348 PanTau::TauFeature* tauFeatures = inSeed->getFeatures();
349
350 // Prepare the list of names for EFO Types &
351 // the 4 momenta of the different sub systems
352 // (ie. charged, neutral subsystem, etc...)
353 TLorentzVector tlv_System[PanTau::TauConstituent::t_nTypes];
354 TLorentzVector tlv_1stEFO[PanTau::TauConstituent::t_nTypes];
355
356 // get input objects to calc combined features
357 bool tlv_Sys_OK[PanTau::TauConstituent::t_nTypes];
358 bool tlv_1st_OK[PanTau::TauConstituent::t_nTypes];
359
360 //initialize arrays with default values
361 for(unsigned int iType=0; iType<(unsigned int)PanTau::TauConstituent::t_nTypes; iType++) {
362 tlv_System[iType] = TLorentzVector();
363 tlv_1stEFO[iType] = TLorentzVector();
364 tlv_Sys_OK[iType] = false;
365 tlv_1st_OK[iType] = false;
366 }
367
368 for(int iType=0; iType<static_cast<int>(PanTau::TauConstituent::t_nTypes); iType++) {
369
370 tlv_System[iType] = inSeed->getSubsystemHLV(iType, tlv_Sys_OK[iType]);
371 if (!tlv_Sys_OK[iType]) continue;
372
373 std::vector<TauConstituent*> typeConstituents = inSeed->getConstituentsOfType(iType, tlv_Sys_OK[iType]);
374 if (typeConstituents.empty()) tlv_Sys_OK[iType] = false;
375 if (!tlv_Sys_OK[iType]) continue;
376
377 if (!typeConstituents.empty()) {
378 tlv_1stEFO[iType] = typeConstituents.at(0)->p4();
379 tlv_1st_OK[iType] = true;
380 } else {
381 tlv_1st_OK[iType] = false;
382 }
383 }
384
385 // From the extracted input, calc combined features
386 std::string prefixVARType = m_varTypeName_Combined;
387
388 // Combined Type-vs-Type Features
389 // Loop over all EFO types...
390 // for every type, loop over all other types (but neglect permutations, i.e. A,B is the same as B,A)
391 // calculate ratios, angles etc...
392
393 for(int iType=0; iType<PanTau::TauConstituent::t_nTypes; iType++) {
394
395 if(iType == static_cast<int>(PanTau::TauConstituent::t_NoType)) continue;
396 int type_Denom = iType;
397
398 for(int jType=0; jType<PanTau::TauConstituent::t_nTypes; jType++) {
399
400 if(jType == static_cast<int>(PanTau::TauConstituent::t_NoType)) continue;
401 int type_Nom = jType;
402
403 if(jType == iType) continue;
404
405 std::string typeName_Nom = PanTau::TauConstituent::getTypeName((PanTau::TauConstituent::Type)type_Nom);
406 std::string typeName_Denom = PanTau::TauConstituent::getTypeName((PanTau::TauConstituent::Type)type_Denom);
407
408 //following features symmetric in system A-B, hence skip multi calculation
409 if(jType <= iType) continue;
410
411 if(tlv_1st_OK[type_Nom] && tlv_1st_OK[type_Denom]) {
412 //Delta R between 1st and 1st EFO
413 tauFeatures->addFeature("CellBased_" + prefixVARType + "_DeltaR1st" + typeName_Nom + "To1st" + typeName_Denom, tlv_1stEFO[type_Nom].DeltaR( tlv_1stEFO[type_Denom] ) );
414
415 } //end check for valid leading efo
416
417 }//end loop over system B
418 }//end loop over system A
419
420 return StatusCode::SUCCESS;
421}
std::vector< PanTau::TauConstituent * > getConstituentsOfType(int tauConstituent_Type, bool &foundit)
TLorentzVector getSubsystemHLV(int tauConstituent_Type, bool &foundit)
const PanTau::TauFeature * getFeatures() const
Definition PanTauSeed.h:217
std::vector< std::string > getTypeName() const
Type
Type enumeration to specify type of this tau constituent.
bool addFeature(const std::string &name, const double value)
adds a new feature

◆ addConstituentMomenta()

StatusCode PanTau::Tool_FeatureExtractor::addConstituentMomenta ( PanTau::PanTauSeed * inSeed) const
protected

Definition at line 154 of file Tool_FeatureExtractor.cxx.

154 {
155 TauFeature* tauFeatureMap = inSeed->getFeatures();
156 std::string prefixVARType = m_varTypeName_HLV;
157 for(int iType=0; iType<static_cast<int>(PanTau::TauConstituent::t_nTypes); iType++) {
158 bool isOK;
159 std::vector<PanTau::TauConstituent*> list_TypeConstituents = inSeed->getConstituentsOfType(iType, isOK); // list of constituents of current type
160 TLorentzVector tlv_TypeConstituents = inSeed->getSubsystemHLV(iType, isOK); // summed hlv of objects of current type
162 std::string name = "CellBased_" + curTypeName + "_" + prefixVARType;
163
164 if(!list_TypeConstituents.empty()) {
165 tauFeatureMap->addFeature(name + "_SumM", tlv_TypeConstituents.M());
166 }
167
168 } //end loop over constituent types
169
170 return StatusCode::SUCCESS;
171}

◆ addFeatureWrtSeedEnergy()

void PanTau::Tool_FeatureExtractor::addFeatureWrtSeedEnergy ( PanTau::TauFeature * targetMap,
const std::string & featName,
double numerator,
const std::map< std::string, double > & denominatorMap )
staticprotected

Definition at line 75 of file Tool_FeatureExtractor.cxx.

78 {
79 std::map<std::string, double>::const_iterator it = denominatorMap.begin();
80 for(; it!=denominatorMap.end(); ++it) {
81 std::string FullName = featName + it->first;
82 float value = static_cast<float>(it->second);
83 if(value <= 0. || std::isnan(value) || std::isinf(value) ) continue;
84 targetMap->addFeature(FullName, numerator / it->second);
85 }
86}

◆ calculateBasicFeatures()

StatusCode PanTau::Tool_FeatureExtractor::calculateBasicFeatures ( PanTau::PanTauSeed * inSeed) const
protected

Loop over types to fill

  • multiplicity of that type
  • sum charge and abs charge

Definition at line 128 of file Tool_FeatureExtractor.cxx.

128 {
129
130 PanTau::TauFeature* featureMap = inSeed->getFeatures();
131
132 std::string featurePrefix = m_varTypeName_Basic;
133 std::string name = "CellBased_" + featurePrefix;
134
138 for(int iType=0; iType<PanTau::TauConstituent::t_nTypes; iType++) {
139
140 bool foundIt = false;
141 std::vector<TauConstituent*> curList = inSeed->getConstituentsOfType(iType, foundIt);
142 if(!foundIt) continue;
143
144 //store multiplicity of current type
146 unsigned int nConstituents = curList.size();
147 featureMap->addFeature(name + "_N" + typeName + "Consts", nConstituents);
148 }
149
150 return StatusCode::SUCCESS;
151}

◆ calculateFeatures()

StatusCode PanTau::Tool_FeatureExtractor::calculateFeatures ( PanTau::PanTauSeed * inSeed,
int tauConstituentType,
const std::map< std::string, double > & variants_SeedEt ) const
protected

//////////////////////////////////////////
Prepare variables for information from eflow Objects //////////////////////////////////////////

////////////////////////////////////////// Loop over selected constituents and collect information //////////////////////////////////////////

////////////////////////////////////////// Calculate & fill features //////////////////////////////////////////

Multiplicities ///////////////////////////////////////////

Substructure particle ID features ///////////////////////////////////////////

Shot information ///////////////////////////////////////////

Ratios ///////////////////////////////////////////

Standard deviations ///////////////////////////////////////////

JetMoment ///////////////////////////////////////////

Definition at line 174 of file Tool_FeatureExtractor.cxx.

176 {
177
178 std::string curTypeName = PanTau::TauConstituent::getTypeName( (PanTau::TauConstituent::Type)tauConstituentType );
179 std::string curTypeName_All = PanTau::TauConstituent::AllConstituentsName();
180 PanTau::TauFeature* tauFeatureMap = inSeed->getFeatures();
181 TLorentzVector tlv_Reference = inSeed->getProtoMomentumCore();
182
183 std::vector<PanTau::TauConstituent*> list_AllConstituents = inSeed->getConstituentsAsList_Core();
184
185 bool foundIt = false;
186 std::vector<PanTau::TauConstituent*> list_TypeConstituents;
187 if (tauConstituentType != PanTau::TauConstituent::t_NoType) list_TypeConstituents = inSeed->getConstituentsOfType(tauConstituentType, foundIt);
188 if (tauConstituentType == PanTau::TauConstituent::t_NoType) list_TypeConstituents = list_AllConstituents;
189 if (!foundIt) return StatusCode::SUCCESS;
190
191 unsigned int n_Constituents_Type = list_TypeConstituents.size();
192
193 //sort the lists by Et
194 std::sort(list_AllConstituents.begin(), list_AllConstituents.end(), sortTauConstituentEt);
195 std::sort(list_TypeConstituents.begin(), list_TypeConstituents.end(), sortTauConstituentEt);
196
197 //make an additional list of constituents, but now ordered by BDT value
198 std::vector<PanTau::TauConstituent*> list_TypeConstituents_SortBDT = list_TypeConstituents;
199 std::sort(list_TypeConstituents_SortBDT.begin(), list_TypeConstituents_SortBDT.end(), sortTauConstituentMVA);
200
201 TLorentzVector tlv_1st_BDT;
202
203 if(!list_TypeConstituents_SortBDT.empty()) tlv_1st_BDT = list_TypeConstituents_SortBDT[0]->p4();
204
208
209 // ===> Sum of Et, Et^2, E and E^2
210 double sum_Et = 0;
211 double sum_Et2 = 0;
212 // ===> Sum of Et (and E) times DeltaR, DeltaR', Angle
213 double sum_EtxDR = 0;
214 // ===> Multiplicities
215 unsigned int num_EFOs = 0;
216
220 for(unsigned int iTypeConst=0; iTypeConst<list_TypeConstituents.size(); iTypeConst++) {
221
222 //get hep lorentz vector
223 TLorentzVector tlv_curConst = list_TypeConstituents.at(iTypeConst)->p4();
224
225 //final check (nan & inf)
226 if (std::isnan(tlv_curConst.Pt()) || std::isinf(tlv_curConst.Pt())) continue;
227
228 //ready to calc stuff
229 //basically update each of the prepared sum_* and num_* variables above,
230 // the sum HLV and the pointers to 1st, 2nd, 3rd leading constituents of current type
231
232 //helpers to reduce function calls
233 double hlp_Et = tlv_curConst.Et();
234 double hlp_Et2 = hlp_Et * hlp_Et;
235 double hlp_DeltaR = tlv_Reference.DeltaR(tlv_curConst);
236
237 // update Sum of Et, Et^2, E and E^2
238 sum_Et += hlp_Et;
239 sum_Et2 += hlp_Et2;
240 // update Sum of Et (and E) times DeltaR, DeltaR', Angle
241 sum_EtxDR += hlp_Et * hlp_DeltaR;
242 // update Multiplicities
243 num_EFOs++;
244 }//end loop over selected EFOs
245
246
247
251
252 // naming string
253 std::string prefixVARType = "";
254
256 //if there are no EFOs of this type in the seed, all other variables cannot be calculated to have any reasonable value
257 if( num_EFOs == 0 ) {
258 return StatusCode::SUCCESS;
259 }
260
262 prefixVARType = m_varTypeName_PID;
263
264 // Sorted by highest BDT score
265 for(unsigned int iTypeConst=0; iTypeConst<n_Constituents_Type; iTypeConst++) {
266
267 double value_BDT = list_TypeConstituents_SortBDT[iTypeConst]->getBDTValue();
268 if( std::isnan(value_BDT) || std::isinf(value_BDT) ) continue;
269
270 //correct BDT value based on BDT cut
271 if(tauConstituentType != PanTau::TauConstituent::t_Charged) {
272 double mvaCorrection = 0.0;
273 double etaCurConst = list_TypeConstituents_SortBDT[iTypeConst]->p4().Eta();
274 int etaBinIndex = m_HelperFunctions.getBinIndex(m_Config_BinEdges_Eta, std::abs(etaCurConst));
275 int numTrack = inSeed->getTauJet()->nTracks();
276 if(numTrack == 1) { mvaCorrection = m_Config_CellBased_EtaBinned_Pi0MVACut_1prong.at(etaBinIndex); }
277 else { mvaCorrection = m_Config_CellBased_EtaBinned_Pi0MVACut_3prong.at(etaBinIndex); }
278
279 value_BDT = value_BDT - mvaCorrection;
280 }
281
282 std::string iConst = m_HelperFunctions.convertNumberToString(static_cast<double>(iTypeConst+1));
283 tauFeatureMap->addFeature("CellBased_" + curTypeName + "_" + prefixVARType + "_BDTValues_BDTSort_" + iConst, value_BDT);
284
285 }
286
289 //only execute if the constituent type is neutral
290 if(PanTau::TauConstituent::isNeutralType(tauConstituentType)) {
291
292 unsigned int totalPhotonsInSeed = 0;
293
294 for(unsigned int iConst=0; iConst<list_TypeConstituents_SortBDT.size(); iConst++) {
295
296 PanTau::TauConstituent* curConst = list_TypeConstituents_SortBDT.at(iConst);
297 std::vector<PanTau::TauConstituent*> shotConstituents = curConst->getShots();
298 unsigned int nShots = shotConstituents.size();
299
300 unsigned int totalPhotonsInNeutral = 0;
301
302 for(unsigned int iShot=0; iShot<nShots; iShot++) {
303 PanTau::TauConstituent* curShot = shotConstituents.at(iShot);
304 totalPhotonsInNeutral += curShot->getNPhotonsInShot();
305 }//end loop over shots
306 totalPhotonsInSeed += totalPhotonsInNeutral;
307
308 }//end loop over constituents in tau
309
310 //number of shots in seed
311 tauFeatureMap->addFeature("CellBased_" + curTypeName + "_" + prefixVARType + "_NPhotonsInSeed", totalPhotonsInSeed);
312
313 }//end if check for shot info dumping
314
315
317 prefixVARType = m_varTypeName_Ratio;
318
319 if(curTypeName != curTypeName_All) addFeatureWrtSeedEnergy(tauFeatureMap, "CellBased_" + curTypeName + "_" + prefixVARType + "_EtOver", sum_Et, variants_SeedEt);
320
321 if(tlv_1st_BDT.Pt() != 0) addFeatureWrtSeedEnergy(tauFeatureMap, "CellBased_" + curTypeName + "_" + prefixVARType + "_1stBDTEtOver", tlv_1st_BDT.Et(), variants_SeedEt);
322
324 prefixVARType = m_varTypeName_StdDev;
325
326 double stddev_Et = m_HelperFunctions.stddev(sum_Et2, sum_Et, num_EFOs);
327
328 if(stddev_Et > 0.) addFeatureWrtSeedEnergy(tauFeatureMap, "CellBased_" + curTypeName + "_" + prefixVARType + "_Et_Wrt", stddev_Et, variants_SeedEt);
329
331 // Moment wrt X = Sum( Et * X ) / Sum(Et)
332 // ==> Named as Eflow_EFOType_JetMoment_EtX" when using Et as weight
333 // ==> Named as Eflow_EFOType_JetMoment_EX" when using E as weight
334 prefixVARType = m_varTypeName_JetMoment;
335
336 if(sum_Et > 0.) {
337 //Using transverse energy
338 tauFeatureMap->addFeature("CellBased_" + curTypeName + "_" + prefixVARType + "_EtDRxTotalEt", (sum_EtxDR / sum_Et) * variants_SeedEt.at("EtAllConsts"));
339 }
340
341 return StatusCode::SUCCESS;
342}
bool sortTauConstituentMVA(const PanTau::TauConstituent *u, const PanTau::TauConstituent *v)
bool sortTauConstituentEt(const PanTau::TauConstituent *u, const PanTau::TauConstituent *v)
TLorentzVector getProtoMomentumCore() const
Definition PanTauSeed.h:219
const std::vector< PanTau::TauConstituent * > & getConstituentsAsList_Core() const
Definition PanTauSeed.h:221
const xAOD::TauJet * getTauJet() const
Definition PanTauSeed.h:215
const std::vector< TauConstituent * > & getShots() const
static bool isNeutralType(int tauConstituentType)
static std::string AllConstituentsName()
std::vector< double > m_Config_BinEdges_Eta
Helper members.
static const std::string varTypeName_Shots()
std::vector< double > m_Config_CellBased_EtaBinned_Pi0MVACut_3prong
std::vector< double > m_Config_CellBased_EtaBinned_Pi0MVACut_1prong
static void addFeatureWrtSeedEnergy(PanTau::TauFeature *targetMap, const std::string &featName, double numerator, const std::map< std::string, double > &denominatorMap)
PanTau::HelperFunctions m_HelperFunctions
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode PanTau::Tool_FeatureExtractor::execute ( PanTau::PanTauSeed * inSeed) const
overridevirtual

Implements PanTau::ITool_PanTauTools.

Definition at line 89 of file Tool_FeatureExtractor.cxx.

89 {
90
93 bool noValidInputTau = inSeed->isOfTechnicalQuality(PanTau::PanTauSeed::t_NoValidInputTau);
94 bool isBadSeed = (noAnyConstituents || noSelConstituents || noValidInputTau);
95 if(static_cast<bool>(m_Config_UseEmptySeeds)) isBadSeed = noValidInputTau;
96
97 if (isBadSeed) {
98 ATH_MSG_DEBUG("Seed is not valid for feature extraction (no constituents or no valid input tau) - just fill isPanTauCandidate feature");
99 inSeed->getFeatures()->addFeature("CellBased_" + m_varTypeName_Basic + "_isPanTauCandidate", 0);
100 return StatusCode::SUCCESS;
101 }
102 inSeed->getFeatures()->addFeature("CellBased_" + m_varTypeName_Basic + "_isPanTauCandidate", 1);
103
104
106
108
109 // map containing different methods to calc seed et
110 std::map<std::string, double> variants_SeedEt;
111 // calculate the Et variants for the seed
112 fillVariantsSeedEt(inSeed->getConstituentsAsList_All(), variants_SeedEt);
113
114 //loop through all types of Constituents in tau and calculate type features for them
115 //baseline
116 ATH_CHECK( calculateFeatures(inSeed, PanTau::TauConstituent::t_NoType, variants_SeedEt) ); //=> all constituents
117 ATH_CHECK( calculateFeatures(inSeed, PanTau::TauConstituent::t_Charged, variants_SeedEt) ); //=> charged ones in core
118 ATH_CHECK( calculateFeatures(inSeed, PanTau::TauConstituent::t_Neutral, variants_SeedEt) ); //=> neutral ones in core
119 ATH_CHECK( calculateFeatures(inSeed, PanTau::TauConstituent::t_Pi0Neut, variants_SeedEt) ); //=> pi0 tagged ones in core
120
121 //fill the combined features
123
124 return StatusCode::SUCCESS;
125}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
bool isOfTechnicalQuality(int pantauSeed_TechnicalQuality) const
const std::vector< PanTau::TauConstituent * > & getConstituentsAsList_All() const
Definition PanTauSeed.h:222
StatusCode addConstituentMomenta(PanTau::PanTauSeed *inSeed) const
StatusCode calculateFeatures(PanTau::PanTauSeed *inSeed, int tauConstituentType, const std::map< std::string, double > &variants_SeedEt) const
StatusCode addCombinedFeatures(PanTau::PanTauSeed *inSeed) const
StatusCode calculateBasicFeatures(PanTau::PanTauSeed *inSeed) const
static void fillVariantsSeedEt(const std::vector< PanTau::TauConstituent * > &tauConstituents, std::map< std::string, double > &variants_SeedEt)

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ fillVariantsSeedEt()

void PanTau::Tool_FeatureExtractor::fillVariantsSeedEt ( const std::vector< PanTau::TauConstituent * > & tauConstituents,
std::map< std::string, double > & variants_SeedEt )
staticprotected

Definition at line 53 of file Tool_FeatureExtractor.cxx.

54 {
55
56 //use different approaches to calculate total energy of seed:
57 variants_SeedEt["EtAllConsts"] = 0.0;
58
59 //loop over all constituents in seed
60 for (unsigned int iConst = 0; iConst < tauConstituents.size(); iConst++) {
61
62 //get current constituents
63 PanTau::TauConstituent* curConstituent = tauConstituents.at(iConst);
64 double curEt = curConstituent->p4().Et();
65
66 //update the different Et definitions
67 if (curConstituent->isOfType(PanTau::TauConstituent::t_Charged) ||
69 variants_SeedEt["EtAllConsts"] += curEt;
70 }
71 }//end loop over constituents in seed
72}
virtual FourMom_t p4() const
The full 4-momentum of the particle as a TLorentzVector.
bool isOfType(TauConstituent::Type aType) const

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ initialize()

StatusCode PanTau::Tool_FeatureExtractor::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 27 of file Tool_FeatureExtractor.cxx.

27 {
28
29 ATH_MSG_INFO(" initialize()");
30 m_init=true;
31
34
35 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_Ratio", m_varTypeName_Ratio) );
36 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_StdDev", m_varTypeName_StdDev) );
37 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_HLV", m_varTypeName_HLV) );
38 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_JetMoment", m_varTypeName_JetMoment) );
39 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_Combined", m_varTypeName_Combined) );
40 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_Basic", m_varTypeName_Basic) );
41 ATH_CHECK( m_Tool_InformationStore->getInfo_String("FeatureExtractor_VarTypeName_varTypeName_PID", m_varTypeName_PID) );
42
43 ATH_CHECK( m_Tool_InformationStore->getInfo_Int("FeatureExtractor_UseEmptySeeds", m_Config_UseEmptySeeds) );
44
45 ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("Common_BinEdges_Eta", m_Config_BinEdges_Eta) );
46 ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("CellBased_EtaBinned_Pi0MVACut_1prong", m_Config_CellBased_EtaBinned_Pi0MVACut_1prong) );
47 ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("CellBased_EtaBinned_Pi0MVACut_3prong", m_Config_CellBased_EtaBinned_Pi0MVACut_3prong) );
48
49 return StatusCode::SUCCESS;
50}
#define ATH_MSG_INFO(x)
static StatusCode bindToolHandle(ToolHandle< T > &, std::string)
Gaudi::Property< std::string > m_Tool_InformationStoreName
ToolHandle< PanTau::ITool_InformationStore > m_Tool_InformationStore

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isInitialized()

bool PanTau::Tool_FeatureExtractor::isInitialized ( )
inlineoverridevirtual

Implements PanTau::ITool_PanTauTools.

Definition at line 105 of file Tool_FeatureExtractor.h.

105{return m_init;}

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print()

◆ renounce()

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 > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
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)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ varTypeName_Basic()

const std::string PanTau::Tool_FeatureExtractor::varTypeName_Basic ( )
inlinestaticprotected

Definition at line 90 of file Tool_FeatureExtractor.h.

90{return "Basic";}

◆ varTypeName_Combined()

const std::string PanTau::Tool_FeatureExtractor::varTypeName_Combined ( )
inlinestaticprotected

Definition at line 89 of file Tool_FeatureExtractor.h.

89{return "Combined";}

◆ varTypeName_DeltaR()

const std::string PanTau::Tool_FeatureExtractor::varTypeName_DeltaR ( )
inlinestaticprotected

Definition at line 87 of file Tool_FeatureExtractor.h.

87{return "DeltaR";}

◆ varTypeName_HLV()

const std::string PanTau::Tool_FeatureExtractor::varTypeName_HLV ( )
inlinestaticprotected

Definition at line 86 of file Tool_FeatureExtractor.h.

86{return "HLV";}

◆ varTypeName_JetMoment()

const std::string PanTau::Tool_FeatureExtractor::varTypeName_JetMoment ( )
inlinestaticprotected

Definition at line 88 of file Tool_FeatureExtractor.h.

88{return "JetMoment";}

◆ varTypeName_Mean()

const std::string PanTau::Tool_FeatureExtractor::varTypeName_Mean ( )
inlinestaticprotected

Definition at line 84 of file Tool_FeatureExtractor.h.

84{return "Mean";}

◆ varTypeName_PID()

const std::string PanTau::Tool_FeatureExtractor::varTypeName_PID ( )
inlinestaticprotected

Definition at line 91 of file Tool_FeatureExtractor.h.

91{return "PID";}

◆ varTypeName_Ratio()

const std::string PanTau::Tool_FeatureExtractor::varTypeName_Ratio ( )
inlinestaticprotected

Definition at line 83 of file Tool_FeatureExtractor.h.

83{return "Ratio";}

◆ varTypeName_Shots()

const std::string PanTau::Tool_FeatureExtractor::varTypeName_Shots ( )
inlinestaticprotected

Definition at line 92 of file Tool_FeatureExtractor.h.

92{return "Shots";}

◆ varTypeName_StdDev()

const std::string PanTau::Tool_FeatureExtractor::varTypeName_StdDev ( )
inlinestaticprotected

Definition at line 85 of file Tool_FeatureExtractor.h.

85{return "StdDev";}

Member Data Documentation

◆ m_Config_BinEdges_Eta

std::vector<double> PanTau::Tool_FeatureExtractor::m_Config_BinEdges_Eta
protected

Helper members.

Definition at line 78 of file Tool_FeatureExtractor.h.

◆ m_Config_CellBased_EtaBinned_Pi0MVACut_1prong

std::vector<double> PanTau::Tool_FeatureExtractor::m_Config_CellBased_EtaBinned_Pi0MVACut_1prong
protected

Definition at line 79 of file Tool_FeatureExtractor.h.

◆ m_Config_CellBased_EtaBinned_Pi0MVACut_3prong

std::vector<double> PanTau::Tool_FeatureExtractor::m_Config_CellBased_EtaBinned_Pi0MVACut_3prong
protected

Definition at line 80 of file Tool_FeatureExtractor.h.

◆ m_Config_UseEmptySeeds

int PanTau::Tool_FeatureExtractor::m_Config_UseEmptySeeds = 0
protected

Definition at line 74 of file Tool_FeatureExtractor.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_HelperFunctions

PanTau::HelperFunctions PanTau::Tool_FeatureExtractor::m_HelperFunctions
protected

Definition at line 46 of file Tool_FeatureExtractor.h.

◆ m_init

bool PanTau::Tool_FeatureExtractor::m_init =false
protected

Definition at line 102 of file Tool_FeatureExtractor.h.

◆ m_Tool_InformationStore

ToolHandle<PanTau::ITool_InformationStore> PanTau::Tool_FeatureExtractor::m_Tool_InformationStore {this, "Tool_InformationStore", "PanTau::Tool_InformationStore/Tool_InformationStore","Tool handle to the information store tool"}
protected

Definition at line 47 of file Tool_FeatureExtractor.h.

47{this, "Tool_InformationStore", "PanTau::Tool_InformationStore/Tool_InformationStore","Tool handle to the information store tool"};

◆ m_Tool_InformationStoreName

Gaudi::Property<std::string> PanTau::Tool_FeatureExtractor::m_Tool_InformationStoreName {this, "Tool_InformationStoreName", "", "Tool handle to the information store tool"}
protected

Definition at line 48 of file Tool_FeatureExtractor.h.

48{this, "Tool_InformationStoreName", "", "Tool handle to the information store tool"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_varTypeName_Basic

std::string PanTau::Tool_FeatureExtractor::m_varTypeName_Basic
protected

Definition at line 99 of file Tool_FeatureExtractor.h.

◆ m_varTypeName_Combined

std::string PanTau::Tool_FeatureExtractor::m_varTypeName_Combined
protected

Definition at line 98 of file Tool_FeatureExtractor.h.

◆ m_varTypeName_HLV

std::string PanTau::Tool_FeatureExtractor::m_varTypeName_HLV
protected

Definition at line 96 of file Tool_FeatureExtractor.h.

◆ m_varTypeName_JetMoment

std::string PanTau::Tool_FeatureExtractor::m_varTypeName_JetMoment
protected

Definition at line 97 of file Tool_FeatureExtractor.h.

◆ m_varTypeName_PID

std::string PanTau::Tool_FeatureExtractor::m_varTypeName_PID
protected

Definition at line 100 of file Tool_FeatureExtractor.h.

◆ m_varTypeName_Ratio

std::string PanTau::Tool_FeatureExtractor::m_varTypeName_Ratio
protected

Definition at line 94 of file Tool_FeatureExtractor.h.

◆ m_varTypeName_StdDev

std::string PanTau::Tool_FeatureExtractor::m_varTypeName_StdDev
protected

Definition at line 95 of file Tool_FeatureExtractor.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: