Transition to NewIO
[u/mrichter/AliRoot.git] / ITS / AliITSVertexer.cxx
CommitLineData
88cb7938 1#include <Riostream.h>
c5f0f3c1 2#include <AliITSVertex.h>
3#include <AliITSVertexer.h>
88cb7938 4#include <AliRunLoader.h>
5#include <AliITSLoader.h>
c5f0f3c1 6
7ClassImp(AliITSVertexer)
8
9//////////////////////////////////////////////////////////////////////
10// Base class for primary vertex reconstruction //
11// AliITSVertex is a class for full 3D primary vertex finding //
12//////////////////////////////////////////////////////////////////////
13
14//______________________________________________________________________
15AliITSVertexer::AliITSVertexer() {
16 // Default Constructor
17
18 fCurrentVertex = 0;
c5f0f3c1 19 SetDebug();
20 SetFirstEvent(0);
21 SetLastEvent(0);
22}
23
88cb7938 24AliITSVertexer::AliITSVertexer(TString filename) {
c5f0f3c1 25 // Standard constructor
88cb7938 26 AliRunLoader *rl = AliRunLoader::GetRunLoader();
27 if(!rl){
28 Fatal("AliITSVertexer","Run Loader not found");
29 }
30 if(rl->LoadgAlice()){
31 Fatal("AliITSVertexer","The AliRun object is not available - nothing done");
32 }
c5f0f3c1 33 fCurrentVertex = 0;
c5f0f3c1 34 SetDebug();
35 SetFirstEvent(0);
36 SetLastEvent(0);
88cb7938 37 rl->LoadHeader();
38 AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader");
39 if(filename.Data()!="default")ITSloader->SetVerticesFileName(filename);
40 ITSloader->LoadVertices("recreate");
41 ITSloader->LoadRecPoints();
42 Int_t lst;
43 if(rl->TreeE()){
44 lst = static_cast<Int_t>(rl->TreeE()->GetEntries());
45 SetLastEvent(lst-1);
c5f0f3c1 46 }
47}
48
49//______________________________________________________________________
50AliITSVertexer::~AliITSVertexer() {
51 // Default Destructor
52 // The objects poited by the following pointers are not owned
53 // by this class and are not deleted
54
55 fCurrentVertex = 0;
c5f0f3c1 56}
57
58//______________________________________________________________________
59void AliITSVertexer::WriteCurrentVertex(){
60 // Write the current AliVertex object to file fOutFile
88cb7938 61 AliRunLoader *rl = AliRunLoader::GetRunLoader();
62 AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader");
63 fCurrentVertex->SetName("Vertex");
64 // const char * name = fCurrentVertex->GetName();
65 // ITSloader->SetVerticesContName(name);
66 Int_t rc = ITSloader->PostVertex(fCurrentVertex);
67 rc = ITSloader->WriteVertices();
c5f0f3c1 68}