Functions
MRDiFStudy_FHC_Step1.C File Reference
#include "CAFAna/Core/Binning.h"
#include "CAFAna/Core/Spectrum.h"
#include "CAFAna/Core/SpectrumLoader.h"
#include "CAFAna/Core/Var.h"
#include "CAFAna/Core/MultiVar.h"
#include "CAFAna/Cuts/Cuts.h"
#include "3FlavorAna/Cuts/NueCuts2020.h"
#include "CAFAna/Cuts/TimingCuts.h"
#include "CAFAna/Cuts/SpillCuts.h"
#include "3FlavorAna/Cuts/NumuCuts.h"
#include "CAFAna/Cuts/TruthCuts.h"
#include "3FlavorAna/Ana2020/MRstudies/MRDiFCutsAndVars.h"
#include "CAFAna/Vars/Vars.h"
#include "3FlavorAna/Vars/NueVars.h"
#include "StandardRecord/Proxy/SRProxy.h"
#include <cassert>
#include "TFile.h"
#include "TCanvas.h"
#include "TH2.h"
#include "TH1.h"
#include "TStyle.h"
#include "TLegend.h"
#include "TLatex.h"
#include "TArrayD.h"
#include "TTree.h"
#include "TLeaf.h"
#include "stdio.h"
#include <sstream>
#include <string>
#include <iostream>
#include <fstream>

Go to the source code of this file.

Functions

void MRDiFStudy_FHC_Step1 ()
 

Function Documentation

void MRDiFStudy_FHC_Step1 ( )

Definition at line 48 of file MRDiFStudy_FHC_Step1.C.

References caf::Proxy< caf::SRVertexBranch >::elastic, file, caf::Proxy< caf::SRElastic >::fuzzyk, ana::SpectrumLoader::Go(), MECModelEnuComparisons::i, caf::Proxy< caf::SRElastic >::IsValid, ana::kCosmic, ana::kDiFPreselectionCut, ana::kDiFSelectionCut, ana::kInCosmicTimingWindow_FD_MR, ana::kShwAngle, ana::kShwE, ana::kStandardSpillCuts, maxi, caf::Proxy< caf::SRFuzzyK >::png, ana::Spectrum::SaveTo(), ana::SpectrumLoaderBase::SetSpillCut(), ana::Binning::Simple(), sr, string, and caf::Proxy< caf::StandardRecord >::vtx.

49 {
50 
51  const std::string filenameCosmicsData = "prod_mrdifcaf_R19-11-18-prod5reco.i_fd_cosmic_fhc_full_v1_goodruns";
52  const std::string filenameCRYMC = "prod_mrdifcaf_R19-11-18-prod5reco.m_fd_cry_fhc_full_v3";
53  const std::string filenameGENIEFluxswap = "prod_caf_R19-11-18-prod5reco.f_fd_genie_N1810j0211a_fluxswap_fhc_nova_v08_full_v1";
54 
55  const Var kShwAngle([](const caf::SRProxy* sr)
56  {
57  double maxe = -99.0;
58  int maxi = 999.0;
59  double cosz = -1.0;
60 
61  if(!sr->vtx.elastic.IsValid) return -99999.0;
62  if(sr->vtx.elastic.fuzzyk.png.size() < 1) return -99999.0;
63 
64  for(unsigned int i=0;i<sr->vtx.elastic.fuzzyk.png.size();i++){
65  if(maxe < sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE){
66  maxe = sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE;
67  maxi = i;
68  cosz = sr->vtx.elastic.fuzzyk.png[i].shwlid.dir.z;
69  }
70  }
71  return cosz;
72  });
73 
74  const Var kShwE( [](const caf::SRProxy* sr)
75  {
76  double maxe = -99.0;
77  int maxi = 999;
78 
79  if(!sr->vtx.elastic.IsValid) return -99999.0;
80  if(sr->vtx.elastic.fuzzyk.png.size() < 1) return -99999.0;
81 
82  for(unsigned int i=0;i<sr->vtx.elastic.fuzzyk.png.size();i++){
83  if(maxe < sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE){
84  maxe = sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE;
85  maxi = i;
86  }
87  }
88  return maxe;
89 
90  });
91 
92 
93  SpectrumLoader loaderCosmicsData(filenameCosmicsData, kCosmic);
94  SpectrumLoader loaderCRYMC(filenameCRYMC, kCosmic);
95  SpectrumLoader loaderGENIEFluxswap(filenameGENIEFluxswap);
96  loaderGENIEFluxswap.SetSpillCut(kStandardSpillCuts);
97 
98 
99  const Binning ShwAnglebin= Binning::Simple(60, 0.0, 1.0);
100  // const Binning ShwEbin = Binning::Simple(120, 0, 5.0);
101 
102  //1D spectrums CorePresel Cuts
103  Spectrum sShwAngleCorePreselCosmicsData("Cos(#theta_{Z})", ShwAnglebin,loaderCosmicsData,kShwAngle,kDiFPreselectionCut&&kInCosmicTimingWindow_FD_MR);
104  Spectrum sShwAngleCorePreselCRYMC("Cos(#theta_{Z})", ShwAnglebin,loaderCRYMC,kShwAngle,kDiFPreselectionCut&&kInCosmicTimingWindow_FD_MR);
105  Spectrum sShwAngleCorePreselGENIEFluxswap("Cos(#theta_{Z})", ShwAnglebin,loaderGENIEFluxswap,kShwAngle,kDiFPreselectionCut);
106  /*
107  Spectrum sShwECorePreselCosmicsData("Cos(#theta_{Z})", ShwEbin,loaderCosmicsData,kShwE,kDiFPreselectionCut&&kInCosmicTimingWindow_FD_MR);
108  Spectrum sShwECorePreselCRYMC("Cos(#theta_{Z})", ShwEbin,loaderCRYMC,kShwE,kDiFPreselectionCut&&kInCosmicTimingWindow_FD_MR);
109  Spectrum sShwECorePreselGENIEFluxswap("Cos(#theta_{Z})", ShwEbin,loaderGENIEFluxswap,kShwE,kDiFPreselectionCut);
110  */
111 
112  //1D spectrums Core or Peripheral Cuts
113  Spectrum sShwAngleCoreCosmicsData("Cos(#theta_{Z})", ShwAnglebin,loaderCosmicsData,kShwAngle,kDiFSelectionCut&&kInCosmicTimingWindow_FD_MR);
114  Spectrum sShwAngleCoreCRYMC("Cos(#theta_{Z})", ShwAnglebin,loaderCRYMC,kShwAngle,kDiFSelectionCut&&kInCosmicTimingWindow_FD_MR);
115  Spectrum sShwAngleCoreGENIEFluxswap("Cos(#theta_{Z})", ShwAnglebin,loaderGENIEFluxswap,kShwAngle,kDiFSelectionCut);
116  /*
117  Spectrum sShwECoreCosmicsData("Cos(#theta_{Z})", ShwEbin,loaderCosmicsData,kShwE,kDiFSelectionCut&&kInCosmicTimingWindow_FD_MR);
118  Spectrum sShwECoreCRYMC("Cos(#theta_{Z})", ShwEbin,loaderCRYMC,kShwE,kDiFSelectionCut&&kInCosmicTimingWindow_FD_MR);
119  Spectrum sShwECoreGENIEFluxswap("Cos(#theta_{Z})", ShwEbin,loaderGENIEFluxswap,kShwE,kDiFSelectionCut);
120 */
121 
122 
123  loaderCosmicsData.Go();
124  loaderCRYMC.Go();
125  loaderGENIEFluxswap.Go();
126 
127  TFile *file = new TFile("MRDiF_FD_FHC_Step1_test.root", "recreate");
128 
129  sShwAngleCorePreselCosmicsData.SaveTo(file, "sShwAngleCorePreselCosmicsData");
130  sShwAngleCorePreselCRYMC.SaveTo(file, "sShwAngleCorePreselCRYMC");
131  sShwAngleCorePreselGENIEFluxswap.SaveTo(file, "sShwAngleCorePreselGENIEFluxswap");
132  /*
133  sShwECorePreselCosmicsData.SaveTo(file, "sShwECorePreselCosmicsData");
134  sShwECorePreselCRYMC.SaveTo(file, "sShwECorePreselCRYMC");
135  sShwECorePreselGENIEFluxswap.SaveTo(file, "sShwECorePreselGENIEFluxswap");
136  */
137 
138  //1D spectrums Core Cuts
139  sShwAngleCoreCosmicsData.SaveTo(file, "sShwAngleCoreCosmicsData");
140  sShwAngleCoreCRYMC.SaveTo(file, "sShwAngleCoreCRYMC");
141  sShwAngleCoreGENIEFluxswap.SaveTo(file, "sShwAngleCoreGENIEFluxswap");
142 
143  /*
144  sShwECoreCosmicsData.SaveTo(file, "sShwECoreCosmicsData");
145  sShwECoreCRYMC.SaveTo(file, "sShwECoreCRYMC");
146  sShwECoreGENIEFluxswap.SaveTo(file, "sShwECoreGENIEFluxswap");
147  */
148  file->Close();
149  return;
150 
151 }
const Var kShwE([](const caf::SRProxy *sr){double maxe=-99.0;if(!sr->vtx.elastic.IsValid) return-99999.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-99999.0;for(unsigned int i=0;i< sr->vtx.elastic.fuzzyk.npng;i++){if(maxe< sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE){maxe=sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE;}}return maxe;})
Definition: MRVars.h:9
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:16
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
const Cut kDiFPreselectionCut
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2118
Double_t maxi
Definition: plot.C:28
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2043
const Cut kDiFSelectionCut
caf::StandardRecord * sr
caf::Proxy< bool > IsValid
Definition: SRProxy.h:2058
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
TFile * file
Definition: cellShifts.C:17
const Cut kInCosmicTimingWindow_FD_MR
Definition: TimingCuts.cxx:170
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
const Var kShwAngle([](const caf::SRProxy *sr){double maxe=-99.0;double cosz=-1.0;if(!sr->vtx.elastic.IsValid) return-99999.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-99999.0;for(unsigned int i=0;i< sr->vtx.elastic.fuzzyk.npng;i++){if(maxe< sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE){maxe=sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE;cosz=sr->vtx.elastic.fuzzyk.png[i].shwlid.dir.z;}}return cosz;})
Definition: MRVars.h:8
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2146
enum BeamMode string