EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
matscan.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file matscan.C
1 #ifndef MACRO_MATSCAN_C
2 #define MACRO_MATSCAN_C
3 
4 // just a dumb macro to run this before I forget how this is done
5 // to pipe the output into a file (T.T here) execute
6 // .L matscan.C
7 // ROOT6:
8 // .> T.T
9 // matscan()
10 // .q
11 
12 // the span is the delta phi/theta you want to cover, not the maximum
13 // angle. The default is 10 bins in azimuth at theta=0.1 (almost
14 // midrapidity, exact midrapidity we have gaps in the calorimeters and inner tracking
15 
16 #include <fun4all/Fun4AllServer.h>
17 #include <g4main/PHG4Reco.h>
18 
19 R__LOAD_LIBRARY(libg4testbench.so)
20 
21 namespace MATSCAN
22 {
23  float phimin = 0.;
24  float phispan = 360.;
25  int phibins = 10;
26  float thetamin = 0.1; // theta = 0 is perpendicular to beam axis
27  float thetaspan = 360.;
28  int thetabins = 1;
29 } // namespace MATSCAN
30 
31 void matscan()
32 {
34  PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
35  g4->InitRun(se->topNode());
36  char cmd[200];
37  // set the desired phi range and binning (10 bins from 0-90 deg)
38  sprintf(cmd, "/control/matScan/phi %d %f %f deg", MATSCAN::phibins, MATSCAN::phimin, MATSCAN::phispan);
39  cout << "executing " << cmd << endl;
40  g4->ApplyCommand(cmd);
41  // set theta range - one at theta=0 which is vertically w.r.t. the beam axis
42  sprintf(cmd, "/control/matScan/theta %d %f %f deg", MATSCAN::thetabins, MATSCAN::thetamin, MATSCAN::thetaspan);
43  cout << "executing " << cmd << endl;
44  g4->ApplyCommand(cmd);
45  // do the scan
46  cout << "starting scan - patience" << endl;
47  g4->ApplyCommand("/control/matScan/scan");
48  cout << "All done" << endl;
49 }
50 
51 void set_phimin(const float f)
52 {
53  MATSCAN::phimin = f;
54 }
55 
56 void set_phispan(const float f)
57 {
58  MATSCAN::phispan = f;
59 }
60 
61 void set_phibins(const int i)
62 {
63  MATSCAN::phibins = i;
64 }
65 
66 void set_thetamin(const float f)
67 {
69 }
70 
71 void set_thetaspan(const float f)
72 {
74 }
75 
76 void set_thetabins(const int i)
77 {
79 }
80 
81 void print()
82 {
83  cout << "phibins: " << MATSCAN::phibins << endl;
84  cout << "phimin: " << MATSCAN::phimin << endl;
85  cout << "phispan: " << MATSCAN::phispan << endl;
86 
87  cout << "thetabins: " << MATSCAN::thetabins << endl;
88  cout << "thetamin: " << MATSCAN::thetamin << endl;
89  cout << "thetaspan: " << MATSCAN::thetaspan << endl;
90 }
91 
92 // set values for 100 bins in phi from 0-5 degrees at midrapitity
93 void setmidrap()
94 {
95  set_phibins(100);
96  set_phimin(0);
97  set_phispan(5);
98  set_thetabins(1);
99  set_thetamin(0.1);
100  set_thetaspan(0);
101 }
102 
104 {
105  set_phibins(1);
106  set_phimin(1.); // do phi=1deg to avoid phi=0 in case there are discontinuities
107  set_phispan(1);
108  set_thetamin(-60);
109  set_thetaspan(120);
110  set_thetabins(60);
111 }
112 
113 #endif