TIMBER  beta
Tree Interface for Making Binned Events with RDataFrame
Functions
hardware Namespace Reference

C++ namespace for common physics functions. More...

Functions

float DeltaPhi (float phi1, float phi2)
 Calculate the difference in \(\phi\). More...
 
float DeltaR (ROOT::Math::PtEtaPhiMVector v1, ROOT::Math::PtEtaPhiMVector v2)
 Calculate \(\Delta R\) between two vectors. More...
 
template<class T1 , class T2 >
float DeltaR (T1 in1, T2 in2)
 Calculate \(\Delta R\) between two objects. More...
 
RVec< float > HadamardProduct (RVec< float > v1, RVec< float > v2)
 Hadamard product of two vectors (v3[i] = v1[i]*v2[i]) More...
 
RVec< float > HadamardProduct (RVec< float > v1, RVec< RVec< float >> v2, int v2subindex)
 Hadamard product of two vectors (v3[i] = v1[i]*v2[i][v2subindex]) where v2 has multiple sub-elements, only one of which should be accessed (at index of v2subindex). More...
 
double InvariantMass (RVec< ROOT::Math::PtEtaPhiMVector > vects)
 Calculates the invariant mass of a vector of Lorentz vectors (ROOT::Math::PtEtaPhiMVector). Note that this is an alternative to ROOT::VecOps::InvariantMasses() which does not need the intermediate Lorentz vector. More...
 
TH1 * LoadHist (std::string filename, std::string histname, bool inTIMBER=true)
 Generically open a histogram from a file into memory (closing the file in the process). More...
 
RVec< float > MultiHadamardProduct (RVec< float > v1, RVec< RVec< float >> Multiv2)
 Hadamard product of a base vector and a list of N more vectors (vout[i] = v1[i]*v2[i]*v3[i]...). More...
 
RVec< float > MultiHadamardProduct (RVec< float > v1, RVec< RVec< RVec< float >>> Multiv2, int v2subindex)
 Hadamard product of a base vector and a list of N more vectors (vout[i] = v1[i]*v2[i][v2subindex]*v3[i][v2subindex]...) where v<N> has multiple sub-elements, only one of which should be accessed (at index of v2subindex). More...
 
TFile * Open (std::string file, bool inTIMBER=true, const char *option="READ")
 Open a ROOT file inside the TIMBER path. Thsi function essentially just does the char + string formatting for you. More...
 
ROOT::Math::PtEtaPhiMVector TLvector (float pt, float eta, float phi, float m)
 Create a ROOT::Math::PtEtaPhiMVector. More...
 
RVec< ROOT::Math::PtEtaPhiMVector > TLvector (RVec< float > pt, RVec< float > eta, RVec< float > phi, RVec< float > m)
 Create a vector of ROOT::Math::PtEtaPhiMVectors. More...
 
template<class T >
ROOT::Math::PtEtaPhiMVector TLvector (T obj)
 Create a ROOT::Math::PtEtaPhiMVectors. More...
 
template<class T >
RVec< ROOT::Math::PtEtaPhiMVector > TLvector (std::vector< T > objs)
 Create a vector of ROOT::Math::PtEtaPhiMVectors. More...
 
template<class T >
RVec< RVec< T > > Transpose (RVec< RVec< T >> v)
 Transpose a vector so that output[j][i] = input[i][j]. More...
 
float TransverseMass (float MET_pt, float obj_pt, float MET_phi, float obj_phi)
 Calculate the transverse mass from MET \(p_T\) and \(\eta\) and an object's \(p_T\) and \(\eta\). More...
 

Detailed Description

C++ namespace for common physics functions.

Function Documentation

◆ DeltaPhi()

float DeltaPhi ( float  phi1,
float  phi2 
)

Calculate the difference in \(\phi\).

Parameters
phi1
phi2
Returns
float Difference in \(\phi\).

◆ DeltaR() [1/2]

float DeltaR ( ROOT::Math::PtEtaPhiMVector  v1,
ROOT::Math::PtEtaPhiMVector  v2 
)

Calculate \(\Delta R\) between two vectors.

Parameters
v1
v2
Returns
float

◆ DeltaR() [2/2]

float hardware::DeltaR ( T1  in1,
T2  in2 
)

Calculate \(\Delta R\) between two objects.

Parameters
in1
in2
Returns
float

◆ HadamardProduct() [1/2]

RVec< float > HadamardProduct ( RVec< float >  v1,
RVec< float >  v2 
)

Hadamard product of two vectors (v3[i] = v1[i]*v2[i])

Parameters
v1
v2
Returns
RVec<float>

◆ HadamardProduct() [2/2]

RVec< float > HadamardProduct ( RVec< float >  v1,
RVec< RVec< float >>  v2,
int  v2subindex 
)

Hadamard product of two vectors (v3[i] = v1[i]*v2[i][v2subindex]) where v2 has multiple sub-elements, only one of which should be accessed (at index of v2subindex).

Parameters
v1
v2
v2subindex
Returns
RVec<float>

◆ InvariantMass()

double InvariantMass ( RVec< ROOT::Math::PtEtaPhiMVector >  vects)

Calculates the invariant mass of a vector of Lorentz vectors (ROOT::Math::PtEtaPhiMVector). Note that this is an alternative to ROOT::VecOps::InvariantMasses() which does not need the intermediate Lorentz vector.

Parameters
vects
Returns
double

◆ LoadHist()

TH1 * LoadHist ( std::string  filename,
std::string  histname,
bool  inTIMBER = true 
)

Generically open a histogram from a file into memory (closing the file in the process).

Parameters
filename
histname
inTIMBERIf file is in TIMBERPATH. Defaults to true.
Returns
TH1*

◆ MultiHadamardProduct() [1/2]

RVec< float > MultiHadamardProduct ( RVec< float >  v1,
RVec< RVec< float >>  Multiv2 
)

Hadamard product of a base vector and a list of N more vectors (vout[i] = v1[i]*v2[i]*v3[i]...).

Parameters
v1
Multiv2
Returns
RVec<float>

◆ MultiHadamardProduct() [2/2]

RVec< float > MultiHadamardProduct ( RVec< float >  v1,
RVec< RVec< RVec< float >>>  Multiv2,
int  v2subindex 
)

Hadamard product of a base vector and a list of N more vectors (vout[i] = v1[i]*v2[i][v2subindex]*v3[i][v2subindex]...) where v<N> has multiple sub-elements, only one of which should be accessed (at index of v2subindex).

Parameters
v1
Multiv2
v2subindex
Returns
RVec<float>

◆ Open()

TFile * Open ( std::string  file,
bool  inTIMBER = true,
const char *  option = "READ" 
)

Open a ROOT file inside the TIMBER path. Thsi function essentially just does the char + string formatting for you.

Parameters
fileEx. TIMBER/data/example.root
inTIMBERIf file is in TIMBERPATH. Defaults to true.
optionDefaults to "READ" for read-only.
Returns
TFile*

◆ TLvector() [1/4]

ROOT::Math::PtEtaPhiMVector TLvector ( float  pt,
float  eta,
float  phi,
float  m 
)

Create a ROOT::Math::PtEtaPhiMVector.

Parameters
pt
eta
phi
m
Returns
ROOT::Math::PtEtaPhiMVector

◆ TLvector() [2/4]

RVec< ROOT::Math::PtEtaPhiMVector > TLvector ( RVec< float >  pt,
RVec< float >  eta,
RVec< float >  phi,
RVec< float >  m 
)

Create a vector of ROOT::Math::PtEtaPhiMVectors.

Parameters
pt
eta
phi
m
Returns
RVec<ROOT::Math::PtEtaPhiMVector>

◆ TLvector() [3/4]

ROOT::Math::PtEtaPhiMVector hardware::TLvector ( obj)

Create a ROOT::Math::PtEtaPhiMVectors.

Parameters
obj
Returns
ROOT::Math::PtEtaPhiMVector

◆ TLvector() [4/4]

RVec<ROOT::Math::PtEtaPhiMVector> hardware::TLvector ( std::vector< T >  objs)

Create a vector of ROOT::Math::PtEtaPhiMVectors.

Parameters
objs
Returns
RVec<ROOT::Math::PtEtaPhiMVector>

◆ Transpose()

RVec<RVec<T> > hardware::Transpose ( RVec< RVec< T >>  v)

Transpose a vector so that output[j][i] = input[i][j].

Parameters
v
Returns
RVec<RVec<T>>

◆ TransverseMass()

float TransverseMass ( float  MET_pt,
float  obj_pt,
float  MET_phi,
float  obj_phi 
)

Calculate the transverse mass from MET \(p_T\) and \(\eta\) and an object's \(p_T\) and \(\eta\).

Parameters
MET_pt
obj_pt
MET_phi
obj_phi
Returns
float