1 /**************************************************************************
2 * Copyright(c) 1998-2007, 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 //-------------------------------------------------------------------------
20 // Author: Andreas Morsch, CERN
21 //-------------------------------------------------------------------------
23 #include <TLorentzVector.h>
24 #include "AliAODJet.h"
29 //______________________________________________________________________________
30 AliAODJet::AliAODJet() :
35 fRefTracks(new TRefArray())
40 fEffectiveArea[0] = 0.;
41 fEffectiveArea[1] = 0.;
42 fEffectiveAreaError[0] = fEffectiveAreaError[1] = 0;
45 AliAODJet::AliAODJet(Double_t px, Double_t py, Double_t pz, Double_t e):
50 fRefTracks(new TRefArray())
55 fEffectiveArea[0] = 0.;
56 fEffectiveArea[1] = 0.;
57 fEffectiveAreaError[0] = fEffectiveAreaError[1] = 0;
58 fMomentum = new TLorentzVector(px, py, pz, e);
61 AliAODJet::AliAODJet(TLorentzVector & p):
66 fRefTracks(new TRefArray())
71 fEffectiveArea[0] = 0.;
72 fEffectiveArea[1] = 0.;
73 fEffectiveAreaError[0] = fEffectiveAreaError[1] = 0;
74 fMomentum = new TLorentzVector(p);
78 //______________________________________________________________________________
79 AliAODJet::~AliAODJet()
86 //______________________________________________________________________________
87 AliAODJet::AliAODJet(const AliAODJet& jet) :
89 fNeutralFraction(jet.fNeutralFraction),
90 fTrigger(jet.fTrigger),
95 fBackgEnergy[0] = jet.fBackgEnergy[0];
96 fBackgEnergy[1] = jet.fBackgEnergy[1];
97 fEffectiveArea[0] = jet.fEffectiveArea[0];
98 fEffectiveArea[1] = jet.fEffectiveArea[1];
99 fEffectiveAreaError[0] = jet.fEffectiveAreaError[0];
100 fEffectiveAreaError[1] = jet.fEffectiveAreaError[1];
101 fMomentum = new TLorentzVector(*jet.fMomentum);
102 fRefTracks = new TRefArray(*jet.fRefTracks);
105 //______________________________________________________________________________
106 AliAODJet& AliAODJet::operator=(const AliAODJet& jet)
108 // Assignment operator
111 fBackgEnergy[0] = jet.fBackgEnergy[0];
112 fBackgEnergy[1] = jet.fBackgEnergy[1];
113 fEffectiveArea[0] = jet.fEffectiveArea[0];
114 fEffectiveArea[1] = jet.fEffectiveArea[1];
115 fEffectiveAreaError[0] = jet.fEffectiveAreaError[0];
116 fEffectiveAreaError[1] = jet.fEffectiveAreaError[1];
117 fNeutralFraction = jet.fNeutralFraction;
118 fTrigger = jet.fTrigger;
120 fMomentum = new TLorentzVector(*jet.fMomentum);
122 fRefTracks = new TRefArray(*jet.fRefTracks);
128 void AliAODJet::Print(Option_t* /*option*/) const
130 // Print information of all data members
131 printf("Jet 4-vector:\n");
132 printf(" E = %13.3f\n", E() );
133 printf(" Px = %13.3f\n", Px());
134 printf(" Py = %13.3f\n", Py());
135 printf(" Pz = %13.3f\n", Pz());
136 printf("Background Energy:\n");
137 printf("Charged: %13.3f\n", ChargedBgEnergy());
138 printf("Neutral: %13.3f\n", NeutralBgEnergy());
139 printf("Total: %13.3f\n", TotalBgEnergy());
140 printf("Effective Area: \n");
141 printf("Charged: %13.3f\n", EffectiveAreaCharged());
142 printf("Neutral: %13.3f\n", EffectiveAreaNeutral());
145 void AliAODJet::SetPxPyPzE(Double_t px, Double_t py, Double_t pz, Double_t e){
147 // Set the four Momentum from outside
148 // MomentumVector()->SetPxPyPzE() cannot be used since pointer can be 0x0
152 fMomentum = new TLorentzVector(px,py,pz,e);
155 fMomentum->SetPxPyPzE(px,py,pz,e);
159 Double_t AliAODJet::DeltaR(const AliVParticle* part){
161 // Helper function to calculate the distance between two jets
162 // or a jet and particle
164 Double_t dPhi = Phi() - part->Phi();
165 if(dPhi>TMath::Pi())dPhi = dPhi - 2.*TMath::Pi();
166 if(dPhi<(-1.*TMath::Pi()))dPhi = dPhi + 2.*TMath::Pi();
167 Double_t dEta = Eta() - part->Eta();
168 Double_t dR = TMath::Sqrt(dPhi*dPhi+dEta*dEta);
173 void AliAODJet::AddTrack(TObject *tr) {
174 // Add a track to the list of referenced tracks
175 if (fRefTracks->GetEntries() == 0) {
176 new(fRefTracks) TRefArray(TProcessID::GetProcessWithUID(tr));
182 Int_t AliAODJet::Compare( const TObject* obj) const {
185 // see header file for class documentation
191 if ( Pt() < ((AliAODJet*)(obj))->Pt())