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

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

Public Member Functions

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

Protected Member Functions

float InitTMVAPion () const
 

Detailed Description

Definition at line 56 of file NDXSecTrackPID.h.

Constructor & Destructor Documentation

ana::GetPionIDVal::GetPionIDVal ( )
inline

Member Function Documentation

float ana::GetPionIDVal::InitTMVAPion ( ) const
protected

Definition at line 643 of file NDXSecTrackPID.cxx.

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

644  {
645  if(!fReaderBDTPion) fReaderBDTPion = new TMVA::Reader( "!Color:!Silent" );
646  const char* path = getenv("SRT_PUBLIC_CONTEXT");
647  std::string pidlib = std::string(path) + "/NDAna/numucc_ccPi/PionFeatureID_BDT.weights.xml";
648  fReaderBDTPion->AddVariable("TrackStartGap", &TMVAvars[4]);
649  fReaderBDTPion->AddVariable("nGaps/ProjLength", &TMVAvars[5]);
650  fReaderBDTPion->AddVariable("ScatLL", &TMVAvars[1]);
651  fReaderBDTPion->AddVariable("DedxLL", &TMVAvars[0]);
652  fReaderBDTPion->AddVariable("Avededxlast10cm", &TMVAvars[2]);
653  fReaderBDTPion->AddVariable("Avededxlast40cm", &TMVAvars[3]);
654  fReaderBDTPion->BookMVA("BDTGPion", pidlib);
655  return -5.0f;
656  }
std::string getenv(std::string const &name)
static float TMVAvars[4]
Definition: NDNCPi0Xsec.cxx:10
static TMVA::Reader * fReaderBDTPion
const std::string path
Definition: plot_BEN.C:43
enum BeamMode string
float ana::GetPionIDVal::operator() ( float  dedxll,
float  scatll,
float  avededxlast10cm,
float  avededxlast40cm,
float  trackstartgap,
float  gapdensity 
) const

Definition at line 329 of file NDXSecTrackPID.cxx.

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

330  {
331  float pionbdtvalue = -999.0;
332 
334  /*
335  float dedxll = -999.0, scatll = -999.0;
336  float fAvededxlast10cm = -999.0;
337  float fAvededxlast40cm = -999.0;
338  float fTrackStartGap = -999.0;
339  float fGapDensity = -999.0;
340 
341  //int nkals = sr->trk.kalman.ntracks;
342 
343 
344  if (sr->trk.kalman.tracks[idx].rempid == -1) return -2.0f;
345  //if (idx==GetBestTrack()(sr)) return -2.0f;
346 
347  scatll = sr->trk.kalman.tracks[idx].scatllh2017;
348  dedxll = sr->trk.kalman.tracks[idx].dedxllh2017;
349 
350  if (sr->trk.kalman.tracks[idx].avedEdxlast10cm == -5) return -2.0f;
351  if (sr->trk.kalman.tracks[idx].avedEdxlast30cm == -5) return -2.0f;
352  if (sr->trk.kalman.tracks[idx].avedEdxlast20cm == -5) return -2.0f;
353  if (sr->trk.kalman.tracks[idx].avedEdxlast40cm == -5) return -2.0f;
354 
355  if (sr->trk.kalman.tracks[idx].avedEdxlast10cm > 30){
356  fAvededxlast10cm = 30;
357  }else{
358  fAvededxlast10cm = sr->trk.kalman.tracks[idx].avedEdxlast10cm;
359  }
360 
361  if (sr->trk.kalman.tracks[idx].avedEdxlast40cm > 30){
362  fAvededxlast40cm = 30;
363  }else{
364  fAvededxlast40cm = sr->trk.kalman.tracks[idx].avedEdxlast40cm;
365  }
366 
367  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());
368  TVector3 trkpos(sr->trk.kalman.tracks[idx].start.X(),sr->trk.kalman.tracks[idx].start.Y(),sr->trk.kalman.tracks[idx].start.Z());
369  float trackstartgap = (vtxpos-trkpos).Mag();
370  TVector3 trkvec = sr->trk.kalman.tracks[idx].dir;
371  float angle = trkvec.Angle(beamDirND);
372  float length = sr->trk.kalman.tracks[idx].len;
373  float coslength = length*cos(angle);
374  float ngaps = sr->trk.kalman.tracks[idx].nplanegap;
375 
376  fTrackStartGap=trackstartgap;
377  fGapDensity=ngaps/coslength;*/
378 
379  TMVAvars[0] = dedxll;
380  TMVAvars[1] = scatll;
381  TMVAvars[2] = avededxlast10cm;
382  TMVAvars[3] = avededxlast40cm;
383  TMVAvars[4] = trackstartgap;
384  TMVAvars[5] = gapdensity;
385 
387 
388  pionbdtvalue = fReaderBDTPion->EvaluateMVA("BDTGPion");
389 
390  return pionbdtvalue;
391  }
static float TMVAvars[4]
Definition: NDNCPi0Xsec.cxx:10
float InitTMVAPion() const
static TMVA::Reader * fReaderBDTPion

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