G4WeightTable.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \brief Store +/- 1 sigma shifts for all geant4reweight channels
3 /// \author Cathal Sweeney - csweeney@fnal.gov
4 ////////////////////////////////////////////////////////////////////////
5 
6 
7 //This is heavily based on GENIEReweightTable.h
8 
9 #ifndef G4WEIGHTTABLE_H
10 #define G4WEIGHTTABLE_H
11 
12 namespace g4rwgt
13 {
14 
16  {
17  public:
18  uint nUniverses() const {return fNUniv;}
19  void SetNUniv(uint n);
20 
21  std::vector<float> Piplus() const{return fPiplus;}
22  std::vector<float> Piminus() const{return fPiminus;}
23  std::vector<float> Proton() const{return fProton;}
24  void SetWeight(uint i, int pdg, float w);
25 
26 
27  float Piplus_CV() const{return fPiplus_CV;} //central value
28  float Piminus_CV() const{return fPiminus_CV;}
29  float Proton_CV() const{return fProton_CV;}
30  void SetCV(int pdg, float w);
31 
32  protected:
34 
35  std::vector<float> fPiplus;
36  std::vector<float> fPiminus;
37  std::vector<float> fProton;
38 
39  float fPiplus_CV;
40  float fPiminus_CV;
41  float fProton_CV;
42 
43  };
44 
45  void G4WeightTable::SetWeight(uint i, int pdg, float w)
46  {
47 
48  assert(pdg == 211 || pdg == -211 || pdg == 2212 );
49 
50 
51  if(pdg == 211){
52  if(i >= fPiplus.size()){
53  fPiplus.resize(i+1, 1);
54  }
55  fPiplus[i] = w;
56  }
57 
58  if(pdg == -211){
59  if(i >= fPiminus.size()){
60  fPiminus.resize(i+1, 1);
61  }
62  fPiminus[i] = w;
63  }
64 
65  if(pdg == 2212){
66  if(i >= fProton.size()){
67  fProton.resize(i+1, 1);
68  }
69  fProton[i] = w;
70  }
71  }// end SetWeight()
72 
73 
74 
75  void G4WeightTable::SetCV(int pdg, float cv)
76  {
77 
78  assert(pdg == 211 || pdg == -211 || pdg == 2212 );
79 
80  if(pdg == 211){
81  fPiplus_CV = cv;
82  }
83 
84  if(pdg == -211){
85  fPiminus_CV = cv;
86  }
87 
88  if(pdg == 2212){
89  fProton_CV = cv;
90  }
91  }// end SetCV()
92 
93 
94 
96  {
97 
98  fNUniv = n;
99 
100  }// end SetNUniv()
101 
102 
103 
104 }// end namespace
105 
106 
107 #endif
std::vector< float > fProton
Definition: G4WeightTable.h:37
float Piplus_CV() const
Definition: G4WeightTable.h:27
Store +/- 1 sigma shifts for all geant4reweight channels.
Definition: FillTruth.h:19
void SetCV(int pdg, float w)
Definition: G4WeightTable.h:75
std::vector< float > Piplus() const
Definition: G4WeightTable.h:21
float Piminus_CV() const
Definition: G4WeightTable.h:28
std::vector< float > Proton() const
Definition: G4WeightTable.h:23
const std::string cv[Ncv]
float Proton_CV() const
Definition: G4WeightTable.h:29
uint nUniverses() const
Definition: G4WeightTable.h:18
assert(nhit_max >=nhit_nbins)
void SetNUniv(uint n)
Definition: G4WeightTable.h:95
std::vector< float > fPiplus
Definition: G4WeightTable.h:35
void SetWeight(uint i, int pdg, float w)
Definition: G4WeightTable.h:45
Float_t w
Definition: plot.C:20
std::vector< float > Piminus() const
Definition: G4WeightTable.h:22
std::vector< float > fPiminus
Definition: G4WeightTable.h:36
unsigned int uint