Public Member Functions | Protected Member Functions | List of all members
ana::GetNCCosRejKeras Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/NuXAna/Vars/NusVarsTemp.h"

Public Member Functions

 GetNCCosRejKeras ()
 
float operator() (const caf::SRProxy *sr) const
 

Protected Member Functions

void InitKeras () const
 

Detailed Description

Definition at line 113 of file NusVarsTemp.h.

Constructor & Destructor Documentation

ana::GetNCCosRejKeras::GetNCCosRejKeras ( )
inline

Definition at line 116 of file NusVarsTemp.h.

References ana::GetNCCosRejBDTG2020::operator()(), and sr.

116 {}

Member Function Documentation

void ana::GetNCCosRejKeras::InitKeras ( ) const
protected

Definition at line 687 of file NusVarsTemp.cxx.

References ana::assert(), cet::getenv(), and string.

688  {
689 
690  if(!fModel){
691  const char* libpath = getenv("NCID_LIB_PATH");
692  assert(libpath);
693  std::string keras_model = std::string(libpath)+"/keras_nn_5layer_v2_weight.nnet";
694  fModel = new keras::KerasModel(keras_model,true);
695  }
696 
697  }
static keras::KerasModel * fModel
std::string getenv(std::string const &name)
assert(nhit_max >=nhit_nbins)
enum BeamMode string
float ana::GetNCCosRejKeras::operator() ( const caf::SRProxy sr) const

Definition at line 482 of file NusVarsTemp.cxx.

References om::cout, caf::Proxy< caf::SRVertexBranch >::elastic, allTimeWatchdog::endl, check_time_usage::float, caf::Proxy< caf::SRElastic >::fuzzyk, std::isinf(), std::isnan(), caf::Proxy< caf::SRElastic >::IsValid, ana::nmiphit, caf::Proxy< caf::SRSlice >::nmiphit, caf::Proxy< caf::SRFuzzyK >::npng, ana::nshwlid, caf::Proxy< caf::SRFuzzyK >::nshwlid, caf::Proxy< caf::SRIDBranch >::nuecosrej, caf::Proxy< caf::SRNueCosRej >::partptp, caf::Proxy< caf::SRFuzzyK >::png, caf::Proxy< caf::StandardRecord >::sel, ana::shwcalE, ana::shwdirY, ana::shwGap, ana::shwlen, ana::shwnhit, ana::shwnhitx, ana::shwnhity, ana::shwwidth, ana::shwxminusy, ana::shwxovery, ana::shwxplusy, caf::Proxy< caf::StandardRecord >::slc, and caf::Proxy< caf::StandardRecord >::vtx.

483  {
484  keras::DataChunk *sample = new keras::DataChunkFlat();
485 
486  if(!fModel) InitKeras();
487 
488  if(!sr->vtx.elastic.IsValid) return -5.f;
489  if(sr->vtx.elastic.fuzzyk.npng == 0) return -5.f;
490  if(sr->vtx.elastic.fuzzyk.nshwlid == 0) return -5.f;
491  std::cout << "ERROR::GetNCCosRejKeras. Looking for cvn2017. Branch no longer exists." << std::endl;
492  abort();
493  //if(sr->sel.cvn2017.noutput == 0) return -5.f; // Karl::Deleted branch
494  if(std::isnan(1.*sr->sel.nuecosrej.partptp) ||
495  std::isinf(1.*sr->sel.nuecosrej.partptp)) return -5.f;
496  //cosmicid = sr->sel.cvn2017.output[14]; // Karl::Deleted branch
498  shwnhit = (float)sr->vtx.elastic.fuzzyk.png[0].shwlid.nhit;
499  shwnhitx = (float)sr->vtx.elastic.fuzzyk.png[0].shwlid.nhitx;
500  shwnhity = (float)sr->vtx.elastic.fuzzyk.png[0].shwlid.nhity;
504  shwcalE = sr->vtx.elastic.fuzzyk.png[0].shwlid.calE;
505  shwdirY = sr->vtx.elastic.fuzzyk.png[0].shwlid.dir.y;
506  shwlen = sr->vtx.elastic.fuzzyk.png[0].shwlid.len;
507  shwwidth = sr->vtx.elastic.fuzzyk.png[0].shwlid.width;
508  shwGap = sr->vtx.elastic.fuzzyk.png[0].shwlid.gap;
510  nmiphit = sr->slc.nmiphit;
511 
512  float myfloats[] = {partptp,
513  cosmicid,
514  nmiphit,
515  shwcalE,
516  shwnhit,
517  nshwlid,
518  shwnhitx,
519  shwnhity,
520  shwxminusy,
521  shwxplusy,
522  shwxovery,
523  shwdirY,
524  shwlen,
525  shwwidth,
526  shwGap};
527 
528  std::vector<float> vec_myfloats(myfloats, myfloats + sizeof(myfloats) / sizeof(float));
529  sample->set_data(vec_myfloats);
530  ncid = fModel->compute_output(sample)[0];
531  if(std::isnan(ncid) || std::isinf(ncid)){
532  ncid = -5.;
533  }
534  delete sample;
535 
536  return ncid;
537 
538  }
float nshwlid
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
caf::Proxy< unsigned int > nshwlid
Definition: SRProxy.h:2040
Definition: FillPIDs.h:18
int isinf(const stan::math::var &a)
Definition: std_isinf.hpp:16
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
float partptp
Definition: NusVarsTemp.cxx:50
float shwwidth
float shwnhity
float shwGap
float shwxplusy
virtual void set_data(std::vector< std::vector< std::vector< float > > > const &)
Definition: KerasModel.h:38
float shwnhitx
std::vector< float > compute_output(keras::DataChunk *dc)
Definition: KerasModel.cxx:354
float shwcalE
int isnan(const stan::math::var &a)
Definition: std_isnan.hpp:18
float cosmicid
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2118
caf::Proxy< caf::SRNueCosRej > nuecosrej
Definition: SRProxy.h:1265
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2043
float shwlen
float nmiphit
static keras::KerasModel * fModel
caf::Proxy< unsigned int > nmiphit
Definition: SRProxy.h:1316
caf::Proxy< float > partptp
Definition: SRProxy.h:1057
float shwdirY
OStream cout
Definition: OStream.cxx:6
float ncid
caf::Proxy< bool > IsValid
Definition: SRProxy.h:2058
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2142
float shwxovery
void InitKeras() const
float shwxminusy
float shwnhit
caf::Proxy< caf::SRIDBranch > sel
Definition: SRProxy.h:2141
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2146

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