MINT2
DiskResidentEventList.h
Go to the documentation of this file.
1 #ifndef DISK_RESIDENT_EVENT_LIST_HH
2 #define DISK_RESIDENT_EVENT_LIST_HH
3 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
4 // status: Mon 9 Feb 2009 19:18:00 GMT
5 
9 
10 #include "Mint/IDalitzEvent.h"
11 #include "Mint/DalitzEvent.h"
13 #include "Mint/DalitzHistoSet.h"
14 #include "Mint/counted_ptr.h"
15 
16 #include <string>
17 
18 class TNtupleD;
19 class TFile;
20 
21 /*
22  WARNING: Event pointer returned by this list are only
23  valid until the next operation on the list is carried out,
24  so if you want to use the event longer, use getEventCopy.
25  */
26 class DiskResidentEventList : virtual public MINT::IMinimalEventList<DalitzEvent>{
27  protected:
28  std::string _fname;
29  std::string _opt;
30 
31  TFile* _f; // object ownership with gDirectory
32  TNtupleD* _ntp; // object ownership with gDirectory
33  double _scaleData;
34 
35 
37 
38  static int __maxBytes;
39  std::string cName();
40  std::string ntpName();
41 
42  bool openFile();
43  bool makeNtp(const DalitzEvent& evt);
44  bool makeNewFile();
45  bool fromFile();
46 
47  bool init();
48  public:
49 
51 
52  DiskResidentEventList(const std::string& fname
53  , const std::string& opt="UPDATE"
54 );
55  DiskResidentEventList(const std::string& fname
56  , int scales
57  , const std::string& treeName
58  , const std::string& opt="UPDATE"
59 );
60  // DiskResidentEventList(TNtupleD* ntp);
62  );
64  , const std::string& fname
65  , const std::string& opt="RECREATE");
66 
68  );
69  //DiskResidentEventList(const MINT::IMinimalEventList<IDalitzEvent>& otherList
70  // );
72  , const std::string& newFname
73  , const std::string& opt="RECREATE"
74  );
75  //DiskResidentEventList(const MINT::IMinimalEventList<IDalitzEvent>& otherList
76  // , const std::string& newFname
77  // , const std::string& opt="RECREATE"
78  // );
79 
80  virtual ~DiskResidentEventList();
81 
82  static std::string generateFname();
83 
84  virtual unsigned int size() const;
85  virtual bool empty() const;
86 
87  // DalitzEvent operator[](unsigned int i) const;
88  DalitzEvent getEvent(unsigned int i) const;
89 
90  virtual bool Add(const DalitzEvent& evt);
91  bool Add(const IDalitzEvent& evt);
92  bool Add(const IDalitzEvent* evt); // for backward compatibility
93  bool Add(const MINT::counted_ptr<IDalitzEvent>& evt);
94  bool Add(const MINT::IMinimalEventList<DalitzEvent>& otherList);
95  //bool Add(const MINT::IMinimalEventList<IDalitzEvent>& otherList);
96 
97  bool save();
98  bool Close();
99 
100 
101  DalitzHistoSet histoSet() const;
105 
106  bool makePlots(const std::string& filename);
107 
108 
109  DalitzEvent operator()(unsigned int i);
110  private:
111  std::string _cName;
112  std::string _ntpName;
113 
114 };
115 
116 #endif
117 //
bool makeNtp(const DalitzEvent &evt)
DalitzHistoSet reWeightedHistoSet(MINT::IReturnRealForEvent< IDalitzEvent > *w) const
DalitzHistoSet weighedReWeightedHistoSet(MINT::IReturnRealForEvent< IDalitzEvent > *w) const
DalitzHistoSet weightedHistoSet() const
bool makePlots(const std::string &filename)
virtual bool Add(const DalitzEvent &evt)
virtual unsigned int size() const
static std::string generateFname()
DalitzHistoSet histoSet() const
DalitzEvent getEvent(unsigned int i) const
virtual bool empty() const
DalitzEvent operator()(unsigned int i)