TIMBER  beta
Tree Interface for Making Binned Events with RDataFrame
GenMatching.h
1 #ifndef _TIMBER_GENMATCHING
2 #define _TIMBER_GENMATCHING
3 #include <map>
4 #include <algorithm>
5 #include <numeric>
6 #include <math.h>
7 #include <cstdlib>
8 #include "Collection.h"
9 #include "common.h"
10 #include <Math/Vector4D.h>
11 #include <Math/VectorUtil.h>
12 
13 using namespace ROOT::VecOps;
14 using LVector = ROOT::Math::PtEtaPhiMVector;
15 
16 namespace GenMatching {
24  bool BitChecker(const int &bit, int &number);
25 
28  extern std::map <int, std::string> PDGIds;
29 
32  extern std::map <std::string, int> GenParticleStatusFlags;
33 }
34 
39 class Particle {
40  public:
41  bool flag = true;
42  int index;
43  int* pdgId;
44  int* status;
45  std::map <std::string, int> statusFlags;
47  std::vector<int> childIndex;
48  LVector vect;
49  Particle();
55  void AddParent(int idx);
61  void AddChild(int idx);
68  float DeltaR(LVector input_vector);
69 };
70 
71 
78 {
79  private:
80  Collection GenParts;
81  std::vector<Particle*> nodes;
82  std::vector<Particle*> heads;
83 
84  bool MatchParticleToString(Particle* particle, std::string string);
85  std::vector<Particle*> RunChain(Particle* node, std::vector<std::string> chain);
86 
87  std::vector<int> StoredIndexes();
88  Particle NoneParticle;
89 
90  public:
92  NoneParticle.flag = false;
93  };
99  void AddParticle(Particle* particle);
105  std::vector<Particle*> GetParticles() {return nodes;}
112  std::vector<Particle*> GetChildren(Particle* particle);
119  Particle* GetParent(Particle* particle);
126  std::vector<std::vector<Particle*>> FindChain(std::string chainstring);
127 };
128 
135  private:
136  Collection GenPartCollection;
141  void SetStatusFlags(int particleIndex);
142 
143  public:
157  GenParticleObjs(RVec<float> in_pt,
158  RVec<float> in_eta, RVec<float> in_phi,
159  RVec<float> in_m, RVec<int> in_pdgId,
160  RVec<int> in_status, RVec<int> in_statusFlags,
161  RVec<int> in_genPartIdxMother);
167  GenParticleObjs(Collection genParts);
168 
177  std::map< std::string, bool> CompareToVector(LVector vect);
184  Particle SetIndex(int idx);
189  int GetStatusFlag(std::string flagName);
190 };
191 #endif
C++ class. Class that stores and manipulates the information for gen particles. Stores all gen partic...
Definition: GenMatching.h:134
std::vector< Particle * > GetParticles()
Get the list of particle objects.
Definition: GenMatching.h:105
int index
Definition: GenMatching.h:42
bool flag
Definition: GenMatching.h:41
C++ class. Stores identifying features of a particle in the GenPart collection.
Definition: GenMatching.h:39
C++ structure to store maps of the various types of objects in a collection. OUTDATED BY analyzer...
Definition: Collection.h:16
C++ class. Constructs tree by adding particles. Establish relationships between particles (parent...
Definition: GenMatching.h:77
LVector vect
Definition: GenMatching.h:48
int parentIndex
Definition: GenMatching.h:46
std::vector< int > childIndex
Definition: GenMatching.h:47
std::map< std::string, int > statusFlags
Definition: GenMatching.h:45
Particle particle
Definition: GenMatching.h:169
int * pdgId
Definition: GenMatching.h:43
int * status
Definition: GenMatching.h:44
Definition: GenMatching.h:16