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