Functions
MRDiFStudy_RHC_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_RHC_Step1 ()
 

Function Documentation

void MRDiFStudy_RHC_Step1 ( )

Definition at line 50 of file MRDiFStudy_RHC_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.

51 {
52 
53  const std::string filenameCosmicsData = "prod_mrdifcaf_R19-11-18-prod5reco.i_fd_cosmic_rhc_full_v1_goodruns";
54  const std::string filenameCRYMC = "prod_mrdifcaf_R19-11-18-prod5reco.m_fd_cry_rhc_full_v3";
55  const std::string filenameGENIEFluxswap = "prod_caf_R19-11-18-prod5reco.f_fd_genie_N1810j0211a_fluxswap_rhc_nova_v08_full_v1";
56 
57  const Var kShwAngle([](const caf::SRProxy* sr)
58  {
59  double maxe = -99.0;
60  int maxi = 999.0;
61  double cosz = -1.0;
62 
63  if(!sr->vtx.elastic.IsValid) return -99999.0;
64  if(sr->vtx.elastic.fuzzyk.png.size() < 1) return -99999.0;
65 
66  for(unsigned int i=0;i<sr->vtx.elastic.fuzzyk.png.size();i++){
67  if(maxe < sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE){
68  maxe = sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE;
69  maxi = i;
70  cosz = sr->vtx.elastic.fuzzyk.png[i].shwlid.dir.z;
71  }
72  }
73  return cosz;
74  });
75 
76  const Var kShwE( [](const caf::SRProxy* sr)
77  {
78  double maxe = -99.0;
79  int maxi = 999;
80 
81  if(!sr->vtx.elastic.IsValid) return -99999.0;
82  if(sr->vtx.elastic.fuzzyk.png.size() < 1) return -99999.0;
83 
84  for(unsigned int i=0;i<sr->vtx.elastic.fuzzyk.png.size();i++){
85  if(maxe < sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE){
86  maxe = sr->vtx.elastic.fuzzyk.png[i].shwlid.shwE;
87  maxi = i;
88  }
89  }
90  return maxe;
91 
92  });
93 
94 
95  SpectrumLoader loaderCosmicsData(filenameCosmicsData, kCosmic);
96  SpectrumLoader loaderCRYMC(filenameCRYMC, kCosmic);
97  SpectrumLoader loaderGENIEFluxswap(filenameGENIEFluxswap);
98  loaderGENIEFluxswap.SetSpillCut(kStandardSpillCuts);
99 
100 
101  const Binning ShwAnglebin= Binning::Simple(60, 0.0, 1.0);
102  const Binning ShwEbin = Binning::Simple(120, 0, 5.0);
103 
104  //1D spectrums CorePresel Cuts
105  Spectrum sShwAngleCorePreselCosmicsData("Cos(#theta_{Z})", ShwAnglebin,loaderCosmicsData,kShwAngle,kDiFPreselectionCut&&kInCosmicTimingWindow_FD_MR);
106  Spectrum sShwAngleCorePreselCRYMC("Cos(#theta_{Z})", ShwAnglebin,loaderCRYMC,kShwAngle,kDiFPreselectionCut&&kInCosmicTimingWindow_FD_MR);
107  Spectrum sShwAngleCorePreselGENIEFluxswap("Cos(#theta_{Z})", ShwAnglebin,loaderGENIEFluxswap,kShwAngle,kDiFPreselectionCut);
108  /*
109  Spectrum sShwECorePreselCosmicsData("Cos(#theta_{Z})", ShwEbin,loaderCosmicsData,kShwE,kDiFPreselectionCut&&kInCosmicTimingWindow_FD_MR);
110  Spectrum sShwECorePreselCRYMC("Cos(#theta_{Z})", ShwEbin,loaderCRYMC,kShwE,kDiFPreselectionCut&&kInCosmicTimingWindow_FD_MR);
111  Spectrum sShwECorePreselGENIEFluxswap("Cos(#theta_{Z})", ShwEbin,loaderGENIEFluxswap,kShwE,kDiFPreselectionCut);
112  */
113 
114  //1D spectrums Core or Peripheral Cuts
115  Spectrum sShwAngleCoreCosmicsData("Cos(#theta_{Z})", ShwAnglebin,loaderCosmicsData,kShwAngle,kDiFSelectionCut&&kInCosmicTimingWindow_FD_MR);
116  Spectrum sShwAngleCoreCRYMC("Cos(#theta_{Z})", ShwAnglebin,loaderCRYMC,kShwAngle,kDiFSelectionCut&&kInCosmicTimingWindow_FD_MR);
117  Spectrum sShwAngleCoreGENIEFluxswap("Cos(#theta_{Z})", ShwAnglebin,loaderGENIEFluxswap,kShwAngle,kDiFSelectionCut);
118  /*
119  Spectrum sShwECoreCosmicsData("Cos(#theta_{Z})", ShwEbin,loaderCosmicsData,kShwE,kDiFSelectionCut&&kInCosmicTimingWindow_FD_MR);
120  Spectrum sShwECoreCRYMC("Cos(#theta_{Z})", ShwEbin,loaderCRYMC,kShwE,kDiFSelectionCut&&kInCosmicTimingWindow_FD_MR);
121  Spectrum sShwECoreGENIEFluxswap("Cos(#theta_{Z})", ShwEbin,loaderGENIEFluxswap,kShwE,kDiFSelectionCut);
122  */
123 
124 
125  loaderCosmicsData.Go();
126  loaderCRYMC.Go();
127  loaderGENIEFluxswap.Go();
128 
129  TFile *file = new TFile("MRDiF_FD_RHC_Step1.root", "recreate");
130 
131  sShwAngleCorePreselCosmicsData.SaveTo(file, "sShwAngleCorePreselCosmicsData");
132  sShwAngleCorePreselCRYMC.SaveTo(file, "sShwAngleCorePreselCRYMC");
133  sShwAngleCorePreselGENIEFluxswap.SaveTo(file, "sShwAngleCorePreselGENIEFluxswap");
134  /*
135  sShwECorePreselCosmicsData.SaveTo(file, "sShwECorePreselCosmicsData");
136  sShwECorePreselCRYMC.SaveTo(file, "sShwECorePreselCRYMC");
137  sShwECorePreselGENIEFluxswap.SaveTo(file, "sShwECorePreselGENIEFluxswap");
138  */
139  //1D spectrums Core Cuts
140  sShwAngleCoreCosmicsData.SaveTo(file, "sShwAngleCoreCosmicsData");
141  sShwAngleCoreCRYMC.SaveTo(file, "sShwAngleCoreCRYMC");
142  sShwAngleCoreGENIEFluxswap.SaveTo(file, "sShwAngleCoreGENIEFluxswap");
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