Sum of energies on calculated once.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Jun 2011 08:52:02 +0000 (08:52 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Jun 2011 08:52:02 +0000 (08:52 +0000)
STEER/AliAODZDC.cxx
STEER/AliAODZDC.h

index 4747243..a6bc410 100644 (file)
@@ -26,12 +26,12 @@ ClassImp(AliAODZDC)
 
 AliAODZDC::AliAODZDC() :
   AliVZDC(),
-  fZNCEnergy(0),
-  fZNAEnergy(0),
-  fZPCEnergy(0),
-  fZPAEnergy(0),
-  fZEM1Energy(0),
-  fZEM2Energy(0),
+  fZNCEnergy(-999.),
+  fZNAEnergy(-999.),
+  fZPCEnergy(-999.),
+  fZPAEnergy(-999.),
+  fZEM1Energy(0.),
+  fZEM2Energy(0..),
   fZDCParticipants(0),
   fZDCPartSideA(0),
   fZDCPartSideC(0),
@@ -126,33 +126,41 @@ AliAODZDC& AliAODZDC::operator=(const AliAODZDC& zdcAOD)
 //______________________________________________________________________________
 Double_t  AliAODZDC::GetZNCEnergy() const
 {
-   Double_t sumZNC=0.;
-   for(Int_t i=0; i<5; i++) sumZNC += fZNCTowerEnergy[i];
-   return sumZNC;
+    if (fZNCEnergy < 0.) {
+       fZNCEnergy = 0.;
+       for(Int_t i=0; i<5; i++) fZNCEnergy += fZNCTowerEnergy[i];
+    }
+    return fZNCEnergy;
 }
 
 //______________________________________________________________________________
 Double_t  AliAODZDC::GetZNAEnergy() const
 {
-   Double_t sumZNA=0.;
-   for(Int_t i=0; i<5; i++) sumZNA += fZNATowerEnergy[i];
-   return sumZNA;
+    if (fZNAEnergy < 0.) {
+       fZNAEnergy = 0.;
+       for(Int_t i=0; i<5; i++) fZNAEnergy += fZNATowerEnergy[i];
+    }
+    return fZNAEnergy;
 }
 
 //______________________________________________________________________________
 Double_t  AliAODZDC::GetZPCEnergy() const
 {
-   Double_t sumZPC=0.;
-   for(Int_t i=0; i<5; i++) sumZPC += fZPCTowerEnergy[i];
-   return sumZPC;
+    if (fZPCEnergy < 0.) {
+       fZPCEnergy = 0.;
+       for(Int_t i=0; i<5; i++) fZPCEnergy += fZPCTowerEnergy[i];
+    }
+    return fZPCEnergy;
 }
 
 //______________________________________________________________________________
 Double_t  AliAODZDC::GetZPAEnergy() const
 {
-   Double_t sumZPA=0.;
-   for(Int_t i=0; i<5; i++) sumZPA += fZPATowerEnergy[i];
-   return sumZPA;
+    if (fZPAEnergy < 0.) {
+       fZPAEnergy = 0.;
+       for(Int_t i=0; i<5; i++) fZPAEnergy += fZPATowerEnergy[i];
+    }
+    return fZPAEnergy;
 }
 
 //______________________________________________________________________________
index cfd0d9f..4e575d9 100644 (file)
@@ -70,10 +70,10 @@ public:
  
 protected:
   
-  Double32_t   fZNCEnergy;           // E in ZNC
-  Double32_t   fZNAEnergy;           // E in ZNA
-  Double32_t   fZPCEnergy;           // E in ZPC
-  Double32_t   fZPAEnergy;           // E in ZPA
+  mutable Double32_t   fZNCEnergy;           //!E in ZNC
+  mutable Double32_t   fZNAEnergy;           //!E in ZNA
+  mutable Double32_t   fZPCEnergy;           //!E in ZPC
+  mutable Double32_t   fZPAEnergy;           //!E in ZPA
   Double32_t   fZEM1Energy;          // E in ZEM1
   Double32_t   fZEM2Energy;          // E in ZEM2
   Double32_t   fZNCTowerEnergy[5];    // E in 5 ZNC sectors - high gain chain