]>
Commit | Line | Data |
---|---|---|
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 | //------------------------------------------------------------------------- | |
19 | // AOD class for jets | |
20 | // Author: Andreas Morsch, CERN | |
21 | //------------------------------------------------------------------------- | |
22 | ||
23 | #include <TLorentzVector.h> | |
24 | #include "AliAODJet.h" | |
25 | ||
26 | ClassImp(AliAODJet) | |
27 | ||
28 | ||
29 | //______________________________________________________________________________ | |
30 | AliAODJet::AliAODJet() : | |
31 | AliVParticle(), | |
32 | fMomentum(0), | |
33 | fRefTracks(new TRefArray()) | |
34 | { | |
35 | // constructor | |
36 | fBackgEnergy[0] = 0.; | |
37 | fBackgEnergy[1] = 0.; | |
38 | fEffectiveArea[0] = 0.; | |
39 | fEffectiveArea[1] = 0.; | |
40 | } | |
41 | ||
42 | AliAODJet::AliAODJet(Double_t px, Double_t py, Double_t pz, Double_t e): | |
43 | AliVParticle(), | |
44 | fMomentum(0), | |
45 | fRefTracks(new TRefArray()) | |
46 | { | |
47 | // constructor | |
48 | fBackgEnergy[0] = 0.; | |
49 | fBackgEnergy[1] = 0.; | |
50 | fEffectiveArea[0] = 0.; | |
51 | fEffectiveArea[1] = 0.; | |
52 | fMomentum = new TLorentzVector(px, py, pz, e); | |
53 | } | |
54 | ||
55 | AliAODJet::AliAODJet(TLorentzVector & p): | |
56 | AliVParticle(), | |
57 | fMomentum(0), | |
58 | fRefTracks(new TRefArray()) | |
59 | { | |
60 | // constructor | |
61 | fBackgEnergy[0] = 0.; | |
62 | fBackgEnergy[1] = 0.; | |
63 | fEffectiveArea[0] = 0.; | |
64 | fEffectiveArea[1] = 0.; | |
65 | fMomentum = new TLorentzVector(p); | |
66 | } | |
67 | ||
68 | ||
69 | //______________________________________________________________________________ | |
70 | AliAODJet::~AliAODJet() | |
71 | { | |
72 | // destructor | |
73 | delete fMomentum; | |
74 | delete fRefTracks; | |
75 | } | |
76 | ||
77 | //______________________________________________________________________________ | |
78 | AliAODJet::AliAODJet(const AliAODJet& jet) : | |
79 | AliVParticle(jet), | |
80 | fMomentum(0), | |
81 | fRefTracks(0) | |
82 | { | |
83 | // Copy constructor | |
84 | fBackgEnergy[0] = jet.fBackgEnergy[0]; | |
85 | fBackgEnergy[1] = jet.fBackgEnergy[1]; | |
86 | fEffectiveArea[0] = jet.fEffectiveArea[0]; | |
87 | fEffectiveArea[1] = jet.fEffectiveArea[1]; | |
88 | ||
89 | fMomentum = new TLorentzVector(*jet.fMomentum); | |
90 | fRefTracks = new TRefArray(*jet.fRefTracks); | |
91 | } | |
92 | ||
93 | //______________________________________________________________________________ | |
94 | AliAODJet& AliAODJet::operator=(const AliAODJet& jet) | |
95 | { | |
96 | // Assignment operator | |
97 | if(this!=&jet) { | |
98 | ||
99 | fBackgEnergy[0] = jet.fBackgEnergy[0]; | |
100 | fBackgEnergy[1] = jet.fBackgEnergy[1]; | |
101 | fEffectiveArea[0] = jet.fEffectiveArea[0]; | |
102 | fEffectiveArea[1] = jet.fEffectiveArea[1]; | |
103 | ||
104 | delete fMomentum; | |
105 | fMomentum = new TLorentzVector(*jet.fMomentum); | |
106 | delete fRefTracks; | |
107 | fRefTracks = new TRefArray(*jet.fRefTracks); | |
108 | } | |
109 | ||
110 | return *this; | |
111 | } | |
112 | ||
113 | void AliAODJet::Print(Option_t* /*option*/) const | |
114 | { | |
115 | // Print information of all data members | |
116 | printf("Jet 4-vector:\n"); | |
117 | printf(" E = %13.3f\n", E() ); | |
118 | printf(" Px = %13.3f\n", Px()); | |
119 | printf(" Py = %13.3f\n", Py()); | |
120 | printf(" Pz = %13.3f\n", Pz()); | |
121 | printf("Background Energy:\n"); | |
122 | printf("Charged: %13.3f\n", ChargedBgEnergy()); | |
123 | printf("Neutral: %13.3f\n", NeutralBgEnergy()); | |
124 | printf("Total: %13.3f\n", TotalBgEnergy()); | |
125 | printf("Effective Area: \n"); | |
126 | printf("Charged: %13.3f\n", EffectiveAreaCharged()); | |
127 | printf("Neutral: %13.3f\n", EffectiveAreaNeutral()); | |
128 | } | |
129 | ||
130 | void AliAODJet::SetPxPyPzE(Double_t px, Double_t py, Double_t pz, Double_t e){ | |
131 | // | |
132 | // Set the four Momentum from outside | |
133 | // MomentumVector()->SetPxPyPzE() cannot be used since pointer can be 0x0 | |
134 | // | |
135 | ||
136 | if(!fMomentum){ | |
137 | fMomentum = new TLorentzVector(px,py,pz,e); | |
138 | } | |
139 | else{ | |
140 | fMomentum->SetPxPyPzE(px,py,pz,e); | |
141 | } | |
142 | } | |
143 | ||
144 | Double_t AliAODJet::DeltaR(const AliVParticle* part){ | |
145 | ||
146 | // Helper function to calculate the distance between two jets | |
147 | // or a jet and particle | |
148 | ||
149 | Double_t dPhi = Phi() - part->Phi(); | |
150 | if(dPhi>TMath::Pi())dPhi = dPhi - 2.*TMath::Pi(); | |
151 | if(dPhi<(-1.*TMath::Pi()))dPhi = dPhi + 2.*TMath::Pi(); | |
152 | Double_t dEta = Eta() - part->Eta(); | |
153 | Double_t dR = TMath::Sqrt(dPhi*dPhi+dEta*dEta); | |
154 | return dR; | |
155 | } |