RecordList.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // \author Christopher Backhouse -- bckhouse@caltech.edu
3 ////////////////////////////////////////////////////////////////////////
4 
5 #ifndef EVENTGENERATOR_GIBUU_RECORDLIST_H
6 #define EVENTGENERATOR_GIBUU_RECORDLIST_H
7 
8 #include <vector>
9 
10 class TFile;
11 class TTree;
12 
13 namespace gibuu
14 {
15  //___________________________________________________________________________
16  struct Particle
17  {
18  int pdg;
19  float E, px, py, pz;
20  };
21 
22  //___________________________________________________________________________
23  struct Record
24  {
25  Record();
26  Record(float _E, float _w, int _prod_id, const std::vector<Particle>& _ps);
27 
28  bool operator<(const Record& rhs) const;
29 
30  float E;
31  float weight;
32  int prod_id;
33  std::vector<Particle> parts;
34  };
35 
36  //___________________________________________________________________________
38  {
39  public:
40  virtual ~IRecordList(){}
41  virtual const Record* GetRecord(float E) const = 0;
42  };
43 
44  //___________________________________________________________________________
45  /// Helper for \ref SimpleRecordList and \ref OnDemandRecordList
47  {
48  public:
49  RecordLoader(const char* fname);
50  ~RecordLoader();
51 
52  long NRecords() const;
53  Record GetRecord(int i) const;
54  protected:
55  TFile* fFile;
56  TTree* fTree;
57 
58  float Enu, weight;
59  int prod_id;
60  int nparts;
61  int pdgs[1024];
62  float Es[1024], px[1024], py[1024], pz[1024];
63  };
64 
65  //___________________________________________________________________________
67  {
68  public:
69  SimpleRecordList(const char* fname);
70  virtual ~SimpleRecordList(){}
71 
72  const Record* GetRecord(float E) const override;
73  protected:
74  std::vector<Record> fRecs;
75  };
76 
77  //___________________________________________________________________________
79  {
80  public:
81  OnDemandRecordList(const char* fname);
82  virtual ~OnDemandRecordList(){}
83 
84  const Record* GetRecord(float E) const override;
85  protected:
87 
88  std::vector<std::pair<float, int>> fEnergies;
89 
90  mutable Record fRecord;
91  };
92 
93 } // namespace
94 
95 #endif
Helper for SimpleRecordList and OnDemandRecordList.
Definition: RecordList.h:46
std::vector< Particle > parts
Definition: RecordList.h:33
virtual ~IRecordList()
Definition: RecordList.h:40
std::vector< std::pair< float, int > > fEnergies
Definition: RecordList.h:88
bool operator<(StanConfig::Verbosity a, StanConfig::Verbosity b)
Allow for comparing them, since kQuiet is definitely "less" verbose than kVerbose.
Definition: StanConfig.h:95
virtual ~OnDemandRecordList()
Definition: RecordList.h:82
virtual ~SimpleRecordList()
Definition: RecordList.h:70
float weight
Definition: RecordList.h:31
std::vector< Record > fRecs
Definition: RecordList.h:74