ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
PanTau::HelperFunctions Class Reference

#include <HelperFunctions.h>

Inheritance diagram for PanTau::HelperFunctions:
Collaboration diagram for PanTau::HelperFunctions:

Public Member Functions

 HelperFunctions (const std::string &name="")
 
virtual ~HelperFunctions ()
 
virtual std::string convertNumberToString (double x) const
 
virtual int getBinIndex (const std::vector< double > &binEdges, double value) const
 
virtual double stddev (double sumOfSquares, double sumOfValues, int numConsts) const
 
virtual double deltaRprime (const TVector3 &vec1, const TVector3 &vec2) const
 
const std::string & getName () const
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Static Public Member Functions

static TauConstituentgetNeutralConstWithLargestAngle (const TLorentzVector &charged, const std::vector< PanTau::TauConstituent * > &neutral)
 
template<class T >
static StatusCode bindToolHandle (ToolHandle< T > &, std::string)
 

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

std::string m_name
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Definition at line 26 of file Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h.

Constructor & Destructor Documentation

◆ HelperFunctions()

PanTau::HelperFunctions::HelperFunctions ( const std::string &  name = "")
inline

Definition at line 31 of file Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h.

31  :
33  m_name(name)
34  {}

◆ ~HelperFunctions()

virtual PanTau::HelperFunctions::~HelperFunctions ( )
inlinevirtual

Member Function Documentation

◆ bindToolHandle()

template<class T >
static StatusCode PanTau::HelperFunctions::bindToolHandle ( ToolHandle< T > &  ,
std::string   
)
inlinestatic

Definition at line 60 of file Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h.

60 {return StatusCode::SUCCESS;}

◆ convertNumberToString()

std::string PanTau::HelperFunctions::convertNumberToString ( double  x) const
virtual

Definition at line 35 of file Reconstruction/PanTau/PanTauAlgs/Root/HelperFunctions.cxx.

35  {
36  std::stringstream tmpStream;
37  tmpStream << x;
38  return tmpStream.str();
39 }

◆ deltaRprime()

double PanTau::HelperFunctions::deltaRprime ( const TVector3 &  vec1,
const TVector3 &  vec2 
) const
virtual

Definition at line 70 of file Reconstruction/PanTau/PanTauAlgs/Root/HelperFunctions.cxx.

70  {
71  const double a = vec1.DeltaPhi(vec2);
72  const double b = vec1.Theta() - vec2.Theta();
73  double dRprime = std::sqrt(a*a + b*b);
74  return dRprime;
75 }

◆ getBinIndex()

int PanTau::HelperFunctions::getBinIndex ( const std::vector< double > &  binEdges,
double  value 
) const
virtual

Definition at line 42 of file Reconstruction/PanTau/PanTauAlgs/Root/HelperFunctions.cxx.

42  {
43  int resBin = -1;
44  for(unsigned int i=0; i<binEdges.size()-1; i++) {
45  double lowerEdge = binEdges[i];
46  double upperEdge = binEdges[i+1];
47  if(lowerEdge <= value && value < upperEdge) resBin = i;
48  }
49  if(resBin == -1) {
50  ATH_MSG_WARNING("Could not find matching bin for value " << value << " in these bin edges:");
51  for(unsigned int i=0; i<binEdges.size(); i++) ATH_MSG_WARNING("\tbin edge " << i << ": " << binEdges[i]);
52  }
53  return resBin;
54 }

◆ getName()

const std::string& PanTau::HelperFunctions::getName ( ) const
inline

Definition at line 63 of file Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h.

64  {
65  return m_name;
66  }

◆ getNeutralConstWithLargestAngle()

PanTau::TauConstituent * PanTau::HelperFunctions::getNeutralConstWithLargestAngle ( const TLorentzVector &  charged,
const std::vector< PanTau::TauConstituent * > &  neutral 
)
static

Definition at line 16 of file Reconstruction/PanTau/PanTauAlgs/Root/HelperFunctions.cxx.

17  {
18  if(neutral.empty()) return nullptr;
19  //loop through neutrals to find the one with largest angle
20  unsigned int idx_Neutral = -1;
21  double angle_Neutral = -1.;
22  for(unsigned int iNeut=0; iNeut<neutral.size(); iNeut++) {
23  TLorentzVector tlv_CurNeut = neutral[iNeut]->p4();
24  double angle = charged.Angle(tlv_CurNeut.Vect());
25  if(angle > angle_Neutral) {
26  angle_Neutral = angle;
27  idx_Neutral = iNeut;
28  }
29  }//end loop neutrals
30 
31  return neutral[idx_Neutral];
32 }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ msg() [1/2]

MsgStream & asg::AsgMessaging::msg ( ) const
inherited

The standard message stream.

Returns
A reference to the default message stream of this object.

Definition at line 49 of file AsgMessaging.cxx.

49  {
50 #ifndef XAOD_STANDALONE
52 #else // not XAOD_STANDALONE
53  return m_msg;
54 #endif // not XAOD_STANDALONE
55  }

◆ msg() [2/2]

MsgStream & asg::AsgMessaging::msg ( const MSG::Level  lvl) const
inherited

The standard message stream.

Parameters
lvlThe message level to set the stream to
Returns
A reference to the default message stream, set to level "lvl"

Definition at line 57 of file AsgMessaging.cxx.

57  {
58 #ifndef XAOD_STANDALONE
60 #else // not XAOD_STANDALONE
61  m_msg << lvl;
62  return m_msg;
63 #endif // not XAOD_STANDALONE
64  }

◆ msgLvl()

bool asg::AsgMessaging::msgLvl ( const MSG::Level  lvl) const
inherited

Test the output level of the object.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
true If messages at level "lvl" will be printed

Definition at line 41 of file AsgMessaging.cxx.

41  {
42 #ifndef XAOD_STANDALONE
43  return ::AthMessaging::msgLvl( lvl );
44 #else // not XAOD_STANDALONE
45  return m_msg.msgLevel( lvl );
46 #endif // not XAOD_STANDALONE
47  }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

◆ stddev()

double PanTau::HelperFunctions::stddev ( double  sumOfSquares,
double  sumOfValues,
int  numConsts 
) const
virtual

Definition at line 57 of file Reconstruction/PanTau/PanTauAlgs/Root/HelperFunctions.cxx.

57  {
58  // calculate standard deviations according to:
59  // sigma^2 = (sum_i x_i^2) / N - ((sum_i x_i)/N)^2 (biased maximum-likelihood estimate)
60  // directly set sigma^2 to 0 in case of N=1, otherwise numerical effects may yield very small negative sigma^2
61  if(numConsts == 1) return 0;
62  double a = sumOfSquares / ((double)numConsts);
63  double b = sumOfValues / ((double)numConsts);
64  double stdDev = a - b*b;
65  if(stdDev < 0.) stdDev = 0;
66  return std::sqrt(stdDev);
67 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_name

std::string PanTau::HelperFunctions::m_name
private

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
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
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
x
#define x
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
lumiFormat.i
int i
Definition: lumiFormat.py:85
angle
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
Definition: TRTDetectorFactory_Full.cxx:73
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
CP::neutral
@ neutral
Definition: Reconstruction/PFlow/PFlowUtils/PFlowUtils/PFODefs.h:11
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
PanTau::HelperFunctions::m_name
std::string m_name
Definition: Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h:71
a
TList * a
Definition: liststreamerinfos.cxx:10
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
CP::charged
@ charged
Definition: Reconstruction/PFlow/PFlowUtils/PFlowUtils/PFODefs.h:11