Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
matscan.C
Go to the documentation of this file.
1 // just a dumb macro to run this before I forget how this is done
2 // to pipe the output into a file (T.T here) execute
3 // .L matscan.C
4 // matscan(); > T.T
5 
6 // the span is the delta phi/theta you want to cover, not the maximum
7 // angle
8 float phimin = 0.;
9 float phispan = 360.;
10 int phibins = 20;
11 float thetamin = 40; // theta = 0 is perpendicular to beam axis
12 float thetaspan = 50;
13 int thetabins = 6;
14 // pos
15 float pos_x = 0;
16 float pos_y = 0;
17 float pos_z = -300;
18 
19 void matscan()
20 {
22  PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
23  g4->InitRun(se->topNode());
24  char cmd[200];
25  // set the desired
26  sprintf(cmd,"/control/matScan/eyePosition %f %f %f cm", pos_x, pos_y, pos_z);
27  cout << "executing " << cmd << endl;
28  g4->ApplyCommand(cmd);
29  // set the desired phi range and binning (10 bins from 0-90 deg)
30  sprintf(cmd,"/control/matScan/phi %d %f %f deg",phibins,phimin,phispan);
31  cout << "executing " << cmd << endl;
32  g4->ApplyCommand(cmd);
33  // set theta range - one at theta=0 which is vertically w.r.t. the beam axis
34  sprintf(cmd,"/control/matScan/theta %d %f %f deg",thetabins,thetamin,thetaspan);
35  cout << "executing " << cmd << endl;
36  g4->ApplyCommand(cmd);
37  // do the scan
38  cout << "starting scan - patience" << endl;
39  g4->ApplyCommand("/control/matScan/scan");
40 }
41 
42 void set_phimin(const float f)
43 {
44  phimin = f;
45 }
46 
47 void set_phispan(const float f)
48 {
49  phispan = f;
50 }
51 
52 void set_phibins(const int i)
53 {
54  phibins = i;
55 }
56 
57 void set_thetamin(const float f)
58 {
59  thetamin = f;
60 }
61 
62 void set_thetaspan(const float f)
63 {
64  thetaspan = f;
65 }
66 
67 void set_thetabins(const int i)
68 {
69  thetabins = i;
70 }
71 
72 void print()
73 {
74  cout << "pos: {" << pos_x << ", " << pos_y << ", " << pos_z << "}" << endl;
75  cout << "phibins: " << phibins << endl;
76  cout << "phimin: " << phimin << endl;
77  cout << "phispan: " << phispan << endl;
78 
79  cout << "thetabins: " << thetabins << endl;
80  cout << "thetamin: " << thetamin << endl;
81  cout << "thetaspan: " << thetaspan << endl;
82 }
83 
84 // set values for 100 bins in phi from 0-5 degrees at midrapitity
85 void setmidrap()
86 {
87  set_thetabins(1);
88  set_phibins(100);
89  set_phispan(5);
90  set_thetaspan(0);
91 }
Runs G4 as a subsystem.
Definition: PHG4Reco.h:38
int thetabins
Definition: matscan.C:13
void setmidrap()
Definition: matscan.C:85
float pos_z
Definition: matscan.C:17
float thetamin
Definition: matscan.C:11
static Fun4AllServer * instance()
int phibins
Definition: matscan.C:10
void set_phibins(const int i)
Definition: matscan.C:52
Fun4AllServer * se
void set_phispan(const float f)
Definition: matscan.C:47
float pos_y
Definition: matscan.C:16
void set_phimin(const float f)
Definition: matscan.C:42
void matscan()
Definition: matscan.C:19
void print()
Definition: matscan.C:72
float phispan
Definition: matscan.C:9
PHCompositeNode * topNode() const
Definition: Fun4AllServer.h:59
void set_thetamin(const float f)
Definition: matscan.C:57
int InitRun(PHCompositeNode *topNode)
Definition: PHG4Reco.cc:320
void set_thetabins(const int i)
Definition: matscan.C:67
SubsysReco * getSubsysReco(const std::string &name)
float thetaspan
Definition: matscan.C:12
int ApplyCommand(const std::string &cmd)
interface to G4 cmd interpreter
Definition: PHG4Reco.cc:566
float phimin
Definition: matscan.C:8
void set_thetaspan(const float f)
Definition: matscan.C:62
float pos_x
Definition: matscan.C:15
string cmd
Definition: submit_bnl.py:63