Public Member Functions | Private Attributes | Friends | List of all members
cmf::MCVarVals Class Reference

Base container for the MC related Vars that constitute an event. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-04-16/CovarianceMatrixFit/core/VarVals.h"

Public Member Functions

 MCVarVals ()
 
 MCVarVals (cmf::TruthVars const &tv, cmf::WeightVars const &wv)
 
 MCVarVals (cmf::TruthVars const &tv, cmf::WeightVars const &wv, cmf::SystVarColl const &gv)
 
float val_at (uint8_t const &varkey) const
 Access a Var by name. More...
 
std::map< float, float > SystVarWgts (uint8_t const &varkey) const
 
cmf::TruthVars const & TruthVars () const
 
cmf::WeightVars const & WeightVars () const
 
cmf::SystVarColl const & SystematicShifts () const
 

Private Attributes

cmf::TruthVars fTruthVars
 
cmf::WeightVars fWeightVars
 
cmf::SystVarColl fSystematicShifts
 

Friends

std::ostream & operator<< (std::ostream &o, cmf::MCVarVals const &mcvv)
 

Detailed Description

Base container for the MC related Vars that constitute an event.

Definition at line 227 of file VarVals.h.

Constructor & Destructor Documentation

cmf::MCVarVals::MCVarVals ( )
inline

Definition at line 235 of file VarVals.h.

236  {}
cmf::MCVarVals::MCVarVals ( cmf::TruthVars const &  tv,
cmf::WeightVars const &  wv 
)
inline

Definition at line 238 of file VarVals.h.

240  : fTruthVars (tv)
241  , fWeightVars(wv)
242  {}
cmf::WeightVars fWeightVars
Definition: VarVals.h:231
cmf::TruthVars fTruthVars
Definition: VarVals.h:230
cmf::MCVarVals::MCVarVals ( cmf::TruthVars const &  tv,
cmf::WeightVars const &  wv,
cmf::SystVarColl const &  gv 
)
inline

Definition at line 244 of file VarVals.h.

References msf_helper::o, and cmf::operator<<().

247  : fTruthVars (tv)
248  , fWeightVars(wv)
249  , fSystematicShifts(gv)
250  {}
cmf::WeightVars fWeightVars
Definition: VarVals.h:231
cmf::SystVarColl fSystematicShifts
Definition: VarVals.h:232
cmf::TruthVars fTruthVars
Definition: VarVals.h:230

Member Function Documentation

cmf::SystVarColl const& cmf::MCVarVals::SystematicShifts ( ) const
inline

Definition at line 263 of file VarVals.h.

263 { return fSystematicShifts; }
cmf::SystVarColl fSystematicShifts
Definition: VarVals.h:232
std::map< float, float > cmf::MCVarVals::SystVarWgts ( uint8_t const &  varkey) const

Definition at line 47 of file VarVals.cxx.

References fSystematicShifts.

Referenced by cmf::ShifterAndWeighter::CMFSystVarWeight().

48  {
49  // get the values for this genie systematic
50  auto itr = std::find(fSystematicShifts.begin(), fSystematicShifts.end(), varKey);
51  std::vector<float> vals = (itr != fSystematicShifts.end()) ? itr->SigmasAsVec() : std::vector<float>({1, 1, 1, 1});
52  // for(auto const& itr : fSystematicShifts){
53  // if(itr.Type() == varKey) vals = itr.SigmasAsVec();
54  // }
55 
56  // if the -2 and +2 sigma values are the same, then they aren't meaningful so don't
57  // add them to the map and only return the -1, 0 and +1 sigma values
58  if(vals[0] == vals[3])
59  return std::move(std::map<float, float>({ {-1., vals[1]},
60  { 0., 1.},
61  { 1., vals[2]} }));
62 
63  return std::move(std::map<float, float>({ {-2., vals[0]},
64  {-1., vals[1]},
65  { 0., 1.},
66  { 1., vals[2]},
67  { 2., vals[3]} }));
68  }
cmf::SystVarColl fSystematicShifts
Definition: VarVals.h:232
cmf::TruthVars const& cmf::MCVarVals::TruthVars ( ) const
inline

Definition at line 261 of file VarVals.h.

261 { return fTruthVars; }
cmf::TruthVars fTruthVars
Definition: VarVals.h:230
float cmf::MCVarVals::val_at ( uint8_t const &  varkey) const

Access a Var by name.

Definition at line 18 of file VarVals.cxx.

References cmf::WeightVars::fPPFXFluxCV_Weight, cmf::WeightVars::fRPARES_Weight, cmf::TruthVars::fTrueCCNC, cmf::TruthVars::fTrueE, cmf::TruthVars::fTrueHitNuc, cmf::TruthVars::fTrueIntMode, cmf::TruthVars::fTrueIntType, cmf::TruthVars::fTrueParentDecay, cmf::TruthVars::fTrueParentPDG, cmf::TruthVars::fTrueParentPT, cmf::TruthVars::fTrueParentPZ, cmf::TruthVars::fTrueParentTargetPDG, cmf::TruthVars::fTruePDG, cmf::TruthVars::fTruePDGOrig, fTruthVars, fWeightVars, cmf::WeightVars::fXSecCV2020_Weight, cmf::WeightVars::fXSecCVPPFX_Weight, cmf::kPPFXFluxCVWgt, cmf::kRPARES_Weight, cmf::kTrueCCNC, cmf::kTrueE, cmf::kTrueHitNuc, cmf::kTrueIntMode, cmf::kTrueIntType, cmf::kTrueParentDecay, cmf::kTrueParentPDG, cmf::kTrueParentPT, cmf::kTrueParentPZ, cmf::kTrueParentTargetPDG, cmf::kTruePDG, cmf::kTruePDGOrig, cmf::kXSecCV2020Wgt, and cmf::kXSecCVPPFX_Weight.

Referenced by cmf::operator<<(), cmf::ShifterAndWeighter::OscillationWeightBinCenter(), cmf::ShifterAndWeighter::OscillationWeightTrueE(), cmf::ShifterAndWeighter::Weight(), and cmf::ShifterAndWeighter::XSecCVPPFXWeight().

19  {
20  if (varkey == kTrueE ) return fTruthVars.fTrueE;
21  else if(varkey == kTruePDG ) return fTruthVars.fTruePDG;
22  else if(varkey == kTrueCCNC ) return fTruthVars.fTrueCCNC;
23  else if(varkey == kTrueIntType ) return fTruthVars.fTrueIntType;
24  else if(varkey == kTruePDGOrig ) return fTruthVars.fTruePDGOrig;
25  else if(varkey == kTrueParentPDG ) return fTruthVars.fTrueParentPDG;
26  else if(varkey == kTrueParentPT ) return fTruthVars.fTrueParentPT;
27  else if(varkey == kTrueParentPZ ) return fTruthVars.fTrueParentPZ;
28  else if(varkey == kTrueParentDecay ) return fTruthVars.fTrueParentDecay;
29  else if(varkey == kTrueParentTargetPDG) return fTruthVars.fTrueParentTargetPDG;
30  else if(varkey == kTrueHitNuc ) return fTruthVars.fTrueHitNuc;
31  else if(varkey == kTrueIntMode ) return fTruthVars.fTrueIntMode;
32 
33  else if(varkey == kXSecCVPPFX_Weight ) return fWeightVars.fXSecCVPPFX_Weight;
34  else if(varkey == kRPARES_Weight ) return fWeightVars.fRPARES_Weight;
35  else if(varkey == kXSecCV2020Wgt ) return fWeightVars.fXSecCV2020_Weight;
36  else if(varkey == kPPFXFluxCVWgt ) return fWeightVars.fPPFXFluxCV_Weight;
37 
38  throw cet::exception("VarVals")
39  << "Key: "
40  << varkey
41  << " does not correspond to any variable";
42 
43  return std::numeric_limits<float>::lowest();
44  }
float fTruePDGOrig
true PDG of original neutrino
Definition: VarVals.h:46
cmf::WeightVars fWeightVars
Definition: VarVals.h:231
float fPPFXFluxCV_Weight
For 2020 Ana, store weights seperately.
Definition: VarVals.h:159
float fTrueHitNuc
true hit nucleus
Definition: VarVals.h:52
float fTrueCCNC
true cc vs nc
Definition: VarVals.h:44
float fTrueParentDecay
true parent decay mode
Definition: VarVals.h:50
float fTruePDG
true PDG
Definition: VarVals.h:43
float fTrueParentPT
true p_T of neutrino parent
Definition: VarVals.h:48
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
float fRPARES_Weight
To be used for systematic evaluation ONLY.
Definition: VarVals.h:152
float fTrueE
True nu energy.
Definition: VarVals.h:42
float fTrueParentPDG
true PDG of neutrino parent
Definition: VarVals.h:47
cmf::TruthVars fTruthVars
Definition: VarVals.h:230
float fXSecCV2020_Weight
For 2020 Ana, store weights seperately.
Definition: VarVals.h:158
float fXSecCVPPFX_Weight
Deprecated, Was Tufts weight for SA.
Definition: VarVals.h:150
float fTrueParentPZ
true p_Z of neutrino parent
Definition: VarVals.h:49
float fTrueIntType
true interaction type
Definition: VarVals.h:45
float fTrueIntMode
true interaction mode
Definition: VarVals.h:53
float fTrueParentTargetPDG
true parent pdg code off the target
Definition: VarVals.h:51
cmf::WeightVars const& cmf::MCVarVals::WeightVars ( ) const
inline

Definition at line 262 of file VarVals.h.

262 { return fWeightVars; }
cmf::WeightVars fWeightVars
Definition: VarVals.h:231

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
cmf::MCVarVals const &  mcvv 
)
friend

Definition at line 71 of file VarVals.cxx.

72  {
73  o << "Event MC related variables are: "
74  << "\n\t" << cmf::KeyToVarName(cmf::kTrueE) << " " << mcvv.val_at(cmf::kTrueE )
75  << "\n\t" << cmf::KeyToVarName(cmf::kTruePDG) << " " << mcvv.val_at(cmf::kTruePDG )
76  << "\n\t" << cmf::KeyToVarName(cmf::kTrueCCNC) << " " << mcvv.val_at(cmf::kTrueCCNC )
77  << "\n\t" << cmf::KeyToVarName(cmf::kTrueIntType) << " " << mcvv.val_at(cmf::kTrueIntType )
78  << "\n\t" << cmf::KeyToVarName(cmf::kTruePDGOrig) << " " << mcvv.val_at(cmf::kTruePDGOrig )
79  << "\n\t" << cmf::KeyToVarName(cmf::kTrueParentPDG) << " " << mcvv.val_at(cmf::kTrueParentPDG )
80  << "\n\t" << cmf::KeyToVarName(cmf::kTrueParentPT) << " " << mcvv.val_at(cmf::kTrueParentPT )
81  << "\n\t" << cmf::KeyToVarName(cmf::kTrueParentPZ) << " " << mcvv.val_at(cmf::kTrueParentPZ )
82  << "\n\t" << cmf::KeyToVarName(cmf::kTrueParentDecay) << " " << mcvv.val_at(cmf::kTrueParentDecay )
83  << "\n\t" << cmf::KeyToVarName(cmf::kTrueParentTargetPDG) << " " << mcvv.val_at(cmf::kTrueParentTargetPDG)
84  << "\n\t" << cmf::KeyToVarName(cmf::kTrueHitNuc) << " " << mcvv.val_at(cmf::kTrueHitNuc )
85  << "\n\t" << cmf::KeyToVarName(cmf::kTrueIntMode) << " " << mcvv.val_at(cmf::kTrueIntMode )
86  << "\n\t" << cmf::KeyToVarName(cmf::kXSecCVPPFX_Weight) << " " << mcvv.val_at(cmf::kXSecCVPPFX_Weight )
87  << "\n\t" << cmf::KeyToVarName(cmf::kRPARES_Weight) << " " << mcvv.val_at(cmf::kRPARES_Weight )
88  << "\n\t and too many GENIE knobs to list"
89  << std::endl;
90 
91  return o;
92  }
static std::string KeyToVarName(uint8_t const &key)
Definition: StaticFuncs.h:410

Member Data Documentation

cmf::SystVarColl cmf::MCVarVals::fSystematicShifts
private

Definition at line 232 of file VarVals.h.

Referenced by SystVarWgts().

cmf::TruthVars cmf::MCVarVals::fTruthVars
private

Definition at line 230 of file VarVals.h.

Referenced by val_at().

cmf::WeightVars cmf::MCVarVals::fWeightVars
private

Definition at line 231 of file VarVals.h.

Referenced by val_at().


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