4#include <TGeoManager.h>
7#include "CbmStsTrack.h"
8#include "CbmStsPoint.h"
33 cout <<
"\nBmnPairFinder::Constructor()" << endl;
36 fParticlePair =
nullptr;
40 fParticle = unique_ptr<TParticlePDG>(particle);
45 cout <<
"\nBmnPairFinder::Destructor()" << endl;
50 cout <<
"\nBmnPairFinder::Init()" << endl;
51 switch (fParticle->PdgCode()){
53 fDecayFirstParticle = unique_ptr<TParticlePDG>(TDatabasePDG::Instance()->GetParticle(211));
54 fDecaySecondParticle = unique_ptr<TParticlePDG>(TDatabasePDG::Instance()->GetParticle(-211));
58 fDecayFirstParticle = unique_ptr<TParticlePDG>(TDatabasePDG::Instance()->GetParticle(2212));
59 fDecaySecondParticle = unique_ptr<TParticlePDG>(TDatabasePDG::Instance()->GetParticle(-211));
63 LOGF(error,
"Unsupported particle %d %s !", fParticle->PdgCode(), fParticle->GetName());
68 LOGF(info,
"Search decays: %s -> %s %s",
69 fParticle->GetName(), fDecayFirstParticle->GetName(), fDecaySecondParticle->GetName());
71 FairRootManager *ioman = FairRootManager::Instance();
72 fDstHeader = (
DstEventHeader *)ioman->GetObject(
"DstEventHeader.");
73 fStsTracks = (TClonesArray *)ioman->GetObject(
"StsVector");
74 fVertex = (
CbmVertex *)ioman->GetObject(
"PrimaryVertex.");
76 fParticlePair =
new TClonesArray(
"BmnParticlePair");
77 ioman->Register(
"ParticlePair",
"Lambda", fParticlePair, kTRUE);
92 if (evNumber % 1000 == 0) printf(
"Event number: %d\n", evNumber);
94 fParticlePair->Delete();
104 if (fStsTracks->GetEntriesFast() >
NTrCutMax || fStsTracks->GetEntriesFast() <
NTrCutMin)
return;
106 for (Int_t iTrack = 0; iTrack < fStsTracks->GetEntriesFast(); iTrack++)
123 if (par_prot_Vp.GetQp() < 0)
continue;
126 for (Int_t jTrack = 0; jTrack < fStsTracks->GetEntriesFast(); jTrack++)
141 if (par_pion_Vp.GetQp() > 0)
continue;
148 Double_t V0Z = FindV0ByVirtualPlanes(&globTr1, &globTr2, 20, 50);
149 if (V0Z < lowV0Z || V0Z > 50)
continue;
153 if (fKalman->
TGeoTrackPropagate(&par_prot_V0, V0Z, fDecayFirstParticle->PdgCode(),
nullptr,
nullptr, kTRUE) ==
kBMNERROR)
continue;
154 if (fKalman->
TGeoTrackPropagate(&par_pion_V0, V0Z, fDecaySecondParticle->PdgCode(),
nullptr,
nullptr, kTRUE) ==
kBMNERROR)
continue;
159 Double_t V0X = .5 * (par_prot_V0.GetX() + par_pion_V0.GetX());
160 if (V0X < -2.0 || V0X > 2.0)
continue;
161 Double_t V0Y = .5 * (par_prot_V0.GetY() + par_pion_V0.GetY());
162 if (V0Y < -2.0 || V0Y > 2.0)
continue;
164 Float_t Path = GetPath(fVertex->
GetX(), fVertex->
GetY(), fVertex->
GetZ(), V0X, V0Y, V0Z);
165 if (Path < pathCutMin || Path >
pathCutMax)
continue;
167 Float_t DCA0 = FindDCA0(par_prot_V0, par_pion_V0, fVertex->
GetX(), fVertex->
GetY(), fVertex->
GetZ(), V0X, V0Y, V0Z);
168 if (DCA0 < DCA0CutMin || DCA0 >
DCA0CutMax)
continue;
170 Float_t DCA1 = TMath::Sqrt(Sq(par_prot_Vp.GetX() - fVertex->
GetX()) + Sq(par_prot_Vp.GetY() - fVertex->
GetY()));
171 if (DCA1 < DCA1CutMin || DCA1 >
DCA1CutMax)
continue;
173 Float_t DCA2 = TMath::Sqrt(Sq(par_pion_Vp.GetX() - fVertex->
GetX()) + Sq(par_pion_Vp.GetY() - fVertex->
GetY()));
174 if (DCA2 < DCA2CutMin || DCA2 >
DCA2CutMax)
continue;
176 Float_t DCA12 = TMath::Sqrt(Sq(par_prot_V0.GetX() - par_pion_V0.GetX()) + Sq(par_prot_V0.GetY() - par_pion_V0.GetY()));
177 if (DCA12 < DCA12CutMin || DCA12 >
DCA12CutMax)
continue;
189 pair.
SetTxPair(par_prot_V0.GetTx(), par_pion_V0.GetTx());
190 pair.
SetTyPair(par_prot_V0.GetTy(), par_pion_V0.GetTy());
197 pair.
SetInvMass(FindInvMass(par_prot_V0, par_pion_V0));
199 pair.
SetEtaPair(FindEta(par_prot_V0), FindEta(par_pion_V0));
200 new ((*fParticlePair)[fParticlePair->GetEntriesFast()])
BmnParticlePair(pair);
210 const Int_t nPlanes = 5;
217 Double_t zMax = z_0 + range;
218 Double_t zMin = z_0 - range;
219 Double_t zStep = (zMax - zMin) / nPlanes;
221 Double_t zPlane[nPlanes];
222 Double_t
Dist[nPlanes];
227 for (Int_t iPlane = 0; iPlane < nPlanes; ++iPlane)
229 zPlane[iPlane] = zMax - iPlane * zStep;
238 Dist[iPlane] = TMath::Sqrt(Sq(par1.GetX() - par2.GetX()) + Sq(par1.GetY() - par2.GetY()));
241 map<Double_t, Double_t> dist_zPlanes;
243 for (Int_t iPlane = 0; iPlane < nPlanes; iPlane++)
244 dist_zPlanes[
Dist[iPlane]] = zPlane[iPlane];
246 z_0 = dist_zPlanes.begin()->second;
254Double_t BmnPairFinder::FindInvMass(FairTrackParam pi_plus_meson_V0, FairTrackParam pi_minus_meson_V0)
257 Double_t Tx1, Ty1, Tx2, Ty2, p1, p2;
259 TLorentzVector lPos, lNeg;
261 Tx1 = pi_plus_meson_V0.GetTx();
262 Ty1 = pi_plus_meson_V0.GetTy();
263 Tx2 = pi_minus_meson_V0.GetTx();
264 Ty2 = pi_minus_meson_V0.GetTy();
265 p1 = 1. / pi_plus_meson_V0.GetQp();
267 p2 = 1. / pi_minus_meson_V0.GetQp();
271 A1 = 1. / TMath::Sqrt(Tx1 * Tx1 + Ty1 * Ty1 + 1);
272 lPos.SetXYZM(Tx1 * A1 * p1, Ty1 * A1 * p1, p1 * A1, fDecayFirstParticle->Mass());
276 A2 = 1. / TMath::Sqrt(Tx2 * Tx2 + Ty2 * Ty2 + 1);
277 lNeg.SetXYZM(Tx2 * A2 * p2, Ty2 * A2 * p2, p2 * A2, fDecaySecondParticle->Mass());
281 return (TLorentzVector((lPos + lNeg)).Mag());
284Double_t BmnPairFinder::GetPath(Double_t vPx, Double_t vPy, Double_t vPz, Double_t v0x, Double_t v0y, Double_t v0z)
286 TVector3 V0(v0x, v0y, v0z);
287 TVector3 Vp(vPx, vPy, vPz);
288 return TVector3(V0 - Vp).Mag();
291Double_t BmnPairFinder::FindDCA0(FairTrackParam pi_plus_meson_V0, FairTrackParam pi_minus_meson_V0, Double_t vPx, Double_t vPy, Double_t vPz, Double_t v0x, Double_t v0y, Double_t v0z)
293 Double_t Tx1, Ty1, Tx2, Ty2, p1, p2;
295 TVector3 V0(v0x, v0y, v0z);
296 TVector3 Vp(vPx, vPy, vPz);
298 Tx1 = pi_plus_meson_V0.GetTx();
299 Ty1 = pi_plus_meson_V0.GetTy();
300 Tx2 = pi_minus_meson_V0.GetTx();
301 Ty2 = pi_minus_meson_V0.GetTy();
302 p1 = 1. / pi_plus_meson_V0.GetQp();
303 p2 = 1. / pi_minus_meson_V0.GetQp();
305 A1 = 1. / TMath::Sqrt(Tx1 * Tx1 + Ty1 * Ty1 + 1);
307 A2 = 1. / TMath::Sqrt(Tx2 * Tx2 + Ty2 * Ty2 + 1);
309 Double_t PzPart1 = Abs(p1) * A1;
310 Double_t PzPart2 = Abs(p2) * A2;
312 Double_t PzPart0 = PzPart1 + PzPart2;
313 Double_t PxPart0 = PzPart1 * Tx1 + PzPart2 * Tx2;
314 Double_t PyPart0 = PzPart1 * Ty1 + PzPart2 * Ty2;
316 Double_t TxPart0 = PxPart0 / PzPart0;
317 Double_t TyPart0 = PyPart0 / PzPart0;
319 Double_t xPart0 = TxPart0 * (Vp.Z() - V0.Z()) + V0.X();
320 Double_t yPart0 = TyPart0 * (Vp.Z() - V0.Z()) + V0.Y();
322 Double_t dca0 = TMath::Sqrt(Sq(xPart0 - Vp.X()) + Sq(yPart0 - Vp.Y()));
327Double_t BmnPairFinder::FindEta(FairTrackParam pi_plus_meson_V0)
329 Double_t Tx = pi_plus_meson_V0.GetTx();
330 Double_t Ty = pi_plus_meson_V0.GetTy();
331 Double_t p = 1. / pi_plus_meson_V0.GetQp();
333 Double_t Pz = Abs(p) / TMath::Sqrt(1 + Tx * Tx + Ty * Ty);
335 Double_t eta = 0.5 * Log((Abs(p) + Pz) / (Abs(p) - Pz));
340Double_t BmnPairFinder::FindAngleDecayProducts(FairTrackParam proton_V0, FairTrackParam pi_minus_meson_V0)
342 Double_t Tx1, Ty1, Tx2, Ty2, p1, p2;
345 TVector3 Pnegpimeson;
347 Tx1 = proton_V0.GetTx();
348 Ty1 = proton_V0.GetTy();
349 Tx2 = pi_minus_meson_V0.GetTx();
350 Ty2 = pi_minus_meson_V0.GetTy();
352 p1 = 1. / proton_V0.GetQp();
353 p2 = 1. / pi_minus_meson_V0.GetQp();
355 A1 = 1. / TMath::Sqrt(Tx1 * Tx1 + Ty1 * Ty1 + 1);
357 A2 = 1. / TMath::Sqrt(Tx2 * Tx2 + Ty2 * Ty2 + 1);
359 Pproton.SetX(Tx1 * A1 * p1);
360 Pproton.SetY(Ty1 * A1 * p1);
361 Pproton.SetZ(p1 * A1);
363 Pnegpimeson.SetX(Tx2 * A2 * p2);
364 Pnegpimeson.SetY(Ty2 * A2 * p2);
365 Pnegpimeson.SetZ(p2 * A2);
367 Double_t dot_product = Pproton.Dot(Pnegpimeson);
369 Double_t mag_Pproton = Pproton.Mag();
371 Double_t mag_Pnegpimeson = Pnegpimeson.Mag();
375 return ACos(dot_product/(mag_Pproton*mag_Pnegpimeson))*180/Pi();
381 cout <<
"\n-I- [BmnPairFinder::Finish] " << endl;
Float_t Dist(Float_t x1, Float_t y1, Float_t x2, Float_t y2)
const Float_t DCA12CutMax
const Float_t DCA12CutMin
BmnStatus TGeoTrackPropagate(FairTrackParam *par, Double_t zOut, Int_t pdg, vector< Double_t > *F, Double_t *length, Bool_t isField)
virtual InitStatus Init()
BmnPairFinder(TParticlePDG *particle=TDatabasePDG::Instance() ->GetParticle("Lambda0"))
virtual void Exec(Option_t *option)
void SetDCA2(Double_t val)
void SetTxPair(Double_t val1, Double_t val2)
void SetNHitsPair(vector< Int_t > part1, vector< Int_t > part2)
void SetTyPair(Double_t val1, Double_t val2)
void SetInvMass(Double_t val)
void SetChi2Pair(Double_t val1, Double_t val2)
void SetV0Y(Double_t val)
void SetV0Z(Double_t val)
void SetDCA1(Double_t val)
void SetAngleDecayProducts(Double_t val)
void SetDCA12(Double_t val)
void SetMomPair(Double_t val1, Double_t val2)
void SetDCA0(Double_t val)
void SetEtaPair(Double_t val1, Double_t val2)
void SetPath(Double_t val)
void SetV0X(Double_t val)
void SetNDFPair(Int_t val1, Int_t val2)
void SetChi2(Double_t chi2)
void SetParamLast(FairTrackParam &par)
FairTrackParam * GetParamFirst()
void SetParamFirst(FairTrackParam &par)
FairTrackParam * GetParamLast()
Int_t GetNStsHits() const
FairTrackParam * GetParamFirst()