// ------------------------------------------------------------------------- // ----- CbmSttFindVertices source file ----- // ----- Created 02/02/05 by V. Friese ----- // ------------------------------------------------------------------------- #include "iostream.h" #include "TClonesArray.h" #include "CbmRootManager.h" #include "CbmSttFindVertices.h" #include "CbmSttVertex.h" #include "CbmSttVertexFinder.h" // ----- Default constructor ------------------------------------------- CbmSttFindVertices::CbmSttFindVertices() : CbmTask("STT Find Vertices") { fFinder = NULL; fVertexArray = NULL; fNofVertices = 0; fVerbose = 1; } // ------------------------------------------------------------------------- // ----- Standard constructor ------------------------------------------ CbmSttFindVertices::CbmSttFindVertices(CbmSttVertexFinder* finder, Int_t verbose) : CbmTask("STT Find Vertices") { fFinder = finder; fVertexArray = NULL; fNofVertices = 0; fVerbose = verbose; } // ------------------------------------------------------------------------- // ----- Constructor with name and title ------------------------------- CbmSttFindVertices::CbmSttFindVertices(const char* name, const char* title, CbmSttVertexFinder* finder, Int_t verbose) : CbmTask(name) { fFinder = finder; fVertexArray = NULL; fNofVertices = 0; fVerbose = verbose; } // ------------------------------------------------------------------------- // ----- Destructor ---------------------------------------------------- CbmSttFindVertices::~CbmSttFindVertices() { fVertexArray->Delete(); } // ------------------------------------------------------------------------- // ----- Public method Init (abstract in base class) -------------------- InitStatus CbmSttFindVertices::Init() { // Check for Vertex finder if (! fFinder) { cout << "-E- CbmSttFindVertices::Init: No vertex finder selected!" << endl; return kERROR; } CbmRootManager *ioman = CbmRootManager::Instance(); if (!ioman) { cout << "-E- CbmSttFindVertices::Init: " << "RootManager not instantised!" << endl; return kFATAL; } // Create and register SttVertex array fVertexArray = new TClonesArray("CbmSttVertex",100); ioman->Register("STTVertex", "STT", fVertexArray, kTRUE); // Set verbosity of vertex finder fFinder->SetVerbose(fVerbose); // Call the Init method of the vertex finder fFinder->Init(); return kSUCCESS; } // ----- Public method Exec -------------------------------------------- void CbmSttFindVertices::Exec(Option_t* opt) { fVertexArray->Clear(); fNofVertices = fFinder->DoFind(fVertexArray); } // ------------------------------------------------------------------------- // ----- Public method Finish ------------------------------------------ void CbmSttFindVertices::Finish() { fFinder->Finish(); } // ------------------------------------------------------------------------- ClassImp(CbmSttFindVertices)