cafe::StatSample Class Reference

#include <StatSample.hpp>

List of all members.

Public Member Functions

 StatSample (const std::string &sample="data")
virtual ~StatSample ()
const std::string & name () const
const std::vector< std::string > & tags () const
const std::vector< std::string > & tagsAnd () const
void AddTags (const std::string &tag)
 add tag required for this sample with ANY logic

void AddTags (const std::vector< std::string > &tags)
 add tags required for this sample with ANY logic

void AddAndTags (const std::vector< std::string > &tags)
 add tags required for this sample with AND logic

void AddAndTags (const std::string &tag)
 add tag required for this sample with AND logic

bool tagged (const cafe::Event *event) const
unsigned int size () const
 return number of selections for this sample (The initial selection always exist)

unsigned long nevents (unsigned int n=0) const
 return number of events for the selection n

unsigned long nevents (const std::string &name) const
 return number of events for the selection with specified name

double eff (unsigned int n=0) const
 return event selection efficiency or the average weight for a weight by number

double eff (const std::string &name) const
 return the event selection efficiency by name

double effGlob (unsigned int n=0) const
 return global event selection efficiency (relative to the initial number of events) (n = 0 means last selection / first one)

double effGlob (const std::string &name) const
 return global event selection efficiency (relative to the initial number of events)

double correctedEfficiency (unsigned int n=0) const
 return global event selection efficiency (relative to the initial number of events) corrected by the global event weight (n = 0 means last selection / first one)

double correctedEfficiency (const std::string &name) const
 return global event selection efficiency (relative to the initial number of events) corrected by the global event weight

double effErr (unsigned int n=0) const
 return event selection efficiency error or the average weight for a weight by number

double effErr (const std::string &name) const
 return event selection efficiency error by name

double effErrGlob (unsigned int n=0) const
 return global event selection efficiency error (n = 0 means last selection / first one)

double effErrGlob (const std::string &name) const
 return global event selection efficiency error (n = 0 means last selection / first one)

double correctedEffErr (unsigned int n=0) const
 return global event selection efficiency error (n = 0 means last selection / first one) corrected by the global event weight

double correctedEffErr (const std::string &name) const
 return global event selection efficiency error (n = 0 means last selection / first one) corrected by the global event weight

const StatWeighteventSelection (unsigned int n=0) const
 return event selection by number

const StatWeighteventSelection (const std::string &name) const
 return event selection by name

const StatWeighteventWeight (unsigned int n) const
 return event weight by number in the selection vector

const StatWeighteventWeight (const std::string &name="global") const
 return event weight by name. Return global event weight by default

Collection< EventWeightListEventWeights () const
 return a Collection of event weights available. The global event weight comes first

bool compareNames (const StatSample &sample) const
 return true if all selection names in both samples are equal

unsigned long add (cafe::Event *event, const std::string &name="Initial")
 increase event number for the selection by 1

double applyWeight (cafe::Event *event, const std::string &name, double weight, double weight_pos, double weight_neg)
 apply event weight

void Clear ()
 reset selection flags _selected

ostream & HtmlTable (ostream &os) const
 Print sample as a html table.

ostream & print_tex (ostream &os, const std::string title) const
 output operator

 ClassDef (StatSample, 0)

Static Public Member Functions

std::string tex (const std::string &init)
 Convert string to the tex usable format.


Private Attributes

std::string _name
std::vector< std::string > _tags
std::vector< std::string > _tags_and
std::vector< StatWeight * > _events
StatWeight_weight


Constructor & Destructor Documentation

cafe::StatSample::StatSample const std::string &  sample = "data"  ) 
 

Definition at line 8 of file StatSample.cpp.

References _events, and _weight.

cafe::StatSample::~StatSample  )  [virtual]
 

Definition at line 14 of file StatSample.cpp.


Member Function Documentation

unsigned long cafe::StatSample::add cafe::Event event,
const std::string &  name = "Initial"
 

increase event number for the selection by 1

Definition at line 42 of file StatSample.cpp.

References _events, _weight, tagged(), cafe::StatWeight::weight(), cafe::StatWeight::weight_neg(), and cafe::StatWeight::weight_pos().

void cafe::StatSample::AddAndTags const std::string &  tag  )  [inline]
 

add tag required for this sample with AND logic

Definition at line 52 of file StatSample.hpp.

References _tags_and.

void cafe::StatSample::AddAndTags const std::vector< std::string > &  tags  ) 
 

add tags required for this sample with AND logic

Definition at line 30 of file StatSample.cpp.

References _tags_and.

Referenced by cafe::Stat::add_syst(), and cafe::Syst::Syst().

void cafe::StatSample::AddTags const std::vector< std::string > &  tags  ) 
 

add tags required for this sample with ANY logic

Definition at line 17 of file StatSample.cpp.

References _tags.

void cafe::StatSample::AddTags const std::string &  tag  )  [inline]
 

add tag required for this sample with ANY logic

Definition at line 43 of file StatSample.hpp.

References _tags.

Referenced by cafe::Syst::Syst().

double cafe::StatSample::applyWeight cafe::Event event,
const std::string &  name,
double  weight,
double  weight_pos,
double  weight_neg
 

apply event weight

Definition at line 62 of file StatSample.cpp.

References _events, _weight, cafe::StatWeight::applyWeight(), and tagged().

cafe::StatSample::ClassDef StatSample  ,
 

void cafe::StatSample::Clear  ) 
 

reset selection flags _selected

Definition at line 111 of file StatSample.cpp.

References _events, _weight, and cafe::StatWeight::Clear().

bool cafe::StatSample::compareNames const StatSample sample  )  const
 

return true if all selection names in both samples are equal

Definition at line 338 of file StatSample.cpp.

References _events.

double cafe::StatSample::correctedEffErr const std::string &  name  )  const
 

return global event selection efficiency error (n = 0 means last selection / first one) corrected by the global event weight

Definition at line 332 of file StatSample.cpp.

References effErrGlob(), effGlob(), cafe::StatWeight::err(), eventWeight(), and cafe::StatWeight::weight_average().

double cafe::StatSample::correctedEffErr unsigned int  n = 0  )  const
 

return global event selection efficiency error (n = 0 means last selection / first one) corrected by the global event weight

Definition at line 322 of file StatSample.cpp.

References effErrGlob(), effGlob(), cafe::StatWeight::err(), eventWeight(), and cafe::StatWeight::weight_average().

Referenced by HtmlTable(), and print_tex().

double cafe::StatSample::correctedEfficiency const std::string &  name  )  const
 

return global event selection efficiency (relative to the initial number of events) corrected by the global event weight

Definition at line 328 of file StatSample.cpp.

References effGlob(), eventWeight(), and cafe::StatWeight::weight_average().

double cafe::StatSample::correctedEfficiency unsigned int  n = 0  )  const
 

return global event selection efficiency (relative to the initial number of events) corrected by the global event weight (n = 0 means last selection / first one)

Definition at line 318 of file StatSample.cpp.

References effGlob(), eventWeight(), and cafe::StatWeight::weight_average().

Referenced by HtmlTable(), and print_tex().

double cafe::StatSample::eff const std::string &  name  )  const
 

return the event selection efficiency by name

Definition at line 201 of file StatSample.cpp.

References _events, and _name.

double cafe::StatSample::eff unsigned int  n = 0  )  const
 

return event selection efficiency or the average weight for a weight by number

Definition at line 185 of file StatSample.cpp.

References _events, and _name.

Referenced by HtmlTable(), and print_tex().

double cafe::StatSample::effErr const std::string &  name  )  const
 

return event selection efficiency error by name

Definition at line 233 of file StatSample.cpp.

References _events, and _name.

double cafe::StatSample::effErr unsigned int  n = 0  )  const
 

return event selection efficiency error or the average weight for a weight by number

Definition at line 218 of file StatSample.cpp.

References _events, and _name.

Referenced by HtmlTable(), and print_tex().

double cafe::StatSample::effErrGlob const std::string &  name  )  const
 

return global event selection efficiency error (n = 0 means last selection / first one)

Definition at line 300 of file StatSample.cpp.

References _events, and _name.

double cafe::StatSample::effErrGlob unsigned int  n = 0  )  const
 

return global event selection efficiency error (n = 0 means last selection / first one)

Definition at line 285 of file StatSample.cpp.

References _events, and _name.

Referenced by correctedEffErr(), HtmlTable(), and print_tex().

double cafe::StatSample::effGlob const std::string &  name  )  const
 

return global event selection efficiency (relative to the initial number of events)

Definition at line 266 of file StatSample.cpp.

References _events, and _name.

double cafe::StatSample::effGlob unsigned int  n = 0  )  const
 

return global event selection efficiency (relative to the initial number of events) (n = 0 means last selection / first one)

Definition at line 250 of file StatSample.cpp.

References _events, and _name.

Referenced by correctedEffErr(), correctedEfficiency(), HtmlTable(), and print_tex().

const StatWeight * cafe::StatSample::eventSelection const std::string &  name  )  const
 

return event selection by name

Definition at line 171 of file StatSample.cpp.

References _events, and _name.

const StatWeight * cafe::StatSample::eventSelection unsigned int  n = 0  )  const
 

return event selection by number

Definition at line 162 of file StatSample.cpp.

References _events, and _name.

Referenced by HtmlTable(), cafe::Stat::inheritWeights(), and print_tex().

const StatWeight * cafe::StatSample::eventWeight const std::string &  name = "global"  )  const
 

return event weight by name. Return global event weight by default

Definition at line 120 of file StatSample.cpp.

References _events, and _weight.

const StatWeight * cafe::StatSample::eventWeight unsigned int  n  )  const
 

return event weight by number in the selection vector

Definition at line 152 of file StatSample.cpp.

References _events, and _name.

Referenced by correctedEffErr(), correctedEfficiency(), and HtmlTable().

ostream & cafe::StatSample::HtmlTable ostream &  os  )  const
 

Print sample as a html table.

Definition at line 361 of file StatSample.cpp.

References _weight, correctedEffErr(), correctedEfficiency(), eff(), effErr(), effErrGlob(), effGlob(), eventSelection(), eventWeight(), cafe::StatSelection::isWeight(), cafe::StatSelection::name(), name(), nevents(), cafe::StatSelection::nevents(), and size().

Collection< EventWeight > cafe::StatSample::ListEventWeights  )  const
 

return a Collection of event weights available. The global event weight comes first

Definition at line 132 of file StatSample.cpp.

References _events, _weight, cafe::Collection< T >::push_back(), cafe::StatWeight::weight(), cafe::StatWeight::weight_neg(), and cafe::StatWeight::weight_pos().

const std::string& cafe::StatSample::name  )  const [inline]
 

Definition at line 38 of file StatSample.hpp.

References _name.

Referenced by HtmlTable(), print_tex(), and tex().

unsigned long cafe::StatSample::nevents const std::string &  name  )  const
 

return number of events for the selection with specified name

Definition at line 98 of file StatSample.cpp.

References _events, and _name.

unsigned long cafe::StatSample::nevents unsigned int  n = 0  )  const
 

return number of events for the selection n

Definition at line 88 of file StatSample.cpp.

References _events, and _name.

Referenced by HtmlTable(), and print_tex().

ostream & cafe::StatSample::print_tex ostream &  os,
const std::string  title
const
 

output operator

Definition at line 439 of file StatSample.cpp.

References _weight, correctedEffErr(), correctedEfficiency(), eff(), effErr(), effErrGlob(), effGlob(), eventSelection(), cafe::StatSelection::isWeight(), name(), nevents(), cafe::StatSelection::nevents(), size(), and tex().

unsigned int cafe::StatSample::size  )  const [inline]
 

return number of selections for this sample (The initial selection always exist)

Definition at line 58 of file StatSample.hpp.

References _events.

Referenced by HtmlTable(), cafe::Stat::inheritWeights(), and print_tex().

bool cafe::StatSample::tagged const cafe::Event event  )  const
 

Definition at line 348 of file StatSample.cpp.

References _tags, _tags_and, and cafe::EventBase::hasTag().

Referenced by add(), and applyWeight().

const std::vector<std::string>& cafe::StatSample::tags  )  const [inline]
 

Definition at line 39 of file StatSample.hpp.

References _tags.

Referenced by cafe::Syst::Syst().

const std::vector<std::string>& cafe::StatSample::tagsAnd  )  const [inline]
 

Definition at line 40 of file StatSample.hpp.

References _tags_and.

std::string cafe::StatSample::tex const std::string &  init  )  [static]
 

Convert string to the tex usable format.

Definition at line 496 of file StatSample.cpp.

References name().

Referenced by print_tex().


Member Data Documentation

std::vector<StatWeight*> cafe::StatSample::_events [private]
 

Definition at line 30 of file StatSample.hpp.

Referenced by add(), applyWeight(), Clear(), compareNames(), eff(), effErr(), effErrGlob(), effGlob(), eventSelection(), eventWeight(), ListEventWeights(), nevents(), size(), and StatSample().

std::string cafe::StatSample::_name [private]
 

Definition at line 27 of file StatSample.hpp.

Referenced by eff(), effErr(), effErrGlob(), effGlob(), eventSelection(), eventWeight(), name(), and nevents().

std::vector<std::string> cafe::StatSample::_tags [private]
 

Definition at line 28 of file StatSample.hpp.

Referenced by AddTags(), tagged(), and tags().

std::vector<std::string> cafe::StatSample::_tags_and [private]
 

Definition at line 29 of file StatSample.hpp.

Referenced by AddAndTags(), tagged(), and tagsAnd().

StatWeight* cafe::StatSample::_weight [private]
 

Definition at line 31 of file StatSample.hpp.

Referenced by add(), applyWeight(), Clear(), eventWeight(), HtmlTable(), ListEventWeights(), print_tex(), and StatSample().


The documentation for this class was generated from the following files:
Generated on Thu Apr 3 04:14:28 2008 for CAF by doxygen 1.3.4