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