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