Belle II Software  release-06-02-00
Treps3B.h
1 // -*- C++ -*-
2 //
3 // Package: <package>
4 // Module: Treps3B
5 //
6 // Description: <one line class summary>
7 // Class name is TrepsB
8 // Usage:
9 // <usage>
10 //
11 // Author: Sadaharu Uehara
12 // Created: Jul.17 1997
13 // $Id$
14 //
15 // Revision history
16 //
17 // Modified: To use RandFlat instead of bare HepRandom
18 // 9-MAY-2000 S.Uehara
19 // $Log$
20 
21 
22 #pragma once
23 
24 #include<TVector3.h>
25 #include<TLorentzVector.h>
26 #include<TH1F.h>
27 #include<TTree.h>
28 #include<TString.h>
29 #include <generators/treps/Sutool.h>
30 #include <generators/treps/Particle_array.h>
31 
32 #include <string>
33 
34 namespace Belle2 {
41  class TrepsB {
42 
43  public:
44  // Constructors and destructor
45  TrepsB(void);
46  ~TrepsB() {};
47 
48  // constants, enums and typedefs
49  Sutool sutool; //calculation tool kit by S.U
50  double w; // invariant mass of two-photon system
51  TString filnam_hist; // filename for HBOOK histogram output
52  int ntot, nsave ; // number of events generated and saved
53 
54 
55  // member functions
56  void setParameterFile(const std::string& file)
57  {
58  parameterFile = file;
59  }
60  void setWlistFile(const std::string& file)
61  {
62  wlistFile = file;
63  }
64  void setDiffcrosssectionFile(const std::string& file)
65  {
66  diffcrosssectionFile = file;
67  }
68 
69  void setBeamEnergy(double energy)
70  {
71  ebeam = energy;
72  }
73  void setElectronMomentum(TVector3 p)
74  {
75  pfeb = p;
76  }
77  void setPositronMomentum(TVector3 p)
78  {
79  pfpb = p;
80  }
81  TVector3 getElectronMomentum()
82  {
83  return pfeb;
84  }
85  TVector3 getPositronMomentum()
86  {
87  return pfpb;
88  }
89 
90  void setMaximalQ2(double q2)
91  {
92  q2max = q2;
93  }
94  void setMaximalAbsCosTheta(double cost)
95  {
96  cost_cut = cost;
97  }
98  void applyCosThetaCutCharged(bool apply)
99  {
100  if (apply) {
101  cost_flag = 1;
102  qzmin = 0.1;
103  } else {
104  cost_flag = 0;
105  qzmin = -0.1;
106  }
107  }
108  void setMinimalTransverseMomentum(double pt)
109  {
110  pt_cut = pt;
111  }
112  void applyTransverseMomentumCutCharged(bool apply)
113  {
114  if (apply) {
115  pt_flag = 1;
116  qptmin = 0.1;
117  } else {
118  pt_flag = 0;
119  qptmin = -0.1;
120  }
121  }
122 
123 
124 
125  void initp(void); // initialize the generator. read parameterFile and load the parameters
126  void wtable(); // read diffcrosssectionFile and load W-DifferentialCrossSection table.
127  double wtable(int); // read wlistFile and load W-NumberOfEvents table.
128  void create_hist(void); // create histograms. it is just for debug purpose.
129  int event_gen(int); // generate one event with given parameter and W
130  void setW(double); // set given double to w (member variable) and call updateW
131  void updateW(void); // update W and some related parameters
132  double twlumi(void); // calculate and return two-photon luminosity function
133  double twlumi_n(void); // calculate and return two-photon luminosity function for very narrow resonance
134  void tpkin3(Part_gen*,
135  int, int, int, double&, double&, double&,
136  double&, double&, double&, double&) ;
137  void tpkin4(Part_gen*,
138  int, int, int, int, double&, double&, double&,
139  double&, double&, double&, double&, double&,
140  double&, double&, double&, double&) ;
141  void tpkin5(Part_gen*,
142  int, int, int, int, int, double&, double&, double&,
143  double&, double&, double&, TVector3&,
144  TVector3&, TVector3&, double&) ;
145 
146  // This will be overwritten in UtrepsB.h
147  virtual int tpuser(TLorentzVector, TLorentzVector,
148  Part_gen*, int);
149 
150  // const member functions
151  void terminate(void) const ;
152  void print_event(void) const ; // print event information at B2DEBUG(10)
153 
154  // returns form factor effect, actually always returns 1. This will be overwritten in UtrepsB.h
155  virtual double tpform(double, double) const ;
156  // always returns 1. This will be overwritten in UtrepsB.h
157  virtual double tpangd(double, double) ;
158 
159  void trkpsh(int, TLorentzVector, TLorentzVector, Part_gen*, int) const;
160 
161 
162 
163  private:
164 
165  // private member functions
166  double tpgetd(int, double, double, double, double);
167  double tpgetz(int);
168  double tpgetq(double, double, double);
169  void tpgetm(Part_cont*, int);
170 
171  // private const member functions
172  double simpsn1(double, double, int) const ;
173  double simpsn2(double, double, int) const ;
174  double tpxint(double, double, double) const ;
175  double tpf(double, double) const ;
176  double tpdfnc(double) const ;
177  double tplogf(double) const ;
178  double simpsny(double, double, double, int) const ;
179  double simpsnz(double, double, double, int) const ;
180  double tpdfy(double, double) const;
181  double tpdfz(double, double) const;
182 
183  // data members
184  std::string parameterFile; // filename for parameter input
185  std::string wlistFile; // filename for W List input
186  std::string diffcrosssectionFile; // filename for differential cross section
187 
188  double ebeam; // cms beam energy in cm system = sqrt(s)/2
189  constexpr const static double q2zero = 1.0e-6;
190  double q2max; // q^2 max
191  double cost_cut, pt_cut ; // cut for save
192  int cost_flag, pt_flag ; // flag watching neutral particles
193  constexpr const static double pi = 3.14159265358979; // pi
194  constexpr const static double twopi = 2.0 * 3.14159265358979; // 2pi
195  TVector3 pfeb, pfpb; // Momentum of e(lectron) and p(ositron) at lab frame.
196  TVector3 tswsb ; // Normalized boost factor
197  double qzmin, qptmin; // Minimum of qz and qpt
198  Part_cont* parti, *parts ; // Particles to be generated. parti is primary, parts is secondary particles.
199  double ephi, etheta ; // phi and theta of e+e- system at lab frame
200  double s ; // (2*ebeam)^2
201  int imode ; //
202  double dmin, dmax ;
203  double ffmax ;
204  double rs;
205  double vmax;
206  TLorentzVector* pppp ; // Particles to be generated in TLorentzVector
207 
208  public:
209  float wf; // w to set from outside of the class
210 
211  // wlisttableFile mode
212  int inmode; // mode to control setting of wtable(int)
213  int wtcount; // event number counter
214  double wtcond[5000]; // list of W
215  int wthead[5000]; // list of sum-of-NumberOfEvents up to current W
216 
217  // diffcrosssectionFile mode
218  // Table of differential cross section of W.
219  std::map<double, double> diffCrossSectionOfW;
220 
221  // They are used for simulate W distribution with importance sampling. NOT CORRECT cross section !!
222  double totalCrossSectionForMC; // total cross section
223  std::map<double, double> WOfCrossSectionForMC; // W and sum-of-crossSection up to current W
224 
225  int ndecay; // Num of particles at the first stage
226  int pmodel; // Physics model
227  int fmodel; // Form factor model
228 
229  public:
230  TLorentzVector peb, ppb ; // initial-state e+ e- 4-momenta in lab.
231  int ievent; // event number
232  TH1F* treh1, * treh2, * treh3, * treh4, * treh5, * treh6 ; // Histograms for debug
233 
234 
235  // protected:
236  int npart; // Number of particles to be generated
237  Part_gen* partgen; // final-state particle data in lab.
238  TLorentzVector pe, pp ; // final-state e+ e- 4-momenta in lab.
239  constexpr const static double me = 0.000510999; // electron mass
240  TH1F* zdis, *zpdis, *zsdis;
241 
242  };
243 
244 
246 } // namespace Belle2
247 
Abstract base class for different kinds of events.