]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Replacing array of objects by array of pointers
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 6 Jul 2005 19:23:10 +0000 (19:23 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 6 Jul 2005 19:23:10 +0000 (19:23 +0000)
FASTSIM/AliFastGlauber.cxx
FASTSIM/AliFastGlauber.h

index 804f0e52da55b5b21f91f0c7d1089d503487f2a8..7e74953784b58fd4855b6aa47916c5b9ebfca467 100644 (file)
@@ -82,7 +82,7 @@ TF1*    AliFastGlauber::fgWIntRadius     = NULL;
 TF2*    AliFastGlauber::fgWKParticipants = NULL; 
 TF1*    AliFastGlauber::fgWParticipants  = NULL; 
 TF2*    AliFastGlauber::fgWAlmondCurrent = NULL;    
-TF2     AliFastGlauber::fgWAlmondFixedB[40]; 
+TF2*    AliFastGlauber::fgWAlmondFixedB[40]; 
 const Int_t AliFastGlauber::fgkMCInts = 100000;
 Int_t AliFastGlauber::fgCounter = 0;       
 
@@ -103,6 +103,7 @@ AliFastGlauber::AliFastGlauber() : fName()
 AliFastGlauber::~AliFastGlauber()
 {
   fgCounter--;
+  for(Int_t k=0; k<40; k++) delete fgWAlmondFixedB[k];
   //if(fgCounter==0) Reset();
 }
 
@@ -247,7 +248,7 @@ void AliFastGlauber::Init(Int_t mode)
     for(Int_t k=0; k<40; k++) {
       sprintf(almondName,"WAlmondFixedB%d",k);
       fgWAlmondCurrent = (TF2*)ff->Get(almondName);
-      new(&fgWAlmondFixedB[k]) TF2(*fgWAlmondCurrent);
+      fgWAlmondFixedB[k] = fgWAlmondCurrent;
     }
     delete ff;
   }
@@ -1217,7 +1218,7 @@ void AliFastGlauber::GetRandomBHard(Double_t& b)
   b = fgWSbinary->GetRandom();
   Int_t bin = 2*(Int_t)b;
   if( (b-(Int_t)b) > 0.5) bin++;
-  fgWAlmondCurrent = &fgWAlmondFixedB[bin]; 
+  fgWAlmondCurrent = fgWAlmondFixedB[bin]; 
   return;
 }
 
@@ -1470,13 +1471,13 @@ void AliFastGlauber::PlotAlmonds() const
   gStyle->SetPalette(1,0);
   c->Divide(2,2);
   c->cd(1);
-  fgWAlmondFixedB[0].Draw("cont1");
+  fgWAlmondFixedB[0]->Draw("cont1");
   c->cd(2);
-  fgWAlmondFixedB[10].Draw("cont1");
+  fgWAlmondFixedB[10]->Draw("cont1");
   c->cd(3);
-  fgWAlmondFixedB[20].Draw("cont1");
+  fgWAlmondFixedB[20]->Draw("cont1");
   c->cd(4);
-  fgWAlmondFixedB[30].Draw("cont1");
+  fgWAlmondFixedB[30]->Draw("cont1");
   return;
 }
 
index 7717b110db11744963db655281c5c4d353fdf153..6cfe4cbb78f5d9304f4576ee9991d763b6d58e8f 100644 (file)
@@ -54,7 +54,7 @@ class AliFastGlauber : public TObject {
     const TF1* GetWSbinary()       const {return fgWSbinary;}
     const TF1* GetWSN()            const {return fgWSN;}     
     const TF1* GetWEnergyDensity() const {return fgWEnergyDensity;} 
-    const TF2* GetWAlmondFixedB(Int_t i) const {return &fgWAlmondFixedB[i];}
+    const TF2* GetWAlmondFixedB(Int_t i) const {return fgWAlmondFixedB[i];}
     
     Float_t GetWr0() const {return fWSr0;}
     Float_t GetWSd() const {return fWSd;}
@@ -192,7 +192,7 @@ class AliFastGlauber : public TObject {
     static TF1*    fgWSbinary;       // dSigma/db binary
     static TF1*    fgWSN;            // dN/db binary
     static TF1*    fgWEnergyDensity; // Energy density as a function of impact parameter
-    static TF2     fgWAlmondFixedB[40]; // Interaction Almonds read from file
+    static TF2*    fgWAlmondFixedB[40]; // Interaction Almonds read from file
     static TF2*    fgWAlmondCurrent;    // Interaction Almond used for length
     
     Float_t fWSr0;      // Wood-Saxon Parameter r0
@@ -209,7 +209,7 @@ class AliFastGlauber : public TObject {
 
     Int_t fEllDef;      // definition of length (see CalculateLength())
     TString fName;     // filename of stored distributions
-    ClassDef(AliFastGlauber,1) // Event geometry simulation in the Glauber Model
+    ClassDef(AliFastGlauber,2) // Event geometry simulation in the Glauber Model
 };
 
 #endif