]>
Commit | Line | Data |
---|---|---|
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 | ||
26 | ClassImp(AliAODJet) | |
27 | ||
28 | ||
29 | //______________________________________________________________________________ | |
a1708071 | 30 | AliAODJet::AliAODJet() : |
ff7c57dd | 31 | AliVParticle(), |
a5817b6b | 32 | fNeutralFraction(0), |
33 | fTrigger(0), | |
2e7293a2 | 34 | fMomentum(0), |
3e03e74b | 35 | fVectorAreaCharged(0), |
2e7293a2 | 36 | fRefTracks(new TRefArray()) |
df9db588 | 37 | { |
38 | // constructor | |
a1708071 | 39 | fBackgEnergy[0] = 0.; |
40 | fBackgEnergy[1] = 0.; | |
41 | fEffectiveArea[0] = 0.; | |
42 | fEffectiveArea[1] = 0.; | |
a5817b6b | 43 | fEffectiveAreaError[0] = fEffectiveAreaError[1] = 0; |
df9db588 | 44 | } |
45 | ||
87102d3c | 46 | AliAODJet::AliAODJet(Double_t px, Double_t py, Double_t pz, Double_t e): |
ff7c57dd | 47 | AliVParticle(), |
a5817b6b | 48 | fNeutralFraction(0), |
49 | fTrigger(0), | |
2e7293a2 | 50 | fMomentum(0), |
3e03e74b | 51 | fVectorAreaCharged(0), |
2e7293a2 | 52 | fRefTracks(new TRefArray()) |
87102d3c | 53 | { |
54 | // constructor | |
87102d3c | 55 | fBackgEnergy[0] = 0.; |
56 | fBackgEnergy[1] = 0.; | |
57 | fEffectiveArea[0] = 0.; | |
a5817b6b | 58 | fEffectiveArea[1] = 0.; |
59 | fEffectiveAreaError[0] = fEffectiveAreaError[1] = 0; | |
9333290e | 60 | fMomentum = new TLorentzVector(px, py, pz, e); |
87102d3c | 61 | } |
62 | ||
a1708071 | 63 | AliAODJet::AliAODJet(TLorentzVector & p): |
ff7c57dd | 64 | AliVParticle(), |
a5817b6b | 65 | fNeutralFraction(0), |
66 | fTrigger(0), | |
2e7293a2 | 67 | fMomentum(0), |
3e03e74b | 68 | fVectorAreaCharged(0), |
2e7293a2 | 69 | fRefTracks(new TRefArray()) |
87102d3c | 70 | { |
71 | // constructor | |
87102d3c | 72 | fBackgEnergy[0] = 0.; |
73 | fBackgEnergy[1] = 0.; | |
74 | fEffectiveArea[0] = 0.; | |
a5817b6b | 75 | fEffectiveArea[1] = 0.; |
76 | fEffectiveAreaError[0] = fEffectiveAreaError[1] = 0; | |
9333290e | 77 | fMomentum = new TLorentzVector(p); |
87102d3c | 78 | } |
79 | ||
80 | ||
df9db588 | 81 | //______________________________________________________________________________ |
82 | AliAODJet::~AliAODJet() | |
83 | { | |
84 | // destructor | |
87102d3c | 85 | delete fMomentum; |
3e03e74b | 86 | delete fVectorAreaCharged; |
2e7293a2 | 87 | delete fRefTracks; |
df9db588 | 88 | } |
89 | ||
90 | //______________________________________________________________________________ | |
91 | AliAODJet::AliAODJet(const AliAODJet& jet) : | |
ff7c57dd | 92 | AliVParticle(jet), |
a5817b6b | 93 | fNeutralFraction(jet.fNeutralFraction), |
94 | fTrigger(jet.fTrigger), | |
0cd61c1d | 95 | fMomentum(0), |
3e03e74b | 96 | fVectorAreaCharged(0), |
0cd61c1d | 97 | fRefTracks(0) |
df9db588 | 98 | { |
99 | // Copy constructor | |
2e7293a2 | 100 | fBackgEnergy[0] = jet.fBackgEnergy[0]; |
d3ad3ee1 | 101 | fBackgEnergy[1] = jet.fBackgEnergy[1]; |
2e7293a2 | 102 | fEffectiveArea[0] = jet.fEffectiveArea[0]; |
103 | fEffectiveArea[1] = jet.fEffectiveArea[1]; | |
a5817b6b | 104 | fEffectiveAreaError[0] = jet.fEffectiveAreaError[0]; |
105 | fEffectiveAreaError[1] = jet.fEffectiveAreaError[1]; | |
d5f746db | 106 | if(jet.fMomentum)fMomentum = new TLorentzVector(*jet.fMomentum); |
107 | if(jet.fVectorAreaCharged)fVectorAreaCharged = new TLorentzVector(*jet.fVectorAreaCharged); | |
9333290e | 108 | fRefTracks = new TRefArray(*jet.fRefTracks); |
df9db588 | 109 | } |
110 | ||
111 | //______________________________________________________________________________ | |
112 | AliAODJet& AliAODJet::operator=(const AliAODJet& jet) | |
113 | { | |
114 | // Assignment operator | |
115 | if(this!=&jet) { | |
9333290e | 116 | |
117 | fBackgEnergy[0] = jet.fBackgEnergy[0]; | |
118 | fBackgEnergy[1] = jet.fBackgEnergy[1]; | |
119 | fEffectiveArea[0] = jet.fEffectiveArea[0]; | |
120 | fEffectiveArea[1] = jet.fEffectiveArea[1]; | |
a5817b6b | 121 | fEffectiveAreaError[0] = jet.fEffectiveAreaError[0]; |
122 | fEffectiveAreaError[1] = jet.fEffectiveAreaError[1]; | |
123 | fNeutralFraction = jet.fNeutralFraction; | |
124 | fTrigger = jet.fTrigger; | |
d5f746db | 125 | |
126 | ||
127 | if(jet.fMomentum){ | |
128 | if(fMomentum)*fMomentum = *jet.fMomentum; | |
129 | else fMomentum = new TLorentzVector(*jet.fMomentum); | |
130 | } | |
131 | ||
132 | if(jet.fVectorAreaCharged){ | |
133 | if(fVectorAreaCharged)*fVectorAreaCharged = *jet.fVectorAreaCharged; | |
134 | else fVectorAreaCharged = new TLorentzVector(*jet.fVectorAreaCharged); | |
135 | } | |
9333290e | 136 | delete fRefTracks; |
137 | fRefTracks = new TRefArray(*jet.fRefTracks); | |
df9db588 | 138 | } |
139 | ||
140 | return *this; | |
141 | } | |
142 | ||
87102d3c | 143 | void AliAODJet::Print(Option_t* /*option*/) const |
144 | { | |
145 | // Print information of all data members | |
146 | printf("Jet 4-vector:\n"); | |
147 | printf(" E = %13.3f\n", E() ); | |
148 | printf(" Px = %13.3f\n", Px()); | |
149 | printf(" Py = %13.3f\n", Py()); | |
150 | printf(" Pz = %13.3f\n", Pz()); | |
151 | printf("Background Energy:\n"); | |
152 | printf("Charged: %13.3f\n", ChargedBgEnergy()); | |
153 | printf("Neutral: %13.3f\n", NeutralBgEnergy()); | |
154 | printf("Total: %13.3f\n", TotalBgEnergy()); | |
155 | printf("Effective Area: \n"); | |
156 | printf("Charged: %13.3f\n", EffectiveAreaCharged()); | |
157 | printf("Neutral: %13.3f\n", EffectiveAreaNeutral()); | |
158 | } | |
944efc80 | 159 | |
160 | void AliAODJet::SetPxPyPzE(Double_t px, Double_t py, Double_t pz, Double_t e){ | |
161 | // | |
162 | // Set the four Momentum from outside | |
163 | // MomentumVector()->SetPxPyPzE() cannot be used since pointer can be 0x0 | |
164 | // | |
165 | ||
166 | if(!fMomentum){ | |
167 | fMomentum = new TLorentzVector(px,py,pz,e); | |
168 | } | |
169 | else{ | |
170 | fMomentum->SetPxPyPzE(px,py,pz,e); | |
171 | } | |
172 | } | |
a19f293d | 173 | |
174 | Double_t AliAODJet::DeltaR(const AliVParticle* part){ | |
175 | ||
176 | // Helper function to calculate the distance between two jets | |
177 | // or a jet and particle | |
178 | ||
179 | Double_t dPhi = Phi() - part->Phi(); | |
180 | if(dPhi>TMath::Pi())dPhi = dPhi - 2.*TMath::Pi(); | |
181 | if(dPhi<(-1.*TMath::Pi()))dPhi = dPhi + 2.*TMath::Pi(); | |
182 | Double_t dEta = Eta() - part->Eta(); | |
183 | Double_t dR = TMath::Sqrt(dPhi*dPhi+dEta*dEta); | |
184 | return dR; | |
185 | } | |
3a4dcedf | 186 | |
187 | ||
086d6981 | 188 | void AliAODJet::AddTrack(TObject *tr) { |
189 | // Add a track to the list of referenced tracks | |
190 | if (fRefTracks->GetEntries() == 0) { | |
191 | new(fRefTracks) TRefArray(TProcessID::GetProcessWithUID(tr)); | |
192 | } | |
193 | ||
194 | fRefTracks->Add(tr); | |
195 | } | |
196 |