]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDZDC.h
Leak detected by Coverity fixed
[u/mrichter/AliRoot.git] / STEER / AliESDZDC.h
1 // -*- mode: C++ -*- 
2 #ifndef ALIESDZDC_H
3 #define ALIESDZDC_H
4
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6  * See cxx source for full Copyright notice                               */
7
8 //-------------------------------------------------------------------------
9 //                      Implementation of   Class AliESDZDC
10 //   This is a class that summarizes the ZDC data for the ESD   
11 //   Origin: Christian Klein-Boesing, CERN, Christian.Klein-Boesing@cern.ch 
12 //   *** 15/10/2009 Scaler added to AliESDZDC class ***
13 //   *** Scaler format:  32 floats from VME scaler  ***
14 //-------------------------------------------------------------------------
15
16 #include <TObject.h>
17
18 class AliESDZDC: public TObject {
19 public:
20  
21   enum {
22     kCorrectedTDCFilled = BIT(14),
23     kEnergyCalibratedSignal = BIT(15)
24   };
25  
26   AliESDZDC();
27   AliESDZDC(const AliESDZDC& zdc);
28   AliESDZDC& operator=(const AliESDZDC& zdc);
29   virtual void Copy(TObject &obj) const;
30
31   UInt_t   GetESDQuality()  const {return fESDQuality;}
32   Double_t GetZDCN1Energy() const {return fZDCN1Energy;}
33   Double_t GetZDCP1Energy() const {return fZDCP1Energy;}
34   Double_t GetZDCN2Energy() const {return fZDCN2Energy;}
35   Double_t GetZDCP2Energy() const {return fZDCP2Energy;}
36   Double_t GetZDCEMEnergy(Int_t i) const 
37            {if(i==0){return fZDCEMEnergy;} else if(i==1){return fZDCEMEnergy1;}
38            return 0;}
39   Short_t  GetZDCParticipants() const {return fZDCParticipants;}
40   Short_t  GetZDCPartSideA() const {return fZDCPartSideA;}
41   Short_t  GetZDCPartSideC() const {return fZDCPartSideC;}
42   Double_t GetImpactParameter() const {return fImpactParameter;}
43   Double_t GetImpactParamSideA() const {return fImpactParamSideA;}
44   Double_t GetImpactParamSideC() const {return fImpactParamSideC;}
45   const Double_t * GetZN1TowerEnergy() const {return fZN1TowerEnergy;}
46   const Double_t * GetZN2TowerEnergy() const {return fZN2TowerEnergy;}
47   const Double_t * GetZP1TowerEnergy() const {return fZP1TowerEnergy;}
48   const Double_t * GetZP2TowerEnergy() const {return fZP2TowerEnergy;}
49   const Double_t * GetZN1TowerEnergyLR() const {return fZN1TowerEnergyLR;}
50   const Double_t * GetZN2TowerEnergyLR() const {return fZN2TowerEnergyLR;}
51   const Double_t * GetZP1TowerEnergyLR() const {return fZP1TowerEnergyLR;}
52   const Double_t * GetZP2TowerEnergyLR() const {return fZP2TowerEnergyLR;}
53   //
54   Bool_t GetZNCentroidInPbPb(Float_t beamEne, Double_t centrZNC[2], Double_t centrZNA[2]);
55   Bool_t GetZNCentroidInpp(Double_t centrZNC[2], Double_t centrZNA[2]);
56   //
57
58   UInt_t GetZDCScaler(Int_t i)  const {return fVMEScaler[i];}
59   const UInt_t* GetZDCScaler()  const {return fVMEScaler;}
60
61   Int_t GetZDCTDCData(Int_t i, Int_t j) const {return fZDCTDCData[i][j];}
62   Float_t GetZDCTDCCorrected(Int_t i, Int_t j) const 
63           {if(AliESDZDC::kCorrectedTDCFilled) return fZDCTDCCorrected[i][j];
64            else return 0.;}
65   Float_t GetZNTDCSum(Int_t ihit) const 
66           {if(ihit<4 && AliESDZDC::kCorrectedTDCFilled) return (Float_t) (fZDCTDCCorrected[10][ihit]+fZDCTDCCorrected[12][ihit]);
67            else return 0.;}
68   Float_t GetZNTDCDiff(Int_t ihit) const 
69           {if(ihit<4 && AliESDZDC::kCorrectedTDCFilled) return (Float_t) (fZDCTDCCorrected[12][ihit]-fZDCTDCCorrected[10][ihit]);
70            else return 0.;}
71   
72   void  SetZDC(Double_t n1Energy, Double_t p1Energy, 
73                Double_t emEnergy0, Double_t emEnergy1,
74                Double_t n2Energy, Double_t p2Energy, 
75                Short_t participants, Short_t nPartA, Short_t nPartC,
76                Double_t b, Double_t bA, Double_t bC, UInt_t recoFlag) 
77         {fZDCN1Energy=n1Energy; fZDCP1Energy=p1Energy; 
78          fZDCEMEnergy=emEnergy0; fZDCEMEnergy1=emEnergy1;
79          fZDCN2Energy=n2Energy; fZDCP2Energy=p2Energy; 
80          fZDCParticipants=participants; fZDCPartSideA=nPartA; fZDCPartSideC=nPartC;
81          fImpactParameter=b; fImpactParamSideA=bA, fImpactParamSideC=bC,
82          fESDQuality=recoFlag;}
83   //
84   void  SetZN1TowerEnergy(const Float_t tow1[5])
85           {for(Int_t i=0; i<5; i++) fZN1TowerEnergy[i] = tow1[i];}
86   void  SetZN2TowerEnergy(const Float_t tow2[5])
87           {for(Int_t i=0; i<5; i++) fZN2TowerEnergy[i] = tow2[i];}
88   void  SetZP1TowerEnergy(const Float_t tow1[5])
89           {for(Int_t i=0; i<5; i++) fZP1TowerEnergy[i] = tow1[i];}
90   void  SetZP2TowerEnergy(const Float_t tow2[5])
91           {for(Int_t i=0; i<5; i++) fZP2TowerEnergy[i] = tow2[i];}
92   void  SetZN1TowerEnergyLR(const Float_t tow1[5])
93           {for(Int_t i=0; i<5; i++) fZN1TowerEnergyLR[i] = tow1[i];}
94   void  SetZN2TowerEnergyLR(const Float_t tow2[5])
95           {for(Int_t i=0; i<5; i++) fZN2TowerEnergyLR[i] = tow2[i];}
96   void  SetZP1TowerEnergyLR(const Float_t tow1[5])
97           {for(Int_t i=0; i<5; i++) fZP1TowerEnergyLR[i] = tow1[i];}
98   void  SetZP2TowerEnergyLR(const Float_t tow2[5])
99           {for(Int_t i=0; i<5; i++) fZP2TowerEnergyLR[i] = tow2[i];}
100   void  SetZNACentroid(const Float_t centrCoord[2])
101            {for(Int_t i=0; i<2; i++) fZNACentrCoord[i] = centrCoord[i];}
102   void  SetZNCCentroid(const Float_t centrCoord[2])
103            {for(Int_t i=0; i<2; i++) fZNCCentrCoord[i] = centrCoord[i];}
104   
105   void SetZDCScaler(const UInt_t count[32]) 
106        {for(Int_t k=0; k<32; k++) fVMEScaler[k] = count[k];}
107   
108   void SetZDCTDCData(const Int_t values[32][4]) 
109        {for(Int_t k=0; k<32; k++)
110            for(Int_t j=0; j<4; j++) fZDCTDCData[k][j] = values[k][j];}
111   
112   void SetZDCTDCCorrected(const Float_t values[32][4]) 
113        {for(Int_t k=0; k<32; k++)
114            for(Int_t j=0; j<4; j++) fZDCTDCCorrected[k][j] = values[k][j];}
115
116   void    Reset();
117   void    Print(const Option_t *opt=0) const;
118
119 private:
120
121   Double32_t   fZDCN1Energy;  // reconstructed energy in the neutron ZDC
122   Double32_t   fZDCP1Energy;  // reconstructed energy in the proton ZDC
123   Double32_t   fZDCN2Energy;  // reconstructed energy in the neutron ZDC
124   Double32_t   fZDCP2Energy;  // reconstructed energy in the proton ZDC
125   Double32_t   fZDCEMEnergy;  // signal in the electromagnetic ZDCs
126   Double32_t   fZDCEMEnergy1; // second EM signal,cannot change fZDCEMEnergy to array (not backward compatible)
127   Double32_t   fZN1TowerEnergy[5];// reco E in 5 ZN1 sectors - high gain chain
128   Double32_t   fZN2TowerEnergy[5];// reco E in 5 ZN2 sectors - high gain chain
129   Double32_t   fZP1TowerEnergy[5];// reco E in 5 ZP1 sectors - high gain chain
130   Double32_t   fZP2TowerEnergy[5];// reco E in 5 ZP2 sectors - high gain chain
131   Double32_t   fZN1TowerEnergyLR[5];// reco E in 5 ZN1 sectors - low gain chain
132   Double32_t   fZN2TowerEnergyLR[5];// reco E in 5 ZN2 sectors - low gain chain
133   Double32_t   fZP1TowerEnergyLR[5];// reco E in 5 ZP1 sectors - low gain chain
134   Double32_t   fZP2TowerEnergyLR[5];// reco E in 5 ZP2 sectors - low gain chain
135   Short_t      fZDCParticipants;    // number of participants estimated by the ZDC (ONLY in A-A)
136   Short_t      fZDCPartSideA;     // number of participants estimated by the ZDC (ONLY in A-A)
137   Short_t      fZDCPartSideC;     // number of participants estimated by the ZDC (ONLY in A-A)
138   Double32_t   fImpactParameter;  // impact parameter estimated by the ZDC (ONLY in A-A)
139   Double32_t   fImpactParamSideA; // impact parameter estimated by the ZDC (ONLY in A-A)
140   Double32_t   fImpactParamSideC; // impact parameter estimated by the ZDC (ONLY in A-A)
141   Double32_t   fZNACentrCoord[2]; // Coordinates of the centroid over ZNC
142   Double32_t   fZNCCentrCoord[2]; // Coordinates of the centroid over ZNA
143   UInt_t       fESDQuality;       // flags from reconstruction
144   UInt_t       fVMEScaler[32];    // counts from VME scaler
145   Int_t        fZDCTDCData[32][4];     // ZDC TDC data
146   Float_t      fZDCTDCCorrected[32][4];// ZDC TDC data in ns corrected 4 phase shift
147   
148   ClassDef(AliESDZDC,16)
149 };
150
151 #endif
152