Digits and reconstruction with TObject
[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$
7115262b 17Revision 1.6 2001/10/19 05:29:38 alla
18bug in meduim fixed
19
4fdc4526 20Revision 1.5 2001/07/27 13:03:12 hristov
21Default Branch split level set to 99
22
d0f40f23 23Revision 1.4 2000/12/22 16:17:15 hristov
24Updated START code from Alla
25
f3ed336b 26Revision 1.3 2000/10/02 21:28:13 fca
27Removal of useless dependecies via forward declarations
28
94de3818 29Revision 1.2 2000/07/13 16:41:29 fca
30New START corrected for coding conventions
31
ef51244a 32Revision 1.1 2000/03/24 17:46:58 alla
33Vertex reconstruction
34
6740ab97 35*/
7115262b 36#include "TObject.h"
6740ab97 37#include "AliSTARTvertex.h"
38#include "AliSTARTdigit.h"
39#include "AliSTARThit.h"
40#include "AliSTART.h"
41#include "AliRun.h"
42#include "AliMC.h"
43
f3ed336b 44//#include "TTree.h"
45#include "TDirectory.h"
7115262b 46#include <stdlib.h>
47#include <iostream.h>
48#include <fstream.h>
f3ed336b 49
6740ab97 50ClassImp(AliSTARTvertex)
51
52AliSTARTvertex::AliSTARTvertex( Int_t * Zposit)
53{
54 //
6740ab97 55 // The creator for the AliSTARTvertex class. This routine fills the
56 // AliSTARTvertex data members from the array vertex.
57 // The order of the elements in the vertex array are
f3ed336b 58 // fZposition = vertex[0],
6740ab97 59 //
60
61 Zposit = &fZposition ;
62}
63
64void AliSTARTvertex::Reconstruct(Int_t evNumber=1)
65{
f3ed336b 66 /***************************************************
67 Resonstruct digits to vertex position
68 ****************************************************/
69
6740ab97 70 Int_t timediff;
71 Float_t timePs;
72 char nameTD[8],nameTR[8];
73
6740ab97 74 AliSTARTdigit *digits;
7115262b 75 AliSTARTvertex *fvertex;
6740ab97 76
6740ab97 77 digits = new AliSTARTdigit();
7115262b 78 fvertex = new AliSTARTvertex();
6740ab97 79
80 // Event ------------------------- LOOP
81
7115262b 82 gAlice->GetEvent(evNumber);
83
84 sprintf(nameTD,"START_D_%d",evNumber);
85 TObject *td = (TObject*)gDirectory->Get(nameTD);
ef51244a 86 printf("%s\n",nameTD);
7115262b 87
88 if (!td) {
89 cerr<<"something wrong with output...."<<exit;
90 return;
91 }
92 td->Read(nameTD);
93 digits->Read(nameTD);
94 digits->Dump();
ef51244a 95 if(digits->GetTime()!=999999)
96 {
97 timediff=digits->GetTime(); //time in number of channels
98 timePs=(timediff-128)*10.; // time in Ps channel_width =10ps
6740ab97 99 Float_t c = 299792458/1.e9; //speed of light cm/ps
ef51244a 100 //Float_t c = 0.3; //speed of light mm/ps
101 Float_t Zposit=timePs*c;// for 0 vertex
7115262b 102 cout<<" Zposit "<<Zposit<<endl;
103 fvertex->Set((Int_t) Zposit);
6740ab97 104 }
7115262b 105 TTree *outTree = gAlice->TreeR();
106 if (!outTree) {
107 cerr<<"something wrong with output...."<<exit;
108 return;
109 }
110 TTree *outTreeR = gAlice->TreeR();
111 if (!outTreeR) {
112 cerr<<"something wrong with output...."<<exit;
113 return;
114 }
115 sprintf(nameTR,"START_R_%d",evNumber);
116 printf("%s\n",nameTR);
117 TDirectory *wd = gDirectory;
118 outTreeR->GetDirectory()->cd();
119 fvertex->Write(nameTR);
120 wd->cd();
6740ab97 121}
122
123
124
125
7115262b 126
127