]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliESDtest.C
Set run loader for modules
[u/mrichter/AliRoot.git] / STEER / AliESDtest.C
index da6ddf1dc6969590631d43f7074ea87dce105b31..b75c34e5d2133b7713233c06bc032fc9ff0e499d 100644 (file)
   #include "TFile.h"
   #include "TSystem.h"
   #include "TStopwatch.h"
-  #include "TGeant3.h"
+  #include "TArrayF.h"
 
   #include "AliMagF.h"
   #include "AliRun.h"
   #include "AliRunLoader.h"
   #include "AliLoader.h"
+  #include "AliHeader.h"
+  #include "AliGenEventHeader.h"
 
   #include "AliESD.h"
   #include "AliESDpid.h"
   #include "AliTRDPartID.h"
 
   #include "AliTOFpidESD.h"
+  #include "AliTOF.h"
+  #include "AliTOFGeometry.h"
 #endif
 
-extern TSystem *gSystem;
 extern AliRun *gAlice;
 extern TFile *gFile;
 
-Int_t AliESDtest(Int_t nev=1) {
+Int_t AliESDtest(Int_t nev=1,Int_t run=0) {
 
 /**** Initialization of the NewIO *******/
 
@@ -63,9 +66,6 @@ Int_t AliESDtest(Int_t nev=1) {
       gAlice=0;
    }
 
-   gSystem->Load("libgeant321");     // needed for the PID in TOF 
-   new TGeant3("");                  // must be re-done !
-
    AliRunLoader *rl = AliRunLoader::Open("galice.root");
    if (rl == 0x0) {
       cerr<<"Can not open session"<<endl;
@@ -109,8 +109,6 @@ Int_t AliESDtest(Int_t nev=1) {
 
    //An instance of the ITS tracker
    AliITStrackerV2 itsTracker(geom);
-   {Double_t xyz[]={0.,0.,0.}, ers[]={0.005, 0.005, 0.010};
-   itsTracker.SetVertex(xyz,ers);}
    
    //An instance of the ITS PID maker
    Double_t parITS[]={34.,0.15,10.};
@@ -191,6 +189,16 @@ Int_t AliESDtest(Int_t nev=1) {
 
 
 /**** The TOF corner ********************/
+   AliTOF *dTOF = (AliTOF*)gAlice->GetDetector("TOF");
+   if (!dTOF) {
+      cerr<<"AliESDtest.C : Can not find the TOF detector !"<<endl;
+      return 4;
+   }
+   AliTOFGeometry *tofGeo = dTOF->GetGeometry();
+   if (!tofGeo) {
+      cerr<<"AliESDtest.C : Can not find the TOF geometry !"<<endl;
+      return 4;
+   }
 
    AliLoader* tofl = rl->GetLoader("TOFLoader");
    if (tofl == 0x0) {
@@ -218,11 +226,25 @@ Int_t AliESDtest(Int_t nev=1) {
    for (Int_t i=0; i<nev; i++) {
      cerr<<"\n\nProcessing event number : "<<i<<endl;
      AliESD *event=new AliESD(); 
+     event->SetRunNumber(run);
+     event->SetEventNumber(i);
 
      rl->GetEvent(i);
  
+//***** Primary vertex reconstruction (MC vertex position, for the moment)
+     TArrayF v(3);     
+     rl->GetHeader()->GenEventHeader()->PrimaryVertex(v);
+     Double_t vtx[3]={v[0],v[1],v[2]};
+     Double_t cvtx[6]={
+       0.005,
+       0.000, 0.005,
+       0.000, 0.000, 0.010
+     };
+     event->SetVertex(vtx,cvtx);
+     cvtx[1]=cvtx[0]; cvtx[2]=cvtx[5]; //trackers use only the diag.elements
 
 //***** Initial path towards the primary vertex
+     tpcTracker.SetVertex(vtx,cvtx);
      TTree *tpcTree=tpcl->TreeR();
      if (!tpcTree) {
         cerr<<"Can't get the TPC cluster tree !\n";
@@ -231,6 +253,7 @@ Int_t AliESDtest(Int_t nev=1) {
      tpcTracker.LoadClusters(tpcTree);
      rc+=tpcTracker.Clusters2Tracks(event);
 
+     itsTracker.SetVertex(vtx,cvtx);
      TTree *itsTree=itsl->TreeR();
      if (!itsTree) {
         cerr<<"Can't get the ITS cluster tree !\n";
@@ -265,7 +288,7 @@ Int_t AliESDtest(Int_t nev=1) {
         cerr<<"Can't get the TOF cluster tree !\n";
         return 4;
      } 
-     tofPID.LoadClusters(tofTree);
+     tofPID.LoadClusters(tofTree,tofGeo);
      tofPID.MakePID(event);
      tofPID.UnloadClusters();
 
@@ -289,6 +312,7 @@ Int_t AliESDtest(Int_t nev=1) {
 
 
 //***** Hyperon reconstruction 
+     vtxer.SetVertex(vtx);
      rc+=vtxer.Tracks2V0vertices(event);            // V0 finding
      rc+=cvtxer.V0sTracks2CascadeVertices(event);   // cascade finding