FCCAnalyses
Loading...
Searching...
No Matches
Algorithms.h
Go to the documentation of this file.
1#ifndef ALGORITHM_ANALYZERS_H
2#define ALGORITHM_ANALYZERS_H
3
4#include <cmath>
5#include <vector>
6
7#include "edm4hep/ReconstructedParticleData.h"
8
10
11//#include "TFitter.h"
12#include "Math/Minimizer.h"
13#include "ROOT/RVec.hxx"
14
15namespace FCCAnalyses{
16
23namespace Algorithms{
24
27 public:
28 sphericityFit(const ROOT::VecOps::RVec<float> & arg_px,
29 const ROOT::VecOps::RVec<float> & arg_py,
30 const ROOT::VecOps::RVec<float> & arg_pz);
31 float operator()(const double *par);
32
33 private:
34 ROOT::VecOps::RVec<float> _px;
35 ROOT::VecOps::RVec<float> _py;
36 ROOT::VecOps::RVec<float> _pz;
37 };
38
39
42 public:
43 minimize_sphericity(std::string arg_minname="Minuit2",
44 std::string arg_algoname="Migrad",
45 int arg_maxcalls=100000,
46 float arg_tolerance=0.001);
47 ROOT::VecOps::RVec<float> operator()(const ROOT::VecOps::RVec<float> & px,
48 const ROOT::VecOps::RVec<float> & py,
49 const ROOT::VecOps::RVec<float> & pz);
50
51 private:
52 char const *_minname;
53 char const *_algoname;
55 float _tolerance;
56 ROOT::Math::Minimizer *_min;
57 double _step[3]={0.001,0.001,0.001};
58 double _variable[3]={1.0,1.0,1.0};
59 };
60
61
63 struct thrustFit {
64 public:
65 thrustFit(const ROOT::VecOps::RVec<float> & arg_px,
66 const ROOT::VecOps::RVec<float> & arg_py,
67 const ROOT::VecOps::RVec<float> & arg_pz);
68 float operator()(const double *par);
69
70 private:
71 ROOT::VecOps::RVec<float> _px;
72 ROOT::VecOps::RVec<float> _py;
73 ROOT::VecOps::RVec<float> _pz;
74 };
75
76
79 minimize_thrust(std::string arg_minname="Minuit2",
80 std::string arg_algoname="Migrad",
81 int arg_maxcalls=100000,
82 float arg_tolerance=0.001);
83 ROOT::VecOps::RVec<float> operator()(const ROOT::VecOps::RVec<float> & px,
84 const ROOT::VecOps::RVec<float> & py,
85 const ROOT::VecOps::RVec<float> & pz);
86
87 private:
88 char const *_minname;
89 char const *_algoname;
92 ROOT::Math::Minimizer *_min;
93 double _step[3]={0.001,0.001,0.001};
94 double _variable[3]={1.0,1.0,1.0};
95 };
96
100 ROOT::VecOps::RVec<float> operator()(const ROOT::VecOps::RVec<float>& px,
101 const ROOT::VecOps::RVec<float>& py,
102 const ROOT::VecOps::RVec<float>& pz);
103
104 // Helper functions, to ease manipulation with the elements of internal array
105 inline void mag2(float (&vec)[4]);
106 inline float dot(float vec1[4], float vec2[4]);
107 inline void cross(float (&vec)[4], float vec1[4], float vec2[4]);
108 inline void unit(float (&vec)[4]);
109 inline void plus(float (&vec)[4], float vecIn1[4], float vecIn2[4]);
110 inline void minus(float (&vecOut)[4], float vecIn1[4], float vecIn2[4]);
111 inline void copy(float (&vecOut)[4], float vecIn[4]);
112 };
113
116 public:
117 getAxisCharge(bool arg_pos=0,
118 float arg_power=1);
119 float operator() (const ROOT::VecOps::RVec<float> & angle,
120 const ROOT::VecOps::RVec<float> & charge,
121 const ROOT::VecOps::RVec<float> & px,
122 const ROOT::VecOps::RVec<float> & py,
123 const ROOT::VecOps::RVec<float> & pz);
124 private:
125 bool _pos;
126 float _power;
127 };
128
129
131 struct getAxisMass {
132 public:
133 getAxisMass(bool arg_pos=0);
134 float operator() (const ROOT::VecOps::RVec<float> & angle,
135 const ROOT::VecOps::RVec<float> & energy,
136 const ROOT::VecOps::RVec<float> & px,
137 const ROOT::VecOps::RVec<float> & py,
138 const ROOT::VecOps::RVec<float> & pz);
139 private:
140 bool _pos;
141 };
142
143
146 public:
147 getAxisEnergy(bool arg_pos=0);
148 ROOT::VecOps::RVec<float> operator() (const ROOT::VecOps::RVec<float> & angle,
149 const ROOT::VecOps::RVec<float> & charge,
150 const ROOT::VecOps::RVec<float> & energy);
151 private:
152 bool _pos;
153 };
154
155
157 struct getAxisN {
158 public:
159 getAxisN(bool arg_pos=0);
160 ROOT::VecOps::RVec<int> operator() (const ROOT::VecOps::RVec<float> & angle,
161 const ROOT::VecOps::RVec<float> & charge);
162 private:
163 bool _pos;
164 };
165
166
169 public:
170 getThrustPointing(float arg_dir=1.);
171 ROOT::VecOps::RVec<float> operator() (const ROOT::VecOps::RVec<float> & in,
172 const ROOT::VecOps::RVec<float> & rp_e,
173 const ROOT::VecOps::RVec<float> & thrust);
174 private:
175 float _dir;
176 };
177
178
180 ROOT::VecOps::RVec<float> getAxisCosTheta(const ROOT::VecOps::RVec<float> & axis,
181 const ROOT::VecOps::RVec<float> & px,
182 const ROOT::VecOps::RVec<float> & py,
183 const ROOT::VecOps::RVec<float> & pz);
184
186 float getAxisCosTheta(const ROOT::VecOps::RVec<float> & axis,
187 float px,
188 float py,
189 float pz);
190
192 float getMass(const ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> & in);
193
196 int m_sorted=0;
198 jets_TwoHemispheres( int arg_sorted, int arg_recombination ) ;
200 const ROOT::VecOps::RVec<float> & RP_px,
201 const ROOT::VecOps::RVec<float> & RP_py,
202 const ROOT::VecOps::RVec<float> & RP_pz,
203 const ROOT::VecOps::RVec<float> & RP_e,
204 const ROOT::VecOps::RVec<float> & RP_costheta ) ;
205 } ;
206
207}//end NS Algorithms
208
209}//end NS FCCAnalyses
210#endif
ROOT::VecOps::RVec< float > getAxisCosTheta(const ROOT::VecOps::RVec< float > &axis, const ROOT::VecOps::RVec< float > &px, const ROOT::VecOps::RVec< float > &py, const ROOT::VecOps::RVec< float > &pz)
Get the angle cosTheta between particles and an axis.
Definition Algorithms.cc:434
float getMass(const ROOT::VecOps::RVec< edm4hep::ReconstructedParticleData > &in)
Get the invariant mass from a list of reconstructed particles.
Definition Algorithms.cc:423
FCC analyzers collection.
Definition Algorithms.h:15
Calculates the thrust axis by looping over all possible combinations.
Definition Algorithms.h:98
void cross(float(&vec)[4], float vec1[4], float vec2[4])
Definition Algorithms.cc:279
void copy(float(&vecOut)[4], float vecIn[4])
Definition Algorithms.cc:304
void minus(float(&vecOut)[4], float vecIn1[4], float vecIn2[4])
Definition Algorithms.cc:298
calculate_thrust()
Definition Algorithms.h:99
void mag2(float(&vec)[4])
Definition Algorithms.cc:271
void plus(float(&vec)[4], float vecIn1[4], float vecIn2[4])
Definition Algorithms.cc:292
ROOT::VecOps::RVec< float > operator()(const ROOT::VecOps::RVec< float > &px, const ROOT::VecOps::RVec< float > &py, const ROOT::VecOps::RVec< float > &pz)
Definition Algorithms.cc:168
void unit(float(&vec)[4])
Definition Algorithms.cc:285
float dot(float vec1[4], float vec2[4])
Definition Algorithms.cc:275
Get the weighted charge in a given hemisphere (defined by it's angle wrt to axis)....
Definition Algorithms.h:115
float operator()(const ROOT::VecOps::RVec< float > &angle, const ROOT::VecOps::RVec< float > &charge, const ROOT::VecOps::RVec< float > &px, const ROOT::VecOps::RVec< float > &py, const ROOT::VecOps::RVec< float > &pz)
Definition Algorithms.cc:317
float _power
Which hemisphere to select, false/0=cosTheta<0 true/1=cosTheta>0. Default=0.
Definition Algorithms.h:126
getAxisCharge(bool arg_pos=0, float arg_power=1)
Definition Algorithms.cc:312
bool _pos
Definition Algorithms.h:125
Get the energy in a given hemisphere (defined by it's angle wrt to axis). Returns 3 values: total,...
Definition Algorithms.h:145
ROOT::VecOps::RVec< float > operator()(const ROOT::VecOps::RVec< float > &angle, const ROOT::VecOps::RVec< float > &charge, const ROOT::VecOps::RVec< float > &energy)
Definition Algorithms.cc:356
bool _pos
Definition Algorithms.h:152
getAxisEnergy(bool arg_pos=0)
Definition Algorithms.cc:353
Get the invariant mass in a given hemisphere (defined by it's angle wrt to axis).
Definition Algorithms.h:131
float operator()(const ROOT::VecOps::RVec< float > &angle, const ROOT::VecOps::RVec< float > &energy, const ROOT::VecOps::RVec< float > &px, const ROOT::VecOps::RVec< float > &py, const ROOT::VecOps::RVec< float > &pz)
Definition Algorithms.cc:337
getAxisMass(bool arg_pos=0)
Definition Algorithms.cc:334
bool _pos
Definition Algorithms.h:140
Get the number of particles in a given hemisphere (defined by it's angle wrt to axis)....
Definition Algorithms.h:157
bool _pos
Definition Algorithms.h:163
getAxisN(bool arg_pos=0)
Definition Algorithms.cc:376
ROOT::VecOps::RVec< int > operator()(const ROOT::VecOps::RVec< float > &angle, const ROOT::VecOps::RVec< float > &charge)
Definition Algorithms.cc:379
Make the thrust axis points to hemisphere with maximum or minimum energy.
Definition Algorithms.h:168
getThrustPointing(float arg_dir=1.)
Definition Algorithms.cc:397
ROOT::VecOps::RVec< float > operator()(const ROOT::VecOps::RVec< float > &in, const ROOT::VecOps::RVec< float > &rp_e, const ROOT::VecOps::RVec< float > &thrust)
Definition Algorithms.cc:400
float _dir
Definition Algorithms.h:175
make "jets" by splitting the events into two hemisphere transverse to the thrust axis.
Definition Algorithms.h:195
jets_TwoHemispheres(int arg_sorted, int arg_recombination)
Definition Algorithms.cc:462
JetClustering::FCCAnalysesJet operator()(const ROOT::VecOps::RVec< float > &RP_px, const ROOT::VecOps::RVec< float > &RP_py, const ROOT::VecOps::RVec< float > &RP_pz, const ROOT::VecOps::RVec< float > &RP_e, const ROOT::VecOps::RVec< float > &RP_costheta)
Definition Algorithms.cc:469
int m_recombination
E_scheme=0, pt_scheme=1, pt2_scheme=2, Et_scheme=3, Et2_scheme=4, BIpt_scheme=5, BIpt2_scheme=6,...
Definition Algorithms.h:197
int m_sorted
pT ordering=0, E ordering=1
Definition Algorithms.h:196
Calculates the sphericity axis based on a list of px, py, pz.
Definition Algorithms.h:41
char const * _algoname
Minimizer to use, Minuit2 default.
Definition Algorithms.h:53
ROOT::Math::Minimizer * _min
Tolerance for minimization, default=0.001.
Definition Algorithms.h:56
float _tolerance
Maximum call to minimization function, default=100000.
Definition Algorithms.h:55
char const * _minname
Definition Algorithms.h:52
double _step[3]
internal ROOT minimizer
Definition Algorithms.h:57
int _maxcalls
Optimisation algorithm, Migrad default.
Definition Algorithms.h:54
ROOT::VecOps::RVec< float > operator()(const ROOT::VecOps::RVec< float > &px, const ROOT::VecOps::RVec< float > &py, const ROOT::VecOps::RVec< float > &pz)
Definition Algorithms.cc:62
double _variable[3]
Definition Algorithms.h:58
minimize_sphericity(std::string arg_minname="Minuit2", std::string arg_algoname="Migrad", int arg_maxcalls=100000, float arg_tolerance=0.001)
Definition Algorithms.cc:47
Finds the thrust axis based on a list of px, py, pz.
Definition Algorithms.h:78
double _variable[3]
Definition Algorithms.h:94
minimize_thrust(std::string arg_minname="Minuit2", std::string arg_algoname="Migrad", int arg_maxcalls=100000, float arg_tolerance=0.001)
Definition Algorithms.cc:116
char const * _minname
Definition Algorithms.h:88
double _step[3]
internal ROOT minimizer
Definition Algorithms.h:93
ROOT::Math::Minimizer * _min
Tolerance for minimization, default=0.001.
Definition Algorithms.h:92
ROOT::VecOps::RVec< float > operator()(const ROOT::VecOps::RVec< float > &px, const ROOT::VecOps::RVec< float > &py, const ROOT::VecOps::RVec< float > &pz)
Definition Algorithms.cc:131
float _tolerance
Maximum call to minimization function, default=100000.
Definition Algorithms.h:91
char const * _algoname
Minimizer to use, Minuit2 default.
Definition Algorithms.h:89
int _maxcalls
Optimisation algorithm, Migrad default.
Definition Algorithms.h:90
Function that runs the fit for the sphericity axis determination.
Definition Algorithms.h:26
sphericityFit(const ROOT::VecOps::RVec< float > &arg_px, const ROOT::VecOps::RVec< float > &arg_py, const ROOT::VecOps::RVec< float > &arg_pz)
Definition Algorithms.cc:21
ROOT::VecOps::RVec< float > _pz
vector of py
Definition Algorithms.h:36
float operator()(const double *par)
Definition Algorithms.cc:28
ROOT::VecOps::RVec< float > _py
vector of px
Definition Algorithms.h:35
ROOT::VecOps::RVec< float > _px
Definition Algorithms.h:34
Function that runs the fit for the thrust axis determination.
Definition Algorithms.h:63
ROOT::VecOps::RVec< float > _pz
vector of py
Definition Algorithms.h:73
float operator()(const double *par)
Definition Algorithms.cc:98
thrustFit(const ROOT::VecOps::RVec< float > &arg_px, const ROOT::VecOps::RVec< float > &arg_py, const ROOT::VecOps::RVec< float > &arg_pz)
Definition Algorithms.cc:91
ROOT::VecOps::RVec< float > _px
Definition Algorithms.h:71
ROOT::VecOps::RVec< float > _py
vector of px
Definition Algorithms.h:72
Structure to keep useful informations for the jets.
Definition JetClustering.h:22