]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSVertexer.cxx
AliMiniHeader moved to separate file
[u/mrichter/AliRoot.git] / ITS / AliITSVertexer.cxx
1 #include <AliITSVertex.h>
2 #include <AliITSVertexer.h>
3 #include <AliRunLoader.h>
4 #include <AliITSLoader.h>
5
6 ClassImp(AliITSVertexer)
7
8 //////////////////////////////////////////////////////////////////////
9 // Base class for primary vertex reconstruction                     //
10 // AliITSVertex is a class for full 3D primary vertex finding       //
11 // derived classes: AliITSVertexerIons AliITSvertexerPPZ            //
12 //                  AliITSVertexerTracks                            //
13 //////////////////////////////////////////////////////////////////////
14
15 //______________________________________________________________________
16 AliITSVertexer::AliITSVertexer() {
17   // Default Constructor
18
19     fCurrentVertex  = 0;
20     SetDebug();
21     SetFirstEvent(0);
22     SetLastEvent(0);
23 }
24
25 AliITSVertexer::AliITSVertexer(TString filename) {
26   // Standard constructor
27   AliRunLoader *rl = AliRunLoader::GetRunLoader();
28   if(!rl){
29     Fatal("AliITSVertexer","Run Loader not found");
30   }
31   if(rl->LoadgAlice()){
32     Fatal("AliITSVertexer","The AliRun object is not available - nothing done");
33   }
34   fCurrentVertex  = 0;   
35   SetDebug();
36   SetFirstEvent(0);
37   SetLastEvent(0);
38   rl->LoadHeader();
39   AliITSLoader* itsLoader =  (AliITSLoader*) rl->GetLoader("ITSLoader");
40   if(filename.Data()!="default")itsLoader->SetVerticesFileName(filename);
41   itsLoader->LoadVertices("recreate");
42   itsLoader->LoadRecPoints();
43   Int_t lst;
44   if(rl->TreeE()){
45     lst = static_cast<Int_t>(rl->TreeE()->GetEntries());
46     SetLastEvent(lst-1);
47   }
48 }
49
50 //______________________________________________________________________
51 AliITSVertexer::AliITSVertexer(const AliITSVertexer &vtxr) : TObject(vtxr) {
52   // Copy constructor
53   // Copies are not allowed. The method is protected to avoid misuse.
54   Error("AliITSVertexer","Copy constructor not allowed\n");
55 }
56
57 //______________________________________________________________________
58 AliITSVertexer& AliITSVertexer::operator=(const AliITSVertexer& /* vtxr */){
59   // Assignment operator
60   // Assignment is not allowed. The method is protected to avoid misuse.
61   Error("= operator","Assignment operator not allowed\n");
62   return *this;
63 }
64
65 //______________________________________________________________________
66 AliITSVertexer::~AliITSVertexer() {
67   // Default Destructor
68   // The objects pointed by the following pointers are not owned
69   // by this class and are not deleted
70
71     fCurrentVertex  = 0;
72 }
73
74 //______________________________________________________________________
75 void AliITSVertexer::WriteCurrentVertex(){
76   // Write the current AliVertex object to file fOutFile
77   AliRunLoader *rl = AliRunLoader::GetRunLoader();
78   AliITSLoader* itsLoader =  (AliITSLoader*) rl->GetLoader("ITSLoader");
79   fCurrentVertex->SetName("Vertex");
80   //  const char * name = fCurrentVertex->GetName();
81   //  itsLoader->SetVerticesContName(name);
82   Int_t rc = itsLoader->PostVertex(fCurrentVertex);
83   rc = itsLoader->WriteVertices();
84 }