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

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

Public Member Functions

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

Protected Member Functions

float InitTMVAProton () const
 

Detailed Description

Definition at line 65 of file NDXSecTrackPID.h.

Constructor & Destructor Documentation

ana::GetProtonIDVal::GetProtonIDVal ( )
inline

Member Function Documentation

float ana::GetProtonIDVal::InitTMVAProton ( ) const
protected

Definition at line 658 of file NDXSecTrackPID.cxx.

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

659  {
660  const char* path = getenv("SRT_PUBLIC_CONTEXT");
661  if(!fReaderBDTProton) fReaderBDTProton = new TMVA::Reader( "!Color:!Silent" );
662  std::string pidlib1 = std::string(path) + "/NDAna/numucc_ccPi/ProtonFeatureID_BDT.weights.xml";
663  fReaderBDTProton->AddVariable("TrackStartGap", &TMVAvars[4]);
664  fReaderBDTProton->AddVariable("ScatLL", &TMVAvars[1]);
665  fReaderBDTProton->AddVariable("DedxLL", &TMVAvars[0]);
666  fReaderBDTProton->AddVariable("Avededxlast10cm", &TMVAvars[2]);
667  fReaderBDTProton->AddVariable("Avededxlast40cm", &TMVAvars[3]);
668  fReaderBDTProton->AddVariable("nGaps/ProjLength", &TMVAvars[5]);
669  fReaderBDTProton->BookMVA("BDTGProton", pidlib1);
670  return -5.0f;
671  }
static TMVA::Reader * fReaderBDTProton
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::GetProtonIDVal::operator() ( float  dedxll,
float  scatll,
float  avededxlast10cm,
float  avededxlast40cm,
float  trackstartgap,
float  gapdensity 
) const

Definition at line 393 of file NDXSecTrackPID.cxx.

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

394  {
395 
396  float protonbdtvalue = -999.0;
397 
399  /*
400  float dedxll = -999.0, scatll = -999.0;
401  float fAvededxlast10cm = -999.0;
402  float fAvededxlast40cm = -999.0;
403  float fTrackStartGap = -999.0;
404  float fGapDensity = -999.0;
405 
406  //int nkals = sr->trk.kalman.ntracks;
407 
408 
409  if (sr->trk.kalman.tracks[idx].rempid == -1) return -2.0f;
410  //if (idx==GetBestTrack()(sr)) return -2.0f;
411 
412  scatll = sr->trk.kalman.tracks[idx].scatllh2017;
413  dedxll = sr->trk.kalman.tracks[idx].dedxllh2017;
414 
415  if (sr->trk.kalman.tracks[idx].avedEdxlast10cm == -5) return -2.0f;
416  if (sr->trk.kalman.tracks[idx].avedEdxlast30cm == -5) return -2.0f;
417  if (sr->trk.kalman.tracks[idx].avedEdxlast20cm == -5) return -2.0f;
418  if (sr->trk.kalman.tracks[idx].avedEdxlast40cm == -5) return -2.0f;
419 
420  if (sr->trk.kalman.tracks[idx].avedEdxlast10cm > 30){
421  fAvededxlast10cm = 30;
422  }else{
423  fAvededxlast10cm = sr->trk.kalman.tracks[idx].avedEdxlast10cm;
424  }
425 
426  if (sr->trk.kalman.tracks[idx].avedEdxlast40cm > 30){
427  fAvededxlast40cm = 30;
428  }else{
429  fAvededxlast40cm = sr->trk.kalman.tracks[idx].avedEdxlast40cm;
430  }
431 
432  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());
433  TVector3 trkpos(sr->trk.kalman.tracks[idx].start.X(),sr->trk.kalman.tracks[idx].start.Y(),sr->trk.kalman.tracks[idx].start.Z());
434  float trackstartgap = (vtxpos-trkpos).Mag();
435  TVector3 trkvec = sr->trk.kalman.tracks[idx].dir;
436  float angle = trkvec.Angle(beamDirND);
437  float length = sr->trk.kalman.tracks[idx].len;
438  float coslength = length*cos(angle);
439  float ngaps = sr->trk.kalman.tracks[idx].nplanegap;
440 
441  fTrackStartGap=trackstartgap;
442  fGapDensity=ngaps/coslength;*/
443 
444  TMVAvars[0] = dedxll;
445  TMVAvars[1] = scatll;
446  TMVAvars[2] = avededxlast10cm;
447  TMVAvars[3] = avededxlast40cm;
448  TMVAvars[4] = trackstartgap;
449  TMVAvars[5] = gapdensity;
450 
452 
453  protonbdtvalue = fReaderBDTProton->EvaluateMVA("BDTGProton");
454 
455  return protonbdtvalue;
456  }
static TMVA::Reader * fReaderBDTProton
static float TMVAvars[4]
Definition: NDNCPi0Xsec.cxx:10
float InitTMVAProton() const

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