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

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/NDAna/numucc_ccPi/NDXSecTrackPID.h"

Public Member Functions

 GetGammaIDVal ()
 
float operator() (float dedxll, float scatll, float avededxlast10cm, float avededxlast40cm, float trackstartgap, float gapdensity) const
 

Protected Member Functions

float InitTMVAGamma () const
 

Detailed Description

Definition at line 74 of file NDXSecTrackPID.h.

Constructor & Destructor Documentation

ana::GetGammaIDVal::GetGammaIDVal ( )
inline

Member Function Documentation

float ana::GetGammaIDVal::InitTMVAGamma ( ) const
protected

Definition at line 673 of file NDXSecTrackPID.cxx.

References cet::getenv(), path, and string.

674  {
675  const char* path = getenv("SRT_PUBLIC_CONTEXT");
676  if(!fReaderBDTGamma) fReaderBDTGamma = new TMVA::Reader( "!Color:!Silent" );
677  std::string pidlib2 = std::string(path) + "/NDAna/numucc_ccPi/GammaFeatureID_BDT.weights.xml";
678  fReaderBDTGamma->AddVariable("TrackStartGap", &TMVAvars[4]);
679  fReaderBDTGamma->AddVariable("ScatLL", &TMVAvars[1]);
680  fReaderBDTGamma->AddVariable("DedxLL", &TMVAvars[0]);
681  fReaderBDTGamma->AddVariable("Avededxlast10cm", &TMVAvars[2]);
682  fReaderBDTGamma->AddVariable("Avededxlast40cm", &TMVAvars[3]);
683  fReaderBDTGamma->AddVariable("nGaps/ProjLength", &TMVAvars[5]);
684  fReaderBDTGamma->BookMVA("BDTGGamma", pidlib2);
685  return -5.0f;
686  }
static TMVA::Reader * fReaderBDTGamma
std::string getenv(std::string const &name)
static float TMVAvars[4]
Definition: NDNCPi0Xsec.cxx:10
const std::string path
Definition: plot_BEN.C:43
enum BeamMode string
float ana::GetGammaIDVal::operator() ( float  dedxll,
float  scatll,
float  avededxlast10cm,
float  avededxlast40cm,
float  trackstartgap,
float  gapdensity 
) const

Definition at line 458 of file NDXSecTrackPID.cxx.

References make_root_from_grid_output::dedxll, ana::GetPionID::InitTMVAGamma(), and make_root_from_grid_output::scatll.

459  {
460 
461  float gammabdtvalue = -999.0;
462 
464  /*
465  float dedxll = -999.0, scatll = -999.0;
466  float fAvededxlast10cm = -999.0;
467  float fAvededxlast40cm = -999.0;
468  float fTrackStartGap = -999.0;
469  float fGapDensity = -999.0;
470 
471  //int nkals = sr->trk.kalman.ntracks;
472 
473 
474  if (sr->trk.kalman.tracks[idx].rempid == -1) return -2.0f;
475  //if (idx==GetBestTrack()(sr)) return -2.0f;
476 
477  scatll = sr->trk.kalman.tracks[idx].scatllh2017;
478  dedxll = sr->trk.kalman.tracks[idx].dedxllh2017;
479 
480  if (sr->trk.kalman.tracks[idx].avedEdxlast10cm == -5) return -2.0f;
481  if (sr->trk.kalman.tracks[idx].avedEdxlast30cm == -5) return -2.0f;
482  if (sr->trk.kalman.tracks[idx].avedEdxlast20cm == -5) return -2.0f;
483  if (sr->trk.kalman.tracks[idx].avedEdxlast40cm == -5) return -2.0f;
484 
485  if (sr->trk.kalman.tracks[idx].avedEdxlast10cm > 30){
486  fAvededxlast10cm = 30;
487  }else{
488  fAvededxlast10cm = sr->trk.kalman.tracks[idx].avedEdxlast10cm;
489  }
490 
491  if (sr->trk.kalman.tracks[idx].avedEdxlast40cm > 30){
492  fAvededxlast40cm = 30;
493  }else{
494  fAvededxlast40cm = sr->trk.kalman.tracks[idx].avedEdxlast40cm;
495  }
496 
497  TVector3 vtxpos(sr->trk.kalman.tracks[sr->trk.kalman.idxremid].start.X(),sr->trk.kalman.tracks[sr->trk.kalman.idxremid].start.Y(),sr->trk.kalman.tracks[sr->trk.kalman.idxremid].start.Z());
498  TVector3 trkpos(sr->trk.kalman.tracks[idx].start.X(),sr->trk.kalman.tracks[idx].start.Y(),sr->trk.kalman.tracks[idx].start.Z());
499  float trackstartgap = (vtxpos-trkpos).Mag();
500  TVector3 trkvec = sr->trk.kalman.tracks[idx].dir;
501  float angle = trkvec.Angle(beamDirND);
502  float length = sr->trk.kalman.tracks[idx].len;
503  float coslength = length*cos(angle);
504  float ngaps = sr->trk.kalman.tracks[idx].nplanegap;
505 
506  fTrackStartGap=trackstartgap;
507  fGapDensity=ngaps/coslength;*/
508 
509  TMVAvars[0] = dedxll;
510  TMVAvars[1] = scatll;
511  TMVAvars[2] = avededxlast10cm;
512  TMVAvars[3] = avededxlast40cm;
513  TMVAvars[4] = trackstartgap;
514  TMVAvars[5] = gapdensity;
515 
517 
518  gammabdtvalue = fReaderBDTGamma->EvaluateMVA("BDTGGamma");
519 
520  return gammabdtvalue;
521  }
static TMVA::Reader * fReaderBDTGamma
static float TMVAvars[4]
Definition: NDNCPi0Xsec.cxx:10
float InitTMVAGamma() const

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