All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Normalize.cc
Go to the documentation of this file.
1 #include "Normalize.h"
2 #include "core/SubRun.hh"
3 
4 
5 void ana::SBNOsc::Normalize::Initialize(const fhicl::ParameterSet &fcl) {
6  fPotPerReadout = fcl.get<double>("PotPerReadout", 5.e12);
7 
10 
13 
14  fNeutrinoPOT = 0.;
15  fNNeutrinoEvents = 0;
16  fNCosmicEvents = 0;
17 }
18 
20  fNCosmicEvents += meta.n_gen_events;
21 }
22 
24 
26  fNNeutrinoEvents ++;
27 }
28 
30  std::cout << "New subrun: " << subrun.totgoodpot << std::endl;
31  fNeutrinoPOT += subrun.totgoodpot;
32 }
33 
34 double ana::SBNOsc::Normalize::ScaleCosmic(double goal_pot) const {
35 
36  std::cout << "Total N cosmics: " << fNCosmicEvents << std::endl;
37  std::cout << "Total N neutrinos: " << fNNeutrinoEvents << std::endl;
38  std::cout << "Total neutrino POT: " << fNeutrinoPOT << std::endl;
39 
40  // fraction of all POT accounted for by the neutrino sample
41  double neutrino_per_pot = 0.;
42  if (fNeutrinoPOT > 1e-3 && fNNeutrinoEvents > 0) {
43  neutrino_per_pot = fNNeutrinoEvents / (fNeutrinoPOT);
44  }
45 
46  std::cout << "Neutrino per POT: " << neutrino_per_pot << std::endl;
47 
48  // POT per cosmic event
49  double cosmic_per_pot = (1./fPotPerReadout) - neutrino_per_pot;
50 
51  std::cout << "Cosmic per POT: " << cosmic_per_pot << std::endl;
52 
53  // total POT equaivalent of cosmic
54  double cosmic_pot = fNCosmicEvents / cosmic_per_pot;
55 
56  std::cout << "Cosmic POT: " << cosmic_pot << std::endl;
57 
58  // scale
59  return goal_pot / cosmic_pot;
60 }
61 
62 double ana::SBNOsc::Normalize::ScaleNeutrino(double goal_pot) const {
63  if (fNeutrinoPOT < 1e-3 || fNNeutrinoEvents == 0) return 0;
64  // simpler -- just scale neutrino POT to goal
65  return goal_pot / (fNeutrinoPOT);
66 }
67 
68 
69 
process_name standard_reco_uboone fcl
double ScaleCosmic(double goal_pot) const
Definition: Normalize.cc:34
unsigned fNNeutrinoEvents
Definition: Normalize.h:69
void AddNeutrinoEvent(const event::Event &event)
Definition: Normalize.cc:25
void AddCosmicEvent(const event::Event &event)
Definition: Normalize.cc:23
float totgoodpot
Definition: SubRun.hh:40
void AddCosmicFile(const FileMeta &meta)
Definition: Normalize.cc:19
The standard subrun data definition.
Definition: SubRun.hh:23
The standard event data definition.
Definition: Event.hh:228
void AddNeutrinoSubRun(const SubRun &subrun)
Definition: Normalize.cc:29
do i e
void Initialize(const fhicl::ParameterSet &fcl)
Definition: Normalize.cc:5
double ScaleNeutrino(double goal_pot) const
Definition: Normalize.cc:62
BEGIN_PROLOG could also be cout
unsigned n_gen_events
Definition: FileMeta.hh:25
Metadata for each input file.
Definition: FileMeta.hh:16
unsigned fNCosmicEvents
Definition: Normalize.h:70