**************************************************************************/
/*
$Log$
+Revision 1.7 2002/04/15 08:04:01 alla
+Digits and reconstruction with TObject
+
+Revision 1.6 2001/10/19 05:29:38 alla
+bug in meduim fixed
+
+Revision 1.5 2001/07/27 13:03:12 hristov
+Default Branch split level set to 99
+
+Revision 1.4 2000/12/22 16:17:15 hristov
+Updated START code from Alla
+
+Revision 1.3 2000/10/02 21:28:13 fca
+Removal of useless dependecies via forward declarations
+
+Revision 1.2 2000/07/13 16:41:29 fca
+New START corrected for coding conventions
+
+Revision 1.1 2000/03/24 17:46:58 alla
+Vertex reconstruction
+
*/
-#include <TObject.h>
+#include "TObject.h"
#include "AliSTARTvertex.h"
#include "AliSTARTdigit.h"
#include "AliSTARThit.h"
#include "AliRun.h"
#include "AliMC.h"
+//#include "TTree.h"
+#include "TDirectory.h"
+#include <stdlib.h>
+#include <iostream.h>
+#include <fstream.h>
+
ClassImp(AliSTARTvertex)
AliSTARTvertex::AliSTARTvertex( Int_t * Zposit)
{
//
- // Create START digit
// The creator for the AliSTARTvertex class. This routine fills the
// AliSTARTvertex data members from the array vertex.
// The order of the elements in the vertex array are
- // fEvent = digits[0], fZposition = vertex[1],
- // fTime_diff = Vertex[2]
- // Therefore the array digits is expected to be at least 3 elements long.
+ // fZposition = vertex[0],
//
Zposit = &fZposition ;
void AliSTARTvertex::Reconstruct(Int_t evNumber=1)
{
-
+ /***************************************************
+ Resonstruct digits to vertex position
+ ****************************************************/
+
Int_t timediff;
Float_t timePs;
char nameTD[8],nameTR[8];
- TBranch *bRec=0;
- TBranch *bd;
AliSTARTdigit *digits;
- AliSTARTvertex *vertex;
+ AliSTARTvertex *fvertex;
- Int_t buffersize=256;
- Int_t split=1;
-
- // TParticle *particle;
digits = new AliSTARTdigit();
- vertex = new AliSTARTvertex();
- // AliSTART *START = (AliSTART*) gAlice->GetDetector("START");
+ fvertex = new AliSTARTvertex();
// Event ------------------------- LOOP
- sprintf(nameTD,"TreeD%d",evNumber);
- printf("%s\n",nameTD);
- TTree *TD = (TTree*)gDirectory->Get(nameTD);
- bd = TD->GetBranch("START");
- bd->SetAddress(&digits);
- bd->GetEvent(0);
- printf(" Digits: "); digits->MyDump();
-
- sprintf(nameTR,"TreeR%d",evNumber);
- TTree *TR = new TTree(nameTR,"START");
- bRec = TR->Branch("START","AliSTARTvertex",&vertex,buffersize,split);
-
- // TD->Print(); TD->Show(0); TD->GetBranch("START")->Dump();
+ gAlice->GetEvent(evNumber);
+
+ sprintf(nameTD,"START_D_%d",evNumber);
+ TObject *td = (TObject*)gDirectory->Get(nameTD);
+ printf("%s\n",nameTD);
- if(digits->fTime_average!=0)
- {
- timediff=digits->fTime_diff; //time in number of channels
- timePs=(timediff-128)*10.; // time in Ps
- printf(" timediff %d in PS %f\n",timediff,timePs);
+ if (!td) {
+ cerr<<"something wrong with output...."<<endl;
+ exit(111);
+ }
+ td->Read(nameTD);
+ digits->Read(nameTD);
+ digits->Dump();
+ if(digits->GetTime()!=999999)
+ {
+ timediff=digits->GetTime(); //time in number of channels
+ timePs=(timediff-128)*10.; // time in Ps channel_width =10ps
Float_t c = 299792458/1.e9; //speed of light cm/ps
- Float_t Zposit=timePs*c;
- printf(" Z position %f\n",Zposit);
- // vertex->GetVertex();
- vertex->Set(Zposit);
- TR->Fill();
- TR->Write();
- //hTimediff->Fill(timePs);
- //hVertex->Fill(Zposit);
+ //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);
}
-
+ TTree *outTree = gAlice->TreeR();
+ if (!outTree) {
+ cerr<<"something wrong with output...."<<endl;
+ exit(111);
+ }
+ TTree *outTreeR = gAlice->TreeR();
+ if (!outTreeR) {
+ cerr<<"something wrong with output...."<<endl;
+ exit(111);
+ }
+ sprintf(nameTR,"START_R_%d",evNumber);
+ printf("%s\n",nameTR);
+ TDirectory *wd = gDirectory;
+ outTreeR->GetDirectory()->cd();
+ fvertex->Write(nameTR);
+ wd->cd();
}
+
+