Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SQPrimaryVertexGen.h
Go to the documentation of this file.
1 /*==========================================================================
2 Author: Abinash Pun, Kun Liu
3 Sep, 2019
4 Goal: Import the primary vertex generator of E906 experiment(DPVertexGenerator)
5 from Kun to E1039 experiment in Fun4All framework
6 ============================================================================*/
7 
8 #ifndef __SQPRIMARYVERTEXGEN_H__
9 #define __SQPRIMARYVERTEXGEN_H__
10 
11 #include <vector>
12 #include <TString.h>
13 #include <TGeoManager.h>
14 #include <TGeoMedium.h>
15 #include <TGeoNode.h>
16 #include <TF2.h>
17 #include <TVector3.h>
18 #include <TH1F.h>
19 #include "SQBeamlineObject.h"
20 
21 class PHCompositeNode;
22 class SQBeamlineObject;
23 
25 {
26 public:
29 
30 
31  //Initialize files
32  void Initfile();
33 
34  //Initialize at the begining of Run
35  void InitRun(PHCompositeNode* topNode);
36 
37  //Tree traversal
38  void traverse(TGeoNode* node, double&xvertex,double&yvertex,double&zvertex);
39 
40 
41  //get the vertex generated
42  // TVector3 generateVertex();
43  double generateVertex();
44 
45  //use the beam profile to generate
46  void generateVtxPerp(double& x, double& y);
47 
48  //do the actual sampling
49  void findInteractingPiece();
50 
51  //get the proton/neutron ratio of the piece, must be called after generateVertex
52  double getPARatio() { return interactables[index].protonPerc(); }
53 
54  //get the relative luminosity on this target
55  //double getLuminosity() { return p_config->biasVertexGen ? interactables[index].prob : probSum; }
56  double getLuminosity() { return probSum; }
57 
58  //get the reference to the chosen objects
59  //const BeamlineObject& getInteractable() { return interactables[index]; }
60 
61 private:
62  //Array of beamline objects
63  unsigned int nPieces;
64  double probSum;
65  double accumulatedProbs[100]; //for now set to no more than 100 objects
66 
67  //vector of the interactable stuff
68  std::vector<SQBeamlineObject> interactables;
69 
70 
71  //the index of the piece that is chosen
72  int index;
73 
74  //Beam profile
75  TF2* beamProfile;
76 
77  //flag to test if the generator has been initialized
78  bool inited;
79 
80  // flag to use beamProfile function
81  bool beam_profile;
82 
83 
84 };
85 
86 #endif
void traverse(TGeoNode *node, double &xvertex, double &yvertex, double &zvertex)
void InitRun(PHCompositeNode *topNode)
void generateVtxPerp(double &x, double &y)