get_eventlist.C
Go to the documentation of this file.
1 #pragma once
2 
3 #include "CAFAna/numu/Analysis2018/includes.h"
6 #include "CAFAna/Vars/NueEnergy2018.h"
7 #include "NuXAna/Vars/NusVars.h"
10 
11 using namespace ana;
12 
13 
14 void get_eventlist(std::string sam="SAMLIST",
15  std::string outlist="OUTLIST",
16  std::string sel="SELECT",
17  std::string det="DETECTOR")
18 {
19 
20  const Var kNumuCVN2018 = SIMPLEVAR(sel.cvnProd3Train.numuid);
21  const Var kNumuCVN2017 = SIMPLEVAR(sel.cvn2017.numuid);
22  const Var kNumuCosRej2018 = SIMPLEVAR(sel.cosrej.numucontpid);
23  const Var kNumuCosRej2017 = SIMPLEVAR(sel.cosrej.numucontpidoldcvn);
24 
25  const Var kRunNumber = SIMPLEVAR(hdr.run);
26  const Var kRun = SIMPLEVAR(hdr.run);
27  const Var kSubRun = SIMPLEVAR(hdr.subrun);
28  const Var kEvt = SIMPLEVAR(hdr.evt);
29  const Var kCycle = SIMPLEVAR(hdr.cycle);
30  const Var kSlice = SIMPLEVAR(hdr.subevt);
31  const Var kSliceTime = SIMPLEVAR(hdr.unixtime);
32  const Var kSliceMeanTime = SIMPLEVAR(hdr.subevtmeantime);
33  const Var kSliceTsd = SIMPLEVAR(slc.tsd);
34  const Var kNuMuEnergy = kCCE;
35  const Var kNuEEnergy = kNueEnergy2018;
36  const Var kNCEnergy = kNus18Energy;
37  const Var kCVNVal = kCVNSSe;
38  const Var kAlwaysOnWgt = kXSecCVWgt2018 * kPPFXFluxCVWgt;
39 
40  const Var kSliceDeltaT([](const caf::SRProxy *sr) {
41  return (sr->slc.endtime - sr->slc.starttime);
42  });
43 
44  std::cout << sam
45  << " "
46  << outlist
47  << std::endl;
48 
49  std::vector<const Var*> intVars = {&kRun, &kSubRun, &kEvt, &kSlice, &kCycle};
50  std::vector<const Var*> floatVars;
51 
52  if (sel == "numu") floatVars.push_back(&kNuMuEnergy);
53  else if(sel == "nue" ) floatVars.push_back(&kNuEEnergy);
54  else if(sel == "nus" ) floatVars.push_back(&kNCEnergy);
55  floatVars.push_back(&kCVNVal);
56  floatVars.push_back(&kAlwaysOnWgt);
57 
59  if(det == "fd"){
60  if(sam.find("genie") != std::string::npos){
61  std::cout << "getting fd events from MC dataset" << std::endl;
62  if(sel == "numu") MakeTextListFile(sam, {kNumuCutFD2018 && kHasNeutrino && kInBeamSpill}, {outlist}, floatVars, intVars, &kStandardSpillCuts);
63  else if(sel == "nue") MakeTextListFile(sam, {kNue2018FDAllSamples && kHasNeutrino && kInBeamSpill}, {outlist}, floatVars, intVars, &kStandardSpillCuts);
64  else if(sel == "nus") MakeTextListFile(sam, {kNus18FD && kHasNeutrino && kInBeamSpill}, {outlist}, floatVars, intVars, &kStandardSpillCuts);
65  }
66  else{
67  std::cout << "getting fd events from numi dataset" << std::endl;
68  if(sel == "numu") MakeTextListFile(sam, {kNumuCutFD2018 && kInBeamSpill}, {outlist}, floatVars, intVars, &kStandardSpillCuts);
69  else if(sel == "nue") MakeTextListFile(sam, {kNue2018FDAllSamples && kInBeamSpill}, {outlist}, floatVars, intVars, &kStandardSpillCuts);
70  else if(sel == "nus") MakeTextListFile(sam, {kNus18FD && kInBeamSpill}, {outlist}, floatVars, intVars, &kStandardSpillCuts);
71  }
72  }// end if fd
73  else if(det == "nd"){
74  if(sam.find("genie") != std::string::npos){
75  std::cout << "getting nd events from MC dataset " << std::endl;
76  if(sel == "numu") MakeTextListFile(sam, {kNumuCutND2018 && kHasNeutrino && kInBeamSpill}, {outlist}, floatVars, intVars, &kStandardSpillCuts);
77  else if(sel == "nue") MakeTextListFile(sam, {kNue2018NDEnergy && kNue2018NDPresel && kNue2018NDCVNSsb && kHasNeutrino && kInBeamSpill}, {outlist}, floatVars, intVars, &kStandardSpillCuts);
78  else if(sel == "nus") MakeTextListFile(sam, {kNus18ND && kHasNeutrino && kInBeamSpill}, {outlist}, floatVars, intVars, &kStandardSpillCuts);
79  }
80  else{
81  std::cout << "getting nd events from numi dataset" << std::endl;
82  if(sel == "numu") MakeTextListFile(sam, {kNumuCutND2018 && kInBeamSpill}, {outlist}, floatVars, intVars, &kStandardSpillCuts);
83  else if(sel == "nue") MakeTextListFile(sam, {kNue2018NDEnergy && kNue2018NDPresel && kNue2018NDCVNSsb && kInBeamSpill}, {outlist}, floatVars, intVars, &kStandardSpillCuts);
84  else if(sel == "nus") MakeTextListFile(sam, {kNus18ND && kInBeamSpill}, {outlist}, floatVars, intVars, &kStandardSpillCuts);
85  }
86  }//end if nd
87 
88 }
89 
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var kNus18Energy([](const caf::SRProxy *sr){bool h_FHC=sr->spill.isFHC;bool h_RHC=sr->spill.isRHC;double cale=sr->slc.calE;double recoE=0.;if(h_FHC &&sr->hdr.det==caf::kFARDET) recoE=FDscaleCalE18 *cale;else if(h_FHC &&sr->hdr.det==caf::kNEARDET) recoE=NDscaleCalE18 *cale;else if(h_RHC &&sr->hdr.det==caf::kFARDET) recoE=FDscaleCalE18RHC *cale;else if(h_RHC &&sr->hdr.det==caf::kNEARDET) recoE=NDscaleCalE18RHC *cale;return recoE;})
Definition: NusVars.h:63
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
caf::Proxy< float > starttime
Definition: SRProxy.h:1319
const Cut kNumuCutND2018
Definition: NumuCuts2018.h:41
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
const Cut kNue2018NDCVNSsb
Definition: NueCuts2018.h:153
const Var kSliceTime([](const caf::SRProxy *sr){return sr->slc.meantime/1000;})
Definition: NumuVars.h:34
const Cut kNue2018NDEnergy
Definition: NueCuts2018.h:143
const Cut kNus18FD
Definition: NusCuts18.h:100
const Cut kNue2018NDPresel
Definition: NueCuts2018.h:145
void MakeTextListFile(const std::string &wildcard, const std::vector< Cut > &cut, const std::vector< std::string > &output, const std::vector< const Var * > &floatVars, const std::vector< const Var * > &intVars, const SpillCut *spillCut)
Make a file listing all the events passing the specified cut.
Definition: EventList.cxx:193
caf::Proxy< float > endtime
Definition: SRProxy.h:1303
const Var kEvt
Definition: Vars.cxx:23
const Var kNueEnergy2018([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;if(kIsRHC(sr)) return kNueEnergyRHC(sr);else return kNueEnergyFHC(sr);})
Definition: NueEnergy2018.h:25
const Var kCCE
Definition: NumuVars.h:21
caf::StandardRecord * sr
const Var kSubRun
const Cut kNus18ND
Full Nus18 ND analysis selection.
Definition: NusCuts18.h:137
const Var kCycle
Definition: Vars.cxx:22
const Var kCVNSSe([](const caf::SRProxy *sr){throw std::runtime_error("kCVNSSe is no longer available. Fix your macro so you don't use it.");return-5.;})
2018 nue PID
Definition: Vars.h:52
OStream cout
Definition: OStream.cxx:6
const Cut kHasNeutrino([](const caf::SRProxy *sr){return(sr->mc.nnu!=0);})
Check if MC slice has neutrino information (useful for in-and-out tests)
Definition: TruthCuts.h:61
const Cut cut
Definition: exporter_fd.C:30
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2142
void get_eventlist(std::string sam="SAMLIST", std::string outlist="OUTLIST", std::string sel="SELECT", std::string det="DETECTOR")
Definition: get_eventlist.C:14
const Var kXSecCVWgt2018
Definition: XsecTunes.h:49
#define SIMPLEVAR(CAFNAME)
For Vars where literally all you need is a single CAF variable.
Definition: Var.h:88
const Cut kNue2018FDAllSamples
Definition: NueCuts2018.h:77
const Cut kInBeamSpill([](const caf::SRProxy *sr){if(sr->spill.run > util::kLastBadTimingRun) return kInBeamSpill_main(sr);else return kInBeamSpill_main(sr)||kInBeamSpill_shifted(sr);}, [](const caf::SRSpillProxy *spill){if(spill->run > util::kLastBadTimingRun) return kInBeamSpill_main.Livetime(spill);else return kInBeamSpill_main.Livetime(spill)+kInBeamSpill_shifted.Livetime(spill);}, [](const caf::SRSpillProxy *spill) -> double{return spill->spillpot;})
Does the event fall inside the window we call the beam spill?
Definition: TimingCuts.h:8
const Var kSlice
const Cut kNumuCutFD2018
Definition: NumuCuts2018.h:39
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
const Var kRun
Definition: Vars.cxx:20
enum BeamMode string