Commit 2d11c5b0 authored by Volker Friese's avatar Volker Friese
Browse files

Restored primary vertex branch in event-based reconstruction. Refs #2096.

parent 5a3d5bfd
...@@ -107,10 +107,14 @@ InitStatus CbmFindPrimaryVertex::Init() ...@@ -107,10 +107,14 @@ InitStatus CbmFindPrimaryVertex::Init()
} }
// Create and register CbmVertex object // Create and register CbmVertex object
if (!fEvents) { // if (!fEvents) {
fPrimVert = new CbmVertex("Primary Vertex", "Global"); // TODO: This is here for legacy, since many analysis tasks use the vertex branch instead
ioman->Register("PrimaryVertex.", "Global", fPrimVert, IsOutputBranchPersistent("PrimaryVertex")); // of retrieving the vertex from the event object. It shall be removed after the all analysis tasks
} // are adjusted. Neither in event-based nor in time-based reconstruction a branch with a single
// vertex object makes sense.
fPrimVert = new CbmVertex("Primary Vertex", "Global");
ioman->Register("PrimaryVertex.", "Global", fPrimVert, IsOutputBranchPersistent("PrimaryVertex"));
// }
// Call the Init method of the vertex finder // Call the Init method of the vertex finder
fFinder->Init(); fFinder->Init();
...@@ -142,6 +146,7 @@ void CbmFindPrimaryVertex::Exec(Option_t*) ...@@ -142,6 +146,7 @@ void CbmFindPrimaryVertex::Exec(Option_t*)
// Event-based mode // Event-based mode
else { else {
fPrimVert->Reset(); // TODO: Legacy
nEvents = fEvents->GetEntriesFast(); nEvents = fEvents->GetEntriesFast();
for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) { for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
CbmEvent* event = dynamic_cast<CbmEvent*>(fEvents->At(iEvent)); CbmEvent* event = dynamic_cast<CbmEvent*>(fEvents->At(iEvent));
...@@ -149,6 +154,9 @@ void CbmFindPrimaryVertex::Exec(Option_t*) ...@@ -149,6 +154,9 @@ void CbmFindPrimaryVertex::Exec(Option_t*)
result = fFinder->FindEventVertex(event, fTracks); result = fFinder->FindEventVertex(event, fTracks);
LOG(debug) << GetName() << ": Event " << iEvent << " " << event->GetVertex()->ToString(); LOG(debug) << GetName() << ": Event " << iEvent << " " << event->GetVertex()->ToString();
nTracksUsed += result; nTracksUsed += result;
// Legacy: copy event vertex object to event branch
if (iEvent == 0) *fPrimVert = *(event->GetVertex());
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment