CVNProngVars.h
Go to the documentation of this file.
1 #pragma once
2 
3 // Definitions for variables related prongs or choosing prongs with CVN score.
4 
5 #include "CAFAna/Core/Var.h"
6 #include "CAFAna/Core/MultiVar.h"
7 
8 namespace ana
9 {
10 
11  //=============================//
12  // CVN-prong variables:
13  //=============================//
14 
15  /// \brief: Prong index of best muon prong by CVN score & length
16  ///
17  /// Prong index for the most muon like prong. Determined by highest CVN-prong score iff all prongs
18  /// are <= 500 cm long and by longest prong if any prongs are > 500 cm.
19  extern const Var kCVNMuonIdx;
20 
21 
22  /// \brief: Muon score for best muon prong by CVN score & length
23  ///
24  /// CVN-Prong score for most muon-like prong in the slice.
25  /// NOTE: This score assumes tracks longer than 500 cm to have a muon score of 1.0. This is necessary since
26  /// CVN-prong does NOT compute a score for prongs longe than 500 cm.
27  extern const Var kCVNBestMuonScore;
28 
29 
30  /// \brief: Returns "adjusted" CVN prong muon score for a given prong. Here "adjusted" means that the
31  /// the score defaults to 1.0 if the prong is longer than 5.0 m. Not that in the extremely
32  /// rare event that a slice has more than one prong longer than 5.0 m, then all of those prongs
33  /// will get a score of 1.0 with this function.
34  ///
35  /// ProngIdx - index of prong to be considered
36  /// sr - the standard record
37  double GetCVNProngMuonScore(unsigned int ProngIdx, caf::SRProxy *sr);
38 
39 
40  /// \brief: Raw muon score for best muon prong by CVN score & length
41  ///
42  /// Raw CVN-Prong score for most muon-like prong in the slice (unadjusted for prongs longer than 500 cm.)
43  extern const Var kCVNBestMuonRawScore;
44 
45 
46 
47  //
48  // Define functions for calculating various combo PIDs
49  //
50  double EMScore(unsigned int ProngIdx, const caf::SRProxy* sr);
51  double HadScore(unsigned int ProngIdx, const caf::SRProxy* sr);
52  double HadScoreWithMuon(unsigned int ProngIdx, const caf::SRProxy* sr);
53 
54 
55 
56  // ==================== //
57  //
58  // Helper functions and variables for choosing prongs based on CVN score:
59  //
60  // ==================== //
61 
62  bool IsNumuCCPionByCVN(unsigned int ProngIdx, const caf::SRProxy* sr);
63  bool IsNumuCCProtonByCVN(unsigned int ProngIdx, const caf::SRProxy* sr);
64  bool IsNumuCCEMShowerByCVN(unsigned int ProngIdx, const caf::SRProxy* sr);
65 
66  /// kNumuCCPionIndices
67  /// \brief: Returns a vector of indices for prongs selected as pions
68  ///
70 
71  /// kNumuCCProtonIndices
72  /// \brief: Returns a vector of indices for prongs selected as protons
73  ///
75 
76  /// kNumuCCEMShowerIndices
77  /// \brief: Returns a vector of indices for prongs selected as EM showers
78  ///
80 
81 } // end namespace ana
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
double EMScore(unsigned int ProngIdx, const caf::SRProxy *sr)
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
const MultiVar kNumuCCPionIndices([](const caf::SRProxy *sr){std::vector< double > indices;if(sr->vtx.elastic.IsValid){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic.fuzzyk.png.size();png_idx++){if(IsNumuCCPionByCVN(png_idx, sr)) indices.push_back((double) png_idx);}}return indices;})
: Returns a vector of indices for prongs selected as pions
Definition: CVNProngVars.h:69
double HadScoreWithMuon(unsigned int ProngIdx, const caf::SRProxy *sr)
const Var kCVNMuonIdx([](const caf::SRProxy *sr){float longest_idx=-5.0;float longest_len=-5.0;if(sr->vtx.elastic.IsValid){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic.fuzzyk.png.size();png_idx++){auto &png=sr->vtx.elastic.fuzzyk.png[png_idx];if(png.len > longest_len){longest_len=png.len;longest_idx=png_idx;}}} if(longest_len > 500.0) return longest_idx;float best_idx=-5.0;float best_score=-5.0;if(sr->vtx.elastic.IsValid){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic.fuzzyk.png.size();png_idx++){auto &png=sr->vtx.elastic.fuzzyk.png[png_idx];if(png.cvnpart.muonid > best_score){best_score=png.cvnpart.muonid;best_idx=png_idx;}}}return best_idx;})
: Prong index of best muon prong by CVN score & length
Definition: CVNProngVars.h:19
bool IsNumuCCPionByCVN(unsigned int ProngIdx, const caf::SRProxy *sr)
: Returns a bool if prong passes NumuCC event pion selection criteria
const MultiVar kNumuCCEMShowerIndices([](const caf::SRProxy *sr){std::vector< double > indices;if(sr->vtx.elastic.IsValid){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic.fuzzyk.png.size();png_idx++){if(IsNumuCCEMShowerByCVN(png_idx, sr)) indices.push_back((double) png_idx);}}return indices;})
: Returns a vector of indices for prongs selected as EM showers
Definition: CVNProngVars.h:79
bool IsNumuCCEMShowerByCVN(unsigned int ProngIdx, const caf::SRProxy *sr)
: Returns a bool if prong passes NumuCC event EM selection criteria
const MultiVar kNumuCCProtonIndices([](const caf::SRProxy *sr){std::vector< double > indices;if(sr->vtx.elastic.IsValid){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic.fuzzyk.png.size();png_idx++){if(IsNumuCCProtonByCVN(png_idx, sr)) indices.push_back((double) png_idx);}}return indices;})
: Returns a vector of indices for prongs selected as protons
Definition: CVNProngVars.h:74
caf::StandardRecord * sr
double HadScore(unsigned int ProngIdx, const caf::SRProxy *sr)
double GetCVNProngMuonScore(unsigned int ProngIdx, caf::SRProxy *sr)
Function to return "adjusted" CVN-prong muon score:
const Var kCVNBestMuonRawScore([](const caf::SRProxy *sr){float muonScore=-5.0;if(kCVNMuonIdx(sr)< 0.0) return muonScore;if(!sr->vtx.elastic.IsValid) return muonScore;muonScore=sr->vtx.elastic.fuzzyk.png[(unsigned int) kCVNMuonIdx(sr)].cvnpart.muonid;return muonScore;})
: Raw muon score for best muon prong by CVN score & length
Definition: CVNProngVars.h:43
const Var kCVNBestMuonScore([](const caf::SRProxy *sr){float muonScore=-5.0;if(kCVNMuonIdx(sr)< 0.0) return muonScore;if(!sr->vtx.elastic.IsValid) return muonScore;muonScore=sr->vtx.elastic.fuzzyk.png[(unsigned int) kCVNMuonIdx(sr)].cvnpart.muonid;if(sr->vtx.elastic.fuzzyk.png[(unsigned int) kCVNMuonIdx(sr)].len > 500.0) muonScore=1.0;return muonScore;})
: Muon score for best muon prong by CVN score & length
Definition: CVNProngVars.h:27
bool IsNumuCCProtonByCVN(unsigned int ProngIdx, const caf::SRProxy *sr)
: Returns a bool if prong passes NumuCC event proton selection criteria