ATLAS Offline Software
Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef PANTAUALGS_TOOL_HELPERFUNCTIONS
6 #define PANTAUALGS_TOOL_HELPERFUNCTIONS
7 
8 #include <string>
9 #include <iostream>
10 #include <vector>
11 
13 #include "AsgTools/ToolHandle.h"
14 
15 class TLorentzVector;
16 class TVector3;
17 
18 namespace PanTau {
19  class TauConstituent;
20 }
21 
22 class TVector3;
23 
24 namespace PanTau {
25 
27 
28  public:
29 
30  // from PhysicsAnalysis/TauID/TauDiscriminant/TauDiscriminant/MethodBase.h
31  HelperFunctions(const std::string& name = ""):
33  m_name(name)
34  {}
35 
36  virtual ~HelperFunctions () {};
37 
38  static TauConstituent* getNeutralConstWithLargestAngle(const TLorentzVector& charged,
39  const std::vector<PanTau::TauConstituent*>& neutral) ;
40 
41  virtual std::string convertNumberToString(double x) const;
42 
43  virtual int getBinIndex(const std::vector<double>& binEdges, double value) const;
44 
45  virtual double stddev(double sumOfSquares, double sumOfValues, int numConsts) const;
46  virtual double deltaRprime(const TVector3& vec1, const TVector3& vec2) const;
47 
48 #ifdef XAOD_ANALYSIS
49  template<class T>
50  static StatusCode bindToolHandle( ToolHandle<T>& handle, std::string tool_name){
51  T* tool = dynamic_cast<T*> (asg::ToolStore::get(tool_name));
52  if(!tool->isInitialized())
53  if (tool->initialize().isFailure())
54  return StatusCode::FAILURE;
55  handle = ToolHandle<T>(tool);
56  return StatusCode::SUCCESS;
57  }
58 #else
59  template<class T>
60  static StatusCode bindToolHandle( ToolHandle<T>& , std::string){return StatusCode::SUCCESS;}
61 #endif
62 
63  const std::string& getName() const
64  {
65  return m_name;
66  }
67 
68 
69  private:
70 
71  std::string m_name;
72 
73 
74  }; //end class Tool_HelperFunctions
75 
76 
77 }//end namespace PanTau
78 
79 
80 
81 
82 #endif // PANTAUALGS_TOOL_HELPERFUNCTIONS
D3PDMakerTestInstan::vec2
std::vector< D3PDTest::MyVec2 > vec2
Definition: D3PDMakerTestDict.h:14
asg::AsgMessaging::AsgMessaging
AsgMessaging(const std::string &name)
Constructor with a name.
Definition: AsgMessaging.cxx:17
athena.value
value
Definition: athena.py:124
x
#define x
PanTau::HelperFunctions::deltaRprime
virtual double deltaRprime(const TVector3 &vec1, const TVector3 &vec2) const
Definition: Reconstruction/PanTau/PanTauAlgs/Root/HelperFunctions.cxx:70
AsgMessaging.h
PanTau::HelperFunctions
Definition: Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h:26
PanTau::HelperFunctions::getNeutralConstWithLargestAngle
static TauConstituent * getNeutralConstWithLargestAngle(const TLorentzVector &charged, const std::vector< PanTau::TauConstituent * > &neutral)
Definition: Reconstruction/PanTau/PanTauAlgs/Root/HelperFunctions.cxx:16
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
PanTau::HelperFunctions::getBinIndex
virtual int getBinIndex(const std::vector< double > &binEdges, double value) const
Definition: Reconstruction/PanTau/PanTauAlgs/Root/HelperFunctions.cxx:42
PanTau::HelperFunctions::convertNumberToString
virtual std::string convertNumberToString(double x) const
Definition: Reconstruction/PanTau/PanTauAlgs/Root/HelperFunctions.cxx:35
PanTau::HelperFunctions::HelperFunctions
HelperFunctions(const std::string &name="")
Definition: Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h:31
CP::neutral
@ neutral
Definition: Reconstruction/PFlow/PFlowUtils/PFlowUtils/PFODefs.h:11
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
PanTau::HelperFunctions::bindToolHandle
static StatusCode bindToolHandle(ToolHandle< T > &, std::string)
Definition: Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h:60
PanTau::HelperFunctions::~HelperFunctions
virtual ~HelperFunctions()
Definition: Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h:36
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
PanTau::HelperFunctions::m_name
std::string m_name
Definition: Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h:71
asg::ToolStore::get
static IAsgTool * get(const std::string &name, bool silent=false)
Retrieve a tool by name.
Definition: ToolStore.cxx:57
PanTau
xAOD EDM
Definition: Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h:18
PanTau::HelperFunctions::stddev
virtual double stddev(double sumOfSquares, double sumOfValues, int numConsts) const
Definition: Reconstruction/PanTau/PanTauAlgs/Root/HelperFunctions.cxx:57
PanTau::HelperFunctions::getName
const std::string & getName() const
Definition: Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h:63
PanTau::TauConstituent
Definition: TauConstituent.h:25
ToolHandle.h
CP::charged
@ charged
Definition: Reconstruction/PFlow/PFlowUtils/PFlowUtils/PFODefs.h:11