Namespace: Lorentzvector
-
namespace lorentzvector
Functions
-
ROOT::RDF::RNode Build(ROOT::RDF::RNode df, const std::string &outputname, const std::string &pt, const std::string &eta, const std::string &phi, const std::string &mass, const std::string &index_vector, const int position)
This function builds a Lorentz vector for a single object with given kinematic values for \(p_T\), \(\eta\), \(\phi\) and mass. The object is specified by an index from an
index_vector. This function utilizes the PtEtaPhiMVector from ROOT.- Parameters:
df – input dataframe
outputname – name of the output column containing the Lorentz vector
pt – name of the column containing the \(p_T\) values of an object for the Lorentz vector
eta – name of the column containing the \(\eta\) values of an object for the Lorentz vector
phi – name of the column containing the \(\phi\) values of an object for the Lorentz vector
mass – name of the column containing the mass values of an object for the Lorentz vector
index_vector – name of the column containing indices of objects
position – position in the index vector that specifies for which object in the object vector the Lorentz vector should be build
- Returns:
a new dataframe containing the new column
-
ROOT::RDF::RNode Build(ROOT::RDF::RNode df, const std::string &outputname, const std::string &pt, const std::string &eta, const std::string &phi, const std::string &mass, const int index)
This function builds a Lorentz vector for a single object with given kinematic values for \(p_T\), \(\eta\), \(\phi\) and mass. The object is specified by an
index. This function utilizes the PtEtaPhiMVector from ROOT.- Parameters:
df – input dataframe
outputname – name of the output column containing the Lorentz vector
pt – name of the column containing the \(p_T\) values of an object for the Lorentz vector
eta – name of the column containing the \(\eta\) values of an object for the Lorentz vector
phi – name of the column containing the \(\phi\) values of an object for the Lorentz vector
mass – name of the column containing the mass values of an object for the Lorentz vector
index – index of an object that specifies for which object in the object vector the Lorentz vector should be build
- Returns:
a new dataframe containing the new column
-
ROOT::RDF::RNode Build(ROOT::RDF::RNode df, const std::string &outputname, const std::string &pt, const std::string &eta, const std::string &phi, const std::string &mass)
This function builds a Lorentz vector for a single particle with given kinematic values for \(p_T\), \(\eta\), \(\phi\) and mass. This function utilizes the PtEtaPhiMVector from ROOT.
- Parameters:
df – input dataframe
outputname – name of the output column containing the Lorentz vector
pt – name of the column containing the \(p_T\) value for the Lorentz vector
eta – name of the column containing the \(\eta\) value for the Lorentz vector
phi – name of the column containing the \(\phi\) value for the Lorentz vector
mass – name of the column containing the mass value for the Lorentz vector
- Returns:
a new dataframe containing the new column
-
ROOT::RDF::RNode BuildMET(ROOT::RDF::RNode df, const std::string &outputname, const std::string &met_pt, const std::string &met_phi)
This function builds a Lorentz vector for the missing transverse momentum/energy (MET) with given kinematic values for \(p_T\) and \(\phi\). For MET, \(\eta\) and the mass are assumed to be zero. This function utilizes the PtEtaPhiMVector from ROOT.
- Parameters:
df – input dataframe
outputname – name of the output column containing the missing transverse energy Lorentz vector
met_pt – name of the column containing the \(p_T\) value for the Lorentz vector
met_phi – name of the column containing the \(\phi\) value for the Lorentz vector
- Returns:
a new dataframe containing the new column
-
ROOT::RDF::RNode BuildCollection(ROOT::RDF::RNode df, const std::string &outputname, const std::string &pt, const std::string &eta, const std::string &phi, const std::string &mass, const std::string &object_mask)
Build a new column with a collection of Lorentz vectors per dataframe entry, which are created from the \(p_T\), \(\eta\), \(\phi\) and mass columns of a collection (e.g. jets or muons).
For instance, this can be used to create four-vector objects from the four-vector component columns of a NanoAOD collection.
The function expects \(p_T\), \(\eta\), \(\phi\) and mass columns, which contain
ROOT::VecOps::RVec<float>objects. In addition, the argumentobject_maskmust point to a column which contains index lists of typeROOT::VecOps::RVec<int>. These index lists contain the indices of elements, for which four-vectors should be build. The output column contains a vector of four-vectorsROOT::VecOps::RVec<PtEtaPhiMVector>and only contains the elements, which have been selected in by applying theobject_mask.- Parameters:
df – input dataframe
outputname – name of the output column containing the collection vector of Lorentz vectors
pt – name of the column containing the \(p_T\) values of the object collection
eta – name of the column containing the \(\eta\) values of the object collection
phi – name of the column containing the \(\phi\) values of the object collection
mass – name of the column containing the mass values of the object collection
object_mask – name of the mask column indicating selected objects to only calculate the four-vectors for selected objects
- Returns:
a new dataframe containing the new column
-
ROOT::RDF::RNode BuildCollection(ROOT::RDF::RNode df, const std::string &outputname, const std::string &pt, const std::string &eta, const std::string &phi, const std::string &mass)
Build a new column with a collection of Lorentz vectors per dataframe entry, which are created from the \(p_T\), \(\eta\), \(\phi\) and mass columns of a collection (e.g. jets or muons).
For instance, this can be used to create four-vector objects from the four-vector component columns of a NanoAOD collection.
The function expects \(p_T\), \(\eta\), \(\phi\) and mass columns, which contain
ROOT::VecOps::RVec<float>objects. The output column contains four-vectorsROOT::VecOps::RVec<PtEtaPhiMVector>.- Parameters:
df – input dataframe
outputname – name of the output column containing the collection vector of Lorentz vectors
pt – name of the column containing the \(p_T\) values of the object collection
eta – name of the column containing the \(\eta\) values of the object collection
phi – name of the column containing the \(\phi\) values of the object collection
mass – name of the column containing the mass values of the object collection
- Returns:
a new dataframe containing the new column
-
ROOT::RDF::RNode Scale(ROOT::RDF::RNode df, const std::string &outputname, const std::string &vector, const float &scalefactor)
This function is scaling the \(p_T\) and mass (therefore also energy) of a Lorentz vector by a given scale factor.
- Parameters:
df – input dataframe
outputname – name of the output column containing the scaled Lorentz vector
vector – name of the column containing the Lorentz vector to be scaled
scalefactor – scale factor value that should be applied
- Returns:
a new dataframe containing the new column
-
template<typename ...Lorentzvectors>
ROOT::RDF::RNode Sum(ROOT::RDF::RNode df, const std::string &outputname, const Lorentzvectors&... LVs) This function constructs a vectorial sum of an arbitrary number of Lorentz vectors. If one of the Lorentz vectors is not well defined (has default values), the function returns a default Lorentz vector.
- Template Parameters:
Lorentzvectors – variadic template parameter pack representing the Lorentz vector columns
- Parameters:
df – input dataframe
outputname – name of the output column containing the summed Lorentz vector
LVs – Parameter pack of column names that contain the considered Lorentz vectors, must be of type
ROOT::Math::PtEtaPhiMVector
- Returns:
a dataframe containing the new column
-
template<typename ...Lorentzvectors>
ROOT::RDF::RNode GetPt(ROOT::RDF::RNode df, const std::string &outputname, const Lorentzvectors&... LVs) This function constructs a vectorial sum of an arbitrary number of Lorentz vectors (can also be only one) and returns its transverse momentum ( \(p_T\)). If one of the Lorentz vectors is not well defined (has default values), the function returns a default value.
- Template Parameters:
Lorentzvectors – variadic template parameter pack representing the Lorentz vector columns
- Parameters:
df – input dataframe
outputname – name of the output column containing the \(p_T\) of the summed Lorentz vectors
LVs – Parameter pack of column names that contain the considered Lorentz vectors, must be of type
ROOT::Math::PtEtaPhiMVector
- Returns:
a dataframe containing the new column
-
template<typename ...Lorentzvectors>
ROOT::RDF::RNode GetEta(ROOT::RDF::RNode df, const std::string &outputname, const Lorentzvectors&... LVs) This function constructs a vectorial sum of an arbitrary number of Lorentz vectors (can also be only one) and returns its pseudorapodity \(\eta\). If one of the Lorentz vectors is not well defined (has default values), the function returns a default value.
- Template Parameters:
Lorentzvectors – variadic template parameter pack representing the Lorentz vector columns
- Parameters:
df – input dataframe
outputname – name of the output column containing the pseudorapidity \(\eta\) of the summed Lorentz vectors
LVs – Parameter pack of column names that contain the considered Lorentz vectors, must be of type
ROOT::Math::PtEtaPhiMVector
- Returns:
a dataframe containing the new column
-
template<typename ...Lorentzvectors>
ROOT::RDF::RNode GetPhi(ROOT::RDF::RNode df, const std::string &outputname, const Lorentzvectors&... LVs) This function constructs a vectorial sum of an arbitrary number of Lorentz vectors (can also be only one) and returns its azimuthal angle \(\phi\). If one of the Lorentz vectors is not well defined (has default values), the function returns a default value.
- Template Parameters:
Lorentzvectors – variadic template parameter pack representing the Lorentz vector columns
- Parameters:
df – input dataframe
outputname – name of the output column containing the azimuthal angle \(\phi\) of the summed Lorentz vectors
LVs – Parameter pack of column names that contain the considered Lorentz vectors, must be of type
ROOT::Math::PtEtaPhiMVector
- Returns:
a dataframe containing the new column
-
template<typename ...Lorentzvectors>
ROOT::RDF::RNode GetMass(ROOT::RDF::RNode df, const std::string &outputname, const Lorentzvectors&... LVs) This function constructs a vectorial sum of an arbitrary number of Lorentz vectors (can also be only one) and returns its invariant mass. If one of the Lorentz vectors is not well defined (has default values), the function returns a default value.
- Template Parameters:
Lorentzvectors – variadic template parameter pack representing the Lorentz vector columns
- Parameters:
df – input dataframe
outputname – name of the output column containing the invariant mass of the summed Lorentz vectors
LVs – Parameter pack of column names that contain the considered Lorentz vectors, must be of type
ROOT::Math::PtEtaPhiMVector
- Returns:
a dataframe containing the new column
-
template<typename ...Lorentzvectors>
ROOT::RDF::RNode GetEnergy(ROOT::RDF::RNode df, const std::string &outputname, const Lorentzvectors&... LVs) This function constructs a vectorial sum of an arbitrary number of Lorentz vectors (can also be only one) and returns its energy. If one of the Lorentz vectors is not well defined (has default values), the function returns a default value.
- Template Parameters:
Lorentzvectors – variadic template parameter pack representing the Lorentz vector columns
- Parameters:
df – input dataframe
outputname – name of the output column containing the energy of the summed Lorentz vectors
LVs – Parameter pack of column names that contain the considered Lorentz vectors, must be of type
ROOT::Math::PtEtaPhiMVector
- Returns:
a dataframe containing the new column
-
template<typename ...Lorentzvectors>
ROOT::RDF::RNode GetRapidity(ROOT::RDF::RNode df, const std::string &outputname, const Lorentzvectors&... LVs) This function constructs a vectorial sum of an arbitrary number of Lorentz vectors (can also be only one) and returns its rapidity \(y\). If one of the Lorentz vectors is not well defined (has default values), the function returns a default value.
- Template Parameters:
Lorentzvectors – variadic template parameter pack representing the Lorentz vector columns
- Parameters:
df – input dataframe
outputname – name of the output column containing the rapidity \(y\) of the summed Lorentz vectors
LVs – Parameter pack of column names that contain the considered Lorentz vectors, must be of type
ROOT::Math::PtEtaPhiMVector
- Returns:
a dataframe containing the new column
-
template<typename ...Args>
ROOT::RDF::RNode PropagateToMET(ROOT::RDF::RNode df, const std::string &outputname, const std::string &p4_met, Args... args) This function propagates object corrections to the MET based on Lorentz vectors. The objects can be e.g. leptons like muons or taus. If the energy of an object is corrected/changed (e.g. via some scale factor) or due to a shift, this change in energy has to be propagated to the MET vector, and the MET vector has to be adapted accordingly. The MET is recalculated via.
\[\begin{split} E_{T,miss,x}^{\text{corrected}} = E_{T,miss,x} + p_{x,\text{object}} - p_{x,\text{object}}^{\text{corrected}} \\ E_{T,miss,y}^{\text{corrected}} = E_{T,miss,y} + p_{y,\text{object}} - p_{y,\text{object}}^{\text{corrected}} \\ E_{T,miss}^{\text{corrected}} = \sqrt{E_{T,miss,x}^{\text{corrected}} * E_{T,miss,x}^{\text{corrected}} + E_{T,miss,y}^{\text{corrected}} * E_{T,miss,y}^{\text{corrected}}} \end{split}\]- Parameters:
df – input dataframe
outputname – name of the new column containing the corrected MET Lorentz vector
p4_met – initial/uncorrected MET Lorentz vector
args – the possible arguments need to have a specific structure:
first half: uncorrected lorentz vectors of the objects (e.g. leptons)
second half: corrected lorentz vectors (same number as uncorrected) of the objects (e.g. leptons)
last argument: boolean indicating whether the propagation should be applied or just the original MET vector should be returned
- Returns:
a dataframe with the new column containing the corrected MET Lorentz vector
-
ROOT::RDF::RNode Build(ROOT::RDF::RNode df, const std::string &outputname, const std::string &pt, const std::string &eta, const std::string &phi, const std::string &mass, const std::string &index_vector, const int position)