MINT2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DalitzBoxSet_Method2 Class Reference

#include <DalitzBoxSet_Method2.h>

Inheritance diagram for DalitzBoxSet_Method2:
DalitzBoxSet MINT::IEventGenerator< IDalitzEvent > MINT::PolymorphVector< DalitzBox > MINT::IEventGenerator< IDalitzEvent >

Public Member Functions

 DalitzBoxSet_Method2 (const DalitzEventPattern &pat, TRandom *rnd=gRandom)
 
 DalitzBoxSet_Method2 (const DalitzBoxSet &boxSet, const DalitzEventPattern &pat)
 
 DalitzBoxSet_Method2 (const DalitzBoxSet_Method2 &other)
 
double maxHeight () const
 
virtual MINT::counted_ptr< DalitzEventtryEvent ()
 
virtual MINT::counted_ptr< DalitzEventtryWeightedEvent ()
 
virtual MINT::counted_ptr< IDalitzEventnewEvent ()
 
virtual bool exhausted () const
 
virtual ~DalitzBoxSet_Method2 ()
 
- Public Member Functions inherited from DalitzBoxSet
void makeRelations ()
 
void removeDuplicates ()
 
void sortYourself ()
 
void callSortYourselfForDebug ()
 
 DalitzBoxSet (TRandom *rnd=gRandom)
 
 DalitzBoxSet (const DalitzBoxSet &other)
 
void add (const DalitzBox &box)
 
void add (const MINT::PolymorphVector< DalitzBox > &boxes)
 
void add (const DalitzBoxSet &boxes)
 
void setPDF (MINT::IReturnRealForEvent< IDalitzEvent > *amps)
 
DalitzBoxSet split (unsigned int nWays) const
 
DalitzBoxSet splitIfWiderThan (double maxWidth) const
 
virtual MINT::counted_ptr< DalitzEventgenerateEventForOwner ()
 
virtual DalitzEvent generateEvent ()
 
virtual void print (std::ostream &os=std::cout) const
 
bool setRnd (TRandom *rnd)
 
virtual bool ensureFreshEvents ()
 
virtual ~DalitzBoxSet ()
 
- Public Member Functions inherited from MINT::PolymorphVector< DalitzBox >
 PolymorphVector ()
 
 PolymorphVector (unsigned int N)
 
 PolymorphVector (unsigned int N, const DalitzBox &c)
 
 PolymorphVector (const PolymorphVector &other)
 
 PolymorphVector (const typename std::vector< DalitzBox > &other)
 
virtual ~PolymorphVector ()
 
std::vector< DalitzBox > & theVector ()
 
const std::vector< DalitzBox > & theVector () const
 
DalitzBoxoperator[] (unsigned int i)
 
const DalitzBoxoperator[] (unsigned int i) const
 
DalitzBoxat (unsigned int i)
 
const DalitzBoxat (unsigned int i) const
 
std::vector< DalitzBox >::iterator begin ()
 
std::vector< DalitzBox >::const_iterator begin () const
 
std::vector< DalitzBox >::iterator end ()
 
std::vector< DalitzBox >::const_iterator end () const
 
std::vector< DalitzBox >::iterator find (const DalitzBox &c)
 
std::vector< DalitzBox >::const_iterator find (const DalitzBox &c) const
 
DalitzBoxfront ()
 
const DalitzBoxfront () const
 
DalitzBoxback ()
 
const DalitzBoxback () const
 
unsigned int size () const
 
bool empty () const
 
void push_back (const DalitzBox &c)
 
void pop_back ()
 
void erase (typename std::vector< DalitzBox >::iterator pos)
 
void erase (typename std::vector< DalitzBox >::iterator first, typename std::vector< DalitzBox >::iterator last)
 
PolymorphVector< DalitzBox > & operator= (const PolymorphVector< DalitzBox > &other)
 
void clear ()
 
void resize (unsigned int N)
 
void resize (unsigned int N, const DalitzBox &c)
 
 operator const typename std::vector< DalitzBox > & () const
 
 operator typename std::vector< DalitzBox > & ()
 
bool operator== (const MINT::PolymorphVector< DalitzBox > &v2) const
 
bool operator!= (const MINT::PolymorphVector< DalitzBox > &v2) const
 
bool operator< (const MINT::PolymorphVector< DalitzBox > &v2) const
 
bool operator> (const MINT::PolymorphVector< DalitzBox > &v2) const
 
- Public Member Functions inherited from MINT::IEventGenerator< IDalitzEvent >
virtual ~IEventGenerator ()
 

Private Member Functions

void setBoxesToFlat ()
 
void getMaxHeight ()
 
void setEmptyBoxesHeight ()
 
virtual void getReady ()
 
double eventsPDF (DalitzEvent &evt)
 

Private Attributes

DalitzEventPattern _pat
 
double _maxHeight
 

Additional Inherited Members

- Protected Member Functions inherited from DalitzBoxSet
double VolumeSum () const
 
double AreaSum () const
 
void makeVolumeProbIntervals ()
 
int pickRandomVolume ()
 
void setBoxPDFs ()
 
void setBoxRnds ()
 
void getBoxesReady ()
 
- Protected Attributes inherited from DalitzBoxSet
bool _ready
 
MINT::PolymorphVector< double > _volumeProbs
 
MINT::IReturnRealForEvent< IDalitzEvent > * _amps
 
TRandom * _rnd
 
- Protected Attributes inherited from MINT::PolymorphVector< DalitzBox >
std::vector< DalitzBox_vec
 

Detailed Description

Definition at line 12 of file DalitzBoxSet_Method2.h.

Constructor & Destructor Documentation

◆ DalitzBoxSet_Method2() [1/3]

DalitzBoxSet_Method2::DalitzBoxSet_Method2 ( const DalitzEventPattern pat,
TRandom *  rnd = gRandom 
)

Definition at line 16 of file DalitzBoxSet_Method2.cpp.

18  : DalitzBoxSet(rnd)
19  , _pat(pat)
20 {
21 }
DalitzEventPattern _pat
DalitzBoxSet(TRandom *rnd=gRandom)

◆ DalitzBoxSet_Method2() [2/3]

DalitzBoxSet_Method2::DalitzBoxSet_Method2 ( const DalitzBoxSet boxSet,
const DalitzEventPattern pat 
)

Definition at line 23 of file DalitzBoxSet_Method2.cpp.

26  : DalitzBoxSet(boxSet)
27  , _pat(pat)
28 {
29  cout << " DalitzBoxSet_Method2 from DalitzBoxSet, and pattern "
30  << pat
31  << ", ready? " << _ready
32  << "; this is me:\n" << (*this)
33  << endl;
34  _ready = false;
35 }
DalitzEventPattern _pat
DalitzBoxSet(TRandom *rnd=gRandom)

◆ DalitzBoxSet_Method2() [3/3]

DalitzBoxSet_Method2::DalitzBoxSet_Method2 ( const DalitzBoxSet_Method2 other)

Definition at line 9 of file DalitzBoxSet_Method2.cpp.

11  , DalitzBoxSet(other)
12  , _pat(other._pat)
13 {
14 }
DalitzEventPattern _pat
DalitzBoxSet(TRandom *rnd=gRandom)

◆ ~DalitzBoxSet_Method2()

virtual DalitzBoxSet_Method2::~DalitzBoxSet_Method2 ( )
inlinevirtual

Definition at line 45 of file DalitzBoxSet_Method2.h.

45 {}

Member Function Documentation

◆ eventsPDF()

double DalitzBoxSet_Method2::eventsPDF ( DalitzEvent evt)
private

Definition at line 74 of file DalitzBoxSet_Method2.cpp.

74  {
75 
76  if(0 == _amps ) return 0;
77  double val = _amps->RealVal(evt);
78  return val;
79 }
MINT::IReturnRealForEvent< IDalitzEvent > * _amps
Definition: DalitzBoxSet.h:25
virtual double RealVal(EVENT_TYPE &evt)=0

◆ exhausted()

virtual bool DalitzBoxSet_Method2::exhausted ( ) const
inlinevirtual

Reimplemented from DalitzBoxSet.

Definition at line 44 of file DalitzBoxSet_Method2.h.

44 {return false;}

◆ getMaxHeight()

void DalitzBoxSet_Method2::getMaxHeight ( )
private

Definition at line 44 of file DalitzBoxSet_Method2.cpp.

44  {
45  _maxHeight=-1;
46  for(unsigned int i=0; i < this->size(); i++){
47  double thisHeight = (*this)[i].height();
48  if(thisHeight > _maxHeight) _maxHeight = thisHeight;
49  }
50 }

◆ getReady()

void DalitzBoxSet_Method2::getReady ( )
privatevirtual

Reimplemented from DalitzBoxSet.

Definition at line 65 of file DalitzBoxSet_Method2.cpp.

65  {
66  cout << " getting ready " << endl;
69  getMaxHeight();
71  cout << "DalitzBoxSet_Method2: I am ready.\n" << (*this) << endl;
72 }
virtual void getReady()

◆ maxHeight()

double DalitzBoxSet_Method2::maxHeight ( ) const

Definition at line 61 of file DalitzBoxSet_Method2.cpp.

61  {
62  return _maxHeight;
63 }

◆ newEvent()

counted_ptr< IDalitzEvent > DalitzBoxSet_Method2::newEvent ( )
virtual

Reimplemented from DalitzBoxSet.

Definition at line 88 of file DalitzBoxSet_Method2.cpp.

88  {
89  bool dbThis=false;
90  if(dbThis)cout << "_ready = " << _ready << endl;
91  if(dbThis)cout << " maxHeight " << maxHeight() << endl;
92  if(maxHeight() < -9998 || ! _ready) getReady();
93  if(dbThis)cout << " DalitzBoxSet_Method2::newEvent "
94  << " getting event " << endl;
96  while(0 == ptr){
97  ptr = tryWeightedEvent();
98  }
99  if(dbThis) cout << "got event, returning " << ptr << endl;
100  return ptr;
101 }
virtual MINT::counted_ptr< DalitzEvent > tryWeightedEvent()

◆ setBoxesToFlat()

void DalitzBoxSet_Method2::setBoxesToFlat ( )
private

Definition at line 38 of file DalitzBoxSet_Method2.cpp.

38  {
39  for(unsigned int i=0; i < this->size(); i++){
40  (*this)[i].setFlatPhaseSpace();
41  }
42 }

◆ setEmptyBoxesHeight()

void DalitzBoxSet_Method2::setEmptyBoxesHeight ( )
private

Definition at line 52 of file DalitzBoxSet_Method2.cpp.

52  {
53  for(unsigned int i=0; i < this->size(); i++){
54  double thisHeight = (*this)[i].height();
55  if(thisHeight < 0){
56  (*this)[i].setHeight(_maxHeight);
57  }
58  }
59 }

◆ tryEvent()

counted_ptr< DalitzEvent > DalitzBoxSet_Method2::tryEvent ( )
virtual

Reimplemented from DalitzBoxSet.

Definition at line 103 of file DalitzBoxSet_Method2.cpp.

103  {
104  if(! _ready) getReady();
106  int boxIndex=-1;
107  /*
108  cout << "Hello from DalitzBoxSet_Method2::tryEvent()"
109  << endl;
110  cout << "I've got an event to try " << *evtPtr << endl;
111  */
112  for(unsigned int i=0; i< this->size(); i++){
113  bool isIn = (*this)[i].insideArea(*evtPtr);
114  /*
115  cout << "Is event in box " << i << " ? " << endl;
116  cout << "\t" << (isIn? "yes" : "no")
117  << endl;
118  */
119  if(isIn){
120  boxIndex=i;
121  break;
122  }
123  }
124  if(boxIndex < 0 || boxIndex >= (int) this->size()){
125  cout << "ERROR in DalitzBoxSet_Method2::tryEvent()"
126  << " boxIndex = " << boxIndex
127  << ", outside [" << 0 << ", " << this->size() << "]"
128  << endl;
129  return counted_ptr<DalitzEvent>(0);
130  }
131 
132  double thisHeight = (*this)[boxIndex].height();
133  if(_rnd->Rndm()*maxHeight() >= thisHeight){
134  return counted_ptr<DalitzEvent>(0);
135  }
136  // OK, so it passed the box stage, now internal:
137  double pdf = eventsPDF(*evtPtr);
138  if(pdf > thisHeight){
139  cout << "ERROR, underestimated box height [" << boxIndex << "]"
140  << "\n\t\t thisHeight = " << thisHeight
141  << "\n\t\t < pdf = " << pdf
142  << "\n\t\t (maxHeight = " << maxHeight() << ")" << endl;
143  (*this)[boxIndex].setHeight(3*pdf);
144  getMaxHeight();
145  }
146  if(_rnd->Rndm()* thisHeight >= pdf) {
147  return counted_ptr<DalitzEvent>(0);
148  }
149 
150  return evtPtr;
151 }
DalitzEventPattern _pat
TRandom * _rnd
Definition: DalitzBoxSet.h:27
double eventsPDF(DalitzEvent &evt)

◆ tryWeightedEvent()

counted_ptr< DalitzEvent > DalitzBoxSet_Method2::tryWeightedEvent ( )
virtual

Reimplemented from DalitzBoxSet.

Definition at line 81 of file DalitzBoxSet_Method2.cpp.

81  {
82  if(! _ready) getReady();
83  int boxIndex = pickRandomVolume();
84  //cout << "DalitzBoxSet::tryEvent() in volume " << boxIndex << endl;
85  return (*this)[boxIndex].tryWeightedEventForOwner();
86 }
int pickRandomVolume()

Member Data Documentation

◆ _maxHeight

double DalitzBoxSet_Method2::_maxHeight
private

Definition at line 19 of file DalitzBoxSet_Method2.h.

◆ _pat

DalitzEventPattern DalitzBoxSet_Method2::_pat
private

Definition at line 17 of file DalitzBoxSet_Method2.h.


The documentation for this class was generated from the following files: