Anp::AlgCaddy< T > Class Template Reference

#include <AlgCaddy.h>

List of all members.

Public Member Functions

 AlgCaddy ()
 AlgCaddy (Handle< T > alg_, const std::string &name_)
 ~AlgCaddy ()
void AllEvent (double weight)
void OutEvent (double weight)
void AllSnarl (const Record &record)
void OutSnarl (const Record &record)
unsigned int Width (unsigned int number) const
void Print (unsigned int nw, unsigned int cw, const std::string &opt, std::ostream &o=std::cout) const

Public Attributes

Handle< T > alg
std::string name
unsigned int NSnarlAll
unsigned int NSnarlOut
unsigned int NEventAll
unsigned int NEventOut
double WEventAll
double WEventOut

Detailed Description

template<class T>
class Anp::AlgCaddy< T >

Definition at line 25 of file AlgCaddy.h.


Constructor & Destructor Documentation

template<class T >
Anp::AlgCaddy< T >::AlgCaddy (  )  [inline]

Definition at line 93 of file AlgCaddy.h.

00094       : alg(0), name(),
00095       NSnarlAll(0), NSnarlOut(0), NEventAll(0), NEventOut(0), WEventAll(0.0), WEventOut(0.0)
00096    {
00097    }

template<class T>
Anp::AlgCaddy< T >::AlgCaddy ( Handle< T >  alg_,
const std::string &  name_ 
) [inline]

Definition at line 100 of file AlgCaddy.h.

00101       : alg(alg_), name(name_),
00102       NSnarlAll(0), NSnarlOut(0), NEventAll(0), NEventOut(0), WEventAll(0.0), WEventOut(0.0)
00103    {
00104    }

template<class T >
Anp::AlgCaddy< T >::~AlgCaddy (  )  [inline]

Definition at line 107 of file AlgCaddy.h.

00108    {
00109    }


Member Function Documentation

template<class T >
void Anp::AlgCaddy< T >::AllEvent ( double  weight  )  [inline]

Definition at line 112 of file AlgCaddy.h.

References Anp::AlgCaddy< T >::NEventAll, and Anp::AlgCaddy< T >::WEventAll.

00113    {
00114       ++NEventAll;
00115       WEventAll += weight;
00116    }

template<class T >
void Anp::AlgCaddy< T >::AllSnarl ( const Record record  )  [inline]

Definition at line 126 of file AlgCaddy.h.

References Anp::Record::EventBeg(), Anp::Record::EventEnd(), Anp::AlgCaddy< T >::NEventAll, Anp::AlgCaddy< T >::NSnarlAll, and Anp::AlgCaddy< T >::WEventAll.

Referenced by Anp::RunAlgEvent::Run(), Anp::RunAlgStore::Run(), and Anp::RunAlgSnarl::RunRecord().

00127    {
00128       ++NSnarlAll;
00129       for(EventIter ievent = record.EventBeg(); ievent != record.EventEnd(); ++ievent)
00130       {
00131          ++NEventAll;
00132          WEventAll += ievent -> Weight();
00133       }
00134    }

template<class T >
void Anp::AlgCaddy< T >::OutEvent ( double  weight  )  [inline]

Definition at line 119 of file AlgCaddy.h.

References Anp::AlgCaddy< T >::NEventOut, and Anp::AlgCaddy< T >::WEventOut.

00120    {
00121       ++NEventOut;
00122       WEventOut += weight;
00123    }

template<class T >
void Anp::AlgCaddy< T >::OutSnarl ( const Record record  )  [inline]

Definition at line 137 of file AlgCaddy.h.

References Anp::Record::EventBeg(), Anp::Record::EventEnd(), Anp::AlgCaddy< T >::NEventOut, Anp::AlgCaddy< T >::NSnarlOut, and Anp::AlgCaddy< T >::WEventOut.

Referenced by Anp::RunAlgEvent::Run(), Anp::RunAlgStore::Run(), and Anp::RunAlgSnarl::RunRecord().

00138    {
00139       ++NSnarlOut;
00140       for(EventIter ievent = record.EventBeg(); ievent != record.EventEnd(); ++ievent)
00141       {
00142          ++NEventOut;
00143          WEventOut += ievent -> Weight();
00144       }
00145    }

template<class T >
void Anp::AlgCaddy< T >::Print ( unsigned int  nw,
unsigned int  cw,
const std::string &  opt,
std::ostream &  o = std::cout 
) const [inline]

Definition at line 159 of file AlgCaddy.h.

References Anp::AlgCaddy< T >::name, Anp::AlgCaddy< T >::NEventAll, Anp::AlgCaddy< T >::NEventOut, Anp::AlgCaddy< T >::NSnarlAll, Anp::AlgCaddy< T >::NSnarlOut, Anp::AlgCaddy< T >::WEventAll, Anp::AlgCaddy< T >::WEventOut, and Anp::AlgCaddy< T >::Width().

Referenced by Anp::RunAlgSnarl::End(), Anp::RunAlgEvent::End(), and Anp::RunAlgStore::~RunAlgStore().

00160    {
00161       if(nw < name.size())
00162       {
00163          nw = name.size();
00164       }      
00165       if(cw < 1)
00166       {
00167          cw = std::max<unsigned int>(cw, Width(NSnarlAll));
00168          cw = std::max<unsigned int>(cw, Width(NSnarlOut));
00169          cw = std::max<unsigned int>(cw, Width(NEventAll));
00170          cw = std::max<unsigned int>(cw, Width(NEventOut));
00171       }
00172 
00173       if(opt.find("snarl") != std::string::npos)
00174       {
00175          if(nw > 0)
00176          {
00177             o << std::setfill(' ') << std::setw(nw) << std::left << name << " ";
00178          }
00179 
00180          o << " snarl pass/total = ";
00181          o << std::setfill(' ') << std::setw(cw) << std::right << NSnarlOut << "/"; 
00182          o << std::setfill(' ') << std::setw(cw) << std::right << NSnarlAll;
00183          
00184          if(NSnarlAll > 0)
00185          {
00186             o << " = " << std::setfill(' ') 
00187                       << std::setprecision(5) << std::showpoint << double(NSnarlOut)/double(NSnarlAll);
00188          }
00189          o << std::noshowpoint << std::endl;
00190       }
00191 
00192       if(opt.find("event") != std::string::npos)
00193       {
00194          if(nw > 0)
00195          {
00196             o << std::setfill(' ') << std::setw(nw) << std::left << name << " ";
00197          }
00198          
00199          o << " event pass/total = ";
00200          o << std::setfill(' ') << std::setw(cw) << std::right << NEventOut << "/"; 
00201          o << std::setfill(' ') << std::setw(cw) << std::right << NEventAll;
00202          
00203          if(NEventAll > 0)
00204          {
00205             o << " = " << std::setfill(' ') 
00206                       << std::setprecision(5)  << std::showpoint << double(NEventOut)/double(NEventAll);
00207          }
00208          o << std::noshowpoint << std::endl;
00209       }
00210 
00211       if(opt.find("weight") != std::string::npos)
00212       {
00213          if(nw > 0)
00214          {
00215             o << std::setfill(' ') << std::setw(nw) << std::left << name << " ";
00216          }
00217          
00218          o << "weight pass/total = "
00219            << std::setfill(' ') << std::setw(cw) << std::right << static_cast<long int>(WEventOut) << "/"
00220            << std::setfill(' ') << std::setw(cw) << std::right << static_cast<long int>(WEventAll);
00221          
00222          if(WEventAll > 0.0)
00223          {
00224             o << " = " << std::setfill(' ') 
00225               << std::setprecision(5)  << std::showpoint << WEventOut/WEventAll;
00226          }
00227          o << std::noshowpoint << std::endl;
00228       }
00229    }

template<class T >
unsigned int Anp::AlgCaddy< T >::Width ( unsigned int  number  )  const [inline]

Definition at line 148 of file AlgCaddy.h.

Referenced by Anp::AlgCaddy< T >::Print().

00149    {
00150       if(number > 0)
00151       {
00152          return static_cast<unsigned int>(1 + std::log10(double(number)));
00153       }
00154 
00155       return 1;
00156    }


Member Data Documentation

template<class T>
Handle<T> Anp::AlgCaddy< T >::alg

Definition at line 45 of file AlgCaddy.h.

Referenced by Anp::SelectCount::End().

template<class T>
std::string Anp::AlgCaddy< T >::name

Definition at line 47 of file AlgCaddy.h.

Referenced by Anp::AlgCaddy< T >::Print().

template<class T>
unsigned int Anp::AlgCaddy< T >::NEventAll
template<class T>
unsigned int Anp::AlgCaddy< T >::NEventOut
template<class T>
unsigned int Anp::AlgCaddy< T >::NSnarlAll

Definition at line 49 of file AlgCaddy.h.

Referenced by Anp::AlgCaddy< T >::AllSnarl(), and Anp::AlgCaddy< T >::Print().

template<class T>
unsigned int Anp::AlgCaddy< T >::NSnarlOut

Definition at line 50 of file AlgCaddy.h.

Referenced by Anp::AlgCaddy< T >::OutSnarl(), and Anp::AlgCaddy< T >::Print().

template<class T>
double Anp::AlgCaddy< T >::WEventAll
template<class T>
double Anp::AlgCaddy< T >::WEventOut

The documentation for this class was generated from the following file:

Generated on 3 Dec 2018 for loon by  doxygen 1.6.1