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

#include <MappedDalitzBWArea.h>

Public Member Functions

 MappedDalitzBWArea ()
 
 MappedDalitzBWArea (const DalitzEventPattern &pat, TRandom *rnd=gRandom)
 
 MappedDalitzBWArea (const DalitzEventPattern &pat, const MINT::counted_ptr< IGenFct > &oneFunction, TRandom *rnd=gRandom)
 
 MappedDalitzBWArea (const DalitzEventPattern &pat, const MINT::counted_ptr< IGenFct > &oneFunction, const MINT::counted_ptr< IGenFct > &otherFunction, TRandom *rnd=gRandom)
 
 MappedDalitzBWArea (const DalitzEventPattern &pat, const std::vector< MINT::counted_ptr< IGenFct > > &functions, TRandom *rnd=gRandom)
 
 MappedDalitzBWArea (const MappedDalitzBWArea &other)
 
virtual ~MappedDalitzBWArea ()
 
bool checkIntegration () const
 
MINT::counted_ptr< DalitzEventtryEventForOwner () const
 
bool isInside (const DalitzEvent &evt) const
 
bool isInside (const DalitzCoordinate &dc) const
 
bool isInside (const std::vector< DalitzCoordinate > &dcList) const
 
double genValue (const DalitzEvent &evt) const
 
double size () const
 
double integral () const
 
void setUnWeightPs (bool doSo=true)
 
bool unWeightPs ()
 
void print (std::ostream &os=std::cout) const
 
MINT::counted_ptr< IGenFctfct_for_s (const std::vector< int > &indices) const
 
MINT::counted_ptr< IGenFctfct_for_s (int i, int j, int k=-1) const
 
MappedDalitzBWAreaoperator= (const MappedDalitzBWArea &other)
 
bool setRnd (TRandom *rnd=gRandom)
 

Private Member Functions

void setup ()
 
void findMapping ()
 
void applyLimits ()
 
bool allConsecutive () const
 
bool allStandardised () const
 
std::vector< TLorentzVector > & mapP4 (const DalitzEvent &evt, const Permutation &mapping, std::vector< TLorentzVector > &p4) const
 
std::vector< TLorentzVector > mapP4 (const DalitzEvent &evt, const Permutation &mapping) const
 

Private Attributes

TRandom * _rnd
 
DalitzEventPattern _pat
 
DalitzEventPattern _mappedPat
 
DalitzBWArea _area
 
std::vector< MINT::counted_ptr< IGenFct > > _limits
 
Permutation _mapping
 
Permutation _inverseMapping
 

Detailed Description

Definition at line 21 of file MappedDalitzBWArea.h.

Constructor & Destructor Documentation

◆ MappedDalitzBWArea() [1/6]

MappedDalitzBWArea::MappedDalitzBWArea ( )

Definition at line 24 of file MappedDalitzBWArea.cpp.

25  : _rnd(0)
26  , _pat()
27  , _mappedPat()
28  , _area()
29  , _limits()
30  , _mapping()
31  , _inverseMapping()
32 {
33  setup();
34 }
DalitzEventPattern _pat
DalitzEventPattern _mappedPat
std::vector< MINT::counted_ptr< IGenFct > > _limits
Permutation _inverseMapping

◆ MappedDalitzBWArea() [2/6]

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

Definition at line 35 of file MappedDalitzBWArea.cpp.

37  : _rnd(rnd)
38  , _pat(pat)
39  , _mappedPat(pat)
40  , _area(pat)
41  , _limits()
42  , _mapping(pat.size())
43  , _inverseMapping(pat.size())
44 {
45  setup();
46 }
DalitzEventPattern _pat
DalitzEventPattern _mappedPat
std::vector< MINT::counted_ptr< IGenFct > > _limits
unsigned int size() const
Permutation _inverseMapping

◆ MappedDalitzBWArea() [3/6]

MappedDalitzBWArea::MappedDalitzBWArea ( const DalitzEventPattern pat,
const MINT::counted_ptr< IGenFct > &  oneFunction,
TRandom *  rnd = gRandom 
)

Definition at line 47 of file MappedDalitzBWArea.cpp.

51  : _rnd(rnd)
52  , _pat(pat)
53  , _mappedPat(pat)
54  , _limits(1)
55  , _mapping(pat.size())
56  , _inverseMapping(pat.size())
57 {
58  _limits[0] = oneLimit;
59  setup();
60 }
DalitzEventPattern _pat
DalitzEventPattern _mappedPat
std::vector< MINT::counted_ptr< IGenFct > > _limits
unsigned int size() const
Permutation _inverseMapping

◆ MappedDalitzBWArea() [4/6]

MappedDalitzBWArea::MappedDalitzBWArea ( const DalitzEventPattern pat,
const MINT::counted_ptr< IGenFct > &  oneFunction,
const MINT::counted_ptr< IGenFct > &  otherFunction,
TRandom *  rnd = gRandom 
)

Definition at line 61 of file MappedDalitzBWArea.cpp.

66  : _rnd(rnd)
67  , _pat(pat)
68  , _mappedPat(pat)
69  , _limits(2)
70  , _mapping(pat.size())
71  , _inverseMapping(pat.size())
72 {
73  _limits[0] = oneLimit;
74  _limits[1] = otherLimit;
75  /*
76  cout << " just made a MappedDalitzBWArea with limits :"
77  << oneLimit << ", " << otherLimit << " or "
78  << _limits[0] << ", " << _limits[1] << endl;
79  */
80  setup();
81  /*
82  cout << " ..after setup: "
83  << _limits[0] << ", " << _limits[1] << endl;
84  */
85 }
DalitzEventPattern _pat
DalitzEventPattern _mappedPat
std::vector< MINT::counted_ptr< IGenFct > > _limits
unsigned int size() const
Permutation _inverseMapping

◆ MappedDalitzBWArea() [5/6]

MappedDalitzBWArea::MappedDalitzBWArea ( const DalitzEventPattern pat,
const std::vector< MINT::counted_ptr< IGenFct > > &  functions,
TRandom *  rnd = gRandom 
)

Definition at line 87 of file MappedDalitzBWArea.cpp.

91  : _rnd(rnd)
92  , _pat(pat)
93  , _mappedPat(pat)
94  , _limits(lim)
95  , _mapping(pat.size())
96  , _inverseMapping(pat.size())
97 {
98  setup();
99 }
DalitzEventPattern _pat
DalitzEventPattern _mappedPat
std::vector< MINT::counted_ptr< IGenFct > > _limits
unsigned int size() const
Permutation _inverseMapping

◆ MappedDalitzBWArea() [6/6]

MappedDalitzBWArea::MappedDalitzBWArea ( const MappedDalitzBWArea other)

Definition at line 101 of file MappedDalitzBWArea.cpp.

102  : _rnd(other._rnd)
103  , _pat(other._pat)
104  , _mappedPat(other._mappedPat)
105  , _area(other._area)
106  , _limits(other._limits)
107  , _mapping(other._mapping)
109 {
110 }
DalitzEventPattern _pat
DalitzEventPattern _mappedPat
std::vector< MINT::counted_ptr< IGenFct > > _limits
Permutation _inverseMapping

◆ ~MappedDalitzBWArea()

MappedDalitzBWArea::~MappedDalitzBWArea ( )
virtual

Definition at line 123 of file MappedDalitzBWArea.cpp.

123  {
124 }

Member Function Documentation

◆ allConsecutive()

bool MappedDalitzBWArea::allConsecutive ( ) const
private

Definition at line 126 of file MappedDalitzBWArea.cpp.

126  {
127  for(unsigned int i=0; i < _limits.size(); i++){
128  DalitzCoordinate newCoordinates = (_limits[i])->getCoordinate().mapMe(_mapping);
129  /*
130  cout << "mapped new coordinates: "
131  << i << ": " << newCoordinates << endl;
132  */
133  if(! (newCoordinates.I_am_Consecutive())) return false;
134  }
135  return true;
136 }
bool I_am_Consecutive() const
std::vector< MINT::counted_ptr< IGenFct > > _limits
DalitzCoordinate mapMe(const Permutation &perm) const

◆ allStandardised()

bool MappedDalitzBWArea::allStandardised ( ) const
private

Definition at line 138 of file MappedDalitzBWArea.cpp.

138  {
139  // such that only s123, s12,
140  // or s12, s34
141  // are filled (or s123, or s12 for single
142  // limits).
143  // Helps with generating later.
144 
145  if(_limits.size() > 2 || _limits.empty() ){
146  return true; // no standards for that, all OK
147  }
148  DalitzCoordinate s123(1,2,3);
149  DalitzCoordinate s12(1,2);
150  DalitzCoordinate s34(3,4);
151  if(_limits.size() == 1){
152  if(_limits[0]->getCoordinate().mapMe(_mapping).sameIndices(s123)) return true;
153  if(_limits[0]->getCoordinate().mapMe(_mapping).sameIndices(s12)) return true;
154  }
155  if(_limits.size() == 2){
156  if(_limits[0]->getCoordinate().mapMe(_mapping).sameIndices(s123)
157  && _limits[1]->getCoordinate().mapMe(_mapping).sameIndices(s12)) return true;
158  if(_limits[0]->getCoordinate().mapMe(_mapping).sameIndices(s12)
159  && _limits[1]->getCoordinate().mapMe(_mapping).sameIndices(s34)) return true;
160  if(_limits[1]->getCoordinate().mapMe(_mapping).sameIndices(s123)
161  && _limits[0]->getCoordinate().mapMe(_mapping).sameIndices(s12)) return true;
162  if(_limits[1]->getCoordinate().mapMe(_mapping).sameIndices(s12)
163  && _limits[0]->getCoordinate().mapMe(_mapping).sameIndices(s34)) return true;
164  }
165  return false;
166 }
std::vector< MINT::counted_ptr< IGenFct > > _limits

◆ applyLimits()

void MappedDalitzBWArea::applyLimits ( )
private

Definition at line 235 of file MappedDalitzBWArea.cpp.

235  {
236  bool dbThis=false;
237  for(unsigned int i=0; i < _limits.size(); i++){
238  if(dbThis){
239  cout << "mapped co-ordinates "
240  << (_limits[i])->getCoordinate().mapMe(_mapping)
241  << endl;
242  }
243  _area.setFcn((_limits[i])->getCoordinate().mapMe(_mapping), _limits[i]);
244  }
245 }
void setFcn(const DalitzCoordinate &c, const MINT::counted_ptr< IGenFct > &fcn)
std::vector< MINT::counted_ptr< IGenFct > > _limits

◆ checkIntegration()

bool MappedDalitzBWArea::checkIntegration ( ) const
inline

Definition at line 94 of file MappedDalitzBWArea.h.

94  {
95  return _area.checkIntegration();}
bool checkIntegration() const

◆ fct_for_s() [1/2]

MINT::counted_ptr<IGenFct> MappedDalitzBWArea::fct_for_s ( const std::vector< int > &  indices) const

◆ fct_for_s() [2/2]

MINT::counted_ptr<IGenFct> MappedDalitzBWArea::fct_for_s ( int  i,
int  j,
int  k = -1 
) const

◆ findMapping()

void MappedDalitzBWArea::findMapping ( )
private

Definition at line 168 of file MappedDalitzBWArea.cpp.

168  {
169  bool dbThis=false;
171  if(allConsecutive() && allStandardised()) return;
172 
173  DalitzEventPattern tmpPat(_pat);
174  tmpPat[0] =1;
175  for(unsigned int i=1; i< _pat.size(); i++){
176  tmpPat[i]=0;
177  }
178 
179  Permutator ptor(tmpPat);// this finds all mappings
180  // leaving the 0th particle alone (the mother) and
181  // swapping all the daughters - the pattern
182  // is set up to achieve this ('particles' 1,2,3,4,.. are identical)
183 
184  bool foundOne=false;
185  for(unsigned int i=0; i< ptor.size(); i++){
186  _mapping = ptor[i];
187  if(dbThis) cout << " trying out mapping\n " << _mapping << endl;
188  if(allConsecutive() && allStandardised()){
189  foundOne=true;
190  break;
191  }
192  }
193  if(! foundOne){
194  cout << " MappedDalitzBWArea::findMapping: WARNING!!"
195  << " didn't find a mapping!!!"
196  << endl;
197  throw "shit!";
198  }
200  for(unsigned int i=0; i < _pat.size(); i++){
201  int mappedIndex = _mapping[i];
202  if(mappedIndex < 0 || mappedIndex >= (int) _mappedPat.size()){
203  cout << "ERROR in MappedDalitzBWArea::findMapping()"
204  << "\n Index out of range: " << mappedIndex
205  << " not in [0, " << _mappedPat.size()-1
206  << endl;
207  throw "index out of range.";
208  }
209  if(dbThis) {
210  cout << " mapped index of " << i
211  << " = " << mappedIndex << endl;
212  }
213  _mappedPat[mappedIndex] = _pat[i];
214  }
215 
216  if(dbThis){
217  cout << " using the following mapping:\n "
218  << _mapping << endl;
219  cout << "_mappedPat " << _mappedPat << endl;
220  }
221  return;
222 }
DalitzEventPattern _pat
DalitzEventPattern _mappedPat
void makeUnity()
Definition: Permutation.cpp:42
unsigned int size() const
Permutation _inverseMapping
Permutation getInverse() const
Definition: Permutation.cpp:84

◆ genValue()

double MappedDalitzBWArea::genValue ( const DalitzEvent evt) const

Definition at line 307 of file MappedDalitzBWArea.cpp.

307  {
308  bool dbThis=false;
309 
310  double returnVal = _area.genValue(&evt, _inverseMapping);
311  if(dbThis){
312  vector<TLorentzVector> p4 = mapP4(evt, _mapping );
313  DalitzEvent mappedEvt(_mappedPat, p4);
314  isInside(evt);
315  cout << " mapping: " << _mapping << endl;
316  cout << "old style: " << _area.genValue(&mappedEvt)
317  << "\n new style: " << _area.genValue(&evt, _inverseMapping)
318  << "\n MappedDalitzBWArea::genValue returning " << returnVal << endl;
319  }
320  return returnVal;
321 }
std::vector< TLorentzVector > & mapP4(const DalitzEvent &evt, const Permutation &mapping, std::vector< TLorentzVector > &p4) const
DalitzEventPattern _mappedPat
bool isInside(const DalitzEvent &evt) const
double genValue(const IDalitzEvent *evtPtr) const
Permutation _inverseMapping

◆ integral()

double MappedDalitzBWArea::integral ( ) const
inline

Definition at line 107 of file MappedDalitzBWArea.h.

107  {
108  return _area.integral();
109  }
double integral() const

◆ isInside() [1/3]

bool MappedDalitzBWArea::isInside ( const DalitzEvent evt) const

Definition at line 323 of file MappedDalitzBWArea.cpp.

323  {
324  bool dbThis=false;
325 
326  if(dbThis){
327  vector<TLorentzVector> p4 =
328  mapP4(evt, _mapping );
329  DalitzEvent mappedEvt(_mappedPat, p4);
330  cout << " old style: " << _area.isInside(mappedEvt);
331  cout << " new style: " << _area.isInside(evt, _inverseMapping);
332  }
333  return _area.isInside(evt, _inverseMapping);
334 }
std::vector< TLorentzVector > & mapP4(const DalitzEvent &evt, const Permutation &mapping, std::vector< TLorentzVector > &p4) const
DalitzEventPattern _mappedPat
Permutation _inverseMapping
bool isInside(const DalitzEvent &evt) const

◆ isInside() [2/3]

bool MappedDalitzBWArea::isInside ( const DalitzCoordinate dc) const

Definition at line 336 of file MappedDalitzBWArea.cpp.

336  {
337  return _area.isInside(dc.mapMe(_mapping));
338 }
DalitzCoordinate mapMe(const Permutation &perm) const
bool isInside(const DalitzEvent &evt) const

◆ isInside() [3/3]

bool MappedDalitzBWArea::isInside ( const std::vector< DalitzCoordinate > &  dcList) const

Definition at line 339 of file MappedDalitzBWArea.cpp.

339  {
340  // cout << " inside this: " << *this << endl;
341  for(unsigned int i=0; i < dcList.size(); i++){
342  if(! isInside(dcList[i])){
343  // cout << "Not inside: " << dcList[i]
344  // << "\n\tmapped: " << dcList[i].mapMe(_mapping)
345  // << endl;
346  return false;
347  }
348  }
349  return true;
350 
351 }
bool isInside(const DalitzEvent &evt) const

◆ mapP4() [1/2]

std::vector<TLorentzVector>& MappedDalitzBWArea::mapP4 ( const DalitzEvent evt,
const Permutation mapping,
std::vector< TLorentzVector > &  p4 
) const
inlineprivate

Definition at line 49 of file MappedDalitzBWArea.h.

52  {
53  unsigned int n = evt.eventPattern().size();
54  p4.resize(n);
55  for(unsigned int i=0; i < n; i++){
56  int mappedIndex = mapping[i];
57  if(mappedIndex < 0 || mappedIndex + 1 > (int) n){
58  std::cout << "ERROR in MappedDalitzBWArea::mapP4()"
59  << "\n Index out of range: " << mappedIndex
60  << " not in [0, " << n-1
61  << std::endl;
62  throw "index out of range.";
63  }
64  p4[mappedIndex] = evt.p(i);
65  }
66  return p4;
67  }
virtual const DalitzEventPattern & eventPattern() const
Definition: DalitzEvent.h:173
virtual const TLorentzVector & p(unsigned int i) const
unsigned int size() const

◆ mapP4() [2/2]

std::vector<TLorentzVector> MappedDalitzBWArea::mapP4 ( const DalitzEvent evt,
const Permutation mapping 
) const
inlineprivate

Definition at line 68 of file MappedDalitzBWArea.h.

70  {
71  std::vector<TLorentzVector> p4(evt.eventPattern().size());
72  return mapP4(evt, mapping, p4);
73  }
virtual const DalitzEventPattern & eventPattern() const
Definition: DalitzEvent.h:173
std::vector< TLorentzVector > & mapP4(const DalitzEvent &evt, const Permutation &mapping, std::vector< TLorentzVector > &p4) const
unsigned int size() const

◆ operator=()

MappedDalitzBWArea & MappedDalitzBWArea::operator= ( const MappedDalitzBWArea other)

Definition at line 112 of file MappedDalitzBWArea.cpp.

112  {
113  _rnd = other._rnd;
114  _pat = other._pat;
115  _mappedPat = other._mappedPat;
116  _area = other._area;
117  _limits = other._limits;
118  _mapping = other._mapping;
120  return *this;
121 }
DalitzEventPattern _pat
DalitzEventPattern _mappedPat
std::vector< MINT::counted_ptr< IGenFct > > _limits
Permutation _inverseMapping

◆ print()

void MappedDalitzBWArea::print ( std::ostream &  os = std::cout) const

Definition at line 353 of file MappedDalitzBWArea.cpp.

353  {
354  os << " MappedDalitzBWArea "
355  << " limits: ";
356  for(unsigned int i=0; i < _limits.size(); i++){
357  if(0 == _limits[i]){
358  os << "\n ZERO-PTR LIMIT!" << endl;
359  }else{
360  os << "\n " << (_limits[i])->getCoordinate() << endl;
361  }
362  }
363 
364  os << "\n Mapping:\n " << _mapping
365  << "\n area: " << _area;
366 }
std::vector< MINT::counted_ptr< IGenFct > > _limits

◆ setRnd()

bool MappedDalitzBWArea::setRnd ( TRandom *  rnd = gRandom)

Definition at line 368 of file MappedDalitzBWArea.cpp.

368  {
369  _rnd = rnd;
370  _area.setRnd(_rnd);
371  return true;
372 }
bool setRnd(TRandom *rnd=gRandom)

◆ setUnWeightPs()

void MappedDalitzBWArea::setUnWeightPs ( bool  doSo = true)
inline

Definition at line 110 of file MappedDalitzBWArea.h.

110 {_area.setUnWeightPs(doSo);}
void setUnWeightPs(bool doSo=true)
Definition: DalitzBWArea.h:125

◆ setup()

void MappedDalitzBWArea::setup ( )
private

Definition at line 224 of file MappedDalitzBWArea.cpp.

224  {
225  bool dbThis=false;
226  sort(_limits.begin(), _limits.end());
227 
228  findMapping();
229  if(dbThis) cout << " mappedPat " << _mappedPat << endl;
231  _area.setRnd(_rnd);
232  applyLimits();
233 }
bool setRnd(TRandom *rnd=gRandom)
DalitzEventPattern _mappedPat
std::vector< MINT::counted_ptr< IGenFct > > _limits
void setPattern(const DalitzEventPattern &pat)

◆ size()

double MappedDalitzBWArea::size ( ) const
inline

Definition at line 105 of file MappedDalitzBWArea.h.

105  {
106  return _area.size();}
double size() const

◆ tryEventForOwner()

counted_ptr< DalitzEvent > MappedDalitzBWArea::tryEventForOwner ( ) const

Definition at line 278 of file MappedDalitzBWArea.cpp.

278  {
279  bool dbThis=false;
280  if(dbThis){
281  cout << "Hello from MappedDalitzBWArea::tryEventForOwner()"
282  << endl;
283  }
285 
286  /*
287  if(dbThis && 0 != evt){
288  counted_ptr<DalitzEvent> mappedEvt( _area.tryEventForOwner());
289  if(0 == mappedEvt){
290  return mappedEvt;
291  }
292  static vector<TLorentzVector> p4;
293  mapP4( *mappedEvt, _inverseMapping, p4);
294 
295  counted_ptr<DalitzEvent> evtCheck(new DalitzEvent(_pat, p4));
296  evtCheck->setWeight(mappedEvt->getWeight());
297 
298  cout << "compare new, old event and weight: "
299  << "\n\t new: " << *evt
300  << "\n\t old: " << *evtCheck
301  << endl;
302  }
303  */
304  return evt;
305 }
MINT::counted_ptr< DalitzEvent > tryEventForOwner(const Permutation &mapping=Permutation::unity()) const
Permutation _inverseMapping

◆ unWeightPs()

bool MappedDalitzBWArea::unWeightPs ( )
inline

Definition at line 111 of file MappedDalitzBWArea.h.

111 {return _area.unWeightPs();}
bool unWeightPs() const
Definition: DalitzBWArea.h:124

Member Data Documentation

◆ _area

DalitzBWArea MappedDalitzBWArea::_area
private

Definition at line 26 of file MappedDalitzBWArea.h.

◆ _inverseMapping

Permutation MappedDalitzBWArea::_inverseMapping
private

Definition at line 30 of file MappedDalitzBWArea.h.

◆ _limits

std::vector<MINT::counted_ptr<IGenFct> > MappedDalitzBWArea::_limits
private

Definition at line 28 of file MappedDalitzBWArea.h.

◆ _mappedPat

DalitzEventPattern MappedDalitzBWArea::_mappedPat
private

Definition at line 24 of file MappedDalitzBWArea.h.

◆ _mapping

Permutation MappedDalitzBWArea::_mapping
private

Definition at line 30 of file MappedDalitzBWArea.h.

◆ _pat

DalitzEventPattern MappedDalitzBWArea::_pat
private

Definition at line 24 of file MappedDalitzBWArea.h.

◆ _rnd

TRandom* MappedDalitzBWArea::_rnd
private

Definition at line 22 of file MappedDalitzBWArea.h.


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