MakeReweight.h
Go to the documentation of this file.
1 #ifndef MAKEREWEIGHT_H
2 #define MAKEREWEIGHT_H
3 
4 #include "ReweightDriver.h"
5 #include "InteractionData.h"
6 #include "TargetData.h"
8 #include "InteractionChainData.h"
9 #include "ParameterTable.h"
11 #include "MIPPNumiYieldsBins.h"
12 #include "ThinTargetBins.h"
13 #include "MIPPNumiMC.h"
14 
15 #include "nu_g4numi.h"
16 #include "Numi2Pdg.h"
17 
18 #include "dk2nu/tree/dkmeta.h"
19 #include "dk2nu/tree/dk2nu.h"
20 
21 #include <string>
22 #include <vector>
23 #include <iostream>
24 #include <stdlib.h>
25 #include <iomanip>
26 
27 namespace NeutrinoFluxReweight{
28 
29  /*! \class MakeReweight
30  * \brief A class to make the reweight event by event.
31  */
32  class MakeReweight{
33 
34  private:
35  MakeReweight();
36  ~MakeReweight();
37 
38  public:
39  void SetOptions(std::string fileIn);
40  static MakeReweight* getInstance();
41  static void resetInstance();
42 
43  /*! calculate the weights for this event using the old flux ntuple format
44  * (filled in nu_g4numi object), the tgtcfg (the target configuration, example: le010z)
45  * and the horncfg (horn configuration, example: 185i)
46  */
47  void calculateWeights(nu_g4numi* nu, const char* tgtcfg, const char* horncfg);
48 
49  //! create an interaction chain from the new dk2nu(dkmeta) format
50  void calculateWeights(bsim::Dk2Nu* nu, bsim::DkMeta* meta);
51 
52  //! total weights
53  std::vector<double> GetTotalWeights();
54 
55  //! number of universes used in this run
57 
58  //! get the vector of the weights for a given reweighter
59  std::vector<double> GetWeights(std::string nameReweighter);
60 
61  //! get the cv weights
62  double GetCVWeight();
63 
64  //! vector of Reweighter Drivers, one per universe
65  std::vector<ReweightDriver*> vec_rws;
66 
67  //! Reweighter Drivers for the central value
69 
70  private:
71  /*!
72  * Inititalize the job and configurethe ReweighterDrivier
73  */
74  void Initialize();
75  /*! Parse seeting options */
76  void ParseOptions();
77  /*! Parse seeting options */
78  void doTheJob(InteractionChainData* icd);
79 
80  std::vector<ParameterTable> cvPars,univPars;
84  std::vector<double> vec_wgts;
85  std::map<std::string,std::vector<double> > map_rew_wgts;
86  double cv_wgt;
87 
89 
90  };
91 
92 
93 }
94 #endif
void doTheJob(InteractionChainData *icd)
std::vector< double > GetWeights(std::string nameReweighter)
get the vector of the weights for a given reweighter
A class to make the reweight event by event.
Definition: MakeReweight.h:32
double GetCVWeight()
get the cv weights
std::string string
Definition: nybbler.cc:12
Information about the chain of interactions leading to a neutrino.
static MakeReweight * getInstance()
A class to manage and drive the weight calculation procedure.
std::vector< ParameterTable > cvPars
Definition: MakeReweight.h:80
int GetNumberOfUniversesUsed()
number of universes used in this run
static MakeReweight * instance
Definition: MakeReweight.h:88
void calculateWeights(nu_g4numi *nu, const char *tgtcfg, const char *horncfg)
std::vector< ReweightDriver * > vec_rws
vector of Reweighter Drivers, one per universe
Definition: MakeReweight.h:65
std::map< std::string, std::vector< double > > map_rew_wgts
Definition: MakeReweight.h:85
std::vector< ParameterTable > univPars
Definition: MakeReweight.h:80
ReweightDriver * cv_rw
Reweighter Drivers for the central value.
Definition: MakeReweight.h:68
std::vector< double > vec_wgts
Definition: MakeReweight.h:84
std::vector< double > GetTotalWeights()
total weights
void SetOptions(std::string fileIn)