Update on config macro for analysis task
[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
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 }
54c6a92c 56 for(Int_t i=0; i<32; i++) fVMEScaler[i]=0;
d5ebf00e 57}
58
2b6cdc43 59//______________________________________________________________________________
d5ebf00e 60AliESDZDC::AliESDZDC(const AliESDZDC& zdc) :
61 TObject(zdc),
62 fZDCN1Energy(zdc.fZDCN1Energy),
63 fZDCP1Energy(zdc.fZDCP1Energy),
64 fZDCN2Energy(zdc.fZDCN2Energy),
65 fZDCP2Energy(zdc.fZDCP2Energy),
f6536de8 66 fZDCEMEnergy(zdc.fZDCEMEnergy),
67 fZDCEMEnergy1(zdc.fZDCEMEnergy1),
2b6cdc43 68 fZDCParticipants(zdc.fZDCParticipants),
5f0ec064 69 fZDCPartSideA(zdc.fZDCPartSideA),
70 fZDCPartSideC(zdc.fZDCPartSideC),
71 fImpactParameter(zdc.fImpactParameter),
8c755c03 72 fImpactParamSideA(zdc.fImpactParamSideA),
73 fImpactParamSideC(zdc.fImpactParamSideC),
5f0ec064 74 fESDQuality(zdc.fESDQuality)
d5ebf00e 75{
76 // copy constructor
89291556 77 for(Int_t i=0; i<5; i++){
a85132e7 78 fZN1TowerEnergy[i] = zdc.fZN1TowerEnergy[i];
79 fZN2TowerEnergy[i] = zdc.fZN2TowerEnergy[i];
80 fZP1TowerEnergy[i] = zdc.fZP1TowerEnergy[i];
81 fZP2TowerEnergy[i] = zdc.fZP2TowerEnergy[i];
82 fZN1TowerEnergyLR[i] = zdc.fZN1TowerEnergyLR[i];
83 fZN2TowerEnergyLR[i] = zdc.fZN2TowerEnergyLR[i];
84 fZP1TowerEnergyLR[i] = zdc.fZP1TowerEnergyLR[i];
85 fZP2TowerEnergyLR[i] = zdc.fZP2TowerEnergyLR[i];
86 }
89291556 87 for(Int_t i=0; i<2; i++){
88 fZNACentrCoord[i] = zdc.fZNACentrCoord[i];
89 fZNCCentrCoord[i] = zdc.fZNCCentrCoord[i];
90 }
54c6a92c 91 for(Int_t i=0; i<32; i++) fVMEScaler[i] = zdc.fVMEScaler[i];
d5ebf00e 92}
93
2b6cdc43 94//______________________________________________________________________________
d5ebf00e 95AliESDZDC& AliESDZDC::operator=(const AliESDZDC&zdc)
96{
97 // assigment operator
98 if(this!=&zdc) {
99 TObject::operator=(zdc);
100 fZDCN1Energy = zdc.fZDCN1Energy;
101 fZDCP1Energy = zdc.fZDCP1Energy;
102 fZDCN2Energy = zdc.fZDCN2Energy;
103 fZDCP2Energy = zdc.fZDCP2Energy;
f6536de8 104 fZDCEMEnergy = zdc.fZDCEMEnergy;
105 fZDCEMEnergy1 = zdc.fZDCEMEnergy1;
a85132e7 106 for(Int_t i=0; i<5; i++){
7b4458a2 107 fZN1TowerEnergy[i] = zdc.fZN1TowerEnergy[i];
108 fZN2TowerEnergy[i] = zdc.fZN2TowerEnergy[i];
a85132e7 109 fZP1TowerEnergy[i] = zdc.fZP1TowerEnergy[i];
110 fZP2TowerEnergy[i] = zdc.fZP2TowerEnergy[i];
111 fZN1TowerEnergyLR[i] = zdc.fZN1TowerEnergyLR[i];
112 fZN2TowerEnergyLR[i] = zdc.fZN2TowerEnergyLR[i];
113 fZP1TowerEnergyLR[i] = zdc.fZP1TowerEnergyLR[i];
114 fZP2TowerEnergyLR[i] = zdc.fZP2TowerEnergyLR[i];
7b4458a2 115 }
5f0ec064 116 //
117 fZDCParticipants = zdc.fZDCParticipants;
118 fZDCPartSideA = zdc.fZDCPartSideA;
119 fZDCPartSideC = zdc.fZDCPartSideC;
120 fImpactParameter = zdc.fImpactParameter;
121 fImpactParamSideA = zdc.fImpactParamSideA;
122 fImpactParamSideC = zdc.fImpactParamSideC;
123 //
89291556 124 for(Int_t i=0; i<2; i++){
125 fZNACentrCoord[i] = zdc.fZNACentrCoord[i];
126 fZNCCentrCoord[i] = zdc.fZNCCentrCoord[i];
127 }
5f0ec064 128 //
129 fESDQuality = zdc.fESDQuality;
54c6a92c 130 for(Int_t i=0; i<32; i++) fVMEScaler[i] = zdc.fVMEScaler[i];
d5ebf00e 131 }
132 return *this;
133}
134
2b6cdc43 135//______________________________________________________________________________
732a24fe 136void AliESDZDC::Copy(TObject &obj) const {
137
138 // this overwrites the virtual TOBject::Copy()
139 // to allow run time copying without casting
140 // in AliESDEvent
141
142 if(this==&obj)return;
143 AliESDZDC *robj = dynamic_cast<AliESDZDC*>(&obj);
144 if(!robj)return; // not an AliESDZDC
145 *robj = *this;
146
147}
148
d5ebf00e 149
150//______________________________________________________________________________
151void AliESDZDC::Reset()
152{
153 // reset all data members
154 fZDCN1Energy=0;
155 fZDCP1Energy=0;
156 fZDCN2Energy=0;
157 fZDCP2Energy=0;
f6536de8 158 fZDCEMEnergy=0;
159 fZDCEMEnergy1=0;
89291556 160 for(Int_t i=0; i<5; i++){
a85132e7 161 fZN1TowerEnergy[i] = fZN2TowerEnergy[i] = 0.;
162 fZP1TowerEnergy[i] = fZP2TowerEnergy[i] = 0.;
163 fZN1TowerEnergyLR[i] = fZN2TowerEnergyLR[i] = 0.;
164 fZP1TowerEnergyLR[i] = fZP2TowerEnergyLR[i] = 0.;
165 }
5f0ec064 166 fZDCParticipants=0;
167 fZDCPartSideA=0;
168 fZDCPartSideC=0;
169 fImpactParameter=0;
170 fImpactParamSideA=0;
171 fImpactParamSideC=0;
89291556 172 for(Int_t i=0; i<2; i++){
173 fZNACentrCoord[i] = fZNCCentrCoord[i] = 0.;
174 }
5f0ec064 175 fESDQuality=0;
54c6a92c 176 for(Int_t i=0; i<32; i++) fVMEScaler[i] = 0;
d5ebf00e 177}
178
179//______________________________________________________________________________
180void AliESDZDC::Print(const Option_t *) const
181{
a85132e7 182 // Print ESD for the ZDC
5f0ec064 183 printf("\n \t E_{ZNC} = %f TeV, E_{ZPC} = %f TeV, E_{ZNA} = %f TeV, E_{ZPA} = %f TeV,"
184 " E_{ZEM} = %f GeV, Npart = %d, b = %1.2f fm\n",
185 fZDCN1Energy/1000.,fZDCP1Energy/1000.,fZDCN2Energy/1000.,fZDCP2Energy/1000.,
186 fZDCEMEnergy+fZDCEMEnergy1, fZDCParticipants,fImpactParameter);
54c6a92c 187 //
188 printf(" ### fVMEScaler: \n");
189 for(Int_t i=0; i<32; i++) printf("\t datum %d: %d \n",i,fVMEScaler[i]);
190 printf("\n");
d5ebf00e 191}
192
d1d3e36b 193//______________________________________________________________________________
2b6cdc43 194Double32_t * AliESDZDC::GetZNCCentroid()
d1d3e36b 195{
196 // Provide coordinates of centroid over ZN (side C) front face
d1d3e36b 197 Float_t x[4] = {-1.75, 1.75, -1.75, 1.75};
5f0ec064 198 Float_t y[4] = {-1.75, -1.75, 1.75, 1.75};
48486c12 199 Float_t numX=0., numY=0., den=0.;
5f0ec064 200 Float_t c, alpha=0.395, w;
5f0ec064 201 //
2b6cdc43 202 for(Int_t i=0; i<4; i++){
3f7d0b78 203 if(fZN1TowerEnergy[i+1]<0.) fZN1TowerEnergy[i+1]=0.;
2b6cdc43 204 w = TMath::Power(fZN1TowerEnergy[i+1], alpha);
48486c12 205 numX += x[i]*w;
206 numY += y[i]*w;
207 den += w;
d1d3e36b 208 }
48486c12 209 if(den!=0){
5f0ec064 210 // ATTENTION! Needs to be changed if E_beam(A-A) != 2.76 A TeV !!!!
e955aeff 211 Float_t nSpecn = fZDCN1Energy/2760.;
212 c = 1.89358-0.71262/(nSpecn+0.71789);
5f0ec064 213 fZNCCentrCoord[0] = c*numX/den;
214 fZNCCentrCoord[1] = c*numY/den;
d1d3e36b 215 }
89291556 216 return fZNCCentrCoord;
d1d3e36b 217}
7b4458a2 218
d1d3e36b 219//______________________________________________________________________________
2b6cdc43 220Double32_t * AliESDZDC::GetZNACentroid()
d1d3e36b 221{
222 // Provide coordinates of centroid over ZN (side A) front face
d1d3e36b 223 Float_t x[4] = {-1.75, 1.75, -1.75, 1.75};
5f0ec064 224 Float_t y[4] = {-1.75, -1.75, 1.75, 1.75};
48486c12 225 Float_t numX=0., numY=0., den=0.;
5f0ec064 226 Float_t c, alpha=0.395, w;
e955aeff 227
2b6cdc43 228 for(Int_t i=0; i<4; i++){
e955aeff 229 if(fZN2TowerEnergy[i+1]<0.) fZN2TowerEnergy[i+1]=0.;
230 w = TMath::Power(fZN2TowerEnergy[i+1], alpha);
231 numX += x[i]*w;
232 numY += y[i]*w;
233 den += w;
d1d3e36b 234 }
ce099621 235 //
48486c12 236 if(den!=0){
5f0ec064 237 // ATTENTION! Needs to be changed if E_beam(A-A) != 2.76 A TeV !!!!
e955aeff 238 Float_t nSpecn = fZDCN2Energy/2760.;
239 c = 1.89358-0.71262/(nSpecn+0.71789);
5f0ec064 240 fZNACentrCoord[0] = c*numX/den;
241 fZNACentrCoord[1] = c*numY/den;
ce099621 242 }
89291556 243 return fZNACentrCoord;
d1d3e36b 244}