Coding convention, reconstruction fill ESD
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Mar 2004 12:27:58 +0000 (12:27 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Mar 2004 12:27:58 +0000 (12:27 +0000)
START/AliSTART.cxx
START/AliSTART.h
START/AliSTARTDigitizer.cxx
START/AliSTARTDigitizer.h
START/AliSTARTv1.cxx
START/AliSTARTvertex.cxx
START/AliSTARTvertex.h

index 9097fb4..e6286d3 100755 (executable)
@@ -47,6 +47,7 @@
 #include <TRandom.h>
 #include <TTUBE.h>
 #include <TVirtualMC.h>
+#include <AliESD.h>
 
 #include "AliLoader.h"
 #include "AliRun.h"
@@ -90,7 +91,7 @@ AliSTART::AliSTART(const char *name, const char *title)
 
   fPhotons  = new TClonesArray("AliSTARThitPhoton", 10000);
   gAlice->GetMCApp()->AddHitList (fPhotons);
-  
+  if (GetDebug()>2) cout<<" Debug "<<endl;
   fIshunt     =  1;
   fIdSens   =  0;
   fNPhotons =  0;
@@ -255,15 +256,9 @@ void AliSTART::SetTreeAddress()
   
 }
 
-
-//_____________________________________________________________________________
-
-void AliSTART::Hit2digit(Int_t /*evnum*/) 
-{
-}
-
 //_____________________________________________________________________________
 AliDigitizer* AliSTART::CreateDigitizer(AliRunDigitizer* manager) const
 {
   return new AliSTARTDigitizer(manager);
 }
+
index 7e368b1..64611ba 100755 (executable)
@@ -7,11 +7,13 @@
 //  Manager and hits classes for set:START     //
 ////////////////////////////////////////////////
  
-#include "AliDetector.h"
-#include "TTree.h"
+#include <AliDetector.h>
+#include <TTree.h>
+#include "AliSTARTvertex.h"
+
 class TDirectory;
 class TFile;
-
+class AliESD;
 R__EXTERN TDirectory *  gDirectory;
  
  
@@ -36,15 +38,16 @@ public:
    virtual void   Init();
    virtual void SetHitsAddressBranch(TBranch *b1,TBranch *b2)
      {b1->SetAddress(&fHits); b2=0;}
-   void Hit2digit(Int_t iEventNum);
-   void Hit2digit(){return;}
    virtual void   MakeBranch(Option_t *opt=" ");
    virtual void   StepManager(){}
    virtual void   ResetHits();
    virtual void   SetTreeAddress();
-   TClonesArray   *Photons() {return fPhotons;}
-   
+  
+  TClonesArray   *Photons() {return fPhotons;}
+
    virtual AliDigitizer* CreateDigitizer(AliRunDigitizer* manager) const;
+   //  virtual void   Reconstruct()    const{ AliSTARTvertex reco; reco.Reconstruct();}
+    virtual void          FillESD(AliESD* pESD)  const{ AliSTARTvertex reco; reco.Reconstruct(pESD);}
 
 protected:
    Int_t fIdSens;    // Sensetive Cherenkov radiator
index 0b3497a..f33461e 100644 (file)
 
 
 #include <TTree.h> 
-#include <TVector.h>
-#include <TObjArray.h>
 #include <TFile.h>
 #include <TDirectory.h>
 #include <TRandom.h>
 #include <TArrayI.h>
-#include <TH1.h>
 #include <TError.h>
 
 
 #include "AliSTARThitPhoton.h"
 #include "AliSTARTdigit.h"
 #include "AliRunDigitizer.h"
-#include "AliHeader.h"
-#include "AliGenEventHeader.h"
+#include <AliDetector.h>
 #include "AliRun.h"
-#include "AliPDG.h"
-#include "AliLoader.h"
-#include "AliRunLoader.h"
-#include "AliSTARTLoader.h"
-
+#include <AliLoader.h>
+#include <AliRunLoader.h>
 #include <stdlib.h>
 #include <Riostream.h>
 #include <Riostream.h>
@@ -60,18 +53,25 @@ AliSTARTDigitizer::AliSTARTDigitizer(AliRunDigitizer* manager)
   //   cout<<"AliSTARTDigitizer::AliSTARTDigitizer"<<endl;
 // ctor which should be used
 //  fDebug =0;
- // if (GetDebug()>2)
-  //  cerr<<"AliSTARTDigitizer::AliSTARTDigitizer"
-   //     <<"(AliRunDigitizer* manager) was processed"<<endl;
+  if (GetDebug()>2)
+    cerr<<"AliSTARTDigitizer::AliSTARTDigitizer"
+        <<"(AliRunDigitizer* manager) was processed"<<endl;
 
+  ftimeRightTDC = new TArrayI(12); 
+  ftimeLeftTDC = new TArrayI(12); 
+  fRightADC = new TArrayI(12); 
+  fLeftADC = new TArrayI(12); 
 }
 
 //------------------------------------------------------------------------
 AliSTARTDigitizer::~AliSTARTDigitizer()
 {
 // Destructor
-
-
+  if(GetDebug()) Info("dtor","START"); 
+  delete ftimeRightTDC;
+  delete ftimeLeftTDC;
+  delete fRightADC;
+  delete fLeftADC;
 }
 
  //------------------------------------------------------------------------
@@ -88,24 +88,32 @@ Bool_t AliSTARTDigitizer::Init()
 void AliSTARTDigitizer::Exec(Option_t* /*option*/)
 {
 
+  /*
+    Produde digits from hits
+        digits is TObject and includes
+       We are writing array if left & right  TDC
+       left & right  ADC (will need for slow simulation)
+       TOF first particle left & right
+       mean time and time difference (vertex position)
+       
+  */
 
   AliRunLoader *inRL, *outRL;//in and out Run Loaders
-  AliLoader *ingime, *outgime;// in and out ITSLoaders
+  AliLoader *pInStartLoader, *pOutStartLoader;// in and out STARTLoaders
 
   outRL = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
-  outgime = outRL->GetLoader("STARTLoader");
+  pOutStartLoader = outRL->GetLoader("STARTLoader");
 
 #ifdef DEBUG
-  cout<<"AliSTARTDigitizer::>SDigits2Digits start...\n";
+  cout<<"AliSTARTDigitizer::>Hits2Digits start...\n";
 #endif
   //
   // From hits to digits
   //
   Int_t hit, nhits;
-  Int_t CountEr[13],CountEl[13];                                                       //!!!
+  Float_t meanTime;
+  Int_t countEr[13],countEl[13];
   Int_t volume,pmt,tr,tl,sumRight;
-  Float_t timediff,timeav;
-  Float_t besttimeright,besttimeleft,meanTime;
   Int_t  bestRightADC,bestLeftADC;
   Float_t besttimeleftGaus, besttimerightGaus;
   Float_t timeright[13]={13*0};
@@ -114,20 +122,12 @@ void AliSTARTDigitizer::Exec(Option_t* /*option*/)
   Int_t channelWidthADC=1; //ps
   //  Int_t thresholdAmpl=10;
 
-  ftimeRightTDC = new TArrayI(12); 
-  ftimeLeftTDC = new TArrayI(12); 
-  fRightADC = new TArrayI(12); 
-  fLeftADC = new TArrayI(12); 
   
   inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0));
-  inRL->LoadgAlice();
   
-  //  fHits = new TClonesArray ("AliSTARThit", 1000);
-  fPhotons = new TClonesArray ("AliSTARThitPhoton", 10000);                    //!!!
-  AliSTART *START  = (AliSTART*) gAlice->GetDetector("START");
+
+  AliSTART *fSTART  = (AliSTART*) inRL->GetAliRun()->GetDetector("START");
   AliSTARThit  *startHit;
-  //use if Cherenkov photons
-  //  AliSTARThitPhoton  *startHitPhoton;                                              //!!!
   TBranch *brHits=0;
   TBranch *brHitPhoton=0;
   fdigits= new AliSTARTdigit();
@@ -135,65 +135,42 @@ void AliSTARTDigitizer::Exec(Option_t* /*option*/)
   Int_t nFiles=fManager->GetNinputs();
   for (Int_t inputFile=0; inputFile<nFiles;  inputFile++) {
 
-    besttimeright=9999.;
-    besttimeleft=9999.;
-    Int_t timeDiff=0;
-    Int_t timeAv=0;
+    Float_t besttimeright=9999.;
+    Float_t besttimeleft=9999.;
+    Int_t iTimeDiff=0;
+    Int_t iTimeAv=0;
+    Float_t timeDiff,timeAv; 
     sumRight=0;
     for (Int_t i0=0; i0<13; i0++)
       {
        timeright[i0]=0; timeleft[i0]=0;
-       CountEr[i0]=0;   CountEl[i0]=0;
+       countEr[i0]=0;   countEl[i0]=0;
       }
 
     inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile));
-    ingime = inRL->GetLoader("STARTLoader");
-    ingime->LoadHits("READ");//probably it is necessary to load them before
-    outgime->LoadDigits("UPDATE");//probably it is necessary to load them before
-    //use if Cherenkov photons
-    //  TClonesArray *STARThitsPhotons = START->Photons ();
-    TClonesArray *fHits = START->Hits ();
-    //    cout<<" Load  "<<AliSTARTLoader::LoadDigits()<<endl;
+    pInStartLoader = inRL->GetLoader("STARTLoader");
+    pInStartLoader->LoadHits("READ");//probably it is necessary to load them before
+    pOutStartLoader->LoadDigits("UPDATE");//probably it is necessary to load them before
+    TClonesArray *fHits = fSTART->Hits ();
 
-    TTree *th = ingime->TreeH();
+    TTree *th = pInStartLoader->TreeH();
     brHits = th->GetBranch("START");
     brHitPhoton = th->GetBranch("STARThitPhoton");
     if (brHits) {
-      START->SetHitsAddressBranch(brHits,brHitPhoton);
+      fSTART->SetHitsAddressBranch(brHits,brHitPhoton);
     }else{
       cerr<<"EXEC Branch START hit not found"<<endl;
       exit(111);
     } 
     Int_t ntracks    = (Int_t) th->GetEntries();
-    cout<<" ntracks "<<ntracks<<endl;
-    if (ntracks<=0) return;
-    // Start loop on tracks in the photon hits containers 
-    // for amplitude
-    /*
-    if(brHitPhoton) {
-      cout<<"brHitPhoton "<<endl; 
-      for (Int_t track=0; track<ntracks;track++) {
-       brHitPhoton -> GetEntry(track);;
-       nhits = STARThitsPhotons->GetEntriesFast();
-       for (hit=0;hit<nhits;hit++) {
-         startHitPhoton   = (AliSTARThitPhoton*) 
-          STARThitsPhotons ->UncheckedAt(hit);
-         pmt=startHitPhoton->fPmt;
-         volume = startHitPhoton->fArray;
-         if(RegisterPhotoE(startHitPhoton)) 
-           {
-             if (volume == 1) CountEr[pmt]++;
-             if (volume == 2) CountEl[pmt]++;
-           }
-       } //hit photons
-      } //track photons
-    } // was photons
-    */
+#ifdef DEBUG
+   Info("Digitizer",ntracks);
+#endif
+     if (ntracks<=0) return;
     // Start loop on tracks in the hits containers
     for (Int_t track=0; track<ntracks;track++) {
       brHits->GetEntry(track);
       nhits = fHits->GetEntriesFast();
-      //  cout<<" brHits hits "<<nhits<<endl;
       for (hit=0;hit<nhits;hit++) {
        startHit   = (AliSTARThit*) fHits->UncheckedAt(hit);
        if (!startHit) {
@@ -205,17 +182,15 @@ void AliSTARTDigitizer::Exec(Option_t* /*option*/)
        if(volume==1){
          timeright[pmt] = startHit->Time();
          if(timeright[pmt]<besttimeright)
-           //&&CountEr[pmt-1]>thresholdAmpl)
            {
-           besttimeright=timeright[pmt];
+             besttimeright=timeright[pmt];
          } //timeright
        }//time for right shoulder
        if(volume==2){            
          timeleft[pmt] = startHit->Time();
          if(timeleft[pmt]<besttimeleft)
-           //&&CountEl[pmt-1]>thresholdAmpl) 
            {
-           besttimeleft=timeleft[pmt];
+             besttimeleft=timeleft[pmt];
            
          } //timeleftbest
        }//time for left shoulder
@@ -223,45 +198,38 @@ void AliSTARTDigitizer::Exec(Option_t* /*option*/)
     } //track loop
   
     // z position
-    cout<<" right time  "<<besttimeright<<
-      " right distance "<<besttimeright*30<<endl;;
-    cout<<" left time  "<<besttimeleft<<
-      " left distance "<<besttimeleft*30<<endl;;
-  
 
     //folding with experimental time distribution
     
-    besttimeleftGaus=gRandom->Gaus(besttimeright,0.05);
-    cout<<" besttimeleftGaus "<<besttimeleftGaus<<endl;
-    bestLeftADC=Int_t (besttimeleftGaus*1000/channelWidth);
     Float_t koef=69.7/350.;
-    besttimeright=koef*besttimeleft;
-    besttimerightGaus=gRandom->Gaus(besttimeleft,0.05);
-    
+    besttimeright=koef*besttimeright;
+    besttimeleftGaus=gRandom->Gaus(besttimeleft,0.05);
+    bestLeftADC=Int_t (besttimeleftGaus*1000/channelWidth);
+    besttimerightGaus=gRandom->Gaus(besttimeright,0.05);
     bestRightADC=Int_t (besttimerightGaus*1000/channelWidth);
-    timediff=besttimerightGaus-besttimeleftGaus;
-    cout<<" timediff in ns "<<timediff<<" z= "<<timediff*30<<endl;
+    timeDiff=besttimerightGaus-besttimeleftGaus;
+#ifdef DEBUG
+    cout<<" timediff in ns "<<timeDiff<<" z= "<<timeDiff*30<<endl;
+#endif
     meanTime=(besttimerightGaus+besttimeleftGaus)/2.;
-    if ( TMath::Abs(timediff)<TMath::Abs(0.3) ) 
+    if ( TMath::Abs(timeDiff)<TMath::Abs(0.3) ) 
       {
        Float_t t1=1000.*besttimeleftGaus;
        Float_t t2=1000.*besttimerightGaus;
        t1=t1/channelWidth;   //time in ps to channelWidth
        t2=t2/channelWidth;   //time in ps to channelWidth
-       timeav=(t1+t2)/2.;
+       timeAv=(t1+t2)/2.;// time  channel numbres
        
        // Time to TDC signal
        // 256 channels for timediff, range 1ns
-       
-       timediff=512+1000*timediff/channelWidth; // time in ps 
-       
-       timeAv = (Int_t)(timeav);   // time  channel numbres
-       timeDiff = (Int_t)(timediff); // time  channel numbres
+       iTimeAv=(Int_t)timeAv; 
+       timeDiff= 512+1000*timeDiff/channelWidth; // time  channel numbres 
+       iTimeDiff=(Int_t)timeDiff;
        //       fill digits
        fdigits->SetTimeBestLeft(bestLeftADC);
        fdigits->SetTimeBestRight(bestRightADC);
-       fdigits->SetMeanTime(timeAv);
-       fdigits->SetTimeDiff(timeDiff);
+       fdigits->SetMeanTime(iTimeAv);
+       fdigits->SetTimeDiff(iTimeDiff);
        for (Int_t i=0; i<12; i++)
          {
            //  fill TDC
@@ -275,17 +243,16 @@ void AliSTARTDigitizer::Exec(Option_t* /*option*/)
            ftimeRightTDC->AddAt(tr,i);
            ftimeLeftTDC->AddAt(tl,i);
            //fill ADC
-           Int_t al=( Int_t ) CountEl[i+1]/ channelWidthADC;
-           Int_t ar=( Int_t ) CountEr[i+1]/ channelWidthADC;
+           Int_t al=( Int_t ) countEl[i+1]/ channelWidthADC;
+           Int_t ar=( Int_t ) countEr[i+1]/ channelWidthADC;
            fRightADC->AddAt(ar,i);
            fLeftADC ->AddAt(al,i);
-           sumRight+=CountEr[i+1];
+           sumRight+=countEr[i+1];
          }
        fdigits->SetTimeRight(*ftimeRightTDC);
        fdigits->SetTimeLeft(*ftimeLeftTDC);
        fdigits->SetADCRight(*fRightADC);
        fdigits->SetADCLeft(*fLeftADC);
-       // cout<<" before sum"<<endl;
        fdigits->SetSumADCRight(sumRight);
       }
     else
@@ -293,26 +260,24 @@ void AliSTARTDigitizer::Exec(Option_t* /*option*/)
 
 // trick to find out output dir:
 
-    Char_t nameDigits[20];
-    sprintf(nameDigits,"START_D_%d",fManager->GetOutputEventNr());
     TDirectory *wd = gDirectory;
-    outgime->GetDigitsDataLoader()->GetDirectory()->cd();
-    fdigits->Write(nameDigits);
+    pOutStartLoader->GetDigitsDataLoader()->GetDirectory()->cd();
+    fdigits->Write("START_D");
     wd->cd();
-
-    //    outgime->WriteDigits("OVERWRITE");
-  }
+    pInStartLoader->UnloadHits();
+    pOutStartLoader->UnloadDigits();
+  } //event loop
 }
 
 
 //------------------------------------------------------------------------
 Bool_t AliSTARTDigitizer::RegisterPhotoE(/*AliSTARThitPhoton *hit*/)
 {
-    Double_t    P = 0.2;    
+    Double_t    pP = 0.2;    
     Double_t    p;
     
     p = gRandom->Rndm();
-    if (p > P)
+    if (p > pP)
       return kFALSE;
     
     return kTRUE;
index 5235080..c0e4e38 100644 (file)
@@ -3,11 +3,11 @@
 /* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-#include "AliDigitizer.h"
-#include "AliLoader.h"
-#include "AliRunLoader.h"
+#include <AliDigitizer.h>
+#include <AliLoader.h>
+#include <AliRunLoader.h>
 
-class AliRunDigitizer;
+#include <AliRunDigitizer.h>
 class AliSTART;
 class AliSTARThit;
 class AliSTARThitPhoton;
@@ -22,25 +22,27 @@ class AliSTARTDigitizer : public AliDigitizer {
   virtual Bool_t Init();
   TClonesArray *Hits() const {return fHits;}
   TClonesArray *Photons() const {return fPhotons;}
-  //  TArrayI *timeRightADC() {return ftimeRightADC;}
-  // TArrayI *timeLeftADC() {return ftimeLeftADC;}
+  TArrayI *timeRightTDC() {return ftimeRightTDC;} //for slow simulation
+  TArrayI *timeLeftTDC() {return ftimeLeftTDC;}
+  TArrayI *RightADC() {return fRightADC;} //for slow simulation
+  TArrayI *LeftADC() {return fLeftADC;}
   // Do the main work
   void Exec (Option_t* /*option=0*/) ;
-  Bool_t RegisterPhotoE(/*AliSTARThitPhoton *hit*/);                   //!!!
-
+  Bool_t RegisterPhotoE(/*AliSTARThitPhoton *hit*/);//!!!
+  Bool_t GetDebug() const {return fManager->GetDebug();}
   enum {kBgTag = -1};
 
 private:
 
-  AliSTART *START;
-  TClonesArray *fPhotons   ;                                           //!!! 
-  TClonesArray *fHits      ; // List of summable digits
+  AliSTART *fSTART;
+  TClonesArray *fPhotons   ; //Number of Cherenkov photons                   
+  TClonesArray *fHits      ; // List of hits
   AliSTARTdigit *fdigits   ; // digits
-  TArrayI *ftimeRightTDC    ;
-  TArrayI *ftimeLeftTDC     ;
-  TArrayI *fRightADC    ;
-  TArrayI *fLeftADC     ;
-     
+  TArrayI *ftimeRightTDC    ; //array of TDC signal from right sida
+  TArrayI *ftimeLeftTDC     ; ////array of TDC signal from left side
+  TArrayI *fRightADC    ;   //array of ADC signal from right sida 
+  TArrayI *fLeftADC     ;//array of ADC signal from left sida
+  
     ClassDef(AliSTARTDigitizer,0)
 };    
 #endif
index 02f3337..ae8ba1a 100755 (executable)
@@ -146,37 +146,41 @@ void AliSTARTv1::CreateGeometry()
     ppcon[22] =   4.9;
     ppcon[23] =   5.1;
 
-    
 /// 8
-    ppcon[24]  = ppcon[21];
+    ppcon[24]  = ppcon[21]+0.01;
     ppcon[25] =   3.15;
     ppcon[26] =   3.25;
     
-//  9
-    ppcon[27]  = ppcon[24]+4.5;
+/// 9
+    ppcon[27]  = ppcon[24];
     ppcon[28] =   3.15;
     ppcon[29] =   3.25;
-
+    
 //  10
-    ppcon[30] = ppcon[27];
+    ppcon[30]  = ppcon[27]+4.5;
     ppcon[31] =   3.15;
     ppcon[32] =   3.25;
 
 //  11
-    ppcon[33]  = ppcon[27];
+    ppcon[33] = ppcon[30];
     ppcon[34] =   3.15;
-    ppcon[35] =   7.6;
+    ppcon[35] =   3.25;
 
 //  12
-    ppcon[36]  = ppcon[33]+0.4;
+    ppcon[36]  = ppcon[33];
     ppcon[37] =   3.15;
     ppcon[38] =   7.6;
 
 //  13
-    ppcon[39]  = ppcon[36];
+    ppcon[39]  = ppcon[33]+0.4;
     ppcon[40] =   3.15;
     ppcon[41] =   7.6;
 
+//  14
+//    ppcon[39]  = ppcon[36];
+//    ppcon[40] =   3.15;
+//    ppcon[41] =   7.6;
+
     gMC->Gsvolu("0SUP", "PCON", idtmed[kAir], ppcon,42);
     z=-69.7;//-14.1/2;
     gMC->Gspos("0SUP",1,"ALIC",0.,0.,z,idrotm[901],"ONLY");
@@ -550,7 +554,7 @@ void AliSTARTv1::DrawDetector()
   gMC->SetClipBox(".");
   gMC->SetClipBox("*",0,1000,-1000,1000,-1000,1000);
   gMC->DefaultRange();
-  gMC->Gdraw("alic",40,30,0,12,9.5,.7,0.7);
+  gMC->Gdraw("alic",90,0,0,-35,9.5,.6,0.6);
   gMC->Gdhead(1111,"T-Zero detector");
   gMC->Gdopt("hide","off");
 }
index 840764c..d2646c4 100644 (file)
 #include <TDirectory.h>
 #include <TVirtualMC.h>
 
-#include "AliRun.h"
+#include <AliRun.h>
+#include <AliRunLoader.h>
 #include "AliSTART.h"
 #include "AliSTARTdigit.h"
 #include "AliSTARThit.h"
 #include "AliSTARTvertex.h"
+#include <AliESD.h>
 
 ClassImp(AliSTARTvertex)
 
@@ -37,11 +39,11 @@ AliSTARTvertex::AliSTARTvertex( Int_t * Zposit)
   // The order of the elements in the vertex array are
   //  fZposition = vertex[0],
   //
-
   Zposit = &fZposition ;
 }
 
-void AliSTARTvertex::Reconstruct() 
+void AliSTARTvertex::Reconstruct(AliESD *pESD) 
 {
   /***************************************************
   Resonstruct digits to vertex position
@@ -49,73 +51,58 @@ void AliSTARTvertex::Reconstruct()
 
   Int_t timediff;
   Float_t timePs;
-  char nameTD[8],nameTR[8];
- char filename[100];
-  sprintf(filename,"galice.root");
-  AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read");
+  
+  
+  AliRunLoader* rl = AliRunLoader::Open("galice.root");
+    //,AliConfig::fgkDefaultEventFolderName,"read");
   if (rl == 0x0)
    {
      cerr<<"Can not open session for file galice.root\n";
      return;
    }
-
-  rl->LoadgAlice();
-  gAlice = rl->GetAliRun();
-  
-  //  AliSTART* START  = (AliSTART *)gAlice->GetDetector("START");
   
-  rl->LoadHeader();
-  rl->LoadKinematics("READ");
-
-  AliLoader* lstart = rl->GetLoader("STARTLoader");
-  lstart->LoadDigits("READ");
-  AliSTARTdigit *digits;
-  AliSTARTvertex *fvertex;
+#ifdef DEBUG
+ Info("Reconstruct","START!!!");
+#endif
+  AliLoader* pStartLoader = rl->GetLoader("STARTLoader");
  
-  digits = new AliSTARTdigit();
-  fvertex = new AliSTARTvertex();
-
  // Event ------------------------- LOOP  
    
-  // gAlice->GetEvent(evNumber);
+
   Int_t iNevents=rl->GetNumberOfEvents();
-  cout<<"  nevents   "<<iNevents<<endl;
   
-  for (Int_t evNumber=0; evNumber<iNevents; evNumber++){
+  for (Int_t evNumber=0; evNumber<iNevents; evNumber++)
+    {
     rl->GetEvent(evNumber);
-    lstart->LoadDigits("READ");
-    gDirectory->ls();
-
-    sprintf(nameTD,"START_D_%d",evNumber);
-    TObject *td = (TObject*)gDirectory->Get(nameTD);
-    printf("%s\n",nameTD);
-    //   td->Dump();
-    if (!td) {
-      cerr<<"something wrong with input...."<<endl;
-      exit(111);
-    }
-    td->Read(nameTD);
-    digits->Read(nameTD);
-    if(digits->GetTimeDiff()<TMath::Abs(1000))
+  pStartLoader ->LoadDigits("READ");
+
+#ifdef DEBUG
+  gDirectory->ls();
+#endif
+    AliSTARTdigit* pDigits=(AliSTARTdigit*)gDirectory->Get("START_D");
+
+#ifdef DEBUG
+    pDigits->Dump();
+#endif  
+     if(pDigits->GetTimeDiff()<TMath::Abs(1000))
       {
-       timediff=digits->GetTimeDiff();     //time in number of channels
+       timediff=pDigits->GetTimeDiff();     //time in number of channels
        timePs=(512-timediff)*2.5;       // time in Ps channel_width =10ps
-       cout<<"timediff "<< timediff<<" timePs "<<timePs<<endl;
        // Float_t c = 299792458/1.e9;  //speed of light cm/ps
        Float_t c = 0.3;  //speed of light mm/ps
        Float_t Zposit=timePs*c;// for 0 vertex
-       cout<<" Zposit "<<Zposit<<endl;
-       fvertex->Set((Int_t) Zposit);
-      }
-    lstart->LoadRecPoints("UPDATE");
-    sprintf(nameTR,"START_R_%d",evNumber);
-    printf("%s\n",nameTR);
-    fvertex->Write(nameTR);
-
-
-  }
-}
+#ifdef DEBUG
+       cout<<"timediff "<< timediff<<" timePs "<<timePs<<" Zposit "<<Zposit<<endl;
+#endif 
+       pESD->SetT0zVertex(Zposit);
+
+#ifdef DEBUG
+       cout<<" vertex in ESD "<< pESD->GetT0zVertex()<<endl;
+#endif
+      } // vertex in 3 sigma
+     
+    } //event loop
+ }
 
 
 
index eea93d2..4d4256b 100644 (file)
@@ -4,7 +4,10 @@
  * See cxx source for full Copyright notice                               */
 
 /* $Id$ */
-#include "AliSTART.h"
+
+
+
+#include <AliESD.h>
 
 //___________________________________________
 class AliSTARTvertex   : public TObject {
@@ -12,12 +15,12 @@ class AliSTARTvertex   : public TObject {
 
 ////////////////////////////////////////////////////////////////////////
  private:
-  Int_t fZposition;        // Z position of vertex
-
+  Int_t fZposition;        // Z position of vertex (mm)
+ AliRunLoader* fRunLoader;
  public:
     AliSTARTvertex() {}
     AliSTARTvertex(Int_t *);
-    void Reconstruct();
+    void Reconstruct(AliESD *pESD);
     Int_t GetVertex();
     virtual ~AliSTARTvertex() {}
     void Set(Int_t);