star-travex
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StiHifyEvent.cxx
Go to the documentation of this file.
1 #include <algorithm>
2 
4 #include "StiHify/StiHifyEvent.h"
5 #include "Sti/StiKalmanTrack.h"
6 
8 
9 
11 {
12 }
13 
14 
15 StiHifyEvent::StiHifyEvent(const StiVolumeFilter& stiVolumeFilter) : TStiEvent(stiVolumeFilter)
16 {
17 }
18 
19 
24 EReturnCodes StiHifyEvent::Fill(const StiTrackContainer &stiTrackContainer)
25 {
26  auto acceptTrack = [] (const StiTrack* stiTrack) -> bool
27  {
28  const StiKalmanTrack& stiKTrack = static_cast<const StiKalmanTrack&>(*stiTrack);
29  return (stiKTrack.getFitPointCount(kTpcId) > 40);
30  };
31 
32  // First, create an empty container to keep track states provided directly by Sti
33  StiTrackContainer filtered(stiTrackContainer.getName(), stiTrackContainer.getDescription());
34  filtered.resize(stiTrackContainer.size());
35 
36  // Second, copy in the new container those Sti tracks that satisfy certain
37  // requirements (currently, the condition is simply hard coded above)
38  auto new_end = std::copy_if(stiTrackContainer.begin(), stiTrackContainer.end(), filtered.begin(), acceptTrack);
39  // Shrink container to new size
40  filtered.resize(std::distance(filtered.begin(), new_end));
41 
42  return TStiEvent::Fill(filtered);
43 }
44 
45 
51 {
52  for (auto& track : fTStiKalmanTracks)
53  {
54  track.AssignClosestCandidateHit();
55  }
56 }
std::vector< TStiKalmanTrack > fTStiKalmanTracks
A collection of all Sti tracks of interest in this event.
Definition: TStiEvent.h:48
virtual EReturnCodes Fill(const StiTrackContainer &stiTrackContainer)
Fills internal event container with track states/nodes provided by Sti tracking (some requirements on...
void AssignClosestCandidateHit()
Loops over the internal container of tracks and calls the track method to override the accepted hits ...
ClassImp(StiHifyEvent) StiHifyEvent
Definition: StiHifyEvent.cxx:7
A singleton to manage constraints on save Sti objects such as tracks and track nodes.
virtual EReturnCodes Fill(const StiTrackContainer &stiTrackContainer)
Definition: TStiEvent.cxx:40