]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/hfe/AliHFEpidTRD.cxx
Fix coding rules violations
[u/mrichter/AliRoot.git] / PWG3 / hfe / AliHFEpidTRD.cxx
CommitLineData
809a4336 1/**************************************************************************
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
7* Permission to use, copy, modify and distribute this software and its *
8* documentation strictly for non-commercial purposes is hereby granted *
9* without fee, provided that the above copyright notice appears in all *
10* copies and that both the copyright notice and this permission notice *
11* appear in the supporting documentation. The authors make no claims *
12* about the suitability of this software for any purpose. It is *
13* provided "as is" without express or implied warranty. *
14**************************************************************************/
15/************************************************************************
16 * *
17 * Class for TRD PID *
18 * Implements the abstract base class AliHFEpidbase *
19 * Make PID does the PID decision *
20 * Class further contains TRD specific cuts and QA histograms *
21 * *
22 * Authors: *
23 * Markus Fasel <M.Fasel@gsi.de> *
24 * *
25 ************************************************************************/
26#include <TAxis.h>
27#include <TFile.h>
28#include <TH1F.h>
29#include <TIterator.h>
30#include <TKey.h>
31#include <TMap.h>
32#include <TObjArray.h>
33#include <TObjString.h>
34#include <TString.h>
35#include <TROOT.h>
36
37#include "AliESDtrack.h"
38#include "AliPID.h"
39
40#include "AliHFEpidTRD.h"
41
42ClassImp(AliHFEpidTRD)
43
44//___________________________________________________________________
45AliHFEpidTRD::AliHFEpidTRD(const char* name) :
46 AliHFEpidBase(name)
809a4336 47 , fPIDMethod(kNN)
809a4336 48{
49 //
50 // default constructor
51 //
dbe3abbe 52 memset(fThreshParams, 0, sizeof(Double_t) * kThreshParams);
809a4336 53}
54
55//___________________________________________________________________
56AliHFEpidTRD::AliHFEpidTRD(const AliHFEpidTRD &ref):
57 AliHFEpidBase("")
809a4336 58 , fPIDMethod(kLQ)
809a4336 59{
60 //
61 // Copy constructor
62 //
dbe3abbe 63 memset(fThreshParams, 0, sizeof(Double_t) * kThreshParams);
809a4336 64 ref.Copy(*this);
65}
66
67//___________________________________________________________________
68AliHFEpidTRD &AliHFEpidTRD::operator=(const AliHFEpidTRD &ref){
69 //
70 // Assignment operator
71 //
72 if(this != &ref){
73 ref.Copy(*this);
74 }
75 return *this;
76}
77
78//___________________________________________________________________
79void AliHFEpidTRD::Copy(TObject &ref) const {
80 //
81 // Performs the copying of the object
82 //
83 AliHFEpidTRD &target = dynamic_cast<AliHFEpidTRD &>(ref);
84
809a4336 85 target.fPIDMethod = fPIDMethod;
dbe3abbe 86 memcpy(target.fThreshParams, fThreshParams, sizeof(Double_t) * kThreshParams);
809a4336 87 AliHFEpidBase::Copy(ref);
88}
89
90//___________________________________________________________________
91AliHFEpidTRD::~AliHFEpidTRD(){
92 //
93 // Destructor
94 //
809a4336 95}
96
97//______________________________________________________
98Bool_t AliHFEpidTRD::InitializePID(){
99 //
100 // InitializePID: Load TRD thresholds and create the electron efficiency axis
101 // to navigate
102 //
dbe3abbe 103 InitParameters();
809a4336 104 return kTRUE;
105}
106
107//______________________________________________________
108Int_t AliHFEpidTRD::IsSelected(AliVParticle *track){
109 //
110 // Does PID for TRD alone:
111 // PID thresholds based on 90% Electron Efficiency level approximated by a linear
112 // step function
113 //
114 AliESDtrack *esdTrack = 0x0;
115 if(!(esdTrack = dynamic_cast<AliESDtrack *>(track))) return kFALSE;
116 Double_t p = esdTrack->GetOuterParam() ? esdTrack->GetOuterParam()->P() : esdTrack->P();
117 if(p < 0.6) return 0;
118
809a4336 119 Double_t pidProbs[AliPID::kSPECIES];
120 esdTrack->GetTRDpid(pidProbs);
dbe3abbe 121 if(pidProbs[AliPID::kElectron] > GetTRDthresholds(0.91, p)) return 11;
809a4336 122 return 0;
123}
124
125//___________________________________________________________________
dbe3abbe 126Double_t AliHFEpidTRD::GetTRDthresholds(Double_t electronEff, Double_t p){
127 //
128 // Return momentum dependent and electron efficiency dependent TRD thresholds
129 //
130 Double_t params[4];
131 GetParameters(electronEff, params);
132 return 1. - params[0] * p - params[1] * TMath::Exp(-params[2] * p) - params[3];
809a4336 133}
134
135//___________________________________________________________________
dbe3abbe 136void AliHFEpidTRD::InitParameters(){
137 //
138 // Fill the Parameters into an array
139 //
140
141 // Parameters for 6 Layers
142 fThreshParams[0] = -0.001839; // 0.7 electron eff
143 fThreshParams[1] = 0.000276;
144 fThreshParams[2] = 0.044902;
145 fThreshParams[3] = 1.726751;
146 fThreshParams[4] = -0.002405; // 0.75 electron eff
147 fThreshParams[5] = 0.000372;
148 fThreshParams[6] = 0.061775;
149 fThreshParams[7] = 1.739371;
150 fThreshParams[8] = -0.003178; // 0.8 electron eff
151 fThreshParams[9] = 0.000521;
152 fThreshParams[10] = 0.087585;
153 fThreshParams[11] = 1.749154;
154 fThreshParams[12] = -0.004058; // 0.85 electron eff
155 fThreshParams[13] = 0.000748;
156 fThreshParams[14] = 0.129583;
157 fThreshParams[15] = 1.782323;
158 fThreshParams[16] = -0.004967; // 0.9 electron eff
159 fThreshParams[17] = 0.001216;
160 fThreshParams[18] = 0.210128;
161 fThreshParams[19] = 1.807665;
162 fThreshParams[20] = -0.000996; // 0.95 electron eff
163 fThreshParams[21] = 0.002627;
164 fThreshParams[22] = 0.409099;
165 fThreshParams[23] = 1.787076;
809a4336 166}
167
168//___________________________________________________________________
dbe3abbe 169void AliHFEpidTRD::GetParameters(Double_t electronEff, Double_t *parameters){
170 //
171 // return parameter set for the given efficiency bin
172 //
173 Int_t effbin = static_cast<Int_t>((electronEff - 0.7)/0.3 * 6.);
174 memcpy(parameters, fThreshParams + effbin * 4, sizeof(Double_t) * 4);
809a4336 175}