#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)
// The order of the elements in the vertex array are
// fZposition = vertex[0],
//
-
+
Zposit = &fZposition ;
}
-void AliSTARTvertex::Reconstruct(Int_t evNumber=1)
+void AliSTARTvertex::Reconstruct(AliESD *pESD)
{
/***************************************************
Resonstruct digits to vertex position
Int_t timediff;
Float_t timePs;
- char nameTD[8],nameTR[8];
-
- AliSTARTdigit *digits;
- AliSTARTvertex *fvertex;
+
+
+ AliRunLoader* rl = AliRunLoader::Open("galice.root");
+ //,AliConfig::fgkDefaultEventFolderName,"read");
+ if (rl == 0x0)
+ {
+ cerr<<"Can not open session for file galice.root\n";
+ return;
+ }
+
+#ifdef DEBUG
+ Info("Reconstruct","START!!!");
+#endif
+ AliLoader* pStartLoader = rl->GetLoader("STARTLoader");
- digits = new AliSTARTdigit();
- fvertex = new AliSTARTvertex();
-
// Event ------------------------- LOOP
- // gAlice->GetEvent(evNumber);
- sprintf(nameTD,"START_D_%d",evNumber);
- TObject *td = (TObject*)gDirectory->Get(nameTD);
- printf("%s\n",nameTD);
+ Int_t iNevents=rl->GetNumberOfEvents();
- if (!td) {
- cerr<<"something wrong with output...."<<endl;
- exit(111);
- }
- td->Read(nameTD);
- digits->Read(nameTD);
- if(digits->GetTimeDiff()<TMath::Abs(1000))
+ for (Int_t evNumber=0; evNumber<iNevents; evNumber++)
{
- timediff=digits->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);
- }
- sprintf(nameTR,"START_R_%d",evNumber);
- printf("%s\n",nameTR);
- fvertex->Write(nameTR);
-}
+ rl->GetEvent(evNumber);
+ 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=pDigits->GetTimeDiff(); //time in number of channels
+ timePs=(512-timediff)*2.5; // time in Ps channel_width =10ps
+ // 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
+#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
+ }