1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________
19 // Class to calculate jet chararacteristics
21 // This class implements for PHOS a jet finder for PHOS. It depends on a
23 // minimum energy, cone radius and movement of the cone.
24 //*-- Author : D.Peressounko
25 //////////////////////////////////////////////////////////////////////////////
27 // --- ROOT system ---
28 #include "TParticle.h"
30 // --- Standard library ---
32 // --- AliRoot header files ---
33 #include "AliPHOSJet.h"
34 // #include "AliPHOSGetter.h"
38 //____________________________________________________________________________
39 AliPHOSJet::AliPHOSJet():TObject() {
59 //____________________________________________________________________________
60 AliPHOSJet::~AliPHOSJet(){
68 //____________________________________________________________________________
69 void AliPHOSJet::AddParticle(const TParticle * p,const Int_t index){
70 //adds particle to jet. Calculates change in jet direction,
71 //due to addition of this particle and if it is smaller, than fMaxDev,
72 //add particle, axcept new direction and return true.
74 fSumEnergy+=p->Energy() ;
75 if(p->Pt()/p->Energy() > 0.001)
76 fSumEta+=p->Eta()*p->Energy() ;
78 fSumEta+=100.*p->Pz() ;
79 fSumPhi+=p->Phi()*p->Energy() ;
81 //check if this a leading particle?
82 if(fLEnergy < p->Energy()){
83 fLEnergy = p->Energy() ;
84 if(p->Pt()/p->Energy() > 0.001)
87 fLEta = 100.*p->Pz()/p->Energy() ;
91 if(index >=0){ //add index to list of indexes
93 fList = new TArrayI(100) ;
95 if(fList->GetSize()<=fNpart+1){
96 TArrayI * tmp = new TArrayI(fNpart*2) ;
97 tmp->Adopt(fList->GetSize(),fList->GetArray()) ; //note, we should not delete old array!
100 fList->AddAt(index,fNpart++) ;
103 //____________________________________________________________________________
104 void AliPHOSJet::AddDigit(const Double_t e,const Double_t eta,const Double_t phi, const Int_t index){
105 //adds particle to jet. Calculates change in jet direction,
106 //due to addition of this particle and if it is smaller, than fMaxDev,
107 //add particle, axcept new direction and return true.
113 //check if this a leading particle?
120 if(index >=0){ //add index to list of indexes
122 fList = new TArrayI(100) ;
124 if(fList->GetSize()<=fNpart+1){
125 TArrayI * tmp = new TArrayI(fNpart*2) ;
126 tmp->Adopt(fList->GetSize(),fList->GetArray()) ; //note, we should not delete old array!
129 fList->AddAt(index,fNpart++) ;
132 // //____________________________________________________________________________
133 // Bool_t AliPHOSJet::IsInJet(TParticle * p,Int_t mode)
138 // if(!fEnergy){ //Final values not calculated yet, use intermediate
140 // return kTRUE ; //First particle
141 // note p->Eta() causes fpe!
142 // dEta=(p->Eta() - fSumEta/fSumEnergy) ;
143 // dPhi=(p->Phi() - fSumPhi/fSumEnergy) ;
144 // energy = fSumEnergy ;
146 // else{ //calculated with respect to final
147 // dEta=(p->Eta() - fEta) ;
148 // dPhi=(p->Phi() - fPhi) ;
149 // energy = fEnergy ;
154 // return IsInCone(eta,phi) ; //pure geometrical comparison
156 // return AcceptConeDeviation(dEta,dPhi,p->Energy() );
158 // Error("IsInCone","Unknown mode of cone calculation %d \n",mode );
162 //____________________________________________________________________________
163 Bool_t AliPHOSJet::AcceptConeDeviation(const TParticle * p)const
164 { //Calculate cone deviation in case of inclusion of the given
167 Double_t tmpEnergy = fSumEnergy + p->Energy() ;
168 Double_t tmpEta = fSumEta ;
169 if(p->Pt()/p->Energy() >0.001)
170 tmpEta+= p->Eta()*p->Energy() ;
172 tmpEta+= 100.*p->Pz() ;
173 tmpEta = tmpEta/tmpEnergy / (fSumEta/fSumEnergy) - 1 ;
174 Double_t tmpPhi = fSumPhi + p->Phi()*p->Energy() ;
175 tmpPhi = tmpPhi/tmpEnergy /(fSumPhi/fSumEnergy) - 1 ;
176 Double_t dev = TMath::Sqrt(tmpEta*tmpEta + tmpPhi*tmpPhi) ;
177 if(dev < fMaxConeMove)
182 //____________________________________________________________________________
183 Bool_t AliPHOSJet::AcceptConeDeviation(const Double_t e,const Double_t eta,const Double_t phi)const
184 { //Calculate cone deviation in case of inclusion of the given
187 Double_t tmpEnergy = fSumEnergy + e ;
188 Double_t tmpEta = fSumEta + eta*e ;
189 tmpEta = tmpEta/tmpEnergy / (fSumEta/fSumEnergy) ;
190 Double_t tmpPhi = fSumPhi + phi*e ;
191 tmpPhi = tmpPhi/tmpEnergy /(fSumPhi/fSumEnergy) ;
192 Double_t dev = TMath::Sqrt(tmpEta*tmpEta + tmpPhi*tmpPhi) ;
193 if(dev<fMaxConeMove && dev > fMinConeMove)
198 //____________________________________________________________________________
199 Bool_t AliPHOSJet::IsInCone(const TParticle * p)const
201 //Say if particle is inside the defined cone
204 if(!fEnergy){ //Final values not calculated yet, use intermediate
206 return kTRUE ; //First particle
207 if(p->Pt()/p->Energy() > 0.001)
208 dEta=(p->Eta() - fSumEta/fSumEnergy) ;
210 dEta=(100.*p->Pz()/p->Energy() - fSumEta/fSumEnergy) ;
211 dPhi=(p->Phi() - fSumPhi/fSumEnergy) ;
213 else{ //calculated with respect to final
214 if(p->Pt()/p->Energy() > 0.001)
215 dEta=(p->Eta() - fEta) ;
217 dEta=(100.*p->Pz()/p->Energy() - fEta) ;
218 dPhi=(p->Phi() - fPhi) ;
220 if(TMath::Sqrt(dEta*dEta + dPhi*dPhi) < fConeRad)
225 //____________________________________________________________________________
226 Bool_t AliPHOSJet::IsInCone(const Double_t e,const Double_t eta,const Double_t phi)const
228 //Says if particle is inside the defined cone
231 if(!fEnergy){ //Final values not calculated yet, use intermediate
233 return kTRUE ; //First particle
234 dEta=(eta - fSumEta/fSumEnergy) ;
235 dPhi=(phi - fSumPhi/fSumEnergy) ;
237 else{ //calculated with respect to final
241 if(TMath::Sqrt(dEta*dEta + dPhi*dPhi) < fConeRad)
246 //____________________________________________________________________________
247 Double_t AliPHOSJet::DistanceToJet(const TParticle *p)const{
251 if(!fEnergy){ //Final values not calculated yet, use intermediate
253 return kTRUE ; //First particle
254 if(p->Pt()/p->Energy() > 0.001)
255 dEta=(p->Eta() - fSumEta/fSumEnergy) ;
257 dEta=(100.*p->Pz()/p->Energy() - fSumEta/fSumEnergy) ;
258 dPhi=(p->Phi() - fSumPhi/fSumEnergy) ;
260 else{ //calculated with respect to final
261 if(p->Pt()/p->Energy() > 0.001)
262 dEta=(p->Eta() - fEta) ;
264 dEta=(100*p->Pz()/p->Energy() - fEta) ;
265 dPhi=(p->Phi() - fPhi) ;
267 return TMath::Sqrt(dEta*dEta + dPhi*dPhi) ;
270 //____________________________________________________________________________
271 void AliPHOSJet::CalculateAll(void){
272 //Calculate all jet parameters
274 return ; //Nothing to calculate
276 fEta = fSumEta/fSumEnergy ;
277 fPhi = fSumPhi/fSumEnergy ;
278 fEnergy = fSumEnergy ;
284 //____________________________________________________________________________
285 void AliPHOSJet::Print(Option_t * option){
286 //Print jet parameters
287 printf("-------------- AliPHOSJet ------------\n") ;
288 printf(" Energy............. %f \n",fEnergy) ;
289 printf(" Eta................ %f \n",fEta ) ;
290 printf(" Phi................ %f \n",fPhi ) ;
291 printf(" Leading Energy..... %f \n",fLEnergy) ;
292 printf(" Leading Eta........ %f \n",fLEta) ;
293 printf(" Leading Phi........ %f \n",fLPhi) ;
294 printf(" N particles in jet %d \n",fNpart) ;
295 printf("----------------------------------\n") ;