]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/PartCorrBase/AliIsolationCut.cxx
PartCorr split in 2 Base and Dep; coding violations corrected; PHOS geometry can...
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / AliIsolationCut.cxx
CommitLineData
1c5acb87 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/* $Id: $ */
16
17//_________________________________________________________________________
18// Class containing methods for the isolation cut.
19//
20//
21//*-- Author: Gustavo Conesa (LNF-INFN)
22//////////////////////////////////////////////////////////////////////////////
23
24
25// --- ROOT system ---
26//#include <Riostream.h>
27#include <TLorentzVector.h>
28#include <TSeqCollection.h>
29
30// --- AliRoot system ---
31#include "AliIsolationCut.h"
32class AliLog ;
33#include "AliAODPWG4ParticleCorrelation.h"
34#include "AliAODTrack.h"
35#include "AliAODCaloCluster.h"
36
37ClassImp(AliIsolationCut)
38
39//____________________________________________________________________________
40 AliIsolationCut::AliIsolationCut() :
41 TObject(),
42 fConeSize(0.),fPtThreshold(0.), fPtFraction(0.), fICMethod(0)
43
44{
45 //default ctor
46
47 //Initialize parameters
48 InitParameters();
49
50}
51
52//____________________________________________________________________________
53AliIsolationCut::AliIsolationCut(const AliIsolationCut & g) :
54 TObject(g),
55 fConeSize(g.fConeSize),
56 fPtThreshold(g.fPtThreshold),
57 fPtFraction(g.fPtFraction),
58 fICMethod(g.fICMethod)
59{
60 // cpy ctor
61
62}
63
64//_________________________________________________________________________
65AliIsolationCut & AliIsolationCut::operator = (const AliIsolationCut & source)
66{
67 // assignment operator
68
69 if(&source == this) return *this;
70
71 fConeSize = source.fConeSize ;
72 fPtThreshold = source.fPtThreshold ;
73 fICMethod = source.fICMethod ;
74 fPtFraction = source.fPtFraction ;
75
76 return *this;
77
78}
79
80
81//____________________________________________________________________________
82TString AliIsolationCut::GetICParametersList()
83{
84 //Put data member values in string to keep in output container
85
86 TString parList ; //this will be list of parameters used for this analysis.
87 char onePar[255] ;
88
89 sprintf(onePar,"--- AliIsolationCut ---\n") ;
90 parList+=onePar ;
91 sprintf(onePar,"fConeSize: (isolation cone size) %1.2f\n",fConeSize) ;
92 parList+=onePar ;
93 sprintf(onePar,"fPtThreshold =%1.2f (isolation pt threshold) \n",fPtThreshold) ;
94 parList+=onePar ;
95 sprintf(onePar,"fPtFraction=%1.2f (isolation pt threshold fraction ) \n",fPtFraction) ;
96 parList+=onePar ;
97 sprintf(onePar,"fICMethod=%d (isolation cut case) \n",fICMethod) ;
98 parList+=onePar ;
99
100 return parList;
101}
102
103//____________________________________________________________________________
104void AliIsolationCut::InitParameters()
105{
106 //Initialize the parameters of the analysis.
107
108 fConeSize = 0.4 ;
109 fPtThreshold = 1. ;
110 fPtFraction = 0.1 ;
111
112 fICMethod = kPtThresIC; // 0 pt threshol method, 1 cone pt sum method
113
114}
115
116//__________________________________________________________________
117void AliIsolationCut::MakeIsolationCut(TSeqCollection * plCTS, TSeqCollection * plNe, Double_t * vertex,
118 const Bool_t fillAOD, AliAODPWG4ParticleCorrelation *pCandidate,
119 Int_t & n, Int_t & nfrac, Float_t &coneptsum, Bool_t &isolated) const
120{
121 //Search in cone around a candidate particle if it is isolated
122 Float_t phiC = pCandidate->Phi() ;
123 Float_t etaC = pCandidate->Eta() ;
124 Float_t ptC = pCandidate->Pt() ;
125 Float_t pt = -100. ;
126 Float_t eta = -100. ;
127 Float_t phi = -100. ;
128 Float_t rad = -100 ;
129
130 n = 0 ;
131 coneptsum = 0.;
132 isolated = kFALSE;
133
134 //Check charged particles in cone.
135 if(plCTS){
136 TVector3 p3;
137 for(Int_t ipr = 0;ipr < plCTS->GetEntries() ; ipr ++ ){
138 AliAODTrack* track = (AliAODTrack *)(plCTS->At(ipr)) ;
139 //Do not count the candidate (pion, conversion photon) or the daughters of the candidate
140 if(track->GetID() == pCandidate->GetTrackLabel(0) || track->GetID() == pCandidate->GetTrackLabel(1)) continue ;
141 p3.SetXYZ(track->Px(),track->Py(),track->Pz());
142 pt = p3.Pt();
143 eta = p3.Eta();
144 phi = p3.Phi() ;
145 if(phi<0) phi+=TMath::TwoPi();
146
147 //Check if there is any particle inside cone with pt larger than fPtThreshold
148 rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC));
149
150 if(rad < fConeSize){
151 if(fillAOD) pCandidate->AddIsolationConeTrack(track);
152 //printf("charged in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad);
153 coneptsum+=pt;
154 if(pt > fPtThreshold ) n++;
155 if(pt > fPtFraction*ptC ) nfrac++;
156 }
157 }// charged particle loop
158 }//Tracks
159
160 //Check neutral particles in cone.
161 if(plNe){
162 TLorentzVector mom ;
163 for(Int_t ipr = 0;ipr < plNe->GetEntries() ; ipr ++ ){
164 AliAODCaloCluster * calo = (AliAODCaloCluster *)(plNe->At(ipr)) ;
165
166 //Do not count the candidate (photon or pi0) or the daughters of the candidate
167 if(calo->GetID() == pCandidate->GetCaloLabel(0) || calo->GetID() == pCandidate->GetCaloLabel(1)) continue ; //Skip matched clusters with tracks
168
169 if(calo->GetNTracksMatched() > 0) continue ;
170
171 calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line
172 pt = mom.Pt();
173 eta = mom.Eta();
174 phi = mom.Phi() ;
175 if(phi<0) phi+=TMath::TwoPi();
176
177 //Check if there is any particle inside cone with pt larger than fPtThreshold
178 rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC));
179 if(rad < fConeSize){
180 if(fillAOD) pCandidate->AddIsolationConeCluster(calo);
181 //printf("neutral in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad);
182 coneptsum+=pt;
183 if(pt > fPtThreshold ) n++;
184 if(pt > fPtFraction*ptC ) nfrac++;
185 }//in cone
186 }// neutral particle loop
187 }//neutrals
188
189 //printf("Isolation Cut: in cone with: pT>pTthres %d, pT > pTfrac*pTcandidate %d \n",n,nfrac);
190
191 //Check isolation, depending on method.
192 if( fICMethod == kPtThresIC){
193 if(n==0) isolated = kTRUE ;
194 }
195 else if( fICMethod == kSumPtIC){
196 if(coneptsum < fPtThreshold)
197 isolated = kTRUE ;
198 }
199 else if( fICMethod == kPtFracIC){
200 if(nfrac==0) isolated = kTRUE ;
201 }
202 else if( fICMethod == kSumPtFracIC){
203 if(coneptsum < fPtFraction*ptC)
204 isolated = kTRUE ;
205 }
206}
207
208//__________________________________________________________________
209void AliIsolationCut::Print(const Option_t * opt) const
210{
211
212 //Print some relevant parameters set for the analysis
213 if(! opt)
214 return;
215
216 printf("**** Print %s %s **** \n", GetName(), GetTitle() ) ;
217
218 printf("IC method = %d\n", fICMethod) ;
219 printf("Cone Size = %1.2f\n", fConeSize) ;
220 printf("pT threshold = %2.1f\n", fPtThreshold) ;
221 printf("pT fraction = %3.1f\n", fPtFraction) ;
222
223 printf(" \n") ;
224
225}