MINT2
DalitzBWBoxSet.h
Go to the documentation of this file.
1 #ifndef DALITZ_BW_BOX_SET_HH
2 #define DALITZ_BW_BOX_SET_HH
3 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
4 // status: Mon 9 Feb 2009 19:17:58 GMT
5 
6 #include "Mint/DalitzBWBox.h"
7 
8 #include "Mint/IDalitzEvent.h"
10 
13 
14 #include "Mint/counted_ptr.h"
16 
17 #include <vector>
18 #include <iostream>
19 
20 #include "TRandom.h"
21 
22 
23 class DalitzBWBoxSet : public MINT::PolymorphVector<DalitzBWBox>
24 , virtual public MINT::IUnweightedEventGenerator<IDalitzEvent>{
25  protected:
27 
29  //DalitzEventList _eventList;
30 
33 
35 
36  bool _ready;
37  std::vector<double> _volumeProbs;
38  TRandom* _rnd;
39 
41  mutable double _phaseSpaceIntegral;
42 
44  double _pick_ps_prob;
45 
46  void getReady();
47  void findMax();
48  int justThrowAwayData(double maxValue
50  );
51 
53 
55  void setup_psbox();
56 
57  double VolumeSum()const;
58  double heightSum()const;
60  int pickRandomVolume();
61  double calc_pick_ps_prob() const;
62  double pick_ps_prob();
63 
64  bool checkIntegration()const;
65 
66  bool ready()const {return _ready;}
67 
68  double findMaxInList(double& sampleMax);
69 
70  // these are good for x-checks only, therefore not public:
73 
74  public:
76  , TRandom* r=gRandom);
77  DalitzBWBoxSet(TRandom* r);
78  DalitzBWBoxSet(const DalitzBWBoxSet& other);
79  virtual ~DalitzBWBoxSet(){}
80 
81  void add(DalitzBWBox& box);
82  void add(DalitzBWBoxSet& boxes);
83 
84  void setPhaseSpaceFrac(double ps){_phaseSpaceFrac = ps; getReady();}
85  double phaseSpaceFrac() const{return _phaseSpaceFrac;}
86 
87  void setUnWeightPs(bool doSo=true);
88 
94 
96 
99 
100  virtual bool exhausted() const{return false;}
101 
102  double phaseSpaceIntegral() const;
103 
104  double fullPdf(DalitzEvent& evt);// (|sum A|^2, w/o phase space factor)
105 
106  double genValueNoPs(const DalitzEvent& evt) const;
107  double genValuePs(const DalitzEvent& evt) const;
108  double genValueWithLoop(DalitzEvent& evt) const;
109  double genValue(const DalitzEvent& evt) const;
110 
111  void print(std::ostream& os)const;
112 
113  bool ensureFreshEvents();
114  bool setRnd(TRandom* rnd=gRandom);
115 
116 
117  // these two are for some sanity checks:
118  bool am_I_generating_what_I_think_I_am_generating(int Nevents=1000000);
119  bool compareGenerationMethodsForFullPDF(int Nevents=1000000);
120 };
121 
122 std::ostream& operator<<(std::ostream& os, const DalitzBWBoxSet& box);
123 #endif
124 //
double VolumeSum() const
void makeVolumeProbIntervals()
std::vector< double > _volumeProbs
bool am_I_generating_what_I_think_I_am_generating(int Nevents=1000000)
double calc_pick_ps_prob() const
double fullPdf(DalitzEvent &evt)
bool ready() const
bool ensureFreshEvents()
virtual MINT::counted_ptr< DalitzEvent > makeEventForOwner()
void setPhaseSpaceFrac(double ps)
DalitzEventPtrList _eventPtrList
double genValue(const DalitzEvent &evt) const
void set_psbox_height_and_weight()
virtual MINT::counted_ptr< DalitzEvent > makeWeightedEventForOwner()
virtual MINT::counted_ptr< IDalitzEvent > newEvent()
double genValuePs(const DalitzEvent &evt) const
double _phaseSpaceIntegral
TRandom * _rnd
double findMaxInList(double &sampleMax)
double _maxWeightInSample
bool compareGenerationMethodsForFullPDF(int Nevents=1000000)
void setUnWeightPs(bool doSo=true)
virtual MINT::counted_ptr< DalitzEvent > phaseSpaceEvent()
bool setRnd(TRandom *rnd=gRandom)
double heightSum() const
std::ostream & operator<<(std::ostream &os, const DalitzBWBoxSet &box)
virtual MINT::counted_ptr< IDalitzEvent > newUnweightedEvent()
double _pick_ps_prob
DalitzBWBoxSet(MINT::IReturnRealForEvent< IDalitzEvent > *amps=0, TRandom *r=gRandom)
DalitzPhaseSpaceBox _psbox
MINT::counted_ptr< DalitzEvent > popEventFromList()
double _phaseSpaceFrac
bool checkIntegration() const
static double __phaseSpaceFracDefaultValue
double genValueWithLoop(DalitzEvent &evt) const
virtual ~DalitzBWBoxSet()
virtual bool exhausted() const
virtual MINT::counted_ptr< DalitzEvent > tryEventForOwner()
int justThrowAwayData(double maxValue, MINT::IReturnRealForEvent< IDalitzEvent > *amps)
double _maxWeightEstimate
double phaseSpaceFrac() const
virtual MINT::counted_ptr< DalitzEvent > makeWeightedApproxEventForOwner()
void print(std::ostream &os) const
double phaseSpaceIntegral() const
double genValueNoPs(const DalitzEvent &evt) const
MINT::IReturnRealForEvent< IDalitzEvent > * _ampSum
void add(DalitzBWBox &box)