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"
37 //____________________________________________________________________________
38 AliPHOSJet::AliPHOSJet():
57 //____________________________________________________________________________
58 AliPHOSJet::AliPHOSJet(const AliPHOSJet & jet) :
75 // copy ctor: no implementation yet
76 Fatal("cpy ctor", "not implemented") ;
80 //____________________________________________________________________________
81 AliPHOSJet::~AliPHOSJet(){
89 //____________________________________________________________________________
90 void AliPHOSJet::AddParticle(const TParticle * p, Int_t index){
91 //adds particle to jet. Calculates change in jet direction,
92 //due to addition of this particle and if it is smaller, than fMaxDev,
93 //add particle, axcept new direction and return true.
95 fSumEnergy+=p->Energy() ;
96 if(p->Pt()/p->Energy() > 0.001)
97 fSumEta+=p->Eta()*p->Energy() ;
99 fSumEta+=100.*p->Pz() ;
100 fSumPhi+=p->Phi()*p->Energy() ;
102 //check if this a leading particle?
103 if(fLEnergy < p->Energy()){
104 fLEnergy = p->Energy() ;
105 if(p->Pt()/p->Energy() > 0.001)
108 fLEta = 100.*p->Pz()/p->Energy() ;
112 if(index >=0){ //add index to list of indexes
114 fList = new TArrayI(100) ;
116 if(fList->GetSize()<=fNpart+1){
117 TArrayI * tmp = new TArrayI(fNpart*2) ;
118 tmp->Adopt(fList->GetSize(),fList->GetArray()) ; //note, we should not delete old array!
121 fList->AddAt(index,fNpart++) ;
124 //____________________________________________________________________________
125 void AliPHOSJet::AddDigit(Double_t e, Double_t eta, Double_t phi, Int_t index){
126 //adds particle to jet. Calculates change in jet direction,
127 //due to addition of this particle and if it is smaller, than fMaxDev,
128 //add particle, axcept new direction and return true.
134 //check if this a leading particle?
141 if(index >=0){ //add index to list of indexes
143 fList = new TArrayI(100) ;
145 if(fList->GetSize()<=fNpart+1){
146 TArrayI * tmp = new TArrayI(fNpart*2) ;
147 tmp->Adopt(fList->GetSize(),fList->GetArray()) ; //note, we should not delete old array!
150 fList->AddAt(index,fNpart++) ;
153 // //____________________________________________________________________________
154 // Bool_t AliPHOSJet::IsInJet(TParticle * p,Int_t mode)
159 // if(!fEnergy){ //Final values not calculated yet, use intermediate
161 // return kTRUE ; //First particle
162 // note p->Eta() causes fpe!
163 // dEta=(p->Eta() - fSumEta/fSumEnergy) ;
164 // dPhi=(p->Phi() - fSumPhi/fSumEnergy) ;
165 // energy = fSumEnergy ;
167 // else{ //calculated with respect to final
168 // dEta=(p->Eta() - fEta) ;
169 // dPhi=(p->Phi() - fPhi) ;
170 // energy = fEnergy ;
175 // return IsInCone(eta,phi) ; //pure geometrical comparison
177 // return AcceptConeDeviation(dEta,dPhi,p->Energy() );
179 // AliError(Form("Unknown mode of cone calculation %d \n",mode ));
183 //____________________________________________________________________________
184 Bool_t AliPHOSJet::AcceptConeDeviation(const TParticle * p)const
185 { //Calculate cone deviation in case of inclusion of the given
188 Double_t tmpEnergy = fSumEnergy + p->Energy() ;
189 Double_t tmpEta = fSumEta ;
190 if(p->Pt()/p->Energy() >0.001)
191 tmpEta+= p->Eta()*p->Energy() ;
193 tmpEta+= 100.*p->Pz() ;
194 tmpEta = tmpEta/tmpEnergy / (fSumEta/fSumEnergy) - 1 ;
195 Double_t tmpPhi = fSumPhi + p->Phi()*p->Energy() ;
196 tmpPhi = tmpPhi/tmpEnergy /(fSumPhi/fSumEnergy) - 1 ;
197 Double_t dev = TMath::Sqrt(tmpEta*tmpEta + tmpPhi*tmpPhi) ;
198 if(dev < fMaxConeMove)
203 //____________________________________________________________________________
204 Bool_t AliPHOSJet::AcceptConeDeviation(Double_t e, Double_t eta, Double_t phi)const
205 { //Calculate cone deviation in case of inclusion of the given
208 Double_t tmpEnergy = fSumEnergy + e ;
209 Double_t tmpEta = fSumEta + eta*e ;
210 tmpEta = tmpEta/tmpEnergy / (fSumEta/fSumEnergy) ;
211 Double_t tmpPhi = fSumPhi + phi*e ;
212 tmpPhi = tmpPhi/tmpEnergy /(fSumPhi/fSumEnergy) ;
213 Double_t dev = TMath::Sqrt(tmpEta*tmpEta + tmpPhi*tmpPhi) ;
214 if(dev<fMaxConeMove && dev > fMinConeMove)
219 //____________________________________________________________________________
220 Bool_t AliPHOSJet::IsInCone(const TParticle * p)const
222 //Say if particle is inside the defined cone
225 if(!fEnergy){ //Final values not calculated yet, use intermediate
227 return kTRUE ; //First particle
228 if(p->Pt()/p->Energy() > 0.001)
229 dEta=(p->Eta() - fSumEta/fSumEnergy) ;
231 dEta=(100.*p->Pz()/p->Energy() - fSumEta/fSumEnergy) ;
232 dPhi=(p->Phi() - fSumPhi/fSumEnergy) ;
234 else{ //calculated with respect to final
235 if(p->Pt()/p->Energy() > 0.001)
236 dEta=(p->Eta() - fEta) ;
238 dEta=(100.*p->Pz()/p->Energy() - fEta) ;
239 dPhi=(p->Phi() - fPhi) ;
241 if(TMath::Sqrt(dEta*dEta + dPhi*dPhi) < fConeRad)
246 //____________________________________________________________________________
247 Bool_t AliPHOSJet::IsInCone(Double_t eta, Double_t phi)const
249 //Says if particle is inside the defined cone
252 if(!fEnergy){ //Final values not calculated yet, use intermediate
254 return kTRUE ; //First particle
255 dEta=(eta - fSumEta/fSumEnergy) ;
256 dPhi=(phi - fSumPhi/fSumEnergy) ;
258 else{ //calculated with respect to final
262 if(TMath::Sqrt(dEta*dEta + dPhi*dPhi) < fConeRad)
267 //____________________________________________________________________________
268 Double_t AliPHOSJet::DistanceToJet(const TParticle *p)const{
272 if(!fEnergy){ //Final values not calculated yet, use intermediate
274 return kTRUE ; //First particle
275 if(p->Pt()/p->Energy() > 0.001)
276 dEta=(p->Eta() - fSumEta/fSumEnergy) ;
278 dEta=(100.*p->Pz()/p->Energy() - fSumEta/fSumEnergy) ;
279 dPhi=(p->Phi() - fSumPhi/fSumEnergy) ;
281 else{ //calculated with respect to final
282 if(p->Pt()/p->Energy() > 0.001)
283 dEta=(p->Eta() - fEta) ;
285 dEta=(100*p->Pz()/p->Energy() - fEta) ;
286 dPhi=(p->Phi() - fPhi) ;
288 return TMath::Sqrt(dEta*dEta + dPhi*dPhi) ;
291 //____________________________________________________________________________
292 void AliPHOSJet::CalculateAll(void){
293 //Calculate all jet parameters
295 return ; //Nothing to calculate
297 fEta = fSumEta/fSumEnergy ;
298 fPhi = fSumPhi/fSumEnergy ;
299 fEnergy = fSumEnergy ;
305 //____________________________________________________________________________
306 void AliPHOSJet::Print(const Option_t *) const {
307 //Print jet parameters
308 printf("-------------- AliPHOSJet ------------\n") ;
309 printf(" Energy............. %f \n",fEnergy) ;
310 printf(" Eta................ %f \n",fEta ) ;
311 printf(" Phi................ %f \n",fPhi ) ;
312 printf(" Leading Energy..... %f \n",fLEnergy) ;
313 printf(" Leading Eta........ %f \n",fLEta) ;
314 printf(" Leading Phi........ %f \n",fLPhi) ;
315 printf(" N particles in jet %d \n",fNpart) ;
316 printf("----------------------------------\n") ;