FairRoot/PandaRoot
PndPidFscInfo.cxx
Go to the documentation of this file.
1 #include "PndDetectorList.h"
2 #include "PndPidCorrelator.h"
3 #include "PndPidCandidate.h"
4 #include "PndMCTrack.h"
5 #include "PndTrack.h"
6 #include "PndTrackID.h"
7 
8 #include "PndEmcBump.h"
9 #include "PndEmcDigi.h"
10 #include "PndEmcStructure.h"
11 #include "PndEmcXtal.h"
12 #include "PndEmcErrorMatrix.h"
15 
16 #include "FairTrackParH.h"
17 #include "FairMCApplication.h"
18 #include "FairRunAna.h"
19 #include "FairRootManager.h"
20 #include "FairRuntimeDb.h"
21 
22 Bool_t PndPidCorrelator::GetFscInfo(FairTrackParH* helix, PndPidCandidate* pidCand)
23 {
24  if(!helix)
25  {
26  std::cerr << "<Error> PndPidCorrelator FSCINFO: FairTrackParH NULL pointer parameter."<<std::endl;
27  return kFALSE;
28  }
29  if(!pidCand)
30  {
31  std::cerr << "<Error> PndPidCorrelator FSCINFO: pidCand NULL pointer parameter."<<std::endl;
32  return kFALSE;
33  }
34  if(helix->GetZ() < fCorrPar->GetZLastPlane())
35  {
36  if (fVerbose>0) std::cout << "-W- PndPidCorrelator::GetFscInfo :: Skipping forward tracks propagation in forward direction" << std::endl;
37  return kFALSE;
38  }
39  //---
40  //Float_t trackTheta = helix->GetMomentum().Theta()*TMath::RadToDeg(); //[R.K. 01/2017] unused variable
41 
42  Int_t fscEntries = fEmcCluster->GetEntriesFast();
43  Int_t emcIndex = -1, emcModuleCorr = -1, emcNCrystals = -1;
44  Float_t emcEloss = 0., emcElossCorr = 0., emcGLength = -1000;
45  Float_t emcQuality = 1000000;
46  //Float_t chi2 = 0; //[R.K. 01/2017] unused variable
47  TVector3 vertex(0., 0., 0.); TVector3 emcPos(0., 0., 0.);// TVector3 momentum(0., 0., 0.);
48 
49  // Cluster zenike moment
50  Double_t Z20 = 0.0, Z53 = 0.0, secLatM = 0.00, E1 = 0., E9 = 0., E25 = 0.;
51 
52  for (Int_t ee = 0; ee<fscEntries; ee++)
53  {
54  PndEmcCluster *fscHit = (PndEmcCluster*)fEmcCluster->At(ee);
55  Int_t emcModule = fscHit->GetModule();
56  if (emcModule!=5) continue;
57 
58  if (fIdeal)
59  {
60  std::vector<Int_t> mclist = fscHit->GetMcList();
61  if (mclist.size()==0) continue;
62  if (mclist[0]!=pidCand->GetMcIndex()) continue;
63  }
64 
65  if (fscHit->energy() < fCorrPar->GetEmc12Thr()) continue;
66 
67  emcPos = fscHit->where();
68  if (fGeanePro)
69  { // Overwrites vertex if Geane is used
70  fGeanePropagator->SetPoint(emcPos);
71  fGeanePropagator->PropagateToPCA(1, 1);
72  vertex.SetXYZ(-10000, -10000, -10000); // reset vertex
73  FairTrackParH *fRes= new FairTrackParH();
74  Bool_t rc = fGeanePropagator->Propagate(helix, fRes, fPidHyp*pidCand->GetCharge()); // First propagation at module
75  if (!rc) continue;
76 
77  emcGLength = fGeanePropagator->GetLengthAtPCA();
78  vertex.SetXYZ(fRes->GetX(), fRes->GetY(), fRes->GetZ());
79  //std::map<PndEmcTwoCoordIndex*, PndEmcXtal*> tciXtalMap=PndEmcStructure::Instance()->GetTciXtalMap();
80  //PndEmcDigi *lDigi= (PndEmcDigi*)emcHit->Maxima();
81  //PndEmcXtal* xtal = tciXtalMap[lDigi->GetTCI()];
82  //emcPos = xtal->frontCentre();
83  }
84 
85  Float_t dist = (emcPos-vertex).Mag2();
86  if ( emcQuality > dist )
87  {
88  emcIndex = ee;
89  emcQuality = dist;
90  emcEloss = fscHit->energy();
91  emcElossCorr = fEmcCalibrator->Energy(fscHit);
92  emcModuleCorr = emcModule;
93  emcNCrystals = fscHit->NumberOfDigis();
94  Z20 = fscHit->Z20();// Z_{n = 2}^{m = 0}
95  Z53 = fscHit->Z53();// Z_{n = 5}^{m = 3}
96  secLatM = fscHit->LatMom();
97  if (fEmcDigi)
98  {
99  PndEmcClusterEnergySums esum(*fscHit, fEmcDigi);
100  E1 = esum.E1();
101  E9 = esum.E9();
102  E25 = esum.E25();
103  }
104  }
105 
106  if ((fClusterQ[ee]<0) || (dist < fClusterQ[ee]))
107  // If the track-fsc distance is less than the previous stored value (or still not initialized)
108  {
109  fClusterQ[ee] = dist; // update the param
110  }
111 
112  if (fDebugMode)
113  {
114  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()),
115  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()),
116  static_cast<Float_t>(emcPos.X()), static_cast<Float_t>(emcPos.Y()), static_cast<Float_t>(emcPos.Z()), static_cast<Float_t>(emcPos.Phi()),
117  dist, static_cast<Float_t>(vertex.DeltaPhi(emcPos)), static_cast<Float_t>(fscHit->energy()), emcGLength, static_cast<Float_t>(emcModule)};
118  // Float_t ntuple[] = {vertex.X(), vertex.Y(), vertex.Z(), vertex.Phi(),
119  // helix->GetMomentum().Mag(), helix->GetQ(), helix->GetMomentum().Theta(), helix->GetZ(),
120  // emcPos.X(), emcPos.Y(), emcPos.Z(), emcPos.Phi(),
121  // dist, vertex.DeltaPhi(emcPos), fscHit->energy(), emcGLength, emcModule};
122  fscCorr->Fill(ntuple);
123  }
124  }// End for(ee = 0;)
125 
126  if ((emcQuality < fCorrPar->GetEmc12Cut()) || (fIdeal && emcIndex!=-1))
127  {
128  fClusterList[emcIndex] = kTRUE;
129  pidCand->SetEmcQuality(emcQuality);
130  pidCand->SetEmcRawEnergy(emcEloss);
131  pidCand->SetEmcCalEnergy(emcElossCorr);
132  pidCand->SetEmcIndex(emcIndex);
133  pidCand->SetEmcModule(emcModuleCorr);
134  pidCand->SetEmcNumberOfCrystals(emcNCrystals);
135  //=======
136  pidCand->SetEmcClusterZ20(Z20);
137  pidCand->SetEmcClusterZ53(Z53);
138  pidCand->SetEmcClusterLat(secLatM);
139  pidCand->SetEmcClusterE1(E1);
140  pidCand->SetEmcClusterE9(E9);
141  pidCand->SetEmcClusterE25(E25);
142  //=====
143  }
144 
145  return kTRUE;
146 }
void SetEmcNumberOfCrystals(Int_t val)
CandList mclist
int fVerbose
Definition: poormantracks.C:24
Int_t GetCharge() const
TVector3 where() const
Short_t GetModule() const
void SetEmcModule(Int_t val)
void SetEmcClusterE1(Double_t val)
void SetEmcCalEnergy(Double_t val)
PndPidCorrPar * fCorrPar
PndRichHit TCA.
void SetEmcQuality(Double_t val)
virtual Double_t Energy(PndEmcCluster *clust, Int_t pid=22)=0
map< Int_t, Bool_t > fClusterList
const std::vector< Int_t > & GetMcList() const
Int_t GetMcIndex() const
Bool_t GetFscInfo(FairTrackParH *helix, PndPidCandidate *pid)
PndEmcAbsClusterCalibrator * fEmcCalibrator
FTS geometry parameters.
virtual Double_t E1() const
Double_t Z53() const
Definition: PndEmcCluster.h:69
Double_t Z20() const
Definition: PndEmcCluster.h:67
Double_t
void SetEmcClusterE9(Double_t val)
void SetEmcIndex(Int_t val)
Double_t LatMom() const
Definition: PndEmcCluster.h:71
a cluster (group of neighboring crystals) of hit emc crystals
Definition: PndEmcCluster.h:29
map< Int_t, Double_t > fClusterQ
TClonesArray * fEmcDigi
PndEmcBump TCA.
FairGeanePro * fGeanePropagator
Refitter for MDT tracks.
void SetEmcClusterE25(Double_t val)
Int_t NumberOfDigis() const
void SetEmcClusterLat(Double_t val)
virtual Double_t E25() const
Float_t GetEmc12Thr()
Definition: PndPidCorrPar.h:13
virtual Double_t energy() const
virtual Double_t E9() const
void SetEmcClusterZ20(Double_t val)
void SetEmcClusterZ53(Double_t val)
void SetEmcRawEnergy(Double_t val)
TClonesArray * fEmcCluster
PndFtofPoint TCA.
Float_t GetZLastPlane()
Definition: PndPidCorrPar.h:22