HelperFunctions.h 2.99 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*
  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/

#ifndef PANTAUALGS_TOOL_HELPERFUNCTIONS
#define PANTAUALGS_TOOL_HELPERFUNCTIONS

//#include "NavFourMom/INavigable4MomentumCollection.h"


#include <string>
#include <iostream>

#include "AsgTools/AsgMessaging.h"
15
#include "AsgTools/ToolHandle.h"
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

#include "xAODTau/TauJet.h"
#include "xAODPFlow/PFO.h"

class TLorentzVector;
class TVector3;

namespace PanTau {
    class TauConstituent2;
}

class TVector3;

namespace PanTau {

  class HelperFunctions : public asg::AsgMessaging {
    
    public:

        // from PhysicsAnalysis/TauID/TauDiscriminant/TauDiscriminant/MethodBase.h        
        HelperFunctions(const std::string& _name = ""):
            AsgMessaging(_name),
	    name(_name)
	{}

	virtual ~HelperFunctions () {};
        
        
        virtual void dumpFourMomentum(TLorentzVector FourMom) const;
        virtual void dumpTauConstituent2(PanTau::TauConstituent2* tauConstituent) const;
        
        TauConstituent2* getNeutralConstWithLargestAngle(TLorentzVector                 charged, 
                                                        std::vector<PanTau::TauConstituent2*>    neutral);
        
        virtual std::string convertNumberToString(double x) const;
        
        void vertexCorrection_PFOs(const xAOD::TauJet* tauJet, xAOD::PFO* efo) const;
        
        virtual int getBinIndex(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;
        
        virtual int                 iPow(int man, int exp) const;
        virtual double              ulAngle(double x, double y) const;
        virtual double              sign(double a, double b) const;
        virtual std::vector<double> calcThrust(std::vector<TauConstituent2*>* tauConstituents, bool& calcIsValid) const;
        virtual void                ludbrb(TMatrix* mom, double the, double phi, double bx, double by, double bz) const;
        virtual std::vector<double> calcFWMoments(std::vector<TauConstituent2*>* tauConstituents, bool& calcIsValid) const;
        virtual std::vector<double> calcSphericity(std::vector<TauConstituent2*>* tauConstituents, bool& calcIsValid) const;

67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifdef XAOD_ANALYSIS
	template<class T>
        static StatusCode bindToolHandle( ToolHandle<T>& handle, std::string tool_name){
	  T* tool = dynamic_cast<T*> (asg::ToolStore::get(tool_name));
	  if(!tool->isInitialized())
	    if (tool->initialize().isFailure())
	      return StatusCode::FAILURE;
	  handle = ToolHandle<T>(tool);
	  return StatusCode::SUCCESS;
	}
#else
	template<class T>
	static StatusCode bindToolHandle( ToolHandle<T>& , std::string){return StatusCode::SUCCESS;}
#endif
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

	std::string getName() const
	{
	  return name;
	}
        

    private:
	
	std::string name;


    }; //end class Tool_HelperFunctions


}//end namespace PanTau




#endif // PANTAUALGS_TOOL_HELPERFUNCTIONS