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