FairRoot/PandaRoot
PndPidTofInfo.cxx
Go to the documentation of this file.
1 #include "PndPidCorrelator.h"
2 #include "PndSciTHit.h"
3 #include "PndSciTPoint.h"
4 
5 #include <cmath>
6 
7 //_________________________________________________________________
8 Bool_t PndPidCorrelator::GetTofInfo(FairTrackParH* helix, PndPidCandidate* pidCand) {
9 
10  if (!fIdeal)
11  {
12  if ((helix->GetMomentum().Theta()*TMath::RadToDeg())<20.) return kFALSE;
13  if ((helix->GetMomentum().Theta()*TMath::RadToDeg())>150.) return kFALSE;
14  }
15  //---
16  PndSciTHit *tofHit = NULL;
17  Int_t tofEntries = fTofHit->GetEntriesFast();
18  Int_t tofIndex = -1;
19  Float_t tofTof = 0., tofLength = -1000, tofGLength = -1000, tofLengthTemp = -1000;
20  Float_t tofQuality = 1000000;
21 
22  //Float_t chi2 = 0; //[R.K. 01/2017] unused variable
23  TVector3 vertex(0., 0., 0.);
24  TVector3 tofPos(0., 0., 0.);
25  TVector3 momentum(0., 0., 0.);
26  for (Int_t tt = 0; tt<tofEntries; tt++)
27  {
28  tofHit = (PndSciTHit*)fTofHit->At(tt);
29  if ( fIdeal && ( ((PndSciTPoint*)fTofPoint->At(tofHit->GetRefIndex()))->GetTrackID() !=pidCand->GetMcIndex()) ) continue;
30  tofHit->Position(tofPos);
31 
32  if (fGeanePro) // Overwrites vertex if Geane is used
33  {
34  fGeanePropagator->SetPoint(tofPos);
35  fGeanePropagator->PropagateToPCA(1, 1);
36  FairTrackParH *fRes= new FairTrackParH();
37  Bool_t rc = fGeanePropagator->Propagate(helix, fRes, fPidHyp*pidCand->GetCharge());
38  if (!rc) continue;
39 
40  vertex.SetXYZ(fRes->GetX(), fRes->GetY(), fRes->GetZ());
41 
42  fGeanePropagator->SetPoint(TVector3(0,0,0));
43  fGeanePropagator->PropagateToPCA(1, -1);
44  FairTrackParH *fRes2= new FairTrackParH();
45  Bool_t rc2 = fGeanePropagator->Propagate(fRes, fRes2, fPidHyp*pidCand->GetCharge());
46  if (rc2) tofLengthTemp = fGeanePropagator->GetLengthAtPCA();
47  }
48 
49  Float_t dist = (tofPos-vertex).Mag2();
50 
51  if ( tofQuality > dist)
52  {
53  tofIndex = tt;
54  tofQuality = dist;
55  tofTof = tofHit->GetTime();
56  tofLength = tofLengthTemp; // abs(phi * track->GetRadius() / TMath::Sin(track->GetMomentum().Theta()));
57  }
58  if (fDebugMode)
59  {
60  Float_t ntuple[] = {static_cast<Float_t>(vertex.X()), static_cast<Float_t>(vertex.Y()), static_cast<Float_t>(vertex.Z()), static_cast<Float_t>(vertex.Phi()),
61  static_cast<Float_t>(helix->GetMomentum().Mag()), static_cast<Float_t>(helix->GetQ()), static_cast<Float_t>(helix->GetMomentum().Theta()), static_cast<Float_t>(helix->GetZ()),
62  static_cast<Float_t>(tofPos.X()), static_cast<Float_t>(tofPos.Y()), static_cast<Float_t>(tofPos.Z()), static_cast<Float_t>(tofPos.Phi()),
63  dist, static_cast<Float_t>(vertex.DeltaPhi(tofPos)), tofLength, tofGLength};
64 
65  // Float_t ntuple[] = {vertex.X(), vertex.Y(), vertex.Z(), vertex.Phi(),
66  // helix->GetMomentum().Mag(), helix->GetQ(), helix->GetMomentum().Theta(), helix->GetZ(),
67  // tofPos.X(), tofPos.Y(), tofPos.Z(), tofPos.Phi(),
68  // dist, vertex.DeltaPhi(tofPos), tofLength, tofGLength};
69  tofCorr->Fill(ntuple);
70  }
71  }
72 
73  if ( (tofQuality<fCorrPar->GetTofCut()) || (fIdeal && tofIndex!=-1) )
74  {
75  pidCand->SetTofQuality(tofQuality);
76  pidCand->SetTofStopTime(tofTof);
77  pidCand->SetTofTrackLength(tofLength);
78  pidCand->SetTofIndex(tofIndex);
79  if (tofLength>0.)
80  {
81  // mass^2 = p^2 * ( 1/beta^2 - 1 )
82  Float_t mass2 = helix->GetMomentum().Mag()*helix->GetMomentum().Mag()*(30.*30.*tofTof*tofTof/tofLength/tofLength-1.);
83  pidCand->SetTofM2(mass2);
84  }
85  }
86 
87  return kTRUE;
88 }
89 
Int_t GetCharge() const
void SetTofStopTime(Double_t val)
void SetTofM2(Double_t val)
Bool_t GetTofInfo(FairTrackParH *helix, PndPidCandidate *pid)
void SetTofTrackLength(Double_t val)
Int_t GetMcIndex() const
FairGeanePro * fGeanePropagator
Refitter for MDT tracks.
TClonesArray * fTofPoint
PndTofHit TCA.
void SetTofQuality(Double_t val)
ClassImp(PndAnaContFact)
Double_t GetTime()
Definition: PndSciTHit.h:62
void SetTofIndex(Int_t val)
TClonesArray * fTofHit
PndSdsHit TCA for pixel.