]> git.uio.no Git - u/mrichter/AliRoot.git/blob - START/AliSTARTvertex.cxx
rotated geomtry
[u/mrichter/AliRoot.git] / START / AliSTARTvertex.cxx
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 /* $Id$ */
17
18 #include <Riostream.h>
19 #include <stdlib.h>
20
21 #include <TDirectory.h>
22 #include <TVirtualMC.h>
23
24 #include "AliRun.h"
25 #include "AliSTART.h"
26 #include "AliSTARTdigit.h"
27 #include "AliSTARThit.h"
28 #include "AliSTARTvertex.h"
29
30 ClassImp(AliSTARTvertex)
31
32 AliSTARTvertex::AliSTARTvertex( Int_t * Zposit)
33 {
34   //
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],
39   //
40
41   Zposit = &fZposition ;
42 }
43
44 void AliSTARTvertex::Reconstruct() 
45 {
46   /***************************************************
47   Resonstruct digits to vertex position
48   ****************************************************/
49
50   Int_t timediff;
51   Float_t timePs;
52   char nameTD[8],nameTR[8];
53  char filename[100];
54   sprintf(filename,"galice.root");
55   AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::fgkDefaultEventFolderName,"read");
56   if (rl == 0x0)
57    {
58      cerr<<"Can not open session for file galice.root\n";
59      return;
60    }
61
62   rl->LoadgAlice();
63   gAlice = rl->GetAliRun();
64   
65   AliSTART* START  = (AliSTART *)gAlice->GetDetector("START");
66   
67   rl->LoadHeader();
68   rl->LoadKinematics("READ");
69   Int_t retval;
70   AliLoader* lstart = rl->GetLoader("STARTLoader");
71   lstart->LoadDigits("READ");
72  
73   AliSTARTdigit *digits;
74   AliSTARTvertex *fvertex;
75  
76   digits = new AliSTARTdigit();
77   fvertex = new AliSTARTvertex();
78
79  // Event ------------------------- LOOP  
80    
81   // gAlice->GetEvent(evNumber);
82   Int_t iNevents=rl->GetNumberOfEvents();
83   cout<<"  nevents   "<<iNevents<<endl;
84   
85   for (Int_t evNumber=0; evNumber<iNevents; evNumber++){
86     rl->GetEvent(evNumber);
87     lstart->LoadDigits("READ");
88     gDirectory->ls();
89
90     sprintf(nameTD,"START_D_%d",evNumber);
91     TObject *td = (TObject*)gDirectory->Get(nameTD);
92     printf("%s\n",nameTD);
93     //   td->Dump();
94     if (!td) {
95       cerr<<"something wrong with input...."<<endl;
96       exit(111);
97     }
98     td->Read(nameTD);
99     digits->Read(nameTD);
100     if(digits->GetTimeDiff()<TMath::Abs(1000))
101       {
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);
110       }
111     lstart->LoadRecPoints("UPDATE");
112     sprintf(nameTR,"START_R_%d",evNumber);
113     printf("%s\n",nameTR);
114     fvertex->Write(nameTR);
115
116
117   }
118 }
119
120
121
122
123
124