Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
KFTopoPerformance.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file KFTopoPerformance.h
1 /*
2  * This file is part of KFParticle package
3  * Copyright (C) 2007-2019 FIAS Frankfurt Institute for Advanced Studies
4  * 2007-2019 Goethe University of Frankfurt
5  * 2007-2019 Ivan Kisel <I.Kisel@compeng.uni-frankfurt.de>
6  * 2007-2019 Maksym Zyzak
7  *
8  * KFParticle is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * KFParticle is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
23 
24 #ifndef KFTOPOPERFORMANCE_H
25 #define KFTOPOPERFORMANCE_H
26 
27 
29 
30 #include "KFMCVertex.h"
31 #include "KFMCTrack.h"
32 #include <cstdio>
33 #include <map>
34 
35 #include "KFPartMatch.h"
36 #include "KFMCParticle.h"
37 
38 class AliHLTTPCCAGBTracker;
39 
41 class KFPHistogram;
42 
58 class KFTopoPerformance: public KFParticlePerformanceBase
59 {
60  public:
61 
62  KFTopoPerformance();
63  virtual ~KFTopoPerformance();
64 #ifdef KFPWITHTRACKER
65  virtual void SetNewEvent(
66  const AliHLTTPCCAGBTracker * const Tracker,
67  AliHLTResizableArray<AliHLTTPCCAHitLabel> *hitLabels,
68  AliHLTResizableArray<AliHLTTPCCAMCTrack> *mcTracks,
69  AliHLTResizableArray<AliHLTTPCCALocalMCPoint> *localMCPoints);
70 #endif
71  void SetTopoReconstructor( const KFParticleTopoReconstructor * const TopoReconstructor );
72  const KFParticleTopoReconstructor * GetTopoReconstructor() const { return fTopoReconstructor; }
73 
74  // Check if MC track is reconstructable. Calculate set of MC track. Etc.
75  virtual void CheckMCTracks(); // fill mcData.
76  // Find reco-MCTracks correspondence
77  virtual void MatchTracks(); // fill recoData.
78  // Calculate efficiencies
79 
81  void FillHistos();
82  void FillHistos(const KFPHistogram* histograms);
83  void FillMCHistos();
84 
85  void AddV0Histos();
86 
87  void SetTrackMatch(const std::vector<int>& trackMatch) { fTrackMatch = trackMatch;}
88  void SetMCTracks(const std::vector<KFMCTrack>& mcTracks) { vMCTracks = mcTracks; }
89 
90  const KFPartEfficiencies GetEfficiency() const { return fParteff; }
91  void SetPrintEffFrequency(int n) { fPrintEffFrequency = n;}
92 
93  const std::vector<KFMCVertex> GetPrimVertices() { return fPrimVertices; }
94  const std::vector<KFMCParticle>& MCParticles() { return vMCParticles; }
95  const std::vector<KFPartMatch>& ParticlesMatch() { return RtoMCParticleId; }
96  const std::vector<KFPartMatch>& GetMCtoRPVId() { return MCtoRPVId; }
97  const std::vector<KFPartMatch>& GetRtoMCPVId() { return RtoMCPVId; }
98  const KFMCTrack& GetMCTrack(const int iRecoTrack)
99  {
101  int iMCTrack = 0;
102  if(RtoMCParticleId[iRecoTrack].IsMatched())
103  iMCTrack = RtoMCParticleId[iRecoTrack].GetBestMatch();
104  return vMCTracks[iMCTrack];
105  }
106 
107  void SetCentralityBin(const int iBin) { fCentralityBin = iBin; }
108  void SetCentralityWeight(const float weight) { fCentralityWeight = weight; }
109 
110  private:
111 
112  const KFTopoPerformance& operator = (const KFTopoPerformance&);
113  KFTopoPerformance(const KFTopoPerformance&);
114 
115  void GetMCParticles();
116  void MatchParticles();
117  void MatchPV();
118  void CalculateEfficiency();
119  void CalculatePVEfficiency();
120  void FindReconstructableMCParticles();
121  void CheckMCParticleIsReconstructable(KFMCParticle &part);
122  void FindReconstructableMCVertices();
123  void FillParticleParameters(KFParticle& TempPart,
124  int iParticle,
125  int iP,
126  int iPV,
127  TH1F* histoParameters[4][KFPartEfficiencies::nParticles][nHistoPartParam],
128  TH2F* histoParameters2D[4][KFPartEfficiencies::nParticles][nHistoPartParam2D],
129  TH3F* histoParameters3D[1][KFPartEfficiencies::nParticles][nHistoPartParam3D],
130  TH1F* histoFit[KFPartEfficiencies::nParticles][nFitQA] = 0,
131  TH1F* histoFitDaughtersQA[KFPartEfficiencies::nParticles][nFitQA] = 0,
132  TH1F* histoDSToParticleQA[KFPartEfficiencies::nParticles][nDSToParticleQA] = 0,
133  std::vector<int>* multiplicities = 0);
134 
135  const KFParticleTopoReconstructor *fTopoReconstructor;
136 
137  std::vector<KFMCVertex> fPrimVertices;
138  std::vector<int> fMCTrackToMCPVMatch;
139  std::vector<double> fPVPurity;
140  std::vector<double> fPVTracksRate[4];
141  std::vector<int> fNCorrectPVTracks;
142 
143  std::vector<int> fTrackMatch;
144  std::vector<KFMCTrack> vMCTracks;
145  std::vector<KFMCParticle> vMCParticles;
146  std::vector<int> fNeutralIndex;
147 
150  std::vector<KFPartMatch> MCtoRParticleId;
153  std::vector<KFPartMatch> RtoMCParticleId;
154 
157  std::vector<KFPartMatch> MCtoRPVId;
160  std::vector<KFPartMatch> RtoMCPVId;
161 
162  int fPrintEffFrequency;
163 
164  int fCentralityBin;
165  float fCentralityWeight;
166 };
167 
168 #endif
169 #endif //DO_TPCCATRACKER_EFF_PERFORMANCE