Class Reference for E1039 Core & Analysis Software
SQPrimaryParticleGen.h
Go to the documentation of this file.
1 /*====================================================================
2 Author: Abinash Pun, Kun Liu
3 Nov, 2019
4 Goal: Import the physics generator of E906 experiment (DPSimPrimaryGeneratorAction)
5 from Kun to E1039 experiment in Fun4All framework
6 =========================================================================*/
7 #ifndef __SQPrimaryParticleGen_H__
8 #define __SQPrimaryParticleGen_H__
9 
10 #ifndef __CINT__
11 #include <Pythia8/Pythia.h>
12 #endif
13 #include <LHAPDF/LHAPDF.h>
14 #ifndef __CINT__
15 #include <gsl/gsl_rng.h>
16 #endif
17 
18 #include <string>
19 
20 #include <TGenPhaseSpace.h>
22 
23 class PHCompositeNode;
25 class PHG4InEvent;
26 class PHG4Particle;
27 
28 class PHGenIntegral;
29 class SQEvent;
30 class SQMCEvent;
31 class SQDimuon;
32 class SQDimuonVector;
33 class SQPrimaryVertexGen;
34 
35 //==========
37 
55 {
56 public:
57  typedef enum {
58  Undef = 0,
59  DrellYan = -1,
60  JPsi = -2,
61  PsiPrime = -3,
62  Pythia = -4,
63  Custom = -5
65 
66  SQPrimaryParticleGen(const std::string& name = "PrimaryGen");
68 
69 
70  int Init(PHCompositeNode* topNode);
71  int InitRun(PHCompositeNode* topNode);
72  int End(PHCompositeNode* topNode);
74  //void GeneratePrimaries(G4Event* anEvent);
75 
77 
78  int generateDrellYan(const TVector3& vtx, const double pARatio, double luminosity);
79  int generateJPsi(const TVector3& vtx, const double pARatio, double luminosity);
80  int generatePsip(const TVector3& vtx, const double pARatio, double luminosity);
81  // void generateDarkPhotonFromEta();
82  int generatePythia(const TVector3& vtx, const double pARatio);
83  //int generateCustomDimuon(PHCompositeNode *topNode, TVector3 vtx, const double pARatio);
84 
86 
88  bool generateDimuon(double mass, double xF);
89 
90  //swith for the generators; Abi
91  //@
92  void enablePythia () { _proc_code = Pythia ;}
93  void enableCustomDimuon() { _proc_code = Custom ;}
94  void enableDrellYanGen () { _proc_code = DrellYan;}
95  void enableJPsiGen () { _proc_code = JPsi ;}
96  void enablePsipGen () { _proc_code = PsiPrime;}
97 
98  void set_pdfset(const std::string name) { _pdfset = name; }
99 
100  void set_pT0DY (const double val) { _pT0DY = val; }
101  void set_pTpowDY (const double val) { _pTpowDY = val; }
102  void set_pT0JPsi (const double val) { _pT0JPsi = val; }
103  void set_pTpowJPsi(const double val) { _pTpowJPsi = val; }
104 
106  void set_config_file(const char *cfg_file)
107  {
108  if (cfg_file) _configFile = cfg_file;
109  }
110 
111  void set_xfRange(const double xmin, const double xmax){
112  xfMin = xmin;
113  xfMax = xmax;
114  }
115  void set_massRange(const double mmin, const double mmax){
116  massMin = mmin;
117  massMax = mmax;
118  }
119  //@
120 
121  double CrossSectionDrellYan(const double mass, const double xF, const double pARatio);
122  double CrossSectionDrellYan(const double mass, const double xF, const double x1, const double x2, const double pARatio);
123  double CrossSectionJPsi(const double xF);
124  double CrossSectionPsip(const double xF);
125 
126  private:
127  ProcessCode_t _proc_code;
128 
129  SQPrimaryVertexGen* _vertexGen;
130  PHG4InEvent *ineve;
131  SQEvent* _evt; //< An output node
132  SQMCEvent* _mcevt; //< An output node
133  SQDimuonVector* _vec_dim; //< An output node
134  PHGenIntegral *_integral_node; //< An output node
135 
136  SQDimuon* _dim_gen; //< To hold the kinematics of a dimuon generated
137 
138  //Pythia generator
139  Pythia8::Pythia ppGen;
140  Pythia8::Pythia pnGen;
141  Pythia8::Pythia _Pythia;
143  std::string _configFile;
144  int read_config(const char *cfg_file = 0);
145 
147  TGenPhaseSpace phaseGen;
148 
150  std::string _pdfset;
151  LHAPDF::PDF* _pdf;
152 
153  // Parameters (being moved from DPGEN)
154  double _pT0DY;
155  double _pTpowDY;
156  double _pT0JPsi;
157  double _pTpowJPsi;
158 
159  //some initializations
160  double massMin = 0.22;
161  double massMax = 10.;
162  double x1Min = 0.;
163  double x1Max = 1.;
164  double x2Min = 0.;
165  double x2Max = 1.;
166  double xfMin = -1.;
167  double xfMax = 1.;
168  double cosThetaMin = -1.;
169  double cosThetaMax = 1. ;
170  double zOffsetMin = -1.;
171  double zOffsetMax = 1.;
172 
173  void InsertMuonPair(const TVector3& vtx);
174  void InsertEventInfo(const double xsec, const double weight, const TVector3& vtx);
175 
176  double _n_gen_acc_evt; //< N of generator-accepted events
177  double _n_proc_evt; //< N of processed events
178  double _weight_sum; //< Sum of weights
179  double _inte_lumi; //< Integrated luminosity
180 };
181 
182 //========
183 
184 
185 
186 
187 #endif
188 
PHGenIntegral.
Definition: PHGenIntegral.h:21
An SQ interface class to hold a list of SQDimuon objects.
An SQ interface class to hold one true or reconstructed dimuon.
Definition: SQDimuon.h:8
An SQ interface class to hold one event header.
Definition: SQEvent.h:17
An SQ interface class to hold one simulated-event header.
Definition: SQMCEvent.h:12
Physics generator imported from E906 software.
void set_pT0DY(const double val)
int InitRun(PHCompositeNode *topNode)
int process_event(PHCompositeNode *topNode)
double CrossSectionDrellYan(const double mass, const double xF, const double x1, const double x2, const double pARatio)
void set_xfRange(const double xmin, const double xmax)
void set_massRange(const double mmin, const double mmax)
void set_pdfset(const std::string name)
bool generateDimuon(double mass, double xF)
Dimuon phase space generator.
void set_pTpowDY(const double val)
int generateJPsi(const TVector3 &vtx, const double pARatio, double luminosity)
SQPrimaryParticleGen(const std::string &name="PrimaryGen")
void set_pTpowJPsi(const double val)
void set_pT0JPsi(const double val)
int generateDrellYan(const TVector3 &vtx, const double pARatio, double luminosity)
Various generators.
int Init(PHCompositeNode *topNode)
int generatePsip(const TVector3 &vtx, const double pARatio, double luminosity)
void set_config_file(const char *cfg_file)
config file for pythia
int generatePythia(const TVector3 &vtx, const double pARatio)
virtual ~SQPrimaryParticleGen()
double CrossSectionDrellYan(const double mass, const double xF, const double pARatio)
int End(PHCompositeNode *topNode)
Called at the end of all processing.
double CrossSectionJPsi(const double xF)
double CrossSectionPsip(const double xF)
Class to generate the event vertex, based on the beam profile and the target+spectrometer materials g...