Add attic folder
[u/mrichter/AliRoot.git] / STEER / ESD / 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() :
16d867eb 32 AliVZDC(),
d5ebf00e 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++){
469db8b4 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) :
16d867eb 67 AliVZDC(zdc),
d5ebf00e 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) {
16d867eb 111 AliVZDC::operator=(zdc);
d5ebf00e 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++){
469db8b4 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
16d867eb 207 printf(" ### ZDC energies: \n");
208 printf("\n \t E_ZNC = %1.2f (%1.2f+%1.2f+%1.2f+%1.2f+%1.2f) GeV \n \t E_ZNA = %1.2f (%1.2f+%1.2f+%1.2f+%1.2f+%1.2f) GeV\n"
209 " \t E_ZPC = %1.2f GeV E_ZPA = %1.2f GeV"
210 "\n E_ZEM1 = %1.2f GeV, E_ZEM2 = %1.2f GeV\n \t Npart = %d, b = %1.2f fm\n",
211 fZDCN1Energy, fZN1TowerEnergy[0], fZN1TowerEnergy[1],
212 fZN1TowerEnergy[2], fZN1TowerEnergy[3], fZN1TowerEnergy[4],
213 fZDCN2Energy,fZN2TowerEnergy[0], fZN2TowerEnergy[1],
214 fZN2TowerEnergy[2], fZN2TowerEnergy[3], fZN2TowerEnergy[4],
215 fZDCP1Energy,fZDCP2Energy, fZDCEMEnergy, fZDCEMEnergy1,
216 fZDCParticipants,fImpactParameter);
54c6a92c 217 //
16d867eb 218 /*printf(" ### VMEScaler (!=0): \n");
82dffa48 219 for(Int_t i=0; i<32; i++) if(fVMEScaler[i]!=0) printf("\t %d \n",fVMEScaler[i]);
220 printf("\n");
221 //
222 printf(" ### TDCData (!=0): \n");
32e2fda5 223 for(Int_t i=0; i<32; i++){
224 for(Int_t j=0; j<4; j++)
16d867eb 225 if(TMath::Abs(fZDCTDCCorrected[i][j])>1e-4) printf("\t %1.0f \n",fZDCTDCCorrected[i][j]);
226 }*/
54c6a92c 227 printf("\n");
d5ebf00e 228}
229
d1d3e36b 230//______________________________________________________________________________
789b8a8d 231Bool_t AliESDZDC::GetZNCentroidInPbPb(Float_t beamEne, Double_t centrZNC[2], Double_t centrZNA[2])
d1d3e36b 232{
233 // Provide coordinates of centroid over ZN (side C) front face
789b8a8d 234 if(beamEne==0){
235 printf(" ZDC centroid in PbPb can't be calculated with E_beam = 0 !!!\n");
236 for(Int_t jj=0; jj<2; jj++) fZNCCentrCoord[jj] = 999.;
237 return kFALSE;
238 }
239
b19cc8d0 240 const Float_t x[4] = {-1.75, 1.75, -1.75, 1.75};
241 const Float_t y[4] = {-1.75, -1.75, 1.75, 1.75};
b19cc8d0 242 const Float_t alpha=0.395;
789b8a8d 243 Float_t numXZNC=0., numYZNC=0., denZNC=0., cZNC, wZNC;
244 Float_t numXZNA=0., numYZNA=0., denZNA=0., cZNA, wZNA;
5f0ec064 245 //
789b8a8d 246 for(Int_t i=0; i<4; i++){
b19cc8d0 247 if(fZN1TowerEnergy[i+1]>0.) {
789b8a8d 248 wZNC = TMath::Power(fZN1TowerEnergy[i+1], alpha);
249 numXZNC += x[i]*wZNC;
250 numYZNC += y[i]*wZNC;
251 denZNC += wZNC;
b19cc8d0 252 }
b19cc8d0 253 if(fZN2TowerEnergy[i+1]>0.) {
6dec52cf 254 wZNA = TMath::Power(fZN2TowerEnergy[i+1], alpha);
789b8a8d 255 numXZNA += x[i]*wZNA;
256 numYZNA += y[i]*wZNA;
257 denZNA += wZNA;
b19cc8d0 258 }
789b8a8d 259 }
ce099621 260 //
789b8a8d 261 if(denZNC!=0){
262 Float_t nSpecnC = fZDCN1Energy/beamEne;
263 cZNC = 1.89358-0.71262/(nSpecnC+0.71789);
264 fZNCCentrCoord[0] = cZNC*numXZNC/denZNC;
265 fZNCCentrCoord[1] = cZNC*numYZNC/denZNC;
266 }
267 else{
268 fZNCCentrCoord[0] = fZNCCentrCoord[1] = 999.;
b19cc8d0 269 }
789b8a8d 270 if(denZNA!=0){
9e05925b 271 Float_t nSpecnA = fZDCN2Energy/beamEne;
789b8a8d 272 cZNA = 1.89358-0.71262/(nSpecnA+0.71789);
db3c6990 273 fZNACentrCoord[0] = cZNA*numXZNA/denZNA;
274 fZNACentrCoord[1] = cZNA*numYZNA/denZNA;
789b8a8d 275 }
276 else{
277 fZNACentrCoord[0] = fZNACentrCoord[1] = 999.;
278 }
279 //
280 for(Int_t il=0; il<2; il++){
281 centrZNC[il] = fZNCCentrCoord[il];
282 centrZNA[il] = fZNACentrCoord[il];
283 }
284
285 return kTRUE;
b19cc8d0 286}
287
288//______________________________________________________________________________
789b8a8d 289Bool_t AliESDZDC::GetZNCentroidInpp(Double_t centrZNC[2], Double_t centrZNA[2])
b19cc8d0 290{
291 // Provide coordinates of centroid over ZN (side C) front face
292 const Float_t x[4] = {-1.75, 1.75, -1.75, 1.75};
293 const Float_t y[4] = {-1.75, -1.75, 1.75, 1.75};
b19cc8d0 294 const Float_t alpha=0.5;
789b8a8d 295 Float_t numXZNC=0., numYZNC=0., denZNC=0., wZNC;
296 Float_t numXZNA=0., numYZNA=0., denZNA=0., wZNA;
b19cc8d0 297 //
789b8a8d 298 for(Int_t i=0; i<4; i++){
b19cc8d0 299 if(fZN1TowerEnergy[i+1]>0.) {
789b8a8d 300 wZNC = TMath::Power(fZN1TowerEnergy[i+1], alpha);
301 numXZNC += x[i]*wZNC;
302 numYZNC += y[i]*wZNC;
303 denZNC += wZNC;
b19cc8d0 304 }
b19cc8d0 305 if(fZN2TowerEnergy[i+1]>0.) {
789b8a8d 306 wZNA = TMath::Power(fZN2TowerEnergy[i+1], alpha);
307 numXZNA += x[i]*wZNA;
308 numYZNA += y[i]*wZNA;
309 denZNA += wZNA;
b19cc8d0 310 }
789b8a8d 311 }
312 //
313 if(denZNC!=0){
314 fZNCCentrCoord[0] = numXZNC/denZNC;
315 fZNCCentrCoord[1] = numYZNC/denZNC;
316 }
317 else{
318 fZNCCentrCoord[0] = fZNCCentrCoord[1] = 999.;
319 }
320 if(denZNA!=0){
321 fZNACentrCoord[0] = numXZNA/denZNA;
322 fZNACentrCoord[1] = numYZNA/denZNA;
323 }
324 else{
325 fZNACentrCoord[0] = fZNACentrCoord[1] = 999.;
326 }
b19cc8d0 327 //
789b8a8d 328 for(Int_t il=0; il<2; il++){
329 centrZNC[il] = fZNCCentrCoord[il];
330 centrZNA[il] = fZNACentrCoord[il];
ce099621 331 }
789b8a8d 332
333 return kTRUE;
d1d3e36b 334}