Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

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 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)

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

const StatSelectioneventSelection (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

double correctedEff (const StatWeight *w=0) const
 return efficiency corrected by weight (global event weight by default)

double correctedEffErr (const StatWeight *w=0) const
 return efficiency corrected by weight errors (global event weight by default)

const std::pair< StatWeight *,
StatWeight * > & 
systematics (unsigned int n=0) const
 return systematics by number

unsigned int systsize () const
 return number of systematics for this sample

double totalsyst_pos () const
 total systematics for the positive shift

double totalsyst_neg () const
 total systematics for the negative shift

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

double calculateGlobalWeight (cafe::Event *event)
 calculate global 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

ostream & print_tex_syst (ostream &os) const
 Print systematics as a tex table.

 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< StatSelection * > _events
StatWeight_weight
std::vector< std::pair< StatWeight *,
StatWeight * > > 
_syst


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, and tagged().

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

add tag required for this sample with AND logic

Definition at line 47 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 38 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 63 of file StatSample.cpp.

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

double cafe::StatSample::calculateGlobalWeight cafe::Event event  ) 
 

calculate global event weight

Definition at line 87 of file StatSample.cpp.

References _events, _syst, _weight, cafe::StatSelection::name(), tagged(), cafe::StatWeight::weight(), cafe::StatWeight::weight_average_neg(), cafe::StatWeight::weight_average_pos(), cafe::StatWeight::weight_neg(), and cafe::StatWeight::weight_pos().

cafe::StatSample::ClassDef StatSample  ,
 

void cafe::StatSample::Clear  ) 
 

reset selection flags _selected

Definition at line 173 of file StatSample.cpp.

References _events, _syst, _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 389 of file StatSample.cpp.

References _events.

double cafe::StatSample::correctedEff const StatWeight w = 0  )  const
 

return efficiency corrected by weight (global event weight by default)

Definition at line 399 of file StatSample.cpp.

References _events, _weight, effGlob(), cafe::StatSelection::name(), and cafe::StatWeight::weight_average().

Referenced by HtmlTable(), and print_tex().

double cafe::StatSample::correctedEffErr const StatWeight w = 0  )  const
 

return efficiency corrected by weight errors (global event weight by default)

Definition at line 413 of file StatSample.cpp.

References _weight, effErrGlob(), effGlob(), cafe::StatWeight::err(), 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 272 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 256 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 304 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 289 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 371 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 356 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 337 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 321 of file StatSample.cpp.

References _events, and _name.

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

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

return event selection by name

Definition at line 242 of file StatSample.cpp.

References _events, and _name.

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

return event selection by number

Definition at line 223 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 188 of file StatSample.cpp.

References _events, _name, and _weight.

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

return event weight by number in the selection vector

Definition at line 209 of file StatSample.cpp.

References _events, and _name.

Referenced by HtmlTable(), and print_tex().

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

Print sample as a html table.

Definition at line 452 of file StatSample.cpp.

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

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

Definition at line 33 of file StatSample.hpp.

References _name.

Referenced by HtmlTable(), print_tex(), print_tex_syst(), 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 160 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 150 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 530 of file StatSample.cpp.

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

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

Print systematics as a tex table.

Definition at line 585 of file StatSample.cpp.

References _syst, _weight, name(), tex(), totalsyst_neg(), totalsyst_pos(), and cafe::StatWeight::weight_average().

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

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

Definition at line 53 of file StatSample.hpp.

References _events.

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

const pair< StatWeight *, StatWeight * > & cafe::StatSample::systematics unsigned int  n = 0  )  const
 

return systematics by number

Definition at line 232 of file StatSample.cpp.

References _name, and _syst.

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

return number of systematics for this sample

Definition at line 108 of file StatSample.hpp.

References _syst.

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

Definition at line 439 of file StatSample.cpp.

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

Referenced by add(), applyWeight(), and calculateGlobalWeight().

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

Definition at line 34 of file StatSample.hpp.

References _tags.

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

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

Definition at line 35 of file StatSample.hpp.

References _tags_and.

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

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

Convert string to the tex usable format.

Definition at line 624 of file StatSample.cpp.

References name().

Referenced by print_tex(), and print_tex_syst().

double cafe::StatSample::totalsyst_neg  )  const
 

total systematics for the negative shift

Definition at line 429 of file StatSample.cpp.

References _syst, _weight, and cafe::StatWeight::weight_average().

Referenced by print_tex_syst().

double cafe::StatSample::totalsyst_pos  )  const
 

total systematics for the positive shift

Definition at line 419 of file StatSample.cpp.

References _syst, _weight, and cafe::StatWeight::weight_average().

Referenced by print_tex_syst().


Member Data Documentation

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

Definition at line 24 of file StatSample.hpp.

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

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

Definition at line 21 of file StatSample.hpp.

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

std::vector<std::pair<StatWeight*,StatWeight*> > cafe::StatSample::_syst [private]
 

Definition at line 26 of file StatSample.hpp.

Referenced by calculateGlobalWeight(), Clear(), print_tex_syst(), systematics(), systsize(), totalsyst_neg(), and totalsyst_pos().

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

Definition at line 22 of file StatSample.hpp.

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

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

Definition at line 23 of file StatSample.hpp.

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

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

Definition at line 25 of file StatSample.hpp.

Referenced by applyWeight(), calculateGlobalWeight(), Clear(), correctedEff(), correctedEffErr(), eventWeight(), print_tex_syst(), StatSample(), totalsyst_neg(), and totalsyst_pos().


The documentation for this class was generated from the following files:
Generated on Tue Mar 28 10:13:11 2006 for CAF by doxygen 1.3.4