77 , _ready(other._ready)
78 , _volumeProbs(other._volumeProbs)
93 sort(this->
begin(), this->
end(), moreHeight);
94 stable_sort(this->
begin(), this->
end(), lesserArea);
96 std::vector<DalitzBox>::iterator
97 uniqueEnd = unique(this->
begin(), this->
end(), same);
100 cout <<
"removeDuplicates: after sorting: " << endl;
101 for(
unsigned int i=0; i< this->
size(); i++){
102 bool equalToPrevious =
false;
103 if(i >= 1) equalToPrevious = same((*
this)[i], (*
this)[i-1]);
104 cout <<
" " << i <<
") " 106 <<
"\n is equal to previous? " 116 this->
erase(uniqueEnd, this->
end());
118 cout <<
"removeDuplicates: after removing: " << endl;
119 for(
unsigned int i=0; i< this->
size(); i++){
120 cout <<
" " << i <<
") " 126 cout <<
" DalitzBoxSet::sortYourself() " << endl;
128 if(this->
size() <= 1)
return;
129 cout <<
" creating sba" << endl;
138 stable_sort(this->
begin(), this->
end(), moreHeight);
141 for(
unsigned int i=0; i< this->
size(); i++){
142 (*this)[i].setNumber(i);
144 cout <<
" done sorting " << endl;
148 if(this->
empty())
return;
149 (*this)[0].setDaddy(0);
151 if(this->
size() <=1)
return;
153 for(
unsigned int i=1; i< this->
size(); i++){
154 (*this)[i].setDaddy(&((*
this)[i-1]));
160 for(
unsigned int i=0; i< this->
size(); i++){
161 cout <<
" volume number " << i <<
") " 162 << (*this)[i].volume()
164 sum += (*this)[i].volume();
166 cout <<
" Volume sum: " << sum;
172 for(
unsigned int i=0; i< this->
size(); i++){
173 sum += (*this)[i].area().size();
180 if(this->
empty())
return;
191 for(
unsigned int i=0; i < this->
size(); i++){
192 sum += (*this)[i].volume()/totalVolume;
193 if(dbThis) cout <<
" volume probs [" << i <<
"] = " << sum << endl;
205 double rndNumber =
_rnd->Rndm();
209 cout <<
"WARNING in DalitzBoxSet::pickRandomVolume():" 210 <<
" How odd - should never have gotten here." 211 <<
" rndNumber = " << rndNumber
212 <<
", _volumeProbs[this->size()-1] = " 215 return this->
size()-1;
220 cout <<
" DalitzBoxSet::addBox: adding box " 225 cout <<
" done that." << endl;
230 for(
unsigned int i=0; i<boxes.
size(); i++){
237 for(
unsigned int i=0; i<boxes.
size(); i++){
248 for(
unsigned int i=0; i < this->
size(); i++){
249 (*this)[i].setAmps(
_amps);
253 for(
unsigned int i=0; i < this->
size(); i++){
254 (*this)[i].setRnd(
_rnd);
258 for(
unsigned int i=0; i < this->
size(); i++){
259 cout <<
" getting box " << i <<
" ready." << endl;
260 (*this)[i].getReady();
261 cout <<
" got it." << endl;
269 time_t startTime = time(0);
271 cout <<
"DalitzBoxSet::getReady()" << endl;
272 cout <<
"before removing dupliates: " 273 << this->
size() <<
" boxes." << endl;
275 cout <<
"after removing dupliates: " 276 << this->
size() <<
" boxes." << endl;
278 cout <<
" sorted" << endl;
280 cout <<
" made relations" << endl;
281 cout <<
"I have the following " << this->
size() <<
" boxes: " << endl;
282 cout << *
this << endl;
285 cout <<
" set the pdfs " << endl;
287 cout <<
" set the rnds" << endl;
289 cout <<
" got Boxes ready" << endl;
291 cout <<
" made the intervalse " << endl;
293 double deltaT = difftime(time(0), startTime);
294 cout <<
"DalitzBoxSet: after only:" << deltaT/60 <<
" min" << endl;
295 cout <<
"DalitzBoxSet: I am ready." << endl;
301 if(nWays == 1)
return (*
this);
304 if(nWays == 0)
return newSet;
306 cout <<
" DalitzBoxSet: before splitting I have " 307 << this->
size() <<
" boxes" 309 for(
unsigned int i=0; i< this->
size(); i++){
310 newSet.
add((*
this)[i].
split(nWays));
312 cout <<
"after, it's " << newSet.
size() << endl;
320 cout <<
" DalitzBoxSet: before splitting I have " 321 << this->
size() <<
" boxes" 323 for(
unsigned int i=0; i< this->
size(); i++){
326 cout <<
"after, it's " << newSet.
size() << endl;
335 return (*
this)[boxIndex].tryEventForOwner();
342 return (*
this)[boxIndex].tryWeightedEventForOwner();
348 if(dbThis)cout <<
" DalitzBoxSet::newEvent " 349 <<
" getting event " << endl;
354 if(dbThis) cout <<
"got event, returning " << ptr << endl;
360 unsigned int counter=0;
361 unsigned int veryLargeNumber = 1000000000;
365 }
while(0==
newEvent && counter < veryLargeNumber);
372 cout <<
"WARNING: DalitzBoxSet::generateEvent()" 373 <<
" failed to generate event despite LARGE" 374 <<
" number of tries." << endl;
384 if(0 == rnd)
_rnd = gRandom;
386 for(
unsigned int i=0; this->
size(); i++){
387 (*this)[i].setRnd(
_rnd);
392 _rnd->SetSeed(time(0)*4);
397 os <<
" DalitzBoxSet with " << this->
size() <<
" boxes:" 398 <<
"\n======================================";
399 for(
unsigned int i=0; i< this->
size(); i++){
400 os <<
"\n box " << i <<
"\n" << (*this)[i];
401 os <<
"\n--------------------------------------";
void setPDF(MINT::IReturnRealForEvent< IDalitzEvent > *amps)
MINT::IReturnRealForEvent< IDalitzEvent > * _amps
void makeVolumeProbIntervals()
std::vector< DalitzBox >::iterator end()
DalitzBoxSet split(unsigned int nWays) const
void resize(unsigned int N)
void push_back(const DalitzBox &c)
ostream & operator<<(ostream &os, const DalitzBoxSet &bs)
virtual MINT::counted_ptr< DalitzEvent > tryEvent()
bool operator()(const DalitzBox &a, const DalitzBox &b)
bool operator()(const DalitzBox &a, const DalitzBox &b)
virtual MINT::counted_ptr< IDalitzEvent > newEvent()
DalitzBoxSet splitIfWiderThan(double maxWidth) const
bool setRnd(TRandom *rnd)
virtual bool ensureFreshEvents()
virtual MINT::counted_ptr< DalitzEvent > generateEventForOwner()
double guessedHeight() const
bool operator()(const DalitzBox &a, const DalitzBox &b)
void add(const DalitzBox &box)
bool operator()(const DalitzBox &a, const DalitzBox &b)
const MappedDalitzArea & area() const
void erase(typename std::vector< DalitzBox >::iterator pos)
std::vector< DalitzBox >::iterator begin()
bool operator()(const DalitzBox &a, const DalitzBox &b)
bool similar(const MappedDalitzArea &ma) const
void callSortYourselfForDebug()
unsigned int size() const
virtual unsigned int size() const
MINT::PolymorphVector< double > _volumeProbs
bool operator()(const DalitzBox &a, const DalitzBox &b)
bool less(const MappedDalitzArea &ma) const
virtual MINT::counted_ptr< DalitzEvent > tryWeightedEvent()
bool operator()(const DalitzBox &a, const DalitzBox &b)
DalitzBoxSet(TRandom *rnd=gRandom)
virtual DalitzEvent generateEvent()
DalitzEventList & eventList()
virtual void print(std::ostream &os=std::cout) const