adding information on z-vertex for different trigger classes and control in Spectrum2...
[u/mrichter/AliRoot.git] / STEER / AliESDZDC.cxx
CommitLineData
d5ebf00e 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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
17//-------------------------------------------------------------------------
18// Implementation of Class AliESDZDC
19// This is a class that summarizes the ZDC data
20// for the ESD
21// Origin: Christian Klein-Boesing, CERN, Christian.Klein-Boesing@cern.ch
22//-------------------------------------------------------------------------
23
cb6a0388 24#include <TMath.h>
d5ebf00e 25
26#include "AliESDZDC.h"
27
28ClassImp(AliESDZDC)
29
30//______________________________________________________________________________
31AliESDZDC::AliESDZDC() :
32 TObject(),
33 fZDCN1Energy(0),
34 fZDCP1Energy(0),
35 fZDCN2Energy(0),
36 fZDCP2Energy(0),
f6536de8 37 fZDCEMEnergy(0),
38 fZDCEMEnergy1(0),
2b6cdc43 39 fZDCParticipants(0),
5f0ec064 40 fZDCPartSideA(0),
41 fZDCPartSideC(0),
42 fImpactParameter(0),
43 fImpactParamSideA(0),
44 fImpactParamSideC(0),
45 fESDQuality(0)
d5ebf00e 46{
89291556 47 for(Int_t i=0; i<5; i++){
a85132e7 48 fZN1TowerEnergy[i] = fZN2TowerEnergy[i] = 0.;
49 fZP1TowerEnergy[i] = fZP2TowerEnergy[i] = 0.;
50 fZN1TowerEnergyLR[i] = fZN2TowerEnergyLR[i] = 0.;
51 fZP1TowerEnergyLR[i] = fZP2TowerEnergyLR[i] = 0.;
52 }
89291556 53 for(Int_t i=0; i<2; i++){
54 fZNACentrCoord[i] = fZNCCentrCoord[i] = 0.;
55 }
82dffa48 56 for(Int_t i=0; i<32; i++){
57 fVMEScaler[i]=0;
58 fZDCTDCData[i]=0;
59 }
d5ebf00e 60}
61
2b6cdc43 62//______________________________________________________________________________
d5ebf00e 63AliESDZDC::AliESDZDC(const AliESDZDC& zdc) :
64 TObject(zdc),
65 fZDCN1Energy(zdc.fZDCN1Energy),
66 fZDCP1Energy(zdc.fZDCP1Energy),
67 fZDCN2Energy(zdc.fZDCN2Energy),
68 fZDCP2Energy(zdc.fZDCP2Energy),
f6536de8 69 fZDCEMEnergy(zdc.fZDCEMEnergy),
70 fZDCEMEnergy1(zdc.fZDCEMEnergy1),
2b6cdc43 71 fZDCParticipants(zdc.fZDCParticipants),
5f0ec064 72 fZDCPartSideA(zdc.fZDCPartSideA),
73 fZDCPartSideC(zdc.fZDCPartSideC),
74 fImpactParameter(zdc.fImpactParameter),
8c755c03 75 fImpactParamSideA(zdc.fImpactParamSideA),
76 fImpactParamSideC(zdc.fImpactParamSideC),
5f0ec064 77 fESDQuality(zdc.fESDQuality)
d5ebf00e 78{
79 // copy constructor
89291556 80 for(Int_t i=0; i<5; i++){
a85132e7 81 fZN1TowerEnergy[i] = zdc.fZN1TowerEnergy[i];
82 fZN2TowerEnergy[i] = zdc.fZN2TowerEnergy[i];
83 fZP1TowerEnergy[i] = zdc.fZP1TowerEnergy[i];
84 fZP2TowerEnergy[i] = zdc.fZP2TowerEnergy[i];
85 fZN1TowerEnergyLR[i] = zdc.fZN1TowerEnergyLR[i];
86 fZN2TowerEnergyLR[i] = zdc.fZN2TowerEnergyLR[i];
87 fZP1TowerEnergyLR[i] = zdc.fZP1TowerEnergyLR[i];
88 fZP2TowerEnergyLR[i] = zdc.fZP2TowerEnergyLR[i];
89 }
89291556 90 for(Int_t i=0; i<2; i++){
91 fZNACentrCoord[i] = zdc.fZNACentrCoord[i];
92 fZNCCentrCoord[i] = zdc.fZNCCentrCoord[i];
93 }
82dffa48 94 for(Int_t i=0; i<32; i++){
95 fVMEScaler[i] = zdc.fVMEScaler[i];
96 fZDCTDCData[i] = zdc.fZDCTDCData[i];
97 }
d5ebf00e 98}
99
2b6cdc43 100//______________________________________________________________________________
d5ebf00e 101AliESDZDC& AliESDZDC::operator=(const AliESDZDC&zdc)
102{
103 // assigment operator
104 if(this!=&zdc) {
105 TObject::operator=(zdc);
106 fZDCN1Energy = zdc.fZDCN1Energy;
107 fZDCP1Energy = zdc.fZDCP1Energy;
108 fZDCN2Energy = zdc.fZDCN2Energy;
109 fZDCP2Energy = zdc.fZDCP2Energy;
f6536de8 110 fZDCEMEnergy = zdc.fZDCEMEnergy;
111 fZDCEMEnergy1 = zdc.fZDCEMEnergy1;
a85132e7 112 for(Int_t i=0; i<5; i++){
7b4458a2 113 fZN1TowerEnergy[i] = zdc.fZN1TowerEnergy[i];
114 fZN2TowerEnergy[i] = zdc.fZN2TowerEnergy[i];
a85132e7 115 fZP1TowerEnergy[i] = zdc.fZP1TowerEnergy[i];
116 fZP2TowerEnergy[i] = zdc.fZP2TowerEnergy[i];
117 fZN1TowerEnergyLR[i] = zdc.fZN1TowerEnergyLR[i];
118 fZN2TowerEnergyLR[i] = zdc.fZN2TowerEnergyLR[i];
119 fZP1TowerEnergyLR[i] = zdc.fZP1TowerEnergyLR[i];
120 fZP2TowerEnergyLR[i] = zdc.fZP2TowerEnergyLR[i];
7b4458a2 121 }
5f0ec064 122 //
123 fZDCParticipants = zdc.fZDCParticipants;
124 fZDCPartSideA = zdc.fZDCPartSideA;
125 fZDCPartSideC = zdc.fZDCPartSideC;
126 fImpactParameter = zdc.fImpactParameter;
127 fImpactParamSideA = zdc.fImpactParamSideA;
128 fImpactParamSideC = zdc.fImpactParamSideC;
129 //
89291556 130 for(Int_t i=0; i<2; i++){
131 fZNACentrCoord[i] = zdc.fZNACentrCoord[i];
132 fZNCCentrCoord[i] = zdc.fZNCCentrCoord[i];
133 }
5f0ec064 134 //
135 fESDQuality = zdc.fESDQuality;
82dffa48 136 for(Int_t i=0; i<32; i++){
137 fVMEScaler[i] = zdc.fVMEScaler[i];
138 fZDCTDCData[i] = zdc.fZDCTDCData[i];
139 }
d5ebf00e 140 }
141 return *this;
142}
143
2b6cdc43 144//______________________________________________________________________________
732a24fe 145void AliESDZDC::Copy(TObject &obj) const {
146
147 // this overwrites the virtual TOBject::Copy()
148 // to allow run time copying without casting
149 // in AliESDEvent
150
151 if(this==&obj)return;
152 AliESDZDC *robj = dynamic_cast<AliESDZDC*>(&obj);
153 if(!robj)return; // not an AliESDZDC
154 *robj = *this;
155
156}
157
d5ebf00e 158
159//______________________________________________________________________________
160void AliESDZDC::Reset()
161{
162 // reset all data members
163 fZDCN1Energy=0;
164 fZDCP1Energy=0;
165 fZDCN2Energy=0;
166 fZDCP2Energy=0;
f6536de8 167 fZDCEMEnergy=0;
168 fZDCEMEnergy1=0;
89291556 169 for(Int_t i=0; i<5; i++){
a85132e7 170 fZN1TowerEnergy[i] = fZN2TowerEnergy[i] = 0.;
171 fZP1TowerEnergy[i] = fZP2TowerEnergy[i] = 0.;
172 fZN1TowerEnergyLR[i] = fZN2TowerEnergyLR[i] = 0.;
173 fZP1TowerEnergyLR[i] = fZP2TowerEnergyLR[i] = 0.;
174 }
5f0ec064 175 fZDCParticipants=0;
176 fZDCPartSideA=0;
177 fZDCPartSideC=0;
178 fImpactParameter=0;
179 fImpactParamSideA=0;
180 fImpactParamSideC=0;
89291556 181 for(Int_t i=0; i<2; i++){
182 fZNACentrCoord[i] = fZNCCentrCoord[i] = 0.;
183 }
5f0ec064 184 fESDQuality=0;
82dffa48 185 for(Int_t i=0; i<32; i++){
186 fVMEScaler[i] = 0;
187 fZDCTDCData[i] = 0;
188 }
d5ebf00e 189}
190
191//______________________________________________________________________________
192void AliESDZDC::Print(const Option_t *) const
193{
a85132e7 194 // Print ESD for the ZDC
5f0ec064 195 printf("\n \t E_{ZNC} = %f TeV, E_{ZPC} = %f TeV, E_{ZNA} = %f TeV, E_{ZPA} = %f TeV,"
196 " E_{ZEM} = %f GeV, Npart = %d, b = %1.2f fm\n",
197 fZDCN1Energy/1000.,fZDCP1Energy/1000.,fZDCN2Energy/1000.,fZDCP2Energy/1000.,
198 fZDCEMEnergy+fZDCEMEnergy1, fZDCParticipants,fImpactParameter);
54c6a92c 199 //
82dffa48 200 printf(" ### VMEScaler (!=0): \n");
201 for(Int_t i=0; i<32; i++) if(fVMEScaler[i]!=0) printf("\t %d \n",fVMEScaler[i]);
202 printf("\n");
203 //
204 printf(" ### TDCData (!=0): \n");
205 for(Int_t i=0; i<32; i++) if(fZDCTDCData[i]!=0) printf("\t %d \n",fZDCTDCData[i]);
54c6a92c 206 printf("\n");
d5ebf00e 207}
208
d1d3e36b 209//______________________________________________________________________________
789b8a8d 210Bool_t AliESDZDC::GetZNCentroidInPbPb(Float_t beamEne, Double_t centrZNC[2], Double_t centrZNA[2])
d1d3e36b 211{
212 // Provide coordinates of centroid over ZN (side C) front face
789b8a8d 213 if(beamEne==0){
214 printf(" ZDC centroid in PbPb can't be calculated with E_beam = 0 !!!\n");
215 for(Int_t jj=0; jj<2; jj++) fZNCCentrCoord[jj] = 999.;
216 return kFALSE;
217 }
218
b19cc8d0 219 const Float_t x[4] = {-1.75, 1.75, -1.75, 1.75};
220 const Float_t y[4] = {-1.75, -1.75, 1.75, 1.75};
b19cc8d0 221 const Float_t alpha=0.395;
789b8a8d 222 Float_t numXZNC=0., numYZNC=0., denZNC=0., cZNC, wZNC;
223 Float_t numXZNA=0., numYZNA=0., denZNA=0., cZNA, wZNA;
5f0ec064 224 //
789b8a8d 225 for(Int_t i=0; i<4; i++){
b19cc8d0 226 if(fZN1TowerEnergy[i+1]>0.) {
789b8a8d 227 wZNC = TMath::Power(fZN1TowerEnergy[i+1], alpha);
228 numXZNC += x[i]*wZNC;
229 numYZNC += y[i]*wZNC;
230 denZNC += wZNC;
b19cc8d0 231 }
b19cc8d0 232 if(fZN2TowerEnergy[i+1]>0.) {
6dec52cf 233 wZNA = TMath::Power(fZN2TowerEnergy[i+1], alpha);
789b8a8d 234 numXZNA += x[i]*wZNA;
235 numYZNA += y[i]*wZNA;
236 denZNA += wZNA;
b19cc8d0 237 }
789b8a8d 238 }
ce099621 239 //
789b8a8d 240 if(denZNC!=0){
241 Float_t nSpecnC = fZDCN1Energy/beamEne;
242 cZNC = 1.89358-0.71262/(nSpecnC+0.71789);
243 fZNCCentrCoord[0] = cZNC*numXZNC/denZNC;
244 fZNCCentrCoord[1] = cZNC*numYZNC/denZNC;
245 }
246 else{
247 fZNCCentrCoord[0] = fZNCCentrCoord[1] = 999.;
b19cc8d0 248 }
789b8a8d 249 if(denZNA!=0){
250 Float_t nSpecnA = fZDCN1Energy/beamEne;
251 cZNA = 1.89358-0.71262/(nSpecnA+0.71789);
252 fZNCCentrCoord[0] = cZNA*numXZNA/denZNA;
253 fZNCCentrCoord[1] = cZNA*numYZNA/denZNA;
254 }
255 else{
256 fZNACentrCoord[0] = fZNACentrCoord[1] = 999.;
257 }
258 //
259 for(Int_t il=0; il<2; il++){
260 centrZNC[il] = fZNCCentrCoord[il];
261 centrZNA[il] = fZNACentrCoord[il];
262 }
263
264 return kTRUE;
b19cc8d0 265}
266
267//______________________________________________________________________________
789b8a8d 268Bool_t AliESDZDC::GetZNCentroidInpp(Double_t centrZNC[2], Double_t centrZNA[2])
b19cc8d0 269{
270 // Provide coordinates of centroid over ZN (side C) front face
271 const Float_t x[4] = {-1.75, 1.75, -1.75, 1.75};
272 const Float_t y[4] = {-1.75, -1.75, 1.75, 1.75};
b19cc8d0 273 const Float_t alpha=0.5;
789b8a8d 274 Float_t numXZNC=0., numYZNC=0., denZNC=0., wZNC;
275 Float_t numXZNA=0., numYZNA=0., denZNA=0., wZNA;
b19cc8d0 276 //
789b8a8d 277 for(Int_t i=0; i<4; i++){
b19cc8d0 278 if(fZN1TowerEnergy[i+1]>0.) {
789b8a8d 279 wZNC = TMath::Power(fZN1TowerEnergy[i+1], alpha);
280 numXZNC += x[i]*wZNC;
281 numYZNC += y[i]*wZNC;
282 denZNC += wZNC;
b19cc8d0 283 }
b19cc8d0 284 if(fZN2TowerEnergy[i+1]>0.) {
789b8a8d 285 wZNA = TMath::Power(fZN2TowerEnergy[i+1], alpha);
286 numXZNA += x[i]*wZNA;
287 numYZNA += y[i]*wZNA;
288 denZNA += wZNA;
b19cc8d0 289 }
789b8a8d 290 }
291 //
292 if(denZNC!=0){
293 fZNCCentrCoord[0] = numXZNC/denZNC;
294 fZNCCentrCoord[1] = numYZNC/denZNC;
295 }
296 else{
297 fZNCCentrCoord[0] = fZNCCentrCoord[1] = 999.;
298 }
299 if(denZNA!=0){
300 fZNACentrCoord[0] = numXZNA/denZNA;
301 fZNACentrCoord[1] = numYZNA/denZNA;
302 }
303 else{
304 fZNACentrCoord[0] = fZNACentrCoord[1] = 999.;
305 }
b19cc8d0 306 //
789b8a8d 307 for(Int_t il=0; il<2; il++){
308 centrZNC[il] = fZNCCentrCoord[il];
309 centrZNA[il] = fZNACentrCoord[il];
ce099621 310 }
789b8a8d 311
312 return kTRUE;
d1d3e36b 313}