1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 #include <Riostream.h>
21 #include <TDirectory.h>
22 #include <TVirtualMC.h>
26 #include "AliSTARTdigit.h"
27 #include "AliSTARThit.h"
28 #include "AliSTARTvertex.h"
30 ClassImp(AliSTARTvertex)
32 AliSTARTvertex::AliSTARTvertex( Int_t * Zposit)
35 // The creator for the AliSTARTvertex class. This routine fills the
36 // AliSTARTvertex data members from the array vertex.
37 // The order of the elements in the vertex array are
38 // fZposition = vertex[0],
41 Zposit = &fZposition ;
44 void AliSTARTvertex::Reconstruct()
46 /***************************************************
47 Resonstruct digits to vertex position
48 ****************************************************/
52 char nameTD[8],nameTR[8];
54 sprintf(filename,"galice.root");
55 AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::fgkDefaultEventFolderName,"read");
58 cerr<<"Can not open session for file galice.root\n";
63 gAlice = rl->GetAliRun();
65 AliSTART* START = (AliSTART *)gAlice->GetDetector("START");
68 rl->LoadKinematics("READ");
70 AliLoader* lstart = rl->GetLoader("STARTLoader");
71 lstart->LoadDigits("READ");
73 AliSTARTdigit *digits;
74 AliSTARTvertex *fvertex;
76 digits = new AliSTARTdigit();
77 fvertex = new AliSTARTvertex();
79 // Event ------------------------- LOOP
81 // gAlice->GetEvent(evNumber);
82 Int_t iNevents=rl->GetNumberOfEvents();
83 cout<<" nevents "<<iNevents<<endl;
85 for (Int_t evNumber=0; evNumber<iNevents; evNumber++){
86 rl->GetEvent(evNumber);
87 lstart->LoadDigits("READ");
90 sprintf(nameTD,"START_D_%d",evNumber);
91 TObject *td = (TObject*)gDirectory->Get(nameTD);
92 printf("%s\n",nameTD);
95 cerr<<"something wrong with input...."<<endl;
100 if(digits->GetTimeDiff()<TMath::Abs(1000))
102 timediff=digits->GetTimeDiff(); //time in number of channels
103 timePs=(512-timediff)*2.5; // time in Ps channel_width =10ps
104 cout<<"timediff "<< timediff<<" timePs "<<timePs<<endl;
105 // Float_t c = 299792458/1.e9; //speed of light cm/ps
106 Float_t c = 0.3; //speed of light mm/ps
107 Float_t Zposit=timePs*c;// for 0 vertex
108 cout<<" Zposit "<<Zposit<<endl;
109 fvertex->Set((Int_t) Zposit);
111 lstart->LoadRecPoints("UPDATE");
112 sprintf(nameTR,"START_R_%d",evNumber);
113 printf("%s\n",nameTR);
114 fvertex->Write(nameTR);