ATLAS Offline Software
NtupleTrackSelector.h
Go to the documentation of this file.
1 /* emacs: this is -*- c++ -*- */
12 #ifndef TIDAEXAMPLE_NTUPLETRACKSELECTOR_H
13 #define TIDAEXAMPLE_NTUPLETRACKSELECTOR_H
14 
18 
19 
21 
22 public:
23 
25 
26  virtual TrackSelector* clone() override { return new NtupleTrackSelector(*this); }
27 
30  // do the track extraction stuff here....
31  if ( track ) {
32  TIDA::Track* t = new TIDA::Track( *track );
33  if ( !addTrack( t ) ) delete t;
34  // addTrack( track );
35  }
36  }
37 
38 
40  void selectTrack( const TIDA::Track& track ) {
41  // do the track extraction stuff here....
42  TIDA::Track* t = new TIDA::Track( track );
43  if ( !addTrack( t ) ) delete t;
44  // addTrack( &track );
45  }
46 
48  void selectTracks( const std::vector<TIDA::Track>& tracks ) {
49  // do the track extraction stuff here....
50  std::vector<TIDA::Track>::const_iterator trackitr = tracks.begin();
51  std::vector<TIDA::Track>::const_iterator trackend = tracks.end();
52  while ( trackitr!=trackend ) {
53  selectTrack( *trackitr );
54  trackitr++;
55  }
56  }
57 
59  void selectTracks( const std::vector<TIDA::Track*>& tracks ) {
60  // do the track extraction stuff here....
61  std::vector<TIDA::Track*>::const_iterator trackitr = tracks.begin();
62  std::vector<TIDA::Track*>::const_iterator trackend = tracks.end();
63  while ( trackitr!=trackend ) {
64  // selectTrack( *(*trackitr) );
65  selectTrack( *trackitr );
66  trackitr++;
67  }
68  }
69 
72  virtual void clear() override {
73  for ( int i=m_tracks.size() ; i-- ; ) delete m_tracks[i];
74  m_tracks.clear();
75  }
76 
77 };
78 
79 
80 
81 
82 #endif // TIDAEXAMPLE_NTUPLETRACKSELECTOR_H
NtupleTrackSelector::selectTracks
void selectTracks(const std::vector< TIDA::Track > &tracks)
extract all the tracks from a vector of Tracks
Definition: NtupleTrackSelector.h:48
NtupleTrackSelector::selectTracks
void selectTracks(const std::vector< TIDA::Track * > &tracks)
extract all the tracks from a vector of Tracks pointers
Definition: NtupleTrackSelector.h:59
Track.h
TrackFilter
Definition: TrackFilter.h:26
TrackSelector::addTrack
virtual bool addTrack(TIDA::Track *t, bool(*f)(const TIDA::Track *)=0)
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/TrackSelector.h:35
TrackFilter.h
base class for a single track selection filter allowing parameter setting for complex track selection
xAOD::JetInput::Track
@ Track
Definition: JetContainerInfo.h:61
NtupleTrackSelector::selectTrack
void selectTrack(const TIDA::Track &track)
add a Track
Definition: NtupleTrackSelector.h:40
NtupleTrackSelector::NtupleTrackSelector
NtupleTrackSelector(TrackFilter *selector=0)
Definition: NtupleTrackSelector.h:24
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
NtupleTrackSelector::clear
virtual void clear() override
the ntple selector manages the tracks itself, so we have to do an explicit delete for each one to pre...
Definition: NtupleTrackSelector.h:72
TrackSelector
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/TrackSelector.h:24
NtupleTrackSelector::selectTrack
void selectTrack(TIDA::Track *track)
add single Track
Definition: NtupleTrackSelector.h:29
TrackSelector::m_tracks
std::vector< TIDA::Track * > m_tracks
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/TrackSelector.h:82
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrackSelector.h
NtupleTrackSelector::clone
virtual TrackSelector * clone() override
Definition: NtupleTrackSelector.h:26
TrackSelector::tracks
const std::vector< TIDA::Track * > & tracks() const
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/TrackSelector.h:53
python.selector.AtlRunQuerySelectorLhcOlc.selector
selector
Definition: AtlRunQuerySelectorLhcOlc.py:611
TIDA::Track
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h:26
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
NtupleTrackSelector
Definition: NtupleTrackSelector.h:20