]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliAODJet.cxx
preparation for recalculation of rho
[u/mrichter/AliRoot.git] / STEER / AliAODJet.cxx
CommitLineData
df9db588 1/**************************************************************************
2 * Copyright(c) 1998-2007, 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
16/* $Id$ */
17
18//-------------------------------------------------------------------------
87102d3c 19// AOD class for jets
20// Author: Andreas Morsch, CERN
df9db588 21//-------------------------------------------------------------------------
22
87102d3c 23#include <TLorentzVector.h>
df9db588 24#include "AliAODJet.h"
25
26ClassImp(AliAODJet)
27
28
29//______________________________________________________________________________
a1708071 30AliAODJet::AliAODJet() :
ff7c57dd 31 AliVParticle(),
a5817b6b 32 fNeutralFraction(0),
33 fTrigger(0),
2e7293a2 34 fMomentum(0),
35 fRefTracks(new TRefArray())
df9db588 36{
37 // constructor
a1708071 38 fBackgEnergy[0] = 0.;
39 fBackgEnergy[1] = 0.;
40 fEffectiveArea[0] = 0.;
41 fEffectiveArea[1] = 0.;
a5817b6b 42 fEffectiveAreaError[0] = fEffectiveAreaError[1] = 0;
df9db588 43}
44
87102d3c 45AliAODJet::AliAODJet(Double_t px, Double_t py, Double_t pz, Double_t e):
ff7c57dd 46 AliVParticle(),
a5817b6b 47 fNeutralFraction(0),
48 fTrigger(0),
2e7293a2 49 fMomentum(0),
50 fRefTracks(new TRefArray())
87102d3c 51{
52 // constructor
87102d3c 53 fBackgEnergy[0] = 0.;
54 fBackgEnergy[1] = 0.;
55 fEffectiveArea[0] = 0.;
a5817b6b 56 fEffectiveArea[1] = 0.;
57 fEffectiveAreaError[0] = fEffectiveAreaError[1] = 0;
9333290e 58 fMomentum = new TLorentzVector(px, py, pz, e);
87102d3c 59}
60
a1708071 61AliAODJet::AliAODJet(TLorentzVector & p):
ff7c57dd 62 AliVParticle(),
a5817b6b 63 fNeutralFraction(0),
64 fTrigger(0),
2e7293a2 65 fMomentum(0),
66 fRefTracks(new TRefArray())
87102d3c 67{
68 // constructor
87102d3c 69 fBackgEnergy[0] = 0.;
70 fBackgEnergy[1] = 0.;
71 fEffectiveArea[0] = 0.;
a5817b6b 72 fEffectiveArea[1] = 0.;
73 fEffectiveAreaError[0] = fEffectiveAreaError[1] = 0;
9333290e 74 fMomentum = new TLorentzVector(p);
87102d3c 75}
76
77
df9db588 78//______________________________________________________________________________
79AliAODJet::~AliAODJet()
80{
81 // destructor
87102d3c 82 delete fMomentum;
2e7293a2 83 delete fRefTracks;
df9db588 84}
85
86//______________________________________________________________________________
87AliAODJet::AliAODJet(const AliAODJet& jet) :
ff7c57dd 88 AliVParticle(jet),
a5817b6b 89 fNeutralFraction(jet.fNeutralFraction),
90 fTrigger(jet.fTrigger),
0cd61c1d 91 fMomentum(0),
92 fRefTracks(0)
df9db588 93{
94 // Copy constructor
2e7293a2 95 fBackgEnergy[0] = jet.fBackgEnergy[0];
d3ad3ee1 96 fBackgEnergy[1] = jet.fBackgEnergy[1];
2e7293a2 97 fEffectiveArea[0] = jet.fEffectiveArea[0];
98 fEffectiveArea[1] = jet.fEffectiveArea[1];
a5817b6b 99 fEffectiveAreaError[0] = jet.fEffectiveAreaError[0];
100 fEffectiveAreaError[1] = jet.fEffectiveAreaError[1];
9333290e 101 fMomentum = new TLorentzVector(*jet.fMomentum);
102 fRefTracks = new TRefArray(*jet.fRefTracks);
df9db588 103}
104
105//______________________________________________________________________________
106AliAODJet& AliAODJet::operator=(const AliAODJet& jet)
107{
108 // Assignment operator
109 if(this!=&jet) {
9333290e 110
111 fBackgEnergy[0] = jet.fBackgEnergy[0];
112 fBackgEnergy[1] = jet.fBackgEnergy[1];
113 fEffectiveArea[0] = jet.fEffectiveArea[0];
114 fEffectiveArea[1] = jet.fEffectiveArea[1];
a5817b6b 115 fEffectiveAreaError[0] = jet.fEffectiveAreaError[0];
116 fEffectiveAreaError[1] = jet.fEffectiveAreaError[1];
117 fNeutralFraction = jet.fNeutralFraction;
118 fTrigger = jet.fTrigger;
9333290e 119 delete fMomentum;
120 fMomentum = new TLorentzVector(*jet.fMomentum);
121 delete fRefTracks;
122 fRefTracks = new TRefArray(*jet.fRefTracks);
df9db588 123 }
124
125 return *this;
126}
127
87102d3c 128void AliAODJet::Print(Option_t* /*option*/) const
129{
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());
143}
944efc80 144
145void AliAODJet::SetPxPyPzE(Double_t px, Double_t py, Double_t pz, Double_t e){
146 //
147 // Set the four Momentum from outside
148 // MomentumVector()->SetPxPyPzE() cannot be used since pointer can be 0x0
149 //
150
151 if(!fMomentum){
152 fMomentum = new TLorentzVector(px,py,pz,e);
153 }
154 else{
155 fMomentum->SetPxPyPzE(px,py,pz,e);
156 }
157}
a19f293d 158
159Double_t AliAODJet::DeltaR(const AliVParticle* part){
160
161 // Helper function to calculate the distance between two jets
162 // or a jet and particle
163
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);
169 return dR;
170}
3a4dcedf 171
172
086d6981 173void 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));
177 }
178
179 fRefTracks->Add(tr);
180}
181