GReWeightIORecord.h
Go to the documentation of this file.
1 #ifndef GRWIORECORD_H_
2 #define GRWIORECORD_H_
3 
4 #include <vector>
5 
6 #include <TObject.h>
7 
8 class TRootIOCtor;
9 
10 namespace genie {
11 namespace rew {
12 
13 class GReWeightInfo : public TObject {
14 
15  public:
16  GReWeightInfo() : TObject(), fTweak(0.), fWeight(1.) {}
17  GReWeightInfo( double twk, double wt ) : TObject() { fTweak=twk; fWeight=wt; }
18  GReWeightInfo( TRootIOCtor* ) : TObject(), fTweak(0.), fWeight(1.) {}
19  GReWeightInfo( const GReWeightInfo& r ) : TObject() { fTweak=r.fTweak; fWeight=r.fWeight; }
21 
22  double GetTweak() const { return fTweak; }
23  double GetWeight() const { return fWeight; }
24 
25  private:
26 
27  double fTweak;
28  double fWeight;
29 
30 // NOTE (JY): the 2nd parameter does have a "sense" of versioning, but it's more than that;
31 // in particular, 2 is the "minimal level" for reasonable I/O (e.g.0 would mean
32 // "never store it");
33 // one would increase it when chaning/adding to the data member list, etc.
34 //
35 ClassDef(GReWeightInfo,2)
36 
37 };
38 
39 } // end namespace rew
40 } // end namespace genie
41 
42 namespace genie
43 {
44 namespace rew
45 {
46 
47 class GReWeightIORecord : public TObject {
48 
49  public:
50  using TObject::Copy; // suppress clang 'hides overloaded virtual function [-Woverloaded-virtual]' warnings
51 
54  GReWeightIORecord( TRootIOCtor* );
55 
57 
58  void Reset();
59  void Copy( const GReWeightIORecord& );
60 
61  void SetOriginalEvtNumber( const int ievt ) { fOrigEvtNum = ievt; return; }
62  void Insert( const double, const double );
63 
64  int GetOriginalEvtNumber() const { return fOrigEvtNum; }
65  int GetNumOfRWResults() const { return fRWResults.size(); }
66  double GetTweak( const int i ) const { return ( ( fRWResults.size() > 0 && i >= 0 && i < (int)fRWResults.size() ) ? fRWResults[i].GetTweak() : 0. ); }
67  double GetWeight( const int i ) const { return ( ( fRWResults.size() > 0 && i >= 0 && i < (int)fRWResults.size() ) ? fRWResults[i].GetWeight() : 1. ); }
68 
69  private:
70 
72  std::vector<GReWeightInfo> fRWResults;
73 
74 ClassDef(GReWeightIORecord,2)
75 
76 };
77 
78 } // end namespace rew
79 } // end namespace genie
80 
81 #endif // RWOBJECT_H_
double GetTweak(const int i) const
#include "Numerical/GSFunc.h"
Definition: AlgCmp.h:26
std::vector< GReWeightInfo > fRWResults
GReWeightInfo(const GReWeightInfo &r)
void SetOriginalEvtNumber(const int ievt)
double GetWeight(const int i) const
GReWeightInfo(double twk, double wt)