FairRoot/PandaRoot
Classes | Functions
PndMvaUtil.h File Reference
#include <typeinfo>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <cassert>

Go to the source code of this file.

Classes

struct  StepError
 Structure to hold the per step error values. More...
 
struct  PndMvaDistObj
 

Functions

bool CompLess (PndMvaDistObj const *a, PndMvaDistObj const *b)
 Less than, comparison funtion. More...
 
template<typename T >
T const & minFunct (T const &a, T const &b)
 
template<typename T >
bool compareL (T const *l, T const *r)
 Less than, comparison funtion. More...
 
template<typename Set1 , typename Set2 >
bool is_disjoint (Set1 const &set1, Set2 const &set2)
 
float ComputeDist (std::vector< float > const &EvtData, std::vector< float > const &Example)
 
int str2int (std::string const &str)
 
unsigned int str2Uint (std::string const &str)
 
std::string int2str (int n)
 

Function Documentation

template<typename T >
bool compareL ( T const *  l,
T const *  r 
)
inline

Less than, comparison funtion.

Definition at line 167 of file PndMvaUtil.h.

168 {
169  assert(l && r);
170  return ( (*l) < (*r) );
171 };
double r
Definition: RiemannTest.C:14
bool CompLess ( PndMvaDistObj const *  a,
PndMvaDistObj const *  b 
)
inline

Less than, comparison funtion.

Definition at line 146 of file PndMvaUtil.h.

147 {
148  assert(a && b);
149  return ( (*a).m_dist < (*b).m_dist );
150 };
TTree * b
Int_t a
Definition: anaLmdDigi.C:126
float ComputeDist ( std::vector< float > const &  EvtData,
std::vector< float > const &  Example 
)

Computes the Euclidean distance between two given vectors of event features.

std::string int2str ( int  n)
template<typename Set1 , typename Set2 >
bool is_disjoint ( Set1 const &  set1,
Set2 const &  set2 
)

If 2 sets are disjoint.

Input two sorted (ASC) sequences.

Returns
true if the sets are disjoint.

NOTE: In some cases one might consider using std::set_intersection from <algorithm>

Definition at line 183 of file PndMvaUtil.h.

184 {
185  // IF one of the sets is empty. O(1) true on empty sets per
186  // definition.
187  if( set1.empty() || set2.empty())
188  {
189  return true;
190  }
191  // Start and end iterators of the first sequence.
192  typename Set1::const_iterator it1 = set1.begin();
193  typename Set1::const_iterator it1End = set1.end();
194 
195  // Start and end iterators of the second sequence.
196  typename Set2::const_iterator it2 = set2.begin();
197  typename Set2::const_iterator it2End = set2.end();
198 
199  // This holds because the sequences are pre-sorted. O(1)
200  if( *it1 > *set2.rbegin() || *it2 > *set1.rbegin() )
201  {
202  return true;
203  }
204 
205  // Investigate element-wise.
206  while( (it1 != it1End) && (it2 != it2End) )
207  {
208  if( *it1 == *it2 )
209  {
210  return false;
211  }
212 
213  if( *it1 < *it2 )
214  {
215  it1++;
216  }
217  else
218  {
219  it2++;
220  }
221  }// WHILE
222  return true;
223 }
template<typename T >
T const& minFunct ( T const &  a,
T const &  b 
)
inline

Binary Minimum function.

Definition at line 159 of file PndMvaUtil.h.

References b.

160 {
161  // or: return comp(a,b)?a:b; for the comp version
162  return (a < b) ? a : b;
163 };
TTree * b
Int_t a
Definition: anaLmdDigi.C:126
int str2int ( std::string const &  str)
unsigned int str2Uint ( std::string const &  str)