]> git.uio.no Git - u/mrichter/AliRoot.git/blob - START/AliSTARTvertex.cxx
Streamlining of CodeAnalysis. .ii files are kept for reverse engineering
[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 $Log$
17 */ 
18 #include <TObject.h>
19 #include "AliSTARTvertex.h"
20 #include "AliSTARTdigit.h"
21 #include "AliSTARThit.h"
22 #include "AliSTART.h"
23 #include "AliRun.h"
24 #include "AliMC.h"
25
26 ClassImp(AliSTARTvertex)
27
28 AliSTARTvertex::AliSTARTvertex( Int_t * Zposit)
29 {
30   //
31   // Create START digit
32   //     The creator for the AliSTARTvertex class. This routine fills the
33   // AliSTARTvertex data members from the array vertex.
34   // The order of the elements in the vertex array are
35   // fEvent = digits[0], fZposition = vertex[1],
36   // fTime_diff = Vertex[2]
37   // Therefore the array digits is expected to be at least 3 elements long.
38   //
39
40   Zposit = &fZposition ;
41 }
42
43 void AliSTARTvertex::Reconstruct(Int_t evNumber=1) 
44 {
45  
46   Int_t timediff;
47   Float_t timePs;
48   char nameTD[8],nameTR[8];
49
50   TBranch *bRec=0;
51   TBranch *bd;
52   AliSTARTdigit *digits;
53   AliSTARTvertex *vertex;
54  
55   Int_t buffersize=256;
56   Int_t split=1;
57  
58   // TParticle *particle;
59   digits = new AliSTARTdigit();
60   vertex = new AliSTARTvertex();
61   // AliSTART *START  = (AliSTART*) gAlice->GetDetector("START");
62
63  // Event ------------------------- LOOP  
64    
65     sprintf(nameTD,"TreeD%d",evNumber);
66     printf("%s\n",nameTD);
67     TTree *TD = (TTree*)gDirectory->Get(nameTD);
68     bd = TD->GetBranch("START");
69     bd->SetAddress(&digits);
70     bd->GetEvent(0);
71     printf(" Digits: "); digits->MyDump();
72     
73     sprintf(nameTR,"TreeR%d",evNumber);
74     TTree *TR = new TTree(nameTR,"START");
75     bRec = TR->Branch("START","AliSTARTvertex",&vertex,buffersize,split);
76
77     //  TD->Print(); TD->Show(0); TD->GetBranch("START")->Dump();
78   
79     if(digits->fTime_average!=0)
80       {
81       timediff=digits->fTime_diff;     //time in number of channels
82       timePs=(timediff-128)*10.;       // time in Ps
83       printf(" timediff %d in PS %f\n",timediff,timePs);
84       Float_t c = 299792458/1.e9;  //speed of light cm/ps
85       Float_t Zposit=timePs*c;
86       printf(" Z position %f\n",Zposit);
87       //      vertex->GetVertex();
88       vertex->Set(Zposit);
89       TR->Fill();
90       TR->Write();
91       //hTimediff->Fill(timePs);
92       //hVertex->Fill(Zposit);
93       }
94
95 }
96
97
98
99