Skip to content

Commit

Permalink
Reimplementing analyzers needed for the stage1 of the example analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
kjvbrt committed May 2, 2024
1 parent 9b014c2 commit b18acaf
Show file tree
Hide file tree
Showing 11 changed files with 517 additions and 54 deletions.
26 changes: 11 additions & 15 deletions analyzers/dataframe/FCCAnalyses/Defines.h
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
#ifndef DEFINES_ANALYZERS_H
#define DEFINES_ANALYZERS_H

// std
#include <cmath>
#include <math.h>
#include <vector>

// ROOT
#include "ROOT/RVec.hxx"
#include "TLorentzVector.h"

// EDM4hep
#include "edm4hep/MCParticleData.h"
#include "edm4hep/ParticleIDData.h"
#include "edm4hep/ReconstructedParticleData.h"

/**
* @brief FCC analyzers collection.
*/
namespace FCCAnalyses {
using Vec_b = ROOT::VecOps::RVec<bool>;
using Vec_d = ROOT::VecOps::RVec<double>;
using Vec_f = ROOT::VecOps::RVec<float>;
using Vec_i = ROOT::VecOps::RVec<int>;
using Vec_ui = ROOT::VecOps::RVec<unsigned int>;
using Vec_b = ROOT::VecOps::RVec<bool>;
using Vec_d = ROOT::VecOps::RVec<double>;
using Vec_f = ROOT::VecOps::RVec<float>;
using Vec_i = ROOT::VecOps::RVec<int>;
using Vec_ui = ROOT::VecOps::RVec<unsigned int>;

using rp = edm4hep::ReconstructedParticleData;
using Vec_rp = ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData>;
using Vec_mc = ROOT::VecOps::RVec<edm4hep::MCParticleData>;
using Vec_tlv = ROOT::VecOps::RVec<TLorentzVector>;
using rp = edm4hep::ReconstructedParticleData;
using Vec_rp = ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData>;
using Vec_mc = ROOT::VecOps::RVec<edm4hep::MCParticleData>;
using Vec_tlv = ROOT::VecOps::RVec<TLorentzVector>;
} // namespace FCCAnalyses

namespace recoParticle = FCCAnalyses::ReconstructedParticle::Source;

#endif
151 changes: 140 additions & 11 deletions analyzers/dataframe/FCCAnalyses/ReconstructedParticleSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@
#include "edm4hep/ReconstructedParticleCollection.h"
#include "edm4hep/MCRecoParticleAssociationCollection.h"

namespace FCCAnalyses :: ReconstructedParticle {
namespace FCCAnalyses :: ReconstructedParticle :: Source {
// -------------------- Selectors -----------------------------------------


/**
* \brief Analyzer to select reconstructed particles associated with MC
* particle of the specified PDG ID.
*/
struct selPDG {
const int m_pdg;
/**
* \brief Constructor.
*
* \param[in] pdgID Desired value of the PDG ID.
*/
explicit selPDG(const int pdgID);
const int m_pdg;
/**
* \brief Operator over the input particle collection.
*
Expand All @@ -38,13 +41,13 @@ namespace FCCAnalyses :: ReconstructedParticle {
* particle with the specified absolute value of the PDG ID.
*/
struct selAbsPDG {
const int m_absPdg;
/**
* \brief Constructor.
*
* \param[in] pdgID Desired absolute value of the PDG ID.
*/
explicit selAbsPDG(const int pdgID);
const int m_absPdg;
/**
* \brief Operator over input particle associations collection.
*
Expand All @@ -58,17 +61,40 @@ namespace FCCAnalyses :: ReconstructedParticle {
};


/**
* \brief Select reconstructed particles with transverse momentum greater
* than a minimum value [GeV].
*/
struct selPt {
const float m_minPt;
/**
* \brief Constructor.
*
* \param[in] minPt Transverse momentum threshold [GeV].
*/
explicit selPt(float minPt);
/**
* \brief Operator over input particle associations collection.
*
* \param[in] inColl Input collection of the reconstructed particles.
* \param[out] result Collection of the selected reconstructed particles.
*/
edm4hep::ReconstructedParticleCollection operator() (
const edm4hep::ReconstructedParticleCollection& inColl);
};


/**
* \brief Analyzer to select specified number of reconstructed particles.
*/
struct selUpTo {
const size_t m_size;
/**
* \brief Constructor.
*
* \param[in] size Desired number of reconstructed particles.
*/
explicit selUpTo(const size_t size);
const size_t m_size;
/**
* \brief Operator over input particle associations collection.
*
Expand All @@ -85,13 +111,13 @@ namespace FCCAnalyses :: ReconstructedParticle {
* particle of the desired generator status.
*/
struct selGenStatus {
const int m_status;
/**
* \brief Constructor.
*
* \param[in] status Desired generator status of the MC particle.
*/
explicit selGenStatus(const int status);
const int m_status;
/**
* \brief Operator over input particle associations collection.
*
Expand All @@ -103,24 +129,127 @@ namespace FCCAnalyses :: ReconstructedParticle {
};


// -------------------- Getters -------------------------------------------


/**
* \brief Get momenta of the input reconstructed particles.
*
* \param[in] inColl Input particle collection.
* \param[out] result Vector of particle momenta.
*/
ROOT::VecOps::RVec<float>
getP(const edm4hep::ReconstructedParticleCollection& inColl);


/**
* \brief Get transverse momenta (pT) of the input particles.
*
* \param[in] inParticles Input particles.
* \param[in] inColl Input particle collection.
* \param[out] result Vector of particle pTs.
*/
ROOT::VecOps::RVec<double>
getPt(const edm4hep::ReconstructedParticleCollection& inParticles);
ROOT::VecOps::RVec<float>
getPt(const edm4hep::ReconstructedParticleCollection& inColl);


/**
* \brief Get rapidity (y) of the input reconstructed particles.
*
* \param[in] inColl Input particle collection.
* \param[out] result Vector of particle rapidities.
*/
ROOT::VecOps::RVec<float>
getY(const edm4hep::ReconstructedParticleCollection& inColl);


/**
* \brief Get energy (E) of the input reconstructed particles.
*
* \param[in] inColl Input particle collection.
* \param[out] result Vector of particle energies.
*/
ROOT::VecOps::RVec<float>
getE(const edm4hep::ReconstructedParticleCollection& inColl);


/**
* \brief Get mass of the input reconstructed particles.
*
* \param[in] inColl Input particle collection.
* \param[out] result Vector of particle masses.
*/
ROOT::VecOps::RVec<float>
getMass(const edm4hep::ReconstructedParticleCollection& inColl);


/**
* \brief Get charge of the input reconstructed particles.
*
* \param[in] inColl Input particle collection.
* \param[out] result Vector of particle charges.
*/
ROOT::VecOps::RVec<float>
getCharge(const edm4hep::ReconstructedParticleCollection& inColl);


// -------------------- Transformers --------------------------------------


/**
* \brief Sort input particles by pT.
*
* \param[in] inParticles Input particles.
* \param[in] inColl Input particles.
* \param[out] result Sorted collection of particles.
*/
edm4hep::ReconstructedParticleCollection
sortByPt(const edm4hep::ReconstructedParticleCollection& inParticles);
} /* FCCAnalyses :: ReconstructedParticle */
sortByPt(const edm4hep::ReconstructedParticleCollection& inColl);


/**
* \brief Build two particle resonances from an arbitrary list of input
* reconstructed particles.
* Select the one closest to the pre-defined mass.
*/
struct resonanceBuilder {
const float m_resonanceMass;
/**
* \brief Constructor.
*
* \param[in] resonanceMass Desired value of the resonance mass.
*/
explicit resonanceBuilder(float resonanceMass);
/**
* \brief Operator over input particle collection.
*
* \param[in] inColl Input collection of the reconstructed particles.
* \param[out] result Selected reconstructed particle resonance.
*/
edm4hep::ReconstructedParticleCollection operator() (
const edm4hep::ReconstructedParticleCollection& inColl);
};

/**
* \brief Build the recoil from an arbitrary list of input resonances at the
* specified center of mass energy.
*/
struct recoilBuilder {
const float m_sqrts;
/**
* \brief Constructor.
*
* \param[in] sqrts Center of mass energy.
*/
explicit recoilBuilder(float sqrts);
/**
* \brief Operator over input collection of resonances.
*
* \param[in] inColl Input collection of resonances.
* \param[out] result Resulting recoil.
*/
edm4hep::ReconstructedParticleCollection operator() (
const edm4hep::ReconstructedParticleCollection& inColl);
};

} /* FCCAnalyses :: ReconstructedParticle :: Source */

#endif /* RECONSTRUCTED_PARTICLE_SOURCE_ANALYZERS_H */
Loading

0 comments on commit b18acaf

Please sign in to comment.