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