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()
}
// Create and register CbmVertex object
if (!fEvents) {
fPrimVert = new CbmVertex("Primary Vertex", "Global");
ioman->Register("PrimaryVertex.", "Global", fPrimVert, IsOutputBranchPersistent("PrimaryVertex"));
}
// if (!fEvents) {
// TODO: This is here for legacy, since many analysis tasks use the vertex branch instead
// 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
fFinder->Init();
......@@ -142,6 +146,7 @@ void CbmFindPrimaryVertex::Exec(Option_t*)
// Event-based mode
else {
fPrimVert->Reset(); // TODO: Legacy
nEvents = fEvents->GetEntriesFast();
for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
CbmEvent* event = dynamic_cast<CbmEvent*>(fEvents->At(iEvent));
......@@ -149,6 +154,9 @@ void CbmFindPrimaryVertex::Exec(Option_t*)
result = fFinder->FindEventVertex(event, fTracks);
LOG(debug) << GetName() << ": Event " << iEvent << " " << event->GetVertex()->ToString();
nTracksUsed += result;
// Legacy: copy event vertex object to event branch
if (iEvent == 0) *fPrimVert = *(event->GetVertex());
}
}
......
Supports Markdown
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