]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSGeoPlot.C
Reverting the previous mods as they cause a segmentation violation
[u/mrichter/AliRoot.git] / ITS / AliITSGeoPlot.C
index b1c905ee1e0aac0e4752130cfcf5b26f98dfcbbd..ecf9def8052559a85f751c4b270705e1b675ef96 100644 (file)
@@ -7,37 +7,39 @@
 #include<TClassTable.h>
 #include<TClonesArray.h>
 #include<TFile.h>
+#include<TGeoManager.h>
 #include<TH1.h>
 #include<TH2.h>
 #include <TInterpreter.h>
 #include<TObject.h>
 #include<TObjArray.h>
 #include<TTree.h>
-#include "AliGenEventHeader.h"
-#include <AliRun.h>
-#include <AliITS.h>
-#include <AliITSgeom.h>
-#include <AliITSDetTypeRec.h>
-#include <AliITSRecPoint.h>
-#include <AliITSRecPoint.h>
-#include <AliITSdigit.h>
-#include <AliITSdigitSSD.h>
-#include <AliITShit.h>
-#include <AliITSmodule.h> 
-#include <AliITSsegmentation.h>
-#include <AliITSsegmentationSPD.h> 
-#include <AliITSsegmentationSDD.h>
-#include <AliITSsegmentationSSD.h>
-#include <AliRunLoader.h>
-#include <AliITSLoader.h>
-#include <AliHeader.h>
+#include "AliRun.h"
+#include "AliITS.h"
+#include "AliITSgeom.h"
+#include "AliITSDetTypeRec.h"
+#include "AliITSRecPoint.h"
+#include "AliITSRecPoint.h"
+#include "AliITSdigit.h"
+#include "AliITSdigitSSD.h"
+#include "AliITShit.h"
+#include "AliITSmodule.h" 
+#include "AliITSsegmentation.h"
+#include "AliITSsegmentationSPD.h" 
+#include "AliITSsegmentationSDD.h"
+#include "AliITSsegmentationSSD.h"
+#include "AliRunLoader.h"
+#include "AliITSLoader.h"
+#include "AliHeader.h"
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
 #endif
 void GetHitsCoor(TObject *its, Int_t mod, TObjArray & histos, Int_t subd,Bool_t verb);
 Int_t GetRecCoor(TObject *ge, TClonesArray *ITSrec, Int_t mod, TH2F *h2, TH1F *h1, Bool_t verb);
 Int_t GetClusCoor(TObject *ge, TClonesArray *ITSrec, Int_t mod, TH2F *h2, TH1F *h1, Bool_t verb);
 void GetDigits(TObject *tmps,TObject *ge,TClonesArray *ITSdigits, Int_t subd, Int_t mod, Bool_t verbose, TObjArray & histos);
 
-Int_t AliITSGeoPlot (Int_t evesel=0, char *opt="All+ClustersV2", char *filename="galice.root", Int_t isfastpoints = 0) {
+Int_t AliITSGeoPlot (Int_t evesel=0, char *opt="All+ClustersV2", TString filename="galice.root", Int_t isfastpoints = 0) {
   /*******************************************************************
    *  This macro displays geometrical information related to the
    *  hits, digits and rec points (or V2 clusters) in ITS.
@@ -94,19 +96,36 @@ Int_t AliITSGeoPlot (Int_t evesel=0, char *opt="All+ClustersV2", char *filename=
   Bool_t userec=choice.Contains("Rec");
   Bool_t useclustersv2=choice.Contains("ClustersV2");
   Int_t retcode=1; //return code
   if (gClassTable->GetID("AliRun") < 0) {
     gInterpreter->ExecuteMacro("loadlibs.C");
   }
   else { 
     if(gAlice){
-      delete gAlice->GetRunLoader();
+      delete AliRunLoader::Instance();
       delete gAlice;
       gAlice=0;
     }
   }
+  // Set OCDB if needed
+  AliCDBManager* man = AliCDBManager::Instance();
+  if (!man->IsDefaultStorageSet()) {
+    printf("Setting a local default storage and run number 0\n");
+    man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+    man->SetRun(0);
+  }
+  else {
+    printf("Using deafult storage \n");
+  }
+  // retrives geometry 
+  TString geof(gSystem->DirName(filename));
+  geof += "/geometry.root";
+  TGeoManager::Import(geof.Data());
+  if (!gGeoManager) {
+    cout<<"geometry not found\n";
+    return -1;
+  }
  
-  AliRunLoader* rl = AliRunLoader::Open(filename);
+  AliRunLoader* rl = AliRunLoader::Open(filename.Data());
   if (rl == 0x0){
     cerr<<"AliITSGeoPlot.C : Can not open session RL=NULL"<< endl;
     return -1;
@@ -161,9 +180,9 @@ Int_t AliITSGeoPlot (Int_t evesel=0, char *opt="All+ClustersV2", char *filename=
   cout<<"ITS modules .... DONE!"<<endl;
   
   AliITSDetTypeRec* detTypeRec = new AliITSDetTypeRec();
-  detTypeRec->SetLoader(ITSloader);
-  detTypeRec->SetITSgeom(ITS->GetITSgeom());
+  detTypeRec->SetITSgeom(ITSloader->GetITSgeom());
   detTypeRec->SetDefaults();
+
   // DIGITS
   TTree *TD = ITSloader->TreeD();
 
@@ -304,6 +323,7 @@ Int_t AliITSGeoPlot (Int_t evesel=0, char *opt="All+ClustersV2", char *filename=
   //
   // Loop on subdetectors
   // 
+  cout<<"CALL GETITSGEOM \n \n \n";
   AliITSgeom *geom = ITS->GetITSgeom();
   TString detna; // subdetector name
   for(Int_t subd=0;subd<3;subd++){
@@ -666,3 +686,4 @@ void GetDigits(TObject *tmps,TObject *ge,TClonesArray *ITSdigits, Int_t subd, In
     } // loop on digits for this module
   } // if(ndigits>0....
 }
+