]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added protection in case gGeoManager is a null pointer
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Apr 2008 10:31:04 +0000 (10:31 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Apr 2008 10:31:04 +0000 (10:31 +0000)
ITS/AliITS.cxx
ITS/AliITS.h
ITS/AliITSLoader.cxx
ITS/AliITSQASDDDataMakerSim.cxx

index 9d804f56147752d5e2f26fca731e5c694b77f1c1..64b386e8bb18e26fba84146ca74724cbbaca21cd 100644 (file)
@@ -538,7 +538,7 @@ void AliITS::FillModules(TTree *treeH, Int_t mask) {
 }
 
 //______________________________________________________________________
-void AliITS::InitModules(Int_t size,Int_t &nmodules){
+Bool_t AliITS::InitModules(Int_t size,Int_t &nmodules){
     // Initialize the modules array.
     // Inputs:
     //      Int_t size  Size of array of the number of modules to be
@@ -556,7 +556,7 @@ void AliITS::InitModules(Int_t size,Int_t &nmodules){
 
     if(!fDetTypeSim) {
       Error("InitModules","fDetTypeSim is null!");
-      return;
+      return kFALSE;
     }
 
     Int_t nl,indexMAX,index;
@@ -564,7 +564,7 @@ void AliITS::InitModules(Int_t size,Int_t &nmodules){
     if(size<=0){ // default to using data stored in AliITSgeom
         if(fDetTypeSim->GetITSgeom()==0) {
             Error("InitModules","fITSgeom not defined");
-            return;
+            return kFALSE;
         } // end if fITSgeom==0
         nl = fDetTypeSim->GetITSgeom()->GetNlayers();
         indexMAX = fDetTypeSim->GetITSgeom()->GetIndexMax();
@@ -581,6 +581,7 @@ void AliITS::InitModules(Int_t size,Int_t &nmodules){
 
         nmodules = size;
     } // end i size<=0
+    return kTRUE;
 }
 //______________________________________________________________________
 void AliITS::Hits2SDigits(){
index 0e761f5d62704d97c90d28ddc972646cede349fc..e7527b484aa6caf79c1423c27147f825b5b0f58c 100644 (file)
@@ -97,7 +97,7 @@ class AliITS : public AliDetector {
     //------------ sort hits by module for Digitisation ----------------
     virtual void FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
                             Option_t *opt, const char *filename); 
-    virtual void InitModules(Int_t size,Int_t &nmodules);  
+    virtual Bool_t InitModules(Int_t size,Int_t &nmodules);  
     virtual void FillModules(TTree *treeH, Int_t mask = 0);
     virtual void ClearModules(){if(fITSmodules) fITSmodules->Delete();}
     virtual void AddHit(Int_t track, Int_t *vol, Float_t *hits);
index f71de800175622591e8b4aa1362d44c5dcabfc24..c1ed5709c44c31a9229f5018c01152fbf31a4817 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <TClonesArray.h>
 #include <TClass.h>
+#include <TGeoManager.h>
 
 #include "AliITSdigit.h"
 #include "AliITSLoader.h"
@@ -329,6 +330,10 @@ AliITSgeom* AliITSLoader::GetITSgeom(Bool_t force) {
     delete fGeom;
     fGeom = 0;
   }
+  if(!gGeoManager){
+    AliError("gGeoManager is a null pointer - ITS geometry not built");
+    return fGeom;
+  }
   AliITSInitGeometry initgeom;
   fGeom = initgeom.CreateAliITSgeom();
   AliDebug(1,"AliITSgeom object has been initialized from TGeo\n");
index 274d02fdb2f0d0c44ac0501bc7f4b53acece90df..a5083176500df144dfaf55b404c90456ea132228 100644 (file)
@@ -13,6 +13,8 @@
  * provided "as is" without express or implied warranty.                  *\r
  **************************************************************************/\r
 \r
+/* $Id$ */\r
+\r
 //  *************************************************************\r
 //  Checks the quality assurance \r
 //  by comparing with reference data\r
@@ -133,7 +135,7 @@ void AliITSQASDDDataMakerSim::InitDigits()
 void AliITSQASDDDataMakerSim::MakeDigits(TTree * digits)\r
 { \r
   // Fill QA for DIGIT - SDD -\r
-  //printf("AliITSQASDDDataMakerSim::MakeDigits called \n");\r
+  //  printf("AliITSQASDDDataMakerSim::MakeDigits called \n");\r
   AliITS *fITS  = (AliITS*)gAlice->GetModule("ITS");\r
   fITS->SetTreeAddress();\r
   TClonesArray *iITSdigits  = fITS->DigitsAddress(1);\r
@@ -189,7 +191,7 @@ void AliITSQASDDDataMakerSim::InitSDigits()
 void AliITSQASDDDataMakerSim::MakeSDigits(TTree * sdigits)\r
 { \r
   // Fill QA for SDIGIT - SDD -\r
-  //printf("AliITSQASDDDataMakerSim::MakeSDigits called \n");\r
+  //  printf("AliITSQASDDDataMakerSim::MakeSDigits called \n");\r
   AliITSsegmentationSDD* seg = new AliITSsegmentationSDD();\r
   Int_t nan=seg->Npz();\r
   Int_t ntb=seg->Npx();\r
@@ -265,8 +267,10 @@ void AliITSQASDDDataMakerSim::MakeHits(TTree * hits)
   AliITS *fITS  = (AliITS*)gAlice->GetModule("ITS");\r
   fITS->SetTreeAddress();\r
   Int_t nmodules;\r
-  fITS->InitModules(-1,nmodules);\r
-  //fITS->FillModules(0,0,nmodules," "," ");\r
+  if(!(fITS->InitModules(-1,nmodules))){\r
+    AliError("ITS geometry not available - nothing done");\r
+    return;\r
+  }\r
  \r
   fITS->FillModules(hits,0);\r
 \r