]>
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), |
17fdf3ee | 33 | fPtLeadingConstituent(-1.), |
a5817b6b | 34 | fTrigger(0), |
2e7293a2 | 35 | fMomentum(0), |
3e03e74b | 36 | fVectorAreaCharged(0), |
2e7293a2 | 37 | fRefTracks(new TRefArray()) |
df9db588 | 38 | { |
39 | // constructor | |
a1708071 | 40 | fBackgEnergy[0] = 0.; |
41 | fBackgEnergy[1] = 0.; | |
42 | fEffectiveArea[0] = 0.; | |
43 | fEffectiveArea[1] = 0.; | |
a5817b6b | 44 | fEffectiveAreaError[0] = fEffectiveAreaError[1] = 0; |
6938de9c | 45 | fPtSubtracted[0] = fPtSubtracted[1] = 0; |
df9db588 | 46 | } |
47 | ||
87102d3c | 48 | AliAODJet::AliAODJet(Double_t px, Double_t py, Double_t pz, Double_t e): |
ff7c57dd | 49 | AliVParticle(), |
a5817b6b | 50 | fNeutralFraction(0), |
17fdf3ee | 51 | fPtLeadingConstituent(-1.), |
a5817b6b | 52 | fTrigger(0), |
2e7293a2 | 53 | fMomentum(0), |
3e03e74b | 54 | fVectorAreaCharged(0), |
2e7293a2 | 55 | fRefTracks(new TRefArray()) |
17fdf3ee | 56 | |
57 | ||
87102d3c | 58 | { |
59 | // constructor | |
87102d3c | 60 | fBackgEnergy[0] = 0.; |
61 | fBackgEnergy[1] = 0.; | |
62 | fEffectiveArea[0] = 0.; | |
a5817b6b | 63 | fEffectiveArea[1] = 0.; |
64 | fEffectiveAreaError[0] = fEffectiveAreaError[1] = 0; | |
6938de9c | 65 | fPtSubtracted[0] = fPtSubtracted[1] = 0; |
9333290e | 66 | fMomentum = new TLorentzVector(px, py, pz, e); |
87102d3c | 67 | } |
68 | ||
a1708071 | 69 | AliAODJet::AliAODJet(TLorentzVector & p): |
ff7c57dd | 70 | AliVParticle(), |
a5817b6b | 71 | fNeutralFraction(0), |
17fdf3ee | 72 | fPtLeadingConstituent(-1.), |
a5817b6b | 73 | fTrigger(0), |
2e7293a2 | 74 | fMomentum(0), |
3e03e74b | 75 | fVectorAreaCharged(0), |
2e7293a2 | 76 | fRefTracks(new TRefArray()) |
17fdf3ee | 77 | |
87102d3c | 78 | { |
79 | // constructor | |
87102d3c | 80 | fBackgEnergy[0] = 0.; |
81 | fBackgEnergy[1] = 0.; | |
82 | fEffectiveArea[0] = 0.; | |
a5817b6b | 83 | fEffectiveArea[1] = 0.; |
84 | fEffectiveAreaError[0] = fEffectiveAreaError[1] = 0; | |
6938de9c | 85 | fPtSubtracted[0] = fPtSubtracted[1] = 0; |
9333290e | 86 | fMomentum = new TLorentzVector(p); |
87102d3c | 87 | } |
88 | ||
89 | ||
df9db588 | 90 | //______________________________________________________________________________ |
91 | AliAODJet::~AliAODJet() | |
92 | { | |
93 | // destructor | |
87102d3c | 94 | delete fMomentum; |
3e03e74b | 95 | delete fVectorAreaCharged; |
2e7293a2 | 96 | delete fRefTracks; |
df9db588 | 97 | } |
98 | ||
99 | //______________________________________________________________________________ | |
100 | AliAODJet::AliAODJet(const AliAODJet& jet) : | |
ff7c57dd | 101 | AliVParticle(jet), |
a5817b6b | 102 | fNeutralFraction(jet.fNeutralFraction), |
17fdf3ee | 103 | fPtLeadingConstituent(jet.fPtLeadingConstituent), |
a5817b6b | 104 | fTrigger(jet.fTrigger), |
0cd61c1d | 105 | fMomentum(0), |
3e03e74b | 106 | fVectorAreaCharged(0), |
0cd61c1d | 107 | fRefTracks(0) |
17fdf3ee | 108 | |
df9db588 | 109 | { |
110 | // Copy constructor | |
2e7293a2 | 111 | fBackgEnergy[0] = jet.fBackgEnergy[0]; |
d3ad3ee1 | 112 | fBackgEnergy[1] = jet.fBackgEnergy[1]; |
2e7293a2 | 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]; | |
6938de9c | 117 | fPtSubtracted[0] = jet.fPtSubtracted[0]; |
118 | fPtSubtracted[1] = jet.fPtSubtracted[1]; | |
d5f746db | 119 | if(jet.fMomentum)fMomentum = new TLorentzVector(*jet.fMomentum); |
120 | if(jet.fVectorAreaCharged)fVectorAreaCharged = new TLorentzVector(*jet.fVectorAreaCharged); | |
9333290e | 121 | fRefTracks = new TRefArray(*jet.fRefTracks); |
df9db588 | 122 | } |
123 | ||
124 | //______________________________________________________________________________ | |
125 | AliAODJet& AliAODJet::operator=(const AliAODJet& jet) | |
126 | { | |
127 | // Assignment operator | |
128 | if(this!=&jet) { | |
9333290e | 129 | |
130 | fBackgEnergy[0] = jet.fBackgEnergy[0]; | |
131 | fBackgEnergy[1] = jet.fBackgEnergy[1]; | |
132 | fEffectiveArea[0] = jet.fEffectiveArea[0]; | |
133 | fEffectiveArea[1] = jet.fEffectiveArea[1]; | |
a5817b6b | 134 | fEffectiveAreaError[0] = jet.fEffectiveAreaError[0]; |
135 | fEffectiveAreaError[1] = jet.fEffectiveAreaError[1]; | |
6938de9c | 136 | fPtSubtracted[0] = jet.fPtSubtracted[0]; |
137 | fPtSubtracted[1] = jet.fPtSubtracted[1]; | |
a5817b6b | 138 | fNeutralFraction = jet.fNeutralFraction; |
17fdf3ee | 139 | fPtLeadingConstituent = jet.fPtLeadingConstituent; |
a5817b6b | 140 | fTrigger = jet.fTrigger; |
d5f746db | 141 | |
142 | ||
143 | if(jet.fMomentum){ | |
144 | if(fMomentum)*fMomentum = *jet.fMomentum; | |
145 | else fMomentum = new TLorentzVector(*jet.fMomentum); | |
146 | } | |
147 | ||
148 | if(jet.fVectorAreaCharged){ | |
149 | if(fVectorAreaCharged)*fVectorAreaCharged = *jet.fVectorAreaCharged; | |
150 | else fVectorAreaCharged = new TLorentzVector(*jet.fVectorAreaCharged); | |
151 | } | |
9333290e | 152 | delete fRefTracks; |
153 | fRefTracks = new TRefArray(*jet.fRefTracks); | |
17fdf3ee | 154 | |
155 | ||
df9db588 | 156 | } |
157 | ||
158 | return *this; | |
159 | } | |
160 | ||
6c64f93e | 161 | void AliAODJet::Print(Option_t* option) const |
87102d3c | 162 | { |
6c64f93e | 163 | |
164 | if (!option) { | |
87102d3c | 165 | // Print information of all data members |
166 | printf("Jet 4-vector:\n"); | |
167 | printf(" E = %13.3f\n", E() ); | |
168 | printf(" Px = %13.3f\n", Px()); | |
169 | printf(" Py = %13.3f\n", Py()); | |
170 | printf(" Pz = %13.3f\n", Pz()); | |
171 | printf("Background Energy:\n"); | |
172 | printf("Charged: %13.3f\n", ChargedBgEnergy()); | |
173 | printf("Neutral: %13.3f\n", NeutralBgEnergy()); | |
174 | printf("Total: %13.3f\n", TotalBgEnergy()); | |
175 | printf("Effective Area: \n"); | |
176 | printf("Charged: %13.3f\n", EffectiveAreaCharged()); | |
177 | printf("Neutral: %13.3f\n", EffectiveAreaNeutral()); | |
17fdf3ee | 178 | printf("Leading constituent: %f\n",GetPtLeading()); |
6c64f93e | 179 | } |
180 | else { | |
181 | printf("Jet %s, Eta: %13.3f, Phi: %13.3f, Pt: %13.3f\n",option,Eta(),Phi(),Pt()); | |
182 | } | |
183 | ||
87102d3c | 184 | } |
944efc80 | 185 | |
186 | void AliAODJet::SetPxPyPzE(Double_t px, Double_t py, Double_t pz, Double_t e){ | |
187 | // | |
188 | // Set the four Momentum from outside | |
189 | // MomentumVector()->SetPxPyPzE() cannot be used since pointer can be 0x0 | |
190 | // | |
191 | ||
192 | if(!fMomentum){ | |
193 | fMomentum = new TLorentzVector(px,py,pz,e); | |
194 | } | |
195 | else{ | |
196 | fMomentum->SetPxPyPzE(px,py,pz,e); | |
197 | } | |
198 | } | |
a19f293d | 199 | |
6a845d4e | 200 | void AliAODJet::SetPtEtaPhiM(Double_t pt, Double_t eta, Double_t phi, Double_t m){ |
201 | // | |
202 | // Set the four Momentum from outside with pt eta phi and M | |
203 | // MomentumVector()->SetPtPhiEtaM() cannot be used since pointer can be 0x0 | |
204 | // | |
205 | ||
206 | if(!fMomentum){ | |
207 | fMomentum = new TLorentzVector(); | |
208 | } | |
209 | fMomentum->SetPtEtaPhiM(pt,eta,phi,m); | |
210 | } | |
211 | ||
212 | ||
213 | ||
2735c4db | 214 | Double_t AliAODJet::DeltaR(const AliVParticle* part) const { |
a19f293d | 215 | |
216 | // Helper function to calculate the distance between two jets | |
217 | // or a jet and particle | |
218 | ||
219 | Double_t dPhi = Phi() - part->Phi(); | |
220 | if(dPhi>TMath::Pi())dPhi = dPhi - 2.*TMath::Pi(); | |
221 | if(dPhi<(-1.*TMath::Pi()))dPhi = dPhi + 2.*TMath::Pi(); | |
222 | Double_t dEta = Eta() - part->Eta(); | |
223 | Double_t dR = TMath::Sqrt(dPhi*dPhi+dEta*dEta); | |
224 | return dR; | |
225 | } | |
3a4dcedf | 226 | |
227 | ||
086d6981 | 228 | void AliAODJet::AddTrack(TObject *tr) { |
229 | // Add a track to the list of referenced tracks | |
230 | if (fRefTracks->GetEntries() == 0) { | |
1e044374 | 231 | fRefTracks->Delete(); |
232 | new(fRefTracks) TRefArray(TProcessID::GetProcessWithUID(tr)); | |
086d6981 | 233 | } |
234 | ||
235 | fRefTracks->Add(tr); | |
236 | } | |
237 |