Classes | Functions | Variables
DataMCComp_header.h File Reference
#include "CAFAna/Analysis/Exposures.h"
#include "CAFAna/Analysis/Prod5Loaders.h"
#include "CAFAna/Core/Binning.h"
#include "CAFAna/Core/Cut.h"
#include "CAFAna/Core/Loaders.h"
#include "CAFAna/Core/RunPeriods.h"
#include "CAFAna/Core/Spectrum.h"
#include "CAFAna/Core/SpectrumLoader.h"
#include "CAFAna/Core/Utilities.h"
#include "CAFAna/Cuts/AnalysisMasks.h"
#include "CAFAna/Cuts/Cuts.h"
#include "3FlavorAna/Cuts/NumuCuts2020.h"
#include "3FlavorAna/Cuts/QuantileCuts.h"
#include "3FlavorAna/Cuts/QuantileCuts2020.h"
#include "CAFAna/Cuts/PeriodCuts.h"
#include "CAFAna/Cuts/SpillCuts.h"
#include "CAFAna/Cuts/TimingCuts.h"
#include "CAFAna/Cuts/TruthCuts.h"
#include "CAFAna/Vars/BPFVars.h"
#include "CAFAna/Vars/CVNProngVars.h"
#include "CAFAna/Vars/GenieWeights.h"
#include "CAFAna/Vars/HistAxes.h"
#include "3FlavorAna/Vars/Binnings.h"
#include "3FlavorAna/Vars/NumuVars.h"
#include "CAFAna/Vars/PPFXWeights.h"
#include "CAFAna/Vars/Vars.h"
#include "CAFAna/Vars/XsecTunes.h"
#include "CAFAna/Prediction/PredictionInterp.h"
#include "CAFAna/Prediction/PredictionNoExtrap.h"
#include "CAFAna/Prediction/PredictionGenerator.h"
#include "StandardRecord/Proxy/SRProxy.h"
#include "TGraphAsymmErrors.h"
#include "TFeldmanCousins.h"
#include "/nova/app/users/asutton/3Flavor/Ana2020/BoxOpening_br_ana/plotting_header.h"

Go to the source code of this file.

Classes

struct  PredDef
 
struct  Variable
 

Functions

TGraphAsymmErrors * GraphWithPoissonErrors2 (const TH1 *h, const TH1 *h2, bool noErrorsXaxis, bool drawEmptyBins)
 
int PeriodFromHeader (const caf::SRHeaderProxy &hdr)
 
const Cut kPeriod10 ([](const caf::SRProxy *sr){return PeriodFromHeader(sr->hdr)==10;})
 
const Cut kKalBakCut ([](const caf::SRProxy *sr){return(sr->sel.contain.kalbakcell > 40 && sr->sel.contain.kalbakcell< 88);})
 
const Var kTrkEPerNHit ([](const caf::SRProxy *sr){return(sr->trk.kalman.tracks[0].calE/sr->trk.kalman.tracks[0].nhit);})
 
const Var kKalFwdCell ([](const caf::SRProxy *sr){return sr->sel.contain.kalfwdcell;})
 
const Var kKalBakCell ([](const caf::SRProxy *sr){return sr->sel.contain.kalbakcell;})
 
const Var kMaxKalYPos ([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return std::max(sr->trk.kalman.tracks[0].start.Y()/100, sr->trk.kalman.tracks[0].stop.Y()/100);})
 
const Var kMaxKalZPos ([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return std::max(sr->trk.kalman.tracks[0].start.Z()/100, sr->trk.kalman.tracks[0].stop.Z()/100);})
 
const Var kScattTrLen ([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return(float)((float) sr->sel.cosrej.scatt/(float) sr->trk.kalman.tracks[0].len);})
 
const Var kMinCellEdg ([](const caf::SRProxy *sr){return std::min((sr->sel.contain.kalfwdcell+sr->sel.contain.kalbakcell), (sr->sel.contain.cosfwdcell+sr->sel.contain.cosbakcell));})
 
const Var kRatOfKalHi ([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return(float)((float) sr->trk.kalman.tracks[0].nhit/(float) sr->slc.nhit);})
 
const Var kFirstCell ([](const caf::SRProxy *sr){return sr->slc.firstcell;})
 
const Var kLastCell ([](const caf::SRProxy *sr){return sr->slc.lastcell;})
 
const Var kTrkLenXY ([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;float XLen=(sr->trk.kalman.tracks[0].start.X()-sr->trk.kalman.tracks[0].stop.X())/100;float YLen=(sr->trk.kalman.tracks[0].start.Y()-sr->trk.kalman.tracks[0].stop.Y())/100;return XLen-YLen;})
 
const Var kTrueHFrE ([](const caf::SRProxy *sr){float HadE=kTrueHadE(sr);float TruE=kTrueE(sr);return(HadE/TruE);})
 

Variables

const Var kERes = ( (kCCE-kTrueE)/kTrueE )
 
const Var kTrueHadE = ( kTrueE - kTrueMuonE )
 
const Binning NumHitBins = Binning::Simple( 20, 0.0 , 400 )
 
const Binning RatioBins = Binning::Simple( 51, -0.01 , 1.01 )
 
const Binning CVNLooseBins = Binning::Simple( 31, 0.695, 1.005 )
 
const Binning CosRejBins = Binning::Simple( 35, 0.3 , 0.80 )
 
const Binning OptEnBins = kNumuCCEOptimisedBinning
 
const Binning EnergyBins = Binning::Simple( 100, 0 , 5 )
 
const Binning LowEnBins = Binning::Simple( 25, 0 , 3 )
 
const Binning EnPHitBins = Binning::Simple( 40, 0 , 0.04 )
 
const Binning EResBins = Binning::Simple( 100, -0.5, 0.5 )
 
const Binning HadFracBins = Binning::Simple( 26, -0.02, 1.02 )
 
const Binning NumTrkBins = Binning::Simple( 11, -0.5, 10.5 )
 
const Binning YRangeBins = Binning::Simple( 24, -8 , 8 )
 
const Binning ZRangeBins = Binning::Simple( 25, 0 , 60 )
 
const Binning XYDiffBins = Binning::Simple( 20, 0 , 10 )
 
const Binning LengthBins = Binning::Simple( 25, 0 , 20 )
 
const Binning LgCellsBins = Binning::Simple( 25, 0 , 1000 )
 
const Binning SmCellsBins = Binning::Simple( 25, 0 , 400 )
 
const Binning TimeFBins = Binning::Simple( 100, 0, 550 )
 
const Binning TimeZBins = Binning::Simple( 50, 200, 250 )
 
const std::map< std::pair< std::string, std::string >, Variablevars
 

Function Documentation

TGraphAsymmErrors* GraphWithPoissonErrors2 ( const TH1 *  h,
const TH1 *  h2,
bool  noErrorsXaxis,
bool  drawEmptyBins 
)

Definition at line 53 of file DataMCComp_header.h.

References make_associated_cosmic_defs::fc, MECModelEnuComparisons::i, std::sqrt(), submit_syst::x, and submit_syst::y.

54 {
55  TGraphAsymmErrors* gr = new TGraphAsymmErrors(h);
56 
57  TFeldmanCousins fc(0.6827);//1 sigma
58 
59  std::vector<int> removePoints; // keep track of the points to remove
60  for(int i = 0; i < h->GetNbinsX(); ++i){
61  double x, y;
62  gr->GetPoint(i, x, y);
63 
64  if ( (drawEmptyBins && h2->GetBinContent(i+1) > 0.05) || y>=1 ){
65  if ( y < 50 ) gr->SetPointEYlow(i, y-fc.CalculateLowerLimit(y,0));
66  else gr->SetPointEYlow(i,sqrt(y));
67  if ( y < 30 ) gr->SetPointEYhigh(i,fc.CalculateUpperLimit(y,0)-y);
68  else gr->SetPointEYhigh(i,sqrt(y));
69  } else {
70  removePoints.push_back(i);
71  }
72 
73  if(noErrorsXaxis){
74  gr->SetPointEXlow(i, 0);
75  gr->SetPointEXhigh(i, 0);
76  } // Do not use bin width as X-error for points
77  }
78 
79  // get rid of uninteresting points
80  for (uint i = 0; i < removePoints.size(); ++i)
81  gr->RemovePoint(removePoints[i]-i);
82 
83  return gr;
84 }
T sqrt(T number)
Definition: d0nt_math.hpp:156
TH1F * h2
Definition: plot.C:45
unsigned int uint
const Var kFirstCell ( [] (const caf::SRProxy *sr){return sr->slc.firstcell;}  )
const Var kKalBakCell ( [] (const caf::SRProxy *sr){return sr->sel.contain.kalbakcell;}  )
const Cut kKalBakCut ( [] (const caf::SRProxy *sr){return(sr->sel.contain.kalbakcell > 40 && sr->sel.contain.kalbakcell< 88);}  )

Referenced by PeriodFromHeader().

const Var kKalFwdCell ( [] (const caf::SRProxy *sr){return sr->sel.contain.kalfwdcell;}  )
const Var kLastCell ( [] (const caf::SRProxy *sr){return sr->slc.lastcell;}  )
const Var kMaxKalYPos ( [] (const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return std::max(sr->trk.kalman.tracks[0].start.Y()/100, sr->trk.kalman.tracks[0].stop.Y()/100);}  )
const Var kMaxKalZPos ( [] (const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return std::max(sr->trk.kalman.tracks[0].start.Z()/100, sr->trk.kalman.tracks[0].stop.Z()/100);}  )
const Var kMinCellEdg ( [] (const caf::SRProxy *sr){return std::min((sr->sel.contain.kalfwdcell+sr->sel.contain.kalbakcell), (sr->sel.contain.cosfwdcell+sr->sel.contain.cosbakcell));}  )
const Cut kPeriod10 ( [] (const caf::SRProxy *sr){return PeriodFromHeader(sr->hdr)==10;}  )

Referenced by PeriodFromHeader().

const Var kRatOfKalHi ( [] (const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return(float)((float) sr->trk.kalman.tracks[0].nhit/(float) sr->slc.nhit);}  )
const Var kScattTrLen ( [] (const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return(float)((float) sr->sel.cosrej.scatt/(float) sr->trk.kalman.tracks[0].len);}  )
const Var kTrkEPerNHit ( [] (const caf::SRProxy *sr){return(sr->trk.kalman.tracks[0].calE/sr->trk.kalman.tracks[0].nhit);}  )
const Var kTrkLenXY ( [] (const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;float XLen=(sr->trk.kalman.tracks[0].start.X()-sr->trk.kalman.tracks[0].stop.X())/100;float YLen=(sr->trk.kalman.tracks[0].start.Y()-sr->trk.kalman.tracks[0].stop.Y())/100;return XLen-YLen;}  )
const Var kTrueHFrE ( [] (const caf::SRProxy *sr){float HadE=kTrueHadE(sr);float TruE=kTrueE(sr);return(HadE/TruE);}  )
int PeriodFromHeader ( const caf::SRHeaderProxy hdr)

Definition at line 88 of file DataMCComp_header.h.

References caf::Proxy< caf::SRIDBranch >::contain, om::cout, allTimeWatchdog::endl, caf::Proxy< caf::StandardRecord >::hdr, caf::Proxy< caf::SRContain >::kalbakcell, caf::kFARDET, kKalBakCut(), caf::kNEARDET, kPeriod10(), ana::PeriodFromHeader(), ana::PeriodFromRunFD(), ana::PeriodFromRunND(), caf::Proxy< caf::StandardRecord >::sel, and sr.

89  {
90  if(hdr.det == caf::kNEARDET){
91  return PeriodFromRunND(hdr.run);
92  }
93  else if(hdr.det == caf::kFARDET){
94  return PeriodFromRunFD(hdr.run);
95  }
96  else{
97  std::cout << "PeriodFromHeader(): Unknown detector "
98  << hdr.det << ". Abort" << std::endl;
99  abort();
100  }
101  }
Near Detector underground.
Definition: SREnums.h:10
Far Detector at Ash River.
Definition: SREnums.h:11
unsigned int PeriodFromRunFD(int run)
: Helper function to compute the period given a run number for the FD.
Definition: RunPeriods.cxx:15
OStream cout
Definition: OStream.cxx:6
unsigned int PeriodFromRunND(int run)
: Helper function to compute the period given a run number for the ND.
Definition: RunPeriods.cxx:34

Variable Documentation

const Binning CosRejBins = Binning::Simple( 35, 0.3 , 0.80 )

Definition at line 190 of file DataMCComp_header.h.

const Binning CVNLooseBins = Binning::Simple( 31, 0.695, 1.005 )

Definition at line 189 of file DataMCComp_header.h.

const Binning EnergyBins = Binning::Simple( 100, 0 , 5 )

Definition at line 194 of file DataMCComp_header.h.

const Binning EnPHitBins = Binning::Simple( 40, 0 , 0.04 )

Definition at line 196 of file DataMCComp_header.h.

const Binning EResBins = Binning::Simple( 100, -0.5, 0.5 )

Definition at line 197 of file DataMCComp_header.h.

const Binning HadFracBins = Binning::Simple( 26, -0.02, 1.02 )

Definition at line 198 of file DataMCComp_header.h.

const Var kERes = ( (kCCE-kTrueE)/kTrueE )

Definition at line 116 of file DataMCComp_header.h.

const Var kTrueHadE = ( kTrueE - kTrueMuonE )

Definition at line 176 of file DataMCComp_header.h.

const Binning LengthBins = Binning::Simple( 25, 0 , 20 )

Definition at line 205 of file DataMCComp_header.h.

const Binning LgCellsBins = Binning::Simple( 25, 0 , 1000 )

Definition at line 206 of file DataMCComp_header.h.

const Binning LowEnBins = Binning::Simple( 25, 0 , 3 )

Definition at line 195 of file DataMCComp_header.h.

const Binning NumHitBins = Binning::Simple( 20, 0.0 , 400 )

Definition at line 187 of file DataMCComp_header.h.

const Binning NumTrkBins = Binning::Simple( 11, -0.5, 10.5 )

Definition at line 201 of file DataMCComp_header.h.

const Binning OptEnBins = kNumuCCEOptimisedBinning

Definition at line 193 of file DataMCComp_header.h.

const Binning RatioBins = Binning::Simple( 51, -0.01 , 1.01 )

Definition at line 188 of file DataMCComp_header.h.

const Binning SmCellsBins = Binning::Simple( 25, 0 , 400 )

Definition at line 207 of file DataMCComp_header.h.

const Binning TimeFBins = Binning::Simple( 100, 0, 550 )

Definition at line 210 of file DataMCComp_header.h.

const Binning TimeZBins = Binning::Simple( 50, 200, 250 )

Definition at line 211 of file DataMCComp_header.h.

const std::map< std::pair<std::string, std::string >, Variable > vars
const Binning XYDiffBins = Binning::Simple( 20, 0 , 10 )

Definition at line 204 of file DataMCComp_header.h.

const Binning YRangeBins = Binning::Simple( 24, -8 , 8 )

Definition at line 202 of file DataMCComp_header.h.

const Binning ZRangeBins = Binning::Simple( 25, 0 , 60 )

Definition at line 203 of file DataMCComp_header.h.