PPFXWeights.cxx
Go to the documentation of this file.
2 
4 
5 namespace ana
6 {
7 
8  /// weight events with the flux PPFX Central value correction.
10  {
11  // Temporary condition to set this variable to 1 in cases
12  // where a slice does not have a SRFluxWeight - MCTruth
13  // (with matched NuChoice, see MCReweight/FluxWeightCalculator_module.cc).
14  // But it needs to be modified to have cv_wgt sets to 1 by default.
15  if( nu->rwgt.ppfx.cv != nu->rwgt.ppfx.cv ){
16  return 1.f;
17  }
18  //No weights greater than 90.
19  if(nu->rwgt.ppfx.cv>90){
20  return 1.f;
21  }
22  return float(nu->rwgt.ppfx.cv);
23  });
24 
25  //////////////
27  //Temporary fixed value:
28  int tmp_int = 100;
29  return tmp_int;
30  }
31 
32  //////////////
33  std::vector<NuTruthVar> GetkPPFXFluxUnivWgtST(){
34  std::vector<NuTruthVar> tmp_vec;
35  for(int i=0;i<GetPPFXNuniverses();i++){
36  NuTruthVar kPPFXFluxUnivWgtST([i](const caf::SRNeutrinoProxy* nu){
37  //Only positive values are alowed
38  if(nu->rwgt.ppfx.vuniv[i]<=0){
39  return 1.f;
40  }
41  //No weights greater than 90.
42  if(nu->rwgt.ppfx.vuniv[i]>90){
43  return 1.f;
44  }
45  return float(nu->rwgt.ppfx.vuniv[i]);
46  });
47  tmp_vec.push_back(kPPFXFluxUnivWgtST);
48  }
49  return tmp_vec;
50  }
51 
52  ///////////////
53  std::vector<Var> GetkPPFXFluxUnivWgt(){
54  std::vector<Var> tmp_vec;
55  for(int i=0;i<GetPPFXNuniverses();i++){
56  Var kPPFXFluxUnivWgt([i](const caf::SRProxy *sr){
57  if(sr->mc.nnu < 1 || sr->mc.nu[0].rwgt.ppfx.vuniv[i]<=0)
58  return 1.f;
59  if(sr->mc.nu[0].rwgt.ppfx.vuniv[i]>90){
60  return 1.f;
61  }
62  return float(sr->mc.nu[0].rwgt.ppfx.vuniv[i]);
63  });
64  tmp_vec.push_back(kPPFXFluxUnivWgt);
65  }
66  return tmp_vec;
67  }
68 }
caf::Proxy< std::vector< float > > vuniv
Definition: SRProxy.h:490
caf::Proxy< float > cv
Definition: SRProxy.h:488
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
Proxy for caf::SRNeutrino.
Definition: SRProxy.h:510
int GetPPFXNuniverses()
Definition: PPFXWeights.cxx:26
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
caf::Proxy< std::vector< caf::SRNeutrino > > nu
Definition: SRProxy.h:618
caf::Proxy< caf::SRMCReweight > rwgt
Definition: SRProxy.h:560
caf::Proxy< short int > nnu
Definition: SRProxy.h:617
std::vector< Var > GetkPPFXFluxUnivWgt()
Definition: PPFXWeights.cxx:53
caf::Proxy< caf::SRFluxWeights > ppfx
Definition: SRProxy.h:506
_Var< caf::SRNeutrinoProxy > NuTruthVar
Var designed to be used over the nuTree, ie all neutrinos, not just those that got slices...
Definition: Var.h:82
caf::StandardRecord * sr
std::vector< NuTruthVar > GetkPPFXFluxUnivWgtST()
Definition: PPFXWeights.cxx:33
caf::Proxy< caf::SRTruthBranch > mc
Definition: SRProxy.h:2138
Template for Var and SpillVar.
const NuTruthVar kPPFXFluxCVWgtST([](const caf::SRNeutrinoProxy *nu){ if(nu->rwgt.ppfx.cv!=nu->rwgt.ppfx.cv){return 1.f;}if(nu->rwgt.ppfx.cv >90){return 1.f;}return float(nu->rwgt.ppfx.cv);})
weight events with the flux PPFX Central value correction.
Definition: PPFXWeights.h:12