]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/hfe/AliHFEpidITS.cxx
Cleanup the code. Fix memory leak. Now inherit from AliAnalysisTaskSE (Antoine, Phili...
[u/mrichter/AliRoot.git] / PWG3 / hfe / AliHFEpidITS.cxx
CommitLineData
e8a6457a 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 **************************************************************************/
27de2dfb 15
16/* $Id$ */
17
50685501 18//
19// ITS PID class
20// checks ITS PID based on ITS dE/dx truncated mean
21//
22// Authors: Matus Kalisky <matus.kalisky@cern.ch>
23// Markus Fasel <M.Fasel@gsi.de>
24//
722347d8 25#include <TClass.h>
e8a6457a 26#include <TH2F.h>
27#include <TList.h>
28#include <TMath.h>
722347d8 29#include <TString.h>
e8a6457a 30
50685501 31//#include "AliAODTrack.h"
32//#include "AliAODMCParticle.h"
e8a6457a 33#include "AliESDtrack.h"
34#include "AliLog.h"
35#include "AliPID.h"
36#include "AliVParticle.h"
37
38#include "AliHFEpidITS.h"
39
3a72645a 40ClassImp(AliHFEpidITS)
41
e8a6457a 42//___________________________________________________________________
43AliHFEpidITS::AliHFEpidITS(const Char_t *name):
44 AliHFEpidBase(name)
e8a6457a 45{
46 //
47 // Default constructor
48 //
49}
50
51//___________________________________________________________________
52AliHFEpidITS::AliHFEpidITS(const AliHFEpidITS &ref):
53 AliHFEpidBase("")
e8a6457a 54{
55 //
56 // Copy constructor
57 //
58 ref.Copy(*this);
59}
60
61//___________________________________________________________________
62AliHFEpidITS &AliHFEpidITS::operator=(const AliHFEpidITS &ref){
63 //
64 // Assignment operator
65 //
66 if(this != &ref) ref.Copy(*this);
67 return *this;
68}
69
70//___________________________________________________________________
71AliHFEpidITS::~AliHFEpidITS(){
72 //
73 // Destructor
74 //
e8a6457a 75}
76
77//___________________________________________________________________
78void AliHFEpidITS::Copy(TObject &o) const {
79 //
80 // Copy function
81 // Provides a deep copy
82 //
3a72645a 83 AliHFEpidBase::Copy(o);
e8a6457a 84}
85
86//___________________________________________________________________
87Bool_t AliHFEpidITS::InitializePID(){
88 //
89 // ITS PID initialization
90 //
91 return kTRUE;
92}
93
94
95//___________________________________________________________________
6555e2ad 96Int_t AliHFEpidITS::IsSelected(const AliHFEpidObject* /*track*/, AliHFEpidQAmanager* /*pidqa*/) const {
e8a6457a 97 //
98 // Does PID decision for ITS
99 //
100 return 11; // @TODO: Implement ITS PID decision
101}
102
103//___________________________________________________________________
3a72645a 104Double_t AliHFEpidITS::GetITSSignalV1(AliVParticle *vtrack){
e8a6457a 105 //
106 // Calculate the ITS signal according to the mean charge of the clusters
107 //
3a72645a 108 if(!TString(vtrack->IsA()->GetName()).CompareTo("AliAODTrack")){
722347d8 109 AliError("PID for AODs not implemented yet");
110 return 0.;
111 }
112 AliESDtrack *track = dynamic_cast<AliESDtrack *>(vtrack);
bf892a6a 113 if(!track) return 0.;
e8a6457a 114 Double_t signal = 0.;
115#ifdef TRUNK
116 Double_t dedx[4];
117 track->GetITSdEdxSamples(dedx);
118 signal = TMath::Mean(4, dedx);
119#else
120 signal = track->GetITSsignal();
121#endif
122 Double_t p = track->GetTPCInnerParam() ? track->GetTPCInnerParam()->P() : track->P();
123 AliDebug(1, Form("Momentum: %f, ITS Signal: %f", p, signal));
e8a6457a 124 return signal;
125}
126
127//___________________________________________________________________
3a72645a 128Double_t AliHFEpidITS::GetITSSignalV2(AliVParticle *vtrack){
e8a6457a 129 //
130 // Calculates the ITS signal. Truncated mean is used.
131 //
3a72645a 132 if(!TString(vtrack->IsA()->GetName()).CompareTo("AliAODTrack")){
722347d8 133 AliError("PID for AODs not implemented yet");
134 return 0.;
135 }
136 AliESDtrack *track = dynamic_cast<AliESDtrack *>(vtrack);
bf892a6a 137 if(!track) return 0.;
e8a6457a 138 Double_t dedx[4], tmp[4];
139 Int_t indices[4];
140 track->GetITSdEdxSamples(tmp);
141 TMath::Sort(4, tmp, indices);
142 for(Int_t ien = 0; ien < 4; ien++) dedx[ien] = tmp[indices[ien]];
143 Double_t signal = TMath::Mean(3, dedx);
144 Double_t p = track->GetTPCInnerParam() ? track->GetTPCInnerParam()->P() : track->P();
145 AliDebug(1, Form("Momentum: %f, ITS Signal: %f", p, signal));
e8a6457a 146 return signal;
147}
148