accum_pot_equivalent_fhc.C
Go to the documentation of this file.
2 #include "CAFAna/Core/Binning.h"
3 #include "CAFAna/Core/Spectrum.h"
5 #include "CAFAna/Cuts/Cuts.h"
11 #include "CAFAna/Vars/Vars.h"
16 
17 #include "TCanvas.h"
18 #include "TH2.h"
19 #include "TLegend.h"
20 #include "TLatex.h"
21 #include "TFile.h"
22 #include "TProfile.h"
23 #include "TString.h"
24 #include "TPaveText.h"
25 #include "TGaxis.h"
26 #include "TROOT.h"
27 #include "TStyle.h"
28 
29 #include "Utilities/rootlogon.C"
30 
31 using namespace ana;
32 
34 {
35  TFile *fAccounting = new TFile("/nova/ana/users/howard/Ana2018-pot/nue_ana2018_pot-fhc.root","read"); // File with exposure accounting
36  TH1D* hPOT = (TH1D*)fAccounting->Get("hPOTMass");
37  hPOT->Scale(1./10.43); // scale factor for full detector equivalent (see docdb-23417)
38  int runNBins = hPOT->GetXaxis()->GetNbins();
39  double loRun = hPOT->GetXaxis()->GetBinLowEdge(1);
40  double dxRun = hPOT->GetXaxis()->GetBinLowEdge(2) - hPOT->GetXaxis()->GetBinLowEdge(1);
41  double hiRun = hPOT->GetXaxis()->GetBinLowEdge(runNBins) + dxRun;
42 
43  TH1D* hPOTT = (TH1D*)fAccounting->Get("hPOTMassT");
44  hPOTT->Scale(1./10.43);
45  int timeNBins = hPOTT->GetXaxis()->GetNbins();
46  double loTime = hPOTT->GetXaxis()->GetBinLowEdge(1);
47  double dxTime = hPOTT->GetXaxis()->GetBinLowEdge(2) - hPOTT->GetXaxis()->GetBinLowEdge(1);
48  double hiTime = hPOTT->GetXaxis()->GetBinLowEdge(timeNBins) + dxTime;
49  std::cout << loTime << " - " << hiTime << std::endl;
50 
51  // ---------------------------------------------------------------------------------
52  TH1D *hPOTAccumulated = new TH1D("hPOTAccumulated",";Run;Accumulated Equivalent POT (x10^{20})",runNBins,loRun,hiRun);
53  TH1D *hPOTTAccumulated = new TH1D("hPOTTAccumulated",";Time;Accumulated Equivalent POT (x10^{20})",timeNBins,loTime,hiTime);
54 
55  for( int iRBin = 1; iRBin <= runNBins; ++iRBin ){
56  if( iRBin==1 )
57  hPOTAccumulated->SetBinContent( iRBin, hPOT->GetBinContent(iRBin)/1.0e20 );
58  else
59  hPOTAccumulated->SetBinContent( iRBin, hPOTAccumulated->GetBinContent(iRBin-1)+(hPOT->GetBinContent(iRBin)/1.0e20) );
60  }
61 
62  for( int iTBin = 1; iTBin <= timeNBins; ++iTBin ){
63  if( iTBin==1 )
64  hPOTTAccumulated->SetBinContent( iTBin, hPOTT->GetBinContent(iTBin)/1.0e20 );
65  else
66  hPOTTAccumulated->SetBinContent( iTBin, hPOTTAccumulated->GetBinContent(iTBin-1)+(hPOTT->GetBinContent(iTBin)/1.0e20) );
67  }
68 
69  TFile *outFile = new TFile("potAccumulated_equivalent_FHC.root","recreate");
70  hPOTAccumulated->Write();
71  hPOTTAccumulated->Write();
72  outFile->Close();
73 }
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
TFile * outFile
Definition: PlotXSec.C:135
void accum_pot_equivalent_fhc()
OStream cout
Definition: OStream.cxx:6