]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Bug corrected in the instantiation mechanism
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 18 Jul 2000 12:07:57 +0000 (12:07 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 18 Jul 2000 12:07:57 +0000 (12:07 +0000)
PHOS/AliPHOSGeometry.cxx
PHOS/AliPHOSGeometry.h

index 63b2748c8d5f38faeb93e7f351cd08fa6ab2e87d..105bf524526929317f7e396aec7b795d6fd7b375 100644 (file)
@@ -40,6 +40,7 @@
 ClassImp(AliPHOSGeometry) ;
 
 AliPHOSGeometry * AliPHOSGeometry::fgGeom = 0 ;
+Bool_t            AliPHOSGeometry::fgInit = kFALSE ;
 
 //____________________________________________________________________________
 AliPHOSGeometry::~AliPHOSGeometry(void)
@@ -254,18 +255,17 @@ void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos)
 void AliPHOSGeometry::Init(void)
 {
   // Initializes the PHOS parameters
-  
-  fRotMatrixArray = new TObjArray(fNModules) ; 
 
   cout << "PHOS geometry setup: parameters for option " << fName << " " << fTitle << endl ;
   if ( ((strcmp( fName, "default" )) == 0)  || ((strcmp( fName, "GPS2" )) == 0) ) {
-    fInit     = kTRUE ; 
+    fgInit     = kTRUE ; 
     this->InitPHOS() ; 
     this->InitPPSD() ;
     this->SetPHOSAngles() ; 
+    fRotMatrixArray = new TObjArray(fNModules) ; 
   }
  else {
-   fInit = kFALSE ; 
+   fgInit = kFALSE ; 
    cout << "PHOS Geometry setup: option not defined " << fName << endl ; 
  }
 }
@@ -401,8 +401,14 @@ AliPHOSGeometry *  AliPHOSGeometry::GetInstance(const Text_t* name, const Text_t
     if ( strcmp(name,"") == 0 ) 
       rv = 0 ;
     else {    
-      fgGeom = new AliPHOSGeometry(name, title) ; 
-      rv = (AliPHOSGeometry * ) fgGeom ; 
+      fgGeom = new AliPHOSGeometry(name, title) ;
+      if ( fgInit )
+       rv = (AliPHOSGeometry * ) fgGeom ;
+      else {
+       rv = 0 ; 
+       delete fgGeom ; 
+       fgGeom = 0 ; 
+      }
     }
   }
   else {
index 3a9b1d15ae420eef97069151ab4f9b1ba971ff30..7ad09414656882494426b25a0c611b6ade43d0f8 100644 (file)
@@ -42,7 +42,7 @@ public:
   } 
   
   virtual ~AliPHOSGeometry(void) ; 
-  static AliPHOSGeometry * GetInstance(const Text_t* name, const Text_t* title) ; 
+  static AliPHOSGeometry * GetInstance(const Text_t* name, const Text_t* title="") ; 
   static AliPHOSGeometry * GetInstance() ; 
   virtual void  GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & gmat)  ;
   virtual void  GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos)  ; 
@@ -88,7 +88,7 @@ public:
 
   Bool_t     IsInitialized(void)                  const { 
     // 
-    return fInit ; }  
+    return fgInit ; }  
   Float_t    GetAirFilledBoxSize(Int_t index)     const { 
     // Getter
     return fAirFilledBoxSize[index] ;}
@@ -263,7 +263,6 @@ private:
   Float_t fCrystalWrapThickness ;         // Thickness of Tyvek wrapping the crystal
   Float_t fCrystalHolderThickness ;       // Titanium holder of the crystal
   Float_t fGapBetweenCrystals ;           // Total Gap between two adjacent crystals 
-  Bool_t  fInit ;                         // Tells if geometry has been succesfully set up 
   Float_t fIPtoOuterCoverDistance ;       // Distances from interaction point to outer cover 
   Float_t fIPtoCrystalSurface ;           // Distances from interaction point to Xtal surface
   Float_t fModuleBoxThickness ;           // Thickness of the thermo insulating box containing one crystals module 
@@ -312,6 +311,7 @@ private:
   Float_t fZDisplacement ;                // Z displacement of micromegas1 with respect to micromegas2  
 
   static AliPHOSGeometry * fgGeom ; // pointer to the unique instance of the singleton 
+  static Bool_t  fgInit ;            // Tells if geometry has been succesfully set up 
 
   ClassDef(AliPHOSGeometry,1)  // PHOS geometry class