Fix eff-c++ 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
24
25
26#include "AliESDZDC.h"
27
28ClassImp(AliESDZDC)
29
2b6cdc43 30//Float_t funCParCentr(const Int_t n) {return 1.8936-0.7126/(n + 0.7179);}
d1d3e36b 31
d5ebf00e 32//______________________________________________________________________________
33AliESDZDC::AliESDZDC() :
34 TObject(),
35 fZDCN1Energy(0),
36 fZDCP1Energy(0),
37 fZDCN2Energy(0),
38 fZDCP2Energy(0),
f6536de8 39 fZDCEMEnergy(0),
40 fZDCEMEnergy1(0),
2b6cdc43 41 fZDCParticipants(0),
42 fZDCParticipants2(0)
d5ebf00e 43{
89291556 44 for(Int_t i=0; i<5; i++){
a85132e7 45 fZN1TowerEnergy[i] = fZN2TowerEnergy[i] = 0.;
46 fZP1TowerEnergy[i] = fZP2TowerEnergy[i] = 0.;
47 fZN1TowerEnergyLR[i] = fZN2TowerEnergyLR[i] = 0.;
48 fZP1TowerEnergyLR[i] = fZP2TowerEnergyLR[i] = 0.;
49 }
89291556 50 for(Int_t i=0; i<2; i++){
51 fZNACentrCoord[i] = fZNCCentrCoord[i] = 0.;
52 }
d5ebf00e 53}
54
2b6cdc43 55//______________________________________________________________________________
d5ebf00e 56AliESDZDC::AliESDZDC(const AliESDZDC& zdc) :
57 TObject(zdc),
58 fZDCN1Energy(zdc.fZDCN1Energy),
59 fZDCP1Energy(zdc.fZDCP1Energy),
60 fZDCN2Energy(zdc.fZDCN2Energy),
61 fZDCP2Energy(zdc.fZDCP2Energy),
f6536de8 62 fZDCEMEnergy(zdc.fZDCEMEnergy),
63 fZDCEMEnergy1(zdc.fZDCEMEnergy1),
2b6cdc43 64 fZDCParticipants(zdc.fZDCParticipants),
65 fZDCParticipants2(zdc.fZDCParticipants2)
d5ebf00e 66{
67 // copy constructor
89291556 68 for(Int_t i=0; i<5; i++){
a85132e7 69 fZN1TowerEnergy[i] = zdc.fZN1TowerEnergy[i];
70 fZN2TowerEnergy[i] = zdc.fZN2TowerEnergy[i];
71 fZP1TowerEnergy[i] = zdc.fZP1TowerEnergy[i];
72 fZP2TowerEnergy[i] = zdc.fZP2TowerEnergy[i];
73 fZN1TowerEnergyLR[i] = zdc.fZN1TowerEnergyLR[i];
74 fZN2TowerEnergyLR[i] = zdc.fZN2TowerEnergyLR[i];
75 fZP1TowerEnergyLR[i] = zdc.fZP1TowerEnergyLR[i];
76 fZP2TowerEnergyLR[i] = zdc.fZP2TowerEnergyLR[i];
77 }
89291556 78 for(Int_t i=0; i<2; i++){
79 fZNACentrCoord[i] = zdc.fZNACentrCoord[i];
80 fZNCCentrCoord[i] = zdc.fZNCCentrCoord[i];
81 }
d5ebf00e 82}
83
2b6cdc43 84//______________________________________________________________________________
d5ebf00e 85AliESDZDC& AliESDZDC::operator=(const AliESDZDC&zdc)
86{
87 // assigment operator
88 if(this!=&zdc) {
89 TObject::operator=(zdc);
90 fZDCN1Energy = zdc.fZDCN1Energy;
91 fZDCP1Energy = zdc.fZDCP1Energy;
92 fZDCN2Energy = zdc.fZDCN2Energy;
93 fZDCP2Energy = zdc.fZDCP2Energy;
d5ebf00e 94 fZDCParticipants = zdc.fZDCParticipants;
2b6cdc43 95 fZDCParticipants2 = zdc.fZDCParticipants2;
f6536de8 96 fZDCEMEnergy = zdc.fZDCEMEnergy;
97 fZDCEMEnergy1 = zdc.fZDCEMEnergy1;
a85132e7 98 for(Int_t i=0; i<5; i++){
7b4458a2 99 fZN1TowerEnergy[i] = zdc.fZN1TowerEnergy[i];
100 fZN2TowerEnergy[i] = zdc.fZN2TowerEnergy[i];
a85132e7 101 fZP1TowerEnergy[i] = zdc.fZP1TowerEnergy[i];
102 fZP2TowerEnergy[i] = zdc.fZP2TowerEnergy[i];
103 fZN1TowerEnergyLR[i] = zdc.fZN1TowerEnergyLR[i];
104 fZN2TowerEnergyLR[i] = zdc.fZN2TowerEnergyLR[i];
105 fZP1TowerEnergyLR[i] = zdc.fZP1TowerEnergyLR[i];
106 fZP2TowerEnergyLR[i] = zdc.fZP2TowerEnergyLR[i];
7b4458a2 107 }
89291556 108 for(Int_t i=0; i<2; i++){
109 fZNACentrCoord[i] = zdc.fZNACentrCoord[i];
110 fZNCCentrCoord[i] = zdc.fZNCCentrCoord[i];
111 }
d5ebf00e 112 }
113 return *this;
114}
115
2b6cdc43 116//______________________________________________________________________________
732a24fe 117void AliESDZDC::Copy(TObject &obj) const {
118
119 // this overwrites the virtual TOBject::Copy()
120 // to allow run time copying without casting
121 // in AliESDEvent
122
123 if(this==&obj)return;
124 AliESDZDC *robj = dynamic_cast<AliESDZDC*>(&obj);
125 if(!robj)return; // not an AliESDZDC
126 *robj = *this;
127
128}
129
d5ebf00e 130
131//______________________________________________________________________________
132void AliESDZDC::Reset()
133{
134 // reset all data members
135 fZDCN1Energy=0;
136 fZDCP1Energy=0;
137 fZDCN2Energy=0;
138 fZDCP2Energy=0;
7b4458a2 139 fZDCParticipants=0;
2b6cdc43 140 fZDCParticipants2=0;
f6536de8 141 fZDCEMEnergy=0;
142 fZDCEMEnergy1=0;
89291556 143 for(Int_t i=0; i<5; i++){
a85132e7 144 fZN1TowerEnergy[i] = fZN2TowerEnergy[i] = 0.;
145 fZP1TowerEnergy[i] = fZP2TowerEnergy[i] = 0.;
146 fZN1TowerEnergyLR[i] = fZN2TowerEnergyLR[i] = 0.;
147 fZP1TowerEnergyLR[i] = fZP2TowerEnergyLR[i] = 0.;
148 }
89291556 149 for(Int_t i=0; i<2; i++){
150 fZNACentrCoord[i] = fZNCCentrCoord[i] = 0.;
151 }
d5ebf00e 152}
153
154//______________________________________________________________________________
155void AliESDZDC::Print(const Option_t *) const
156{
a85132e7 157 // Print ESD for the ZDC
158 printf("\n \t ZN1Energy = %f TeV, ZP1Energy = %f TeV, ZN2Energy = %f TeV,"
2b6cdc43 159 " ZP2Energy = %f, Npart side C = %d, Npart side A = %d\n",
160 fZDCN1Energy,fZDCP1Energy,fZDCN2Energy,fZDCP2Energy,fZDCParticipants,fZDCParticipants2);
d5ebf00e 161}
162
d1d3e36b 163//______________________________________________________________________________
2b6cdc43 164Double32_t * AliESDZDC::GetZNCCentroid()
d1d3e36b 165{
166 // Provide coordinates of centroid over ZN (side C) front face
d1d3e36b 167 Float_t x[4] = {-1.75, 1.75, -1.75, 1.75};
168 Float_t y[4] = {-1.75, -1.72, 1.75, 1.75};
48486c12 169 Float_t numX=0., numY=0., den=0.;
d1d3e36b 170 Float_t alpha=0.395, w;
2b6cdc43 171 for(Int_t i=0; i<4; i++){
3f7d0b78 172 if(fZN1TowerEnergy[i+1]<0.) fZN1TowerEnergy[i+1]=0.;
2b6cdc43 173 w = TMath::Power(fZN1TowerEnergy[i+1], alpha);
48486c12 174 numX += x[i]*w;
175 numY += y[i]*w;
176 den += w;
d1d3e36b 177 }
48486c12 178 if(den!=0){
179 fZNCCentrCoord[0] = 1.8665*numX/den;
180 fZNCCentrCoord[1] = 1.8665*numY/den;
d1d3e36b 181 }
89291556 182 return fZNCCentrCoord;
d1d3e36b 183}
7b4458a2 184
d1d3e36b 185//______________________________________________________________________________
2b6cdc43 186Double32_t * AliESDZDC::GetZNACentroid()
d1d3e36b 187{
188 // Provide coordinates of centroid over ZN (side A) front face
d1d3e36b 189 Float_t x[4] = {-1.75, 1.75, -1.75, 1.75};
190 Float_t y[4] = {-1.75, -1.72, 1.75, 1.75};
48486c12 191 Float_t numX=0., numY=0., den=0.;
d1d3e36b 192 Float_t alpha=0.395, w;
2b6cdc43 193 for(Int_t i=0; i<4; i++){
3f7d0b78 194 if(fZN2TowerEnergy[i+1]<0.) fZN2TowerEnergy[i+1]=0.;
2b6cdc43 195 w = TMath::Power(fZN2TowerEnergy[i+1], alpha);
48486c12 196 numX += x[i]*w;
197 numY += y[i]*w;
198 den += w;
d1d3e36b 199 }
ce099621 200 //
48486c12 201 if(den!=0){
202 fZNACentrCoord[0] = 1.8665*numX/den;
203 fZNACentrCoord[1] = 1.8665*numY/den;
ce099621 204 }
89291556 205 return fZNACentrCoord;
d1d3e36b 206}