ATLAS Offline Software
Loading...
Searching...
No Matches
TIDATools.h
Go to the documentation of this file.
1/* emacs: this is -*- c++ -*- */
12
13#ifndef TrigInDetAnalysisExample_TIDATools_H
14#define TrigInDetAnalysisExample_TIDATools_H
15
16
17#include <vector>
18
19template<typename T>
20void HighestPTOnly( std::vector<T*>& tracks ) {
21
22 if ( tracks.size()>1 ) {
23
24 std::vector<T*> tmp_tracks;
25
26 int ih = 0;
27
28 for ( unsigned i=1 ; i<tracks.size() ; i++ ) {
29 if ( std::fabs(tracks[i]->pT())>std::fabs(tracks[ih]->pT()) ) ih = i;
30 }
31
32 tmp_tracks.push_back( tracks[ih] );
33
34 tracks = tmp_tracks;
35 }
36}
37
38
39
40template<typename T>
41void FilterPT( std::vector<T*>& tracks, double pt ) {
42
43 std::vector<T*> tmp_tracks;
44
45 tmp_tracks.reserve( tracks.size() );
46
47 for ( unsigned i=0 ; i<tracks.size() ; i++ ) {
48 if ( std::fabs(tracks[i]->pT())>=pt ) tmp_tracks.push_back( tracks[i] );
49 }
50
51 if ( tmp_tracks.size()<tracks.size() ) tracks = tmp_tracks;
52
53}
54
55
56
57#endif // TrigInDetAnalysisExample_TIDATools_H
void HighestPTOnly(std::vector< T * > &tracks)
Definition TIDATools.h:20
void FilterPT(std::vector< T * > &tracks, double pt)
Definition TIDATools.h:41