]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/AliIsolationCut.cxx
Some mindor mods, bug fix in jet association
[u/mrichter/AliRoot.git] / PWG4 / AliIsolationCut.cxx
CommitLineData
d92b41ad 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
d92b41ad 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"
32#include "AliLog.h"
33#include "AliAODParticleCorrelation.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
82
83 //____________________________________________________________________________
84void AliIsolationCut::InitParameters()
85{
86 //Initialize the parameters of the analysis.
87
88 fConeSize = 0.4 ;
89 fPtThreshold = 1. ;
90 fPtFraction = 0.1 ;
91
92 fICMethod = kPtThresIC; // 0 pt threshol method, 1 cone pt sum method
93
94}
95
96//__________________________________________________________________
97void AliIsolationCut::MakeIsolationCut(TSeqCollection * plCTS, TSeqCollection * plNe, Double_t * vertex,
98 const Bool_t fillAOD, AliAODParticleCorrelation *pCandidate,
99 const Int_t index1, const Int_t index2,
100 Int_t & n, Int_t & nfrac, Float_t &coneptsum, Bool_t &isolated)
101{
102 //Search in cone around a candidate particle if it is isolated
103 Float_t phiC = pCandidate->Phi() ;
104 Float_t etaC = pCandidate->Eta() ;
105 Float_t ptC = pCandidate->Pt() ;
106 Float_t pt = -100. ;
107 Float_t eta = -100. ;
108 Float_t phi = -100. ;
109 Float_t rad = -100 ;
110
111 n = 0 ;
112 coneptsum = 0.;
113 isolated = kFALSE;
114
115 //Check charged particles in cone.
116 if(plCTS){
117 TVector3 p3;
118 for(Int_t ipr = 0;ipr < plCTS->GetEntries() ; ipr ++ ){
119 if(ipr == index1 || ipr == index2) continue ;//Do not count the candidate
120 AliAODTrack* track = dynamic_cast<AliAODTrack *>(plCTS->At(ipr)) ;
121 p3.SetXYZ(track->Px(),track->Py(),track->Pz());
122 pt = p3.Pt();
123 eta = p3.Eta();
124 phi = p3.Phi() ;
125 if(phi<0) phi+=TMath::TwoPi();
126
127 //Check if there is any particle inside cone with pt larger than fPtThreshold
128 rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC));
129
130 if(rad < fConeSize){
131 if(fillAOD) pCandidate->AddIsolationConeTrack(track);
132 //printf("charged in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad);
133 coneptsum+=pt;
134 if(pt > fPtThreshold ) n++;
135 if(pt > fPtFraction*ptC ) nfrac++;
136 }
137 }// charged particle loop
138 }//Tracks
139
140 //Check neutral particles in cone.
141 if(plNe){
142 TLorentzVector mom ;
143 for(Int_t ipr = 0;ipr < plNe->GetEntries() ; ipr ++ ){
144 if(ipr == index1 || ipr == index2) continue ;//Do not count the candidate
145 AliAODCaloCluster * calo = dynamic_cast< AliAODCaloCluster *>(plNe->At(ipr)) ;
146
147 //Skip matched clusters with tracks
148 if(calo->GetNTracksMatched() > 0) continue ;
149
150 calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line
151 pt = mom.Pt();
152 eta = mom.Eta();
153 phi = mom.Phi() ;
154 if(phi<0) phi+=TMath::TwoPi();
155
156 //Check if there is any particle inside cone with pt larger than fPtThreshold
157 rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC));
158 if(rad < fConeSize){
159 if(fillAOD) pCandidate->AddIsolationConeCluster(calo);
160 //printf("neutral in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad);
161 coneptsum+=pt;
162 if(pt > fPtThreshold ) n++;
163 if(pt > fPtFraction*ptC ) nfrac++;
164 }//in cone
165 }// neutral particle loop
166 }//neutrals
167
168 //printf("Isolation Cut: in cone with: pT>pTthres %d, pT > pTfrac*pTcandidate %d \n",n,nfrac);
169
170 //Check isolation, depending on method.
171 if( fICMethod == kPtThresIC){
172 if(n==0) isolated = kTRUE ;
173 }
174 else if( fICMethod == kSumPtIC){
175 if(coneptsum < fPtThreshold)
176 isolated = kTRUE ;
177 }
178 else if( fICMethod == kPtFracIC){
179 if(nfrac==0) isolated = kTRUE ;
180 }
181 else if( fICMethod == kSumPtFracIC){
182 if(coneptsum < fPtFraction*ptC)
183 isolated = kTRUE ;
184 }
185}
186
187//__________________________________________________________________
188void AliIsolationCut::Print(const Option_t * opt) const
189{
190
191 //Print some relevant parameters set for the analysis
192 if(! opt)
193 return;
194
195 printf("**** Print %s %s **** \n", GetName(), GetTitle() ) ;
196
197 printf("IC method = %d\n", fICMethod) ;
198 printf("Cone Size = %1.2f\n", fConeSize) ;
199 printf("pT threshold = %2.1f\n", fPtThreshold) ;
200 printf("pT fraction = %3.1f\n", fPtFraction) ;
201
202 printf(" \n") ;
203
204}