13#ifndef CBM_KRES_FUNCTIONS
14#define CBM_KRES_FUNCTIONS
21#include "TLorentzVector.h"
23#include "TMatrixTSym.h"
28#define M2E 2.6112004954086e-7
29#define M2Pion 0.0194798351452
37 TMatrixFSym* covMat =
new TMatrixFSym(3);
40 FairTrackParam neu_track;
45 neu_track.Momentum(momentum);
57 TMatrixFSym* covMat =
new TMatrixFSym(3);
60 FairTrackParam neu_track;
76 TMatrixFSym* covMat =
new TMatrixFSym(3);
79 FairTrackParam neu_track;
86 neu_track.Momentum(momentum);
97 TLorentzVector lorVec1;
100 TLorentzVector lorVec2;
104 sum = lorVec1 + lorVec2;
112 Double_t energy1 = TMath::Sqrt(part1.Mag2() +
M2E);
113 TLorentzVector lorVec1(part1, energy1);
115 Double_t energy2 = TMath::Sqrt(part2.Mag2() +
M2E);
116 TLorentzVector lorVec2(part2, energy2);
119 sum = lorVec1 + lorVec2;
128 TLorentzVector lorVec1;
131 TLorentzVector lorVec2;
134 TLorentzVector lorVec3;
137 TLorentzVector lorVec4;
141 sum = lorVec1 + lorVec2 + lorVec3 + lorVec4;
148 const TVector3 part4)
150 Double_t energy1 = TMath::Sqrt(part1.Mag2() +
M2E);
151 TLorentzVector lorVec1(part1, energy1);
153 Double_t energy2 = TMath::Sqrt(part2.Mag2() +
M2E);
154 TLorentzVector lorVec2(part2, energy2);
156 Double_t energy3 = TMath::Sqrt(part3.Mag2() +
M2E);
157 TLorentzVector lorVec3(part3, energy3);
159 Double_t energy4 = TMath::Sqrt(part4.Mag2() +
M2E);
160 TLorentzVector lorVec4(part4, energy4);
163 sum = lorVec1 + lorVec2 + lorVec3 + lorVec4;
171 int nofDaughters = 0;
172 for (
size_t i = 0; i < MC.size(); i++) {
173 int motherId_temp = MC.at(i)->GetMotherId();
174 if (motherId == motherId_temp) nofDaughters++;
185 Double_t energyP = TMath::Sqrt(electron1.Mag2() +
M2E);
186 TLorentzVector lorVecP(electron1, energyP);
188 Double_t energyM = TMath::Sqrt(electron2.Mag2() +
M2E);
189 TLorentzVector lorVecM(electron2, energyM);
191 TVector3 momPair = electron1 + electron2;
192 Double_t energyPair = energyP + energyM;
193 Double_t ptPair = momPair.Perp();
194 Double_t pzPair = momPair.Pz();
195 Double_t yPair = 0.5 * TMath::Log((energyPair + pzPair) / (energyPair - pzPair));
196 Double_t anglePair = lorVecM.Angle(lorVecP.Vect());
197 Double_t theta = 180. * anglePair / TMath::Pi();
198 Double_t minv = 2. * TMath::Sin(anglePair / 2.) * TMath::Sqrt(electron1.Mag() * electron2.Mag());
211 const TVector3 part3,
const TVector3 part4)
215 Double_t energy1 = TMath::Sqrt(part1.Mag2() +
M2E);
216 TLorentzVector lorVec1(part1, energy1);
218 Double_t energy2 = TMath::Sqrt(part2.Mag2() +
M2E);
219 TLorentzVector lorVec2(part2, energy2);
221 Double_t energy3 = TMath::Sqrt(part3.Mag2() +
M2E);
222 TLorentzVector lorVec3(part3, energy3);
224 Double_t energy4 = TMath::Sqrt(part4.Mag2() +
M2E);
225 TLorentzVector lorVec4(part4, energy4);
228 sum = lorVec1 + lorVec2 + lorVec3 + lorVec4;
230 TVector3 momPair = part1 + part2 + part3 + part4;
231 Double_t energyPair = energy1 + energy2 + energy3 + energy4;
232 Double_t ptPair = momPair.Perp();
233 Double_t pzPair = momPair.Pz();
234 Double_t yPair = 0.5 * TMath::Log((energyPair + pzPair) / (energyPair - pzPair));
235 Double_t minv = sum.Mag();
249 Double_t energyP = TMath::Sqrt(electron1.Mag2() +
M2E);
250 TLorentzVector lorVecP(electron1, energyP);
252 Double_t energyM = TMath::Sqrt(electron2.Mag2() +
M2E);
253 TLorentzVector lorVecM(electron2, energyM);
255 Double_t anglePair = lorVecM.Angle(lorVecP.Vect());
256 Double_t theta = 180. * anglePair / TMath::Pi();
267 Double_t energyP = TMath::Sqrt(electron1.Mag2() +
M2E);
268 TLorentzVector lorVecP(electron1, energyP);
272 Double_t energyM = TMath::Sqrt(electron2.Mag2() +
M2E);
273 TLorentzVector lorVecM(electron2, energyM);
275 Double_t anglePair = lorVecM.Angle(lorVecP.Vect());
276 Double_t theta = 180. * anglePair / TMath::Pi();
286 Double_t energy1 = TMath::Sqrt(electron1.Mag2() +
M2E);
287 TLorentzVector lorVec1(electron1, energy1);
289 Double_t energy2 = TMath::Sqrt(electron2.Mag2() +
M2E);
290 TLorentzVector lorVec2(electron2, energy2);
292 Double_t energy3 = TMath::Sqrt(electron3.Mag2() +
M2E);
293 TLorentzVector lorVec3(electron3, energy3);
295 Double_t energy4 = TMath::Sqrt(electron4.Mag2() +
M2E);
296 TLorentzVector lorVec4(electron4, energy4);
298 TLorentzVector lorPhoton1 = lorVec1 + lorVec2;
299 TLorentzVector lorPhoton2 = lorVec3 + lorVec4;
301 Double_t angleBetweenPhotons = lorPhoton1.Angle(lorPhoton2.Vect());
302 Double_t theta = 180. * angleBetweenPhotons / TMath::Pi();
310 const TVector3 part4Pion)
312 Double_t energy1 = TMath::Sqrt(part1El.Mag2() +
M2E);
313 TLorentzVector lorVec1(part1El, energy1);
315 Double_t energy2 = TMath::Sqrt(part2El.Mag2() +
M2E);
316 TLorentzVector lorVec2(part2El, energy2);
318 Double_t energy3 = TMath::Sqrt(part3Pion.Mag2() +
M2Pion);
319 TLorentzVector lorVec3(part3Pion, energy3);
321 Double_t energy4 = TMath::Sqrt(part4Pion.Mag2() +
M2Pion);
322 TLorentzVector lorVec4(part4Pion, energy4);
325 sum = lorVec1 + lorVec2 + lorVec3 + lorVec4;
336 TLorentzVector lorVec1;
339 TLorentzVector lorVec2;
342 TLorentzVector lorVec3;
345 TLorentzVector lorVec4;
348 TLorentzVector lorVec5;
351 TLorentzVector lorVec6;
355 sum = lorVec1 + lorVec2 + lorVec3 + lorVec4 + lorVec5 + lorVec6;
362 const TVector3 part4El,
const TVector3 part5Pion,
const TVector3 part6Pion)
364 Double_t energy1 = TMath::Sqrt(part1El.Mag2() +
M2E);
365 TLorentzVector lorVec1(part1El, energy1);
367 Double_t energy2 = TMath::Sqrt(part2El.Mag2() +
M2E);
368 TLorentzVector lorVec2(part2El, energy2);
370 Double_t energy3 = TMath::Sqrt(part3El.Mag2() +
M2E);
371 TLorentzVector lorVec3(part3El, energy3);
373 Double_t energy4 = TMath::Sqrt(part4El.Mag2() +
M2E);
374 TLorentzVector lorVec4(part4El, energy4);
376 Double_t energy5 = TMath::Sqrt(part5Pion.Mag2() +
M2Pion);
377 TLorentzVector lorVec5(part5Pion, energy5);
379 Double_t energy6 = TMath::Sqrt(part6Pion.Mag2() +
M2Pion);
380 TLorentzVector lorVec6(part6Pion, energy6);
383 sum = lorVec1 + lorVec2 + lorVec3 + lorVec4 + lorVec5 + lorVec6;
392 Double_t energyP = TMath::Sqrt(electron1.Mag2() +
M2Pion);
393 TLorentzVector lorVecP(electron1, energyP);
395 Double_t energyM = TMath::Sqrt(electron2.Mag2() +
M2Pion);
396 TLorentzVector lorVecM(electron2, energyM);
398 Double_t anglePair = lorVecM.Angle(lorVecP.Vect());
399 Double_t theta = 180. * anglePair / TMath::Pi();
410 Double_t energyP = TMath::Sqrt(electron1.Mag2() +
M2Pion);
411 TLorentzVector lorVecP(electron1, energyP);
415 Double_t energyM = TMath::Sqrt(electron2.Mag2() +
M2Pion);
416 TLorentzVector lorVecM(electron2, energyM);
418 Double_t anglePair = lorVecM.Angle(lorVecP.Vect());
419 Double_t theta = 180. * anglePair / TMath::Pi();
427 const TVector3 part3,
const TVector3 part4)
431 Double_t energy1 = TMath::Sqrt(part1.Mag2() +
M2E);
432 TLorentzVector lorVec1(part1, energy1);
434 Double_t energy2 = TMath::Sqrt(part2.Mag2() +
M2E);
435 TLorentzVector lorVec2(part2, energy2);
437 Double_t energy3 = TMath::Sqrt(part3.Mag2() +
M2Pion);
438 TLorentzVector lorVec3(part3, energy3);
440 Double_t energy4 = TMath::Sqrt(part4.Mag2() +
M2Pion);
441 TLorentzVector lorVec4(part4, energy4);
444 sum = lorVec1 + lorVec2 + lorVec3 + lorVec4;
446 TVector3 momPair = part1 + part2 + part3 + part4;
447 Double_t energyPair = energy1 + energy2 + energy3 + energy4;
448 Double_t ptPair = momPair.Perp();
449 Double_t pzPair = momPair.Pz();
450 Double_t yPair = 0.5 * TMath::Log((energyPair + pzPair) / (energyPair - pzPair));
451 Double_t minv = sum.Mag();
static Double_t CalculateOpeningAngleBetweenGammas_Reco(TVector3 electron1, TVector3 electron2, TVector3 electron3, TVector3 electron4)
static TVector3 FitToVertexAndGetChi(CbmStsTrack *stsTrack, double x, double y, double z, double &chi)
static double ChiToVertex(CbmStsTrack *stsTrack, double x, double y, double z)
static LmvmKinePar CalculateKinematicParams_2el_2pions(const TVector3 part1, const TVector3 part2, const TVector3 part3, const TVector3 part4)
static int NofDaughters(int motherId, vector< CbmMCTrack * > MC)
static Double_t CalculateOpeningAngle_Reco(TVector3 electron1, TVector3 electron2)
static double Invmass_2particles_MC(const CbmMCTrack *mctrack1, const CbmMCTrack *mctrack2)
static Double_t CalculateOpeningAngle_MC(CbmMCTrack *mctrack1, CbmMCTrack *mctrack2)
static Double_t CalculateOpeningAngleBetweenPions_MC(CbmMCTrack *mctrack1, CbmMCTrack *mctrack2)
calculate opening angle between two pions using MCtrue momenta
static Double_t CalculateOpeningAngleBetweenPions_Reco(TVector3 electron1, TVector3 electron2)
calculate opening angle between two pions using reconstructed momenta
static LmvmKinePar CalculateKinematicParams_4particles(const TVector3 part1, const TVector3 part2, const TVector3 part3, const TVector3 part4)
static double Invmass_6particles_MC(const CbmMCTrack *mctrack1, const CbmMCTrack *mctrack2, const CbmMCTrack *mctrack3, const CbmMCTrack *mctrack4, const CbmMCTrack *mctrack5, const CbmMCTrack *mctrack6)
static double Invmass_2particles_RECO(const TVector3 part1, const TVector3 part2)
static double Invmass_4particles_MC(const CbmMCTrack *mctrack1, const CbmMCTrack *mctrack2, const CbmMCTrack *mctrack3, const CbmMCTrack *mctrack4)
static TVector3 FitToVertex(CbmStsTrack *stsTrack, double x, double y, double z)
static double Invmass_4particles_RECO(const TVector3 part1, const TVector3 part2, const TVector3 part3, const TVector3 part4)
static double Invmass_4el_2pions_RECO(const TVector3 part1El, const TVector3 part2El, const TVector3 part3El, const TVector3 part4El, const TVector3 part5Pion, const TVector3 part6Pion)
static LmvmKinePar CalculateKinematicParamsReco(const TVector3 electron1, const TVector3 electron2)
static double Invmass_2el_2pions_RECO(const TVector3 part1El, const TVector3 part2El, const TVector3 part3Pion, const TVector3 part4Pion)
void GetMomentum(TVector3 &momentum) const
void Get4Momentum(TLorentzVector &momentum) const
Double_t FitToVertex(CbmStsTrack *track, CbmVertex *vtx, FairTrackParam *v_track)
Double_t GetChiToVertex(CbmStsTrack *track, CbmVertex *vtx=nullptr)
void SetVertex(double x, double y, double z, double chi2, int32_t ndf, int32_t nTracks, const TMatrixFSym &covMat)