ATLAS Offline Software
Loading...
Searching...
No Matches
TIDATools.h File Reference

useful tool for the TrigInDetAnalysis class code More...

#include <vector>
Include dependency graph for TIDATools.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename T>
void HighestPTOnly (std::vector< T * > &tracks)
template<typename T>
void FilterPT (std::vector< T * > &tracks, double pt)

Detailed Description

useful tool for the TrigInDetAnalysis class code

Author
mark sutton
Date
Tue 16 May 2017 09:28:55 CEST

Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration

Definition in file TIDATools.h.

Function Documentation

◆ FilterPT()

template<typename T>
void FilterPT ( std::vector< T * > & tracks,
double pt )

Definition at line 41 of file TIDATools.h.

41 {
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}

◆ HighestPTOnly()

template<typename T>
void HighestPTOnly ( std::vector< T * > & tracks)

Definition at line 20 of file TIDATools.h.

20 {
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}