]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSGeoPlot.C
doxy: install-doxygen target
[u/mrichter/AliRoot.git] / ITS / AliITSGeoPlot.C
index 45f6c19893f1da77817b6d33760c2224d890f370..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 <AliITSclusterV2.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,16 +180,15 @@ 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();
 
   //RECPOINTS (V2 clusters)
   TTree *TR = ITSloader->TreeR();
   TClonesArray *ITSrec  = detTypeRec->RecPoints();
-  TClonesArray *ITScl   = detTypeRec->ClustersV2();
   TBranch *branch = 0;
   if(userec && TR && ITSrec){
     if(isfastpoints==1){
@@ -189,9 +207,9 @@ Int_t AliITSGeoPlot (Int_t evesel=0, char *opt="All+ClustersV2", char *filename=
     cout<<"WARNING: there are no RECPOINTS on this file ! \n";
     cout<<"======================================================= \n \n";
   }
-  if(useclustersv2 && TR && ITScl){
-    branch = ITSloader->TreeR()->GetBranch("Clusters");
-    if(branch)branch->SetAddress(&ITScl);
+  if(useclustersv2 && TR && ITSrec){
+    branch = ITSloader->TreeR()->GetBranch("ITSRecPoints");
+    if(branch)branch->SetAddress(&ITSrec);
   }
 
   if(useclustersv2 && (!TR || !ITSrec || !branch)){
@@ -305,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++){
@@ -360,11 +379,11 @@ Int_t AliITSGeoPlot (Int_t evesel=0, char *opt="All+ClustersV2", char *filename=
           nrecp=GetRecCoor(geom,ITSrec,mod,bidi,uni,verbose);
         }
         if(useclustersv2){
-          detTypeRec->ResetClustersV2();
+          detTypeRec->ResetRecPoints();
           branch->GetEvent(mod);
           TH2F *bidi=(TH2F*)histos.At(6+subd*9);
           TH1F *uni=(TH1F*)histos.At(7+subd*9);
-          nrecp=GetClusCoor(geom,ITScl,mod,bidi,uni,verbose);
+          nrecp=GetClusCoor(geom,ITSrec,mod,bidi,uni,verbose);
          
         }
      
@@ -495,7 +514,7 @@ Int_t GetClusCoor(TObject *ge, TClonesArray *ITSrec, Int_t mod, TH2F *h2, TH1F *
       cout<<"Number of CLUSTERS for module "<<mod<<": "<<nrecp<<endl;
     }
     for(Int_t irec=0;irec<nrecp;irec++) {
-      AliITSclusterV2 *recp = (AliITSclusterV2*)ITSrec->At(irec);
+      AliITSRecPoint *recp = (AliITSRecPoint*)ITSrec->At(irec);
       Double_t rot[9];     
       geom->GetRotMatrix(mod,rot);
       Int_t lay,lad,det;   
@@ -538,8 +557,8 @@ Int_t GetRecCoor(TObject *ge, TClonesArray *ITSrec, Int_t mod, TH2F *h2, TH1F *h
     }
     for(Int_t irec=0;irec<nrecp;irec++) {
       AliITSRecPoint *recp = (AliITSRecPoint*)ITSrec->At(irec);
-      lc[0]=recp->GetX();
-      lc[2]=recp->GetZ();
+      lc[0]=recp->GetDetLocalX();
+      lc[2]=recp->GetDetLocalZ();
       geom->LtoG(mod,lc,gc);
       if(verb){
         cout<<"recp # "<<irec<<" local coordinates. lx= "<<lc[0]<<" lz= ";
@@ -667,3 +686,4 @@ void GetDigits(TObject *tmps,TObject *ge,TClonesArray *ITSdigits, Int_t subd, In
     } // loop on digits for this module
   } // if(ndigits>0....
 }
+