]> git.uio.no Git - u/mrichter/AliRoot.git/blame - START/AliSTARTvertex.cxx
New code from Piergiorgio added
[u/mrichter/AliRoot.git] / START / AliSTARTvertex.cxx
CommitLineData
6740ab97 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15/*
16$Log$
ef51244a 17Revision 1.1 2000/03/24 17:46:58 alla
18Vertex reconstruction
19
6740ab97 20*/
21#include <TObject.h>
22#include "AliSTARTvertex.h"
23#include "AliSTARTdigit.h"
24#include "AliSTARThit.h"
25#include "AliSTART.h"
26#include "AliRun.h"
27#include "AliMC.h"
28
29ClassImp(AliSTARTvertex)
30
31AliSTARTvertex::AliSTARTvertex( Int_t * Zposit)
32{
33 //
6740ab97 34 // The creator for the AliSTARTvertex class. This routine fills the
35 // AliSTARTvertex data members from the array vertex.
36 // The order of the elements in the vertex array are
37 // fEvent = digits[0], fZposition = vertex[1],
38 // fTime_diff = Vertex[2]
39 // Therefore the array digits is expected to be at least 3 elements long.
40 //
41
42 Zposit = &fZposition ;
43}
44
45void AliSTARTvertex::Reconstruct(Int_t evNumber=1)
46{
47
48 Int_t timediff;
49 Float_t timePs;
50 char nameTD[8],nameTR[8];
51
52 TBranch *bRec=0;
53 TBranch *bd;
54 AliSTARTdigit *digits;
55 AliSTARTvertex *vertex;
56
57 Int_t buffersize=256;
58 Int_t split=1;
59
60 // TParticle *particle;
61 digits = new AliSTARTdigit();
62 vertex = new AliSTARTvertex();
6740ab97 63
64 // Event ------------------------- LOOP
65
ef51244a 66 sprintf(nameTD,"TreeD%d",evNumber);
67 printf("%s\n",nameTD);
68 TTree *td = (TTree*)gDirectory->Get(nameTD);
69 bd = td->GetBranch("START");
70 bd->SetAddress(&digits);
71 bd->GetEvent(0);
72 printf(" Digits: "); digits->MyDump();
73 sprintf(nameTR,"TreeR%d",evNumber);
74 TTree *tr = new TTree(nameTR,"START");
75 bRec = tr->Branch("START","AliSTARTvertex",&vertex,buffersize,split);
6740ab97 76
ef51244a 77 // td->Print(); td->Show(0); td->GetBranch("START")->Dump();
78 digits->MyDump();
79 printf("digits-> %d \n",digits->GetTime());
6740ab97 80
ef51244a 81 if(digits->GetTime()!=999999)
82 {
83 timediff=digits->GetTime(); //time in number of channels
84 timePs=(timediff-128)*10.; // time in Ps channel_width =10ps
6740ab97 85 printf(" timediff %d in PS %f\n",timediff,timePs);
86 Float_t c = 299792458/1.e9; //speed of light cm/ps
ef51244a 87 //Float_t c = 0.3; //speed of light mm/ps
88 Float_t Zposit=timePs*c;// for 0 vertex
89 // Float_t Zposit=timePs*c/2.;// for spread vertex
90 // printf(" Z position %f\n",Zposit);
6740ab97 91 // vertex->GetVertex();
92 vertex->Set(Zposit);
ef51244a 93 tr->Fill();
94 tr->Write();
6740ab97 95 //hTimediff->Fill(timePs);
96 //hVertex->Fill(Zposit);
97 }
98
99}
100
101
102
103