]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSVertexer.cxx
Improved version of the vertexer used currently in production.
[u/mrichter/AliRoot.git] / ITS / AliITSVertexer.cxx
1 #include <AliESDVertex.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 // AliESDVertexer is a class for full 3D primary vertex finding     //
11 // derived classes: AliITSVertexerIons AliITSvertexerPPZ            //
12 //                  AliITSVertexerTracks                            //
13 //////////////////////////////////////////////////////////////////////
14
15 //______________________________________________________________________
16 AliITSVertexer::AliITSVertexer():AliVertexer() {
17   // Default Constructor
18 }
19
20 AliITSVertexer::AliITSVertexer(TString filename) {
21   // Standard constructor
22   AliRunLoader *rl = AliRunLoader::GetRunLoader();
23   if(!rl){
24     Fatal("AliITSVertexer","Run Loader not found");
25   }
26   if(rl->LoadgAlice()){
27     Fatal("AliITSVertexer","The AliRun object is not available - nothing done");
28   }
29   fCurrentVertex  = 0;   
30   fDebug = 0;
31   SetFirstEvent(0);
32   SetLastEvent(0);
33   rl->LoadHeader();
34   AliITSLoader* itsLoader =  (AliITSLoader*) rl->GetLoader("ITSLoader");
35   if(!filename.Contains("default"))itsLoader->SetVerticesFileName(filename);
36   if(!filename.Contains("null"))itsLoader->LoadVertices("recreate");
37   itsLoader->LoadRecPoints();
38   Int_t lst;
39   if(rl->TreeE()){
40     lst = static_cast<Int_t>(rl->TreeE()->GetEntries());
41     SetLastEvent(lst-1);
42   }
43 }
44
45 //______________________________________________________________________
46 AliITSVertexer::AliITSVertexer(const AliITSVertexer &vtxr) : AliVertexer(vtxr) {
47   // Copy constructor
48   // Copies are not allowed. The method is protected to avoid misuse.
49   Error("AliITSVertexer","Copy constructor not allowed\n");
50 }
51
52 //______________________________________________________________________
53 AliITSVertexer& AliITSVertexer::operator=(const AliITSVertexer& /* vtxr */){
54   // Assignment operator
55   // Assignment is not allowed. The method is protected to avoid misuse.
56   Error("= operator","Assignment operator not allowed\n");
57   return *this;
58 }
59
60
61 //______________________________________________________________________
62 void AliITSVertexer::WriteCurrentVertex(){
63   // Write the current AliVertex object to file fOutFile
64   AliRunLoader *rl = AliRunLoader::GetRunLoader();
65   AliITSLoader* itsLoader =  (AliITSLoader*) rl->GetLoader("ITSLoader");
66   fCurrentVertex->SetName("Vertex");
67   //  const char * name = fCurrentVertex->GetName();
68   //  itsLoader->SetVerticesContName(name);
69   Int_t rc = itsLoader->PostVertex(fCurrentVertex);
70   rc = itsLoader->WriteVertices();
71 }