All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
ana::UniverseWeight Class Reference

#include <SBNWeightSysts.h>

Public Member Functions

 UniverseWeight (const std::string &psetName, int univIdx)
 
double operator() (const caf::SRSliceProxy *sr) const
 

Protected Attributes

std::string fPSetName
 
int fPSetIdx
 
int fUnivIdx
 

Detailed Description

Definition at line 14 of file SBNWeightSysts.h.

Constructor & Destructor Documentation

ana::UniverseWeight::UniverseWeight ( const std::string &  psetName,
int  univIdx 
)

Definition at line 15 of file SBNWeightSysts.cxx.

16  : fPSetName(psetName), fPSetIdx(-1), fUnivIdx(univIdx)
17  {
18  }
std::string fPSetName

Member Function Documentation

double ana::UniverseWeight::operator() ( const caf::SRSliceProxy sr) const

Definition at line 21 of file SBNWeightSysts.cxx.

22  {
23  if(sr->truth.index < 0) return 1;
24 
25  if(fPSetIdx == -1){
26  const UniverseOracle& uo = UniverseOracle::Instance();
27  fPSetIdx = uo.ParameterSetIndex(fPSetName);
28  }
29 
30  const caf::Proxy<std::vector<caf::SRMultiverse>>& wgts = sr->truth.wgt;
31  if(wgts.empty()) return 1;
32 
33  const int Nwgts = wgts[fPSetIdx].univ.size();
34 
35  static bool once = true;
36  if(!once && fUnivIdx >= Nwgts){
37  once = false;
38  std::cout << "UniverseWeight: WARNING requesting universe " << fUnivIdx << " in parameter set " << fPSetName << " which only has size " << Nwgts << ". Will wrap-around and suppress future warnings." << std::endl;
39  }
40 
41  const unsigned int unividx = fUnivIdx % Nwgts;
42 
43  return wgts[fPSetIdx].univ[unividx];
44  }
std::string fPSetName
static UniverseOracle & Instance()
BEGIN_PROLOG could also be cout

Member Data Documentation

int ana::UniverseWeight::fPSetIdx
mutableprotected

Definition at line 23 of file SBNWeightSysts.h.

std::string ana::UniverseWeight::fPSetName
protected

Definition at line 22 of file SBNWeightSysts.h.

int ana::UniverseWeight::fUnivIdx
protected

Definition at line 24 of file SBNWeightSysts.h.


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