MINT2
DalitzBWArea.h
Go to the documentation of this file.
1 #ifndef DALITZ_BW_AREA_HH
2 #define DALITZ_BW_AREA_HH
3 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
4 // status: Mon 9 Feb 2009 19:17:58 GMT
5 
8 #include "Mint/IDalitzEvent.h"
9 
10 #include "Mint/Permutation.h"
11 
12 #include "TLorentzVector.h"
13 #include "TRandom.h"
14 
15 #include <vector>
16 #include <iostream>
17 
18 #include "Mint/counted_ptr.h"
19 #include "Mint/IGenFct.h"
20 
21 class DalitzEvent;
22 
24 
26 
27  TRandom* _rnd;
28 
29  // MINT::counted_ptr<DalitzEvent> _evt;
30 
31  mutable bool _madeCMap;
32 
33  mutable double _areaIntegral;
35 
36  void makeCoords();
37  void makeCoord(int i, int j);
38  void makeCoord(int i, int j, int k);
39 
40  void makeMiMa();
41 
43 
52 
53  std::pair<DalitzCoordinate, MINT::counted_ptr<IGenFct> >&
54  sf(const DalitzCoordinate& c);
55  const std::pair<DalitzCoordinate, MINT::counted_ptr<IGenFct> >&
56  sf(const DalitzCoordinate& c) const;
57 
58  std::pair<DalitzCoordinate, MINT::counted_ptr<IGenFct> >&
59  sf(int i, int j, int k);
60  const std::pair<DalitzCoordinate, MINT::counted_ptr<IGenFct> >&
61  sf(int i, int j, int k) const;
62 
63  std::pair<DalitzCoordinate, MINT::counted_ptr<IGenFct> >&
64  sf(int i, int j);
65  const std::pair<DalitzCoordinate, MINT::counted_ptr<IGenFct> >&
66  sf(int i, int j) const;
67 
68 
69  double MC4Integral(double& prec) const;
70  double MC4IntegralNoTransform(double& prec) const;
73  double genValueRho(const IDalitzEvent* evtPtr) const;
74 
75 
76  std::vector<TLorentzVector>& mapP4(const std::vector<TLorentzVector>& v_in
77  , const Permutation& mapping
78  , std::vector<TLorentzVector>& v_out
79  ) const{
80  unsigned int n = v_in.size();
81  if(mapping.isUnity()){
82  v_out = v_in;
83  return v_out;
84  }
85 
86  v_out.resize(n);
87  for(unsigned int i=0; i < n; i++){
88  int mappedIndex = mapping[i];
89  if(mappedIndex < 0 || mappedIndex + 1 > (int) n){
90  std::cout << "ERROR in DalitzBWArea::mapP4()"
91  << "\n Index out of range: " << mappedIndex
92  << " not in [0, " << n-1
93  << std::endl;
94  throw "index out of range.";
95  }
96  v_out[mappedIndex] = v_in[i];
97  }
98  return v_out;
99  }
100  std::vector<TLorentzVector> mapP4(const std::vector<TLorentzVector>& v_in
101  , const Permutation& mapping
102  ) const{
103  std::vector<TLorentzVector> v_out(v_in.size());
104  return mapP4(v_in, mapping, v_out);
105  }
106 
107  public:
108  // for now keep them public:
109 
110  // currently storing the same info twice, once as
111  // a (flexible) map, once again as seperate variables
112  // - the latter mainly for passing it to
113  // the DalitzEvent constructor.
114  // Can remove the latter copy once the DalitzEvent
115  // constructor can take some 'coordinate set' or so.
116 
117  bool checkIntegration() const;
118 
119  mutable std::map<DalitzCoordKey , std::pair<DalitzCoordinate, MINT::counted_ptr<IGenFct> > > _coords;
120 
121  mutable std::map<DalitzCoordKey , std::pair<DalitzCoordinate, MINT::counted_ptr<IGenFct> > > _mappedCoords;
122 
123 
124  bool unWeightPs()const{ return _unWeightPs;}
125  void setUnWeightPs(bool doSo=true){_unWeightPs = doSo;}
126 
128  return sf(2,3,4).first;
129  }
131  return sf(1,2).first;
132  }
134  return sf(2,3).first;
135  }
137  return sf(3,4).first;
138  }
140  return sf(1,2,3).first;
141  }
142 
143  const DalitzCoordinate& t01() const{
144  return sf(2,3,4).first;
145  }
146  const DalitzCoordinate& s12() const{
147  return sf(1,2).first;
148  }
149  const DalitzCoordinate& s23() const{
150  return sf(2,3).first;
151  }
152  const DalitzCoordinate& s34() const{
153  return sf(3,4).first;
154  }
155  const DalitzCoordinate& t40() const{
156  return sf(1,2,3).first;
157  }
158 
160  return sf(2,3,4).second;
161  }
163  return sf(1,2).second;
164  }
166  return sf(2,3).second;
167  }
169  return sf(3,4).second;
170  }
172  return sf(1,2,3).second;
173  }
174 
175 
176  DalitzBWArea();
177  DalitzBWArea(const DalitzEventPattern& pat, TRandom* rnd = gRandom);
178  DalitzBWArea(const DalitzBWArea& other);
179  ~DalitzBWArea();
180 
181  DalitzBWArea& operator=(const DalitzBWArea& other);
182 
183  void setFcn(const DalitzCoordinate& c
184  , const MINT::counted_ptr<IGenFct>& fcn);
185 
186  double genValue(const IDalitzEvent* evtPtr) const;
187  double genValue(const IDalitzEvent* evtPtr, const Permutation& mapping) const;
188 
189  void setPattern(const DalitzEventPattern& pat);
190 
191  bool isInside(const DalitzEvent& evt) const;
192  bool isInside(const DalitzEvent& evt, const Permutation& mapping) const;
193  bool isInside(const DalitzCoordinate& dc) const;
194  bool isInside(const std::vector<DalitzCoordinate>& dcList) const;
195 
196  double size() const;
197  double integral() const;
198  double integral3()const;
199  double integral4()const;
200  // actually these integrals are WITHOUT phase space
201  // but go with the try...EventWithPhaseSpace routines.
202 
204 
205  /* one day...(3 body)
206  MINT::counted_ptr<DalitzEvent> makeEventForOwner(double scale0
207  double scale1
208  );
209  */
210 
211  bool setRnd(TRandom* rnd=gRandom);
212 
213  void print(std::ostream& os = std::cout) const;
214 
215 };
216 
217 std::ostream& operator<<(std::ostream& os, const DalitzBWArea& da);
218 
219 #endif
220 //
std::map< DalitzCoordKey, std::pair< DalitzCoordinate, MINT::counted_ptr< IGenFct > > > _mappedCoords
Definition: DalitzBWArea.h:121
void print(std::ostream &os=std::cout) const
std::pair< DalitzCoordinate, MINT::counted_ptr< IGenFct > > & sf(const DalitzCoordinate &c)
DalitzCoordinate & t40()
Definition: DalitzBWArea.h:139
MINT::counted_ptr< IGenFct > f_t40()
Definition: DalitzBWArea.h:171
MINT::counted_ptr< IGenFct > f_s23()
Definition: DalitzBWArea.h:165
double integral4() const
double MC4IntegralNoTransform(double &prec) const
DalitzEventPattern _pat
Definition: DalitzBWArea.h:25
DalitzCoordinate & s34()
Definition: DalitzBWArea.h:136
MINT::counted_ptr< DalitzEvent > try3Event(const Permutation &mapping=Permutation::unity()) const
MINT::counted_ptr< IGenFct > f_t01()
Definition: DalitzBWArea.h:159
double genValueRho(const IDalitzEvent *evtPtr) const
const DalitzCoordinate & t40() const
Definition: DalitzBWArea.h:155
MINT::counted_ptr< DalitzEvent > tryEventForOwner(const Permutation &mapping=Permutation::unity()) const
TRandom * _rnd
Definition: DalitzBWArea.h:27
DalitzCoordinate & s23()
Definition: DalitzBWArea.h:133
bool setRnd(TRandom *rnd=gRandom)
void setFcn(const DalitzCoordinate &c, const MINT::counted_ptr< IGenFct > &fcn)
MINT::counted_ptr< IGenFct > f_s12()
Definition: DalitzBWArea.h:162
void setUnWeightPs(bool doSo=true)
Definition: DalitzBWArea.h:125
const DalitzCoordinate & s23() const
Definition: DalitzBWArea.h:149
bool isUnity() const
Definition: Permutation.cpp:47
double MC4Integral(double &prec) const
DalitzBWArea & operator=(const DalitzBWArea &other)
std::ostream & operator<<(std::ostream &os, const DalitzBWArea &da)
std::vector< TLorentzVector > & mapP4(const std::vector< TLorentzVector > &v_in, const Permutation &mapping, std::vector< TLorentzVector > &v_out) const
Definition: DalitzBWArea.h:76
bool _unWeightPs
Definition: DalitzBWArea.h:34
bool checkIntegration() const
DalitzCoordinate & s12()
Definition: DalitzBWArea.h:130
void makeCoord(int i, int j)
double _areaIntegral
Definition: DalitzBWArea.h:33
MINT::counted_ptr< DalitzEvent > try3EventWithPhaseSpace(double &maxWeight, const Permutation &mapping=Permutation::unity()) const
static const Permutation & unity()
Definition: Permutation.cpp:10
double genValue(const IDalitzEvent *evtPtr) const
MINT::counted_ptr< IGenFct > f_s34()
Definition: DalitzBWArea.h:168
bool unWeightPs() const
Definition: DalitzBWArea.h:124
void setPattern(const DalitzEventPattern &pat)
DalitzCoordinate & t01()
Definition: DalitzBWArea.h:127
double size() const
std::map< DalitzCoordKey, std::pair< DalitzCoordinate, MINT::counted_ptr< IGenFct > > > _coords
Definition: DalitzBWArea.h:119
MINT::counted_ptr< DalitzEvent > try4EventWithPhaseSpace(double &maxWeight, const Permutation &mapping=Permutation::unity()) const
double integral3() const
const DalitzCoordinate & s12() const
Definition: DalitzBWArea.h:146
int ResonanceConfigurationNumber() const
std::vector< TLorentzVector > mapP4(const std::vector< TLorentzVector > &v_in, const Permutation &mapping) const
Definition: DalitzBWArea.h:100
const DalitzCoordinate & t01() const
Definition: DalitzBWArea.h:143
MINT::counted_ptr< DalitzEvent > try4Event(const Permutation &mapping=Permutation::unity()) const
const DalitzCoordinate & s34() const
Definition: DalitzBWArea.h:152
bool isInside(const DalitzEvent &evt) const
double integral() const
MINT::counted_ptr< DalitzEvent > tryFlat4EventWithPhaseSpace(double &maxWeight, const Permutation &mapping=Permutation::unity()) const
MINT::counted_ptr< DalitzEvent > make4EventWithPhaseSpace(const Permutation &mapping=Permutation::unity()) const