Classes | Typedefs | Functions | Variables
LSTME Namespace Reference

Classes

class  BasicProngVars
 
struct  BPFVars
 
struct  Config
 
class  FillLSTME
 
struct  LSTMEnergy
 
class  Model
 
class  Png2dVars
 
class  Png3dVars
 
class  ProngBPFVars
 
class  ProngCVNVars
 
class  SliceVars
 
class  VarDictBuilder
 

Typedefs

using CAFAnaModel = ResultCacher< LSTMEnergy >
 

Functions

bool sortByLength (const art::Ptr< rb::Prong > &a, const art::Ptr< rb::Prong > &b)
 
template<class T , size_t N>
std::pair< bool, size_t > getIndex (const std::array< T, N > &array, const T &value)
 
const std::array< int, N_CVNCVN_PNG_LIST ({PDG_ELECTRON, PDG_MUON, PDG_PROTON, PDG_PIPLUS, PDG_GAMMA,})
 
const std::unordered_map< int, std::string > PDG_TO_NAME_MAP ({{PDG_ELECTRON,"electronid"},{PDG_MUON,"muonid"},{PDG_PROTON,"protonid"},{PDG_PIPLUS,"pionid"},{PDG_GAMMA,"photonid"},})
 
static VarDict fillVarDict (const caf::SRProxy *sr, const std::vector< std::pair< std::string, Var >> &sliceVarDefs, const std::vector< std::pair< std::string, MultiVar >> &png2dVarDefs, const std::vector< std::pair< std::string, MultiVar >> &png3dVarDefs)
 
static std::shared_ptr< CAFAnaModelinitCAFAnaModel (const std::string &modelSavedir)
 
static Var muonEnergy (const std::shared_ptr< CAFAnaModel > &model)
 
static Var numuEnergy (const std::shared_ptr< CAFAnaModel > &model)
 
static Var hadEnergy (const std::shared_ptr< CAFAnaModel > &model)
 

Variables

const size_t N_BPF = 3
 
const size_t N_CVN = 5
 
const int PDG_ELECTRON = 11
 
const int PDG_MUON = 13
 
const int PDG_PROTON = 2212
 
const int PDG_PIPLUS = 211
 
const int PDG_GAMMA = 22
 
static const int FD_PERIOD_1_END = 17139
 
static const int FD_PERIOD_2_END = 20752
 
static const int ND_PERIOD_2_END = 11228
 

Typedef Documentation

using LSTME::CAFAnaModel = typedef ResultCacher<LSTMEnergy>

Definition at line 15 of file LSTMEVar.h.

Function Documentation

const std::array<int, N_CVN> LSTME::CVN_PNG_LIST ( {PDG_ELECTRON, PDG_MUON, PDG_PROTON, PDG_PIPLUS, PDG_GAMMA,}  )
static VarDict LSTME::fillVarDict ( const caf::SRProxy sr,
const std::vector< std::pair< std::string, Var >> &  sliceVarDefs,
const std::vector< std::pair< std::string, MultiVar >> &  png2dVarDefs,
const std::vector< std::pair< std::string, MultiVar >> &  png3dVarDefs 
)
static

Definition at line 17 of file LSTMEVar.h.

References fillBadChanDBTables::result, VarDict::scalarVarMap, and VarDict::vectorVarMap.

Referenced by initCAFAnaModel().

23 {
25 
26  for (auto &namedVar : sliceVarDefs) {
27  result.scalarVarMap[namedVar.first] = namedVar.second(sr);
28  }
29 
30  for (auto &namedMultiVar : png2dVarDefs) {
31  result.vectorVarMap[namedMultiVar.first] = namedMultiVar.second(sr);
32  }
33 
34  for (auto &namedMultiVar : png3dVarDefs) {
35  result.vectorVarMap[namedMultiVar.first] = namedMultiVar.second(sr);
36  }
37 
38  return result;
39 }
std::unordered_map< std::string, std::vector< double > > vectorVarMap
Definition: VarDict.h:11
Definition: VarDict.h:7
std::unordered_map< std::string, double > scalarVarMap
Definition: VarDict.h:10
template<class T , size_t N>
std::pair<bool, size_t> LSTME::getIndex ( const std::array< T, N > &  array,
const T value 
)

Definition at line 8 of file ProngCVNVars.cxx.

References it, and make_pair().

Referenced by LSTME::ProngCVNVars::getCVNVars(), and LSTME::ProngCVNVars::getFallbackCVNVars().

9 {
10  auto it = std::find(array.begin(), array.end(), value);
11  if (it == array.end()) {
12  return std::make_pair(false, 0);
13  }
14 
15  return std::make_pair(true, it - array.begin());
16 }
set< int >::iterator it
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:335
const XML_Char int const XML_Char * value
Definition: expat.h:331
static Var LSTME::hadEnergy ( const std::shared_ptr< CAFAnaModel > &  model)
static

Definition at line 87 of file LSTMEVar.h.

References Munits::sr.

Referenced by murem::MuonRemoveAna::analyze(), and cmf::CAFToEventList::FillDataVarVals().

88 {
89  return Var(
90  [model] (const caf::SRProxy *sr) -> double
91  {
92  return (*model)(sr).numuE - (*model)(sr).muonE;
93  }
94  );
95 }
GenericVar< caf::SRProxy > Var
Representation of a variable to be retrieved from a caf::StandardRecord object.
Definition: Var.h:76
Proxy for caf::StandardRecord.
Definition: SRProxy.h:1969
const XML_Char XML_Content * model
Definition: expat.h:151
static constexpr Double_t sr
Definition: Munits.h:164
static std::shared_ptr<CAFAnaModel> LSTME::initCAFAnaModel ( const std::string &  modelSavedir)
static

Definition at line 41 of file LSTMEVar.h.

References fillVarDict(), caf::kFARDET, ana::kPng2dVarDefs, ana::kPng3dVarDefs, ana::kSliceVarDefs, and Munits::sr.

44 {
45  auto model = std::make_shared<Model>(modelSavedir);
46 
47  return std::make_shared<CAFAnaModel>(
48  [
49  model = std::move(model),
50  trkLenCorr = TrackLengthCorrection()
51  ] (const caf::SRProxy *sr) mutable -> LSTMEnergy
52  {
53  auto varDict = fillVarDict(
55  );
56 
57  /* TODO: remove air bubble correction once geometry is fixed */
58  bool isMC = (sr->mc.nallnus > 0) || (sr->mc.nallcosmics > 0);
59  trkLenCorr.setParams(isMC, (sr->hdr.det == caf::kFARDET));
60  trkLenCorr.shift(varDict);
61 
62  return model->predict(varDict);
63  }
64  );
65 }
Far Detector at Ash River.
Definition: SREnums.h:11
Proxy for caf::StandardRecord.
Definition: SRProxy.h:1969
const std::vector< std::pair< std::string, MultiVar > > kPng2dVarDefs
const std::vector< std::pair< std::string, Var > > kSliceVarDefs
const std::vector< std::pair< std::string, MultiVar > > kPng3dVarDefs
static VarDict fillVarDict(const caf::SRProxy *sr, const std::vector< std::pair< std::string, Var >> &sliceVarDefs, const std::vector< std::pair< std::string, MultiVar >> &png2dVarDefs, const std::vector< std::pair< std::string, MultiVar >> &png3dVarDefs)
Definition: LSTMEVar.h:17
const XML_Char XML_Content * model
Definition: expat.h:151
static constexpr Double_t sr
Definition: Munits.h:164
static Var LSTME::muonEnergy ( const std::shared_ptr< CAFAnaModel > &  model)
static

Definition at line 67 of file LSTMEVar.h.

References Munits::sr.

Referenced by murem::MuonRemoveAna::analyze(), caf::FillNumuInfo(), and murem::MuonRemove::MuonInfo().

68 {
69  return Var(
70  [model] (const caf::SRProxy *sr) -> double
71  {
72  return (*model)(sr).muonE;
73  }
74  );
75 }
GenericVar< caf::SRProxy > Var
Representation of a variable to be retrieved from a caf::StandardRecord object.
Definition: Var.h:76
Proxy for caf::StandardRecord.
Definition: SRProxy.h:1969
const XML_Char XML_Content * model
Definition: expat.h:151
static constexpr Double_t sr
Definition: Munits.h:164
static Var LSTME::numuEnergy ( const std::shared_ptr< CAFAnaModel > &  model)
static

Definition at line 77 of file LSTMEVar.h.

References Munits::sr.

Referenced by qeef::QeFinder::produce(), and numusand::FillSandbox::produce().

78 {
79  return Var(
80  [model] (const caf::SRProxy *sr) -> double
81  {
82  return (*model)(sr).numuE;
83  }
84  );
85 }
GenericVar< caf::SRProxy > Var
Representation of a variable to be retrieved from a caf::StandardRecord object.
Definition: Var.h:76
Proxy for caf::StandardRecord.
Definition: SRProxy.h:1969
const XML_Char XML_Content * model
Definition: expat.h:151
static constexpr Double_t sr
Definition: Munits.h:164
const std::unordered_map<int, std::string> LSTME::PDG_TO_NAME_MAP ( {{PDG_ELECTRON,"electronid"},{PDG_MUON,"muonid"},{PDG_PROTON,"protonid"},{PDG_PIPLUS,"pionid"},{PDG_GAMMA,"photonid"},}  )
bool LSTME::sortByLength ( const art::Ptr< rb::Prong > &  a,
const art::Ptr< rb::Prong > &  b 
)

Definition at line 6 of file BasicProngVars.cxx.

References rb::Prong::TotalLength().

Referenced by LSTME::BasicProngVars::getProngs().

6  {
7  return a->TotalLength() > b->TotalLength();
8 }
virtual double TotalLength() const
Distance along prong to reach last cell hit.
Definition: Prong.cxx:186

Variable Documentation

const int LSTME::FD_PERIOD_1_END = 17139
static

Definition at line 14 of file SliceVars.h.

Referenced by LSTME::SliceVars::getCoarseTiming().

const int LSTME::FD_PERIOD_2_END = 20752
static

Definition at line 15 of file SliceVars.h.

Referenced by LSTME::SliceVars::getLowGain().

const size_t LSTME::N_BPF = 3
const size_t LSTME::N_CVN = 5

Definition at line 11 of file ProngCVNVars.h.

Referenced by LSTME::ProngCVNVars::saveToDict().

const int LSTME::ND_PERIOD_2_END = 11228
static

Definition at line 16 of file SliceVars.h.

Referenced by LSTME::SliceVars::getLowGain().

const int LSTME::PDG_ELECTRON = 11

Definition at line 13 of file ProngCVNVars.h.

const int LSTME::PDG_GAMMA = 22

Definition at line 17 of file ProngCVNVars.h.

const int LSTME::PDG_MUON = 13
const int LSTME::PDG_PIPLUS = 211

Definition at line 16 of file ProngCVNVars.h.

const int LSTME::PDG_PROTON = 2212

Definition at line 15 of file ProngCVNVars.h.