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():
58 //____________________________________________________________________________
59 AliPHOSJet::AliPHOSJet(const AliPHOSJet & jet) :
76 // copy ctor: no implementation yet
77 Fatal("cpy ctor", "not implemented") ;
81 //____________________________________________________________________________
82 AliPHOSJet::~AliPHOSJet(){
90 //____________________________________________________________________________
91 void AliPHOSJet::AddParticle(const TParticle * p, Int_t index){
92 //adds particle to jet. Calculates change in jet direction,
93 //due to addition of this particle and if it is smaller, than fMaxDev,
94 //add particle, axcept new direction and return true.
96 fSumEnergy+=p->Energy() ;
97 if(p->Pt()/p->Energy() > 0.001)
98 fSumEta+=p->Eta()*p->Energy() ;
100 fSumEta+=100.*p->Pz() ;
101 fSumPhi+=p->Phi()*p->Energy() ;
103 //check if this a leading particle?
104 if(fLEnergy < p->Energy()){
105 fLEnergy = p->Energy() ;
106 if(p->Pt()/p->Energy() > 0.001)
109 fLEta = 100.*p->Pz()/p->Energy() ;
113 if(index >=0){ //add index to list of indexes
115 fList = new TArrayI(100) ;
117 if(fList->GetSize()<=fNpart+1){
118 TArrayI * tmp = new TArrayI(fNpart*2) ;
119 tmp->Adopt(fList->GetSize(),fList->GetArray()) ; //note, we should not delete old array!
122 fList->AddAt(index,fNpart++) ;
125 //____________________________________________________________________________
126 void AliPHOSJet::AddDigit(Double_t e, Double_t eta, Double_t phi, Int_t index){
127 //adds particle to jet. Calculates change in jet direction,
128 //due to addition of this particle and if it is smaller, than fMaxDev,
129 //add particle, axcept new direction and return true.
135 //check if this a leading particle?
142 if(index >=0){ //add index to list of indexes
144 fList = new TArrayI(100) ;
146 if(fList->GetSize()<=fNpart+1){
147 TArrayI * tmp = new TArrayI(fNpart*2) ;
148 tmp->Adopt(fList->GetSize(),fList->GetArray()) ; //note, we should not delete old array!
151 fList->AddAt(index,fNpart++) ;
154 // //____________________________________________________________________________
155 // Bool_t AliPHOSJet::IsInJet(TParticle * p,Int_t mode)
160 // if(!fEnergy){ //Final values not calculated yet, use intermediate
162 // return kTRUE ; //First particle
163 // note p->Eta() causes fpe!
164 // dEta=(p->Eta() - fSumEta/fSumEnergy) ;
165 // dPhi=(p->Phi() - fSumPhi/fSumEnergy) ;
166 // energy = fSumEnergy ;
168 // else{ //calculated with respect to final
169 // dEta=(p->Eta() - fEta) ;
170 // dPhi=(p->Phi() - fPhi) ;
171 // energy = fEnergy ;
176 // return IsInCone(eta,phi) ; //pure geometrical comparison
178 // return AcceptConeDeviation(dEta,dPhi,p->Energy() );
180 // AliError(Form("Unknown mode of cone calculation %d \n",mode ));
184 //____________________________________________________________________________
185 Bool_t AliPHOSJet::AcceptConeDeviation(const TParticle * p)const
186 { //Calculate cone deviation in case of inclusion of the given
189 Double_t tmpEnergy = fSumEnergy + p->Energy() ;
190 Double_t tmpEta = fSumEta ;
191 if(p->Pt()/p->Energy() >0.001)
192 tmpEta+= p->Eta()*p->Energy() ;
194 tmpEta+= 100.*p->Pz() ;
195 tmpEta = tmpEta/tmpEnergy / (fSumEta/fSumEnergy) - 1 ;
196 Double_t tmpPhi = fSumPhi + p->Phi()*p->Energy() ;
197 tmpPhi = tmpPhi/tmpEnergy /(fSumPhi/fSumEnergy) - 1 ;
198 Double_t dev = TMath::Sqrt(tmpEta*tmpEta + tmpPhi*tmpPhi) ;
199 if(dev < fMaxConeMove)
204 //____________________________________________________________________________
205 Bool_t AliPHOSJet::AcceptConeDeviation(Double_t e, Double_t eta, Double_t phi)const
206 { //Calculate cone deviation in case of inclusion of the given
209 Double_t tmpEnergy = fSumEnergy + e ;
210 Double_t tmpEta = fSumEta + eta*e ;
211 tmpEta = tmpEta/tmpEnergy / (fSumEta/fSumEnergy) ;
212 Double_t tmpPhi = fSumPhi + phi*e ;
213 tmpPhi = tmpPhi/tmpEnergy /(fSumPhi/fSumEnergy) ;
214 Double_t dev = TMath::Sqrt(tmpEta*tmpEta + tmpPhi*tmpPhi) ;
215 if(dev<fMaxConeMove && dev > fMinConeMove)
220 //____________________________________________________________________________
221 Bool_t AliPHOSJet::IsInCone(const TParticle * p)const
223 //Say if particle is inside the defined cone
226 if(!fEnergy){ //Final values not calculated yet, use intermediate
228 return kTRUE ; //First particle
229 if(p->Pt()/p->Energy() > 0.001)
230 dEta=(p->Eta() - fSumEta/fSumEnergy) ;
232 dEta=(100.*p->Pz()/p->Energy() - fSumEta/fSumEnergy) ;
233 dPhi=(p->Phi() - fSumPhi/fSumEnergy) ;
235 else{ //calculated with respect to final
236 if(p->Pt()/p->Energy() > 0.001)
237 dEta=(p->Eta() - fEta) ;
239 dEta=(100.*p->Pz()/p->Energy() - fEta) ;
240 dPhi=(p->Phi() - fPhi) ;
242 if(TMath::Sqrt(dEta*dEta + dPhi*dPhi) < fConeRad)
247 //____________________________________________________________________________
248 Bool_t AliPHOSJet::IsInCone(Double_t eta, Double_t phi)const
250 //Says if particle is inside the defined cone
253 if(!fEnergy){ //Final values not calculated yet, use intermediate
255 return kTRUE ; //First particle
256 dEta=(eta - fSumEta/fSumEnergy) ;
257 dPhi=(phi - fSumPhi/fSumEnergy) ;
259 else{ //calculated with respect to final
263 if(TMath::Sqrt(dEta*dEta + dPhi*dPhi) < fConeRad)
268 //____________________________________________________________________________
269 Double_t AliPHOSJet::DistanceToJet(const TParticle *p)const{
273 if(!fEnergy){ //Final values not calculated yet, use intermediate
275 return kTRUE ; //First particle
276 if(p->Pt()/p->Energy() > 0.001)
277 dEta=(p->Eta() - fSumEta/fSumEnergy) ;
279 dEta=(100.*p->Pz()/p->Energy() - fSumEta/fSumEnergy) ;
280 dPhi=(p->Phi() - fSumPhi/fSumEnergy) ;
282 else{ //calculated with respect to final
283 if(p->Pt()/p->Energy() > 0.001)
284 dEta=(p->Eta() - fEta) ;
286 dEta=(100*p->Pz()/p->Energy() - fEta) ;
287 dPhi=(p->Phi() - fPhi) ;
289 return TMath::Sqrt(dEta*dEta + dPhi*dPhi) ;
292 //____________________________________________________________________________
293 void AliPHOSJet::CalculateAll(void){
294 //Calculate all jet parameters
296 return ; //Nothing to calculate
298 fEta = fSumEta/fSumEnergy ;
299 fPhi = fSumPhi/fSumEnergy ;
300 fEnergy = fSumEnergy ;
306 //____________________________________________________________________________
307 void AliPHOSJet::Print(const Option_t *) const {
308 //Print jet parameters
309 printf("-------------- AliPHOSJet ------------\n") ;
310 printf(" Energy............. %f \n",fEnergy) ;
311 printf(" Eta................ %f \n",fEta ) ;
312 printf(" Phi................ %f \n",fPhi ) ;
313 printf(" Leading Energy..... %f \n",fLEnergy) ;
314 printf(" Leading Eta........ %f \n",fLEta) ;
315 printf(" Leading Phi........ %f \n",fLPhi) ;
316 printf(" N particles in jet %d \n",fNpart) ;
317 printf("----------------------------------\n") ;