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 #pragma once
2 // just a dumb macro to run this before I forget how this is done
3 // to pipe the output into a file (T.T here) execute
4 // .L matscan.C
5 // ROOT5:
6 // matscan(); > T.T
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 float phimin = 0.;
16 float phispan = 360.;
17 int phibins = 1000.;
18 float thetamin = 0.; // theta = 0 is perpendicular to beam axis
19 float thetaspan = 360.;
20 int thetabins = 1000;
21 
22 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
23 #include <fun4all/Fun4AllServer.h>
24 #include <g4main/PHG4Reco.h>
25 
26 R__LOAD_LIBRARY(libg4testbench.so)
27 #endif
28 
29 void matscan(){
31  PHG4Reco *g4Reco = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
32  g4Reco->InitRun(se->topNode());
33  char cmd[200];
34  // set the desired phi range and binning (10 bins from 0-90 deg)
35  sprintf(cmd,"/control/matScan/phi %d %f %f deg",phibins,phimin,phispan);
36  cout << "executing " << cmd << endl;
37  g4Reco->ApplyCommand(cmd);
38  // set theta range - one at theta=0 which is vertically w.r.t. the beam axis
39  sprintf(cmd,"/control/matScan/theta %d %f %f deg",thetabins,thetamin,thetaspan);
40  cout << "executing " << cmd << endl;
41  g4Reco->ApplyCommand(cmd);
42  // do the scan
43  cout << "starting scan - patience" << endl;
44  g4Reco->ApplyCommand("/control/matScan/scan");
45  cout << "All done" << endl;
46 }
47 
48 void set_phimin(const float f){phimin = f;}
49 void set_phispan(const float f){phispan = f;}
50 void set_phibins(const int i){phibins = i;}
51 void set_thetamin(const float f){thetamin = f;}
52 void set_thetaspan(const float f){thetaspan = f;}
53 void set_thetabins(const int i){thetabins = i;}
54 
55 void print(){
56  cout << "phibins: " << phibins << endl;
57  cout << "phimin: " << phimin << endl;
58  cout << "phispan: " << phispan << endl;
59  cout << "thetabins: " << thetabins << endl;
60  cout << "thetamin: " << thetamin << endl;
61  cout << "thetaspan: " << thetaspan << endl;
62 }
63 
64 // set values for 100 bins in phi from 0-5 degrees at midrapitity
65 void setmidrap(){
66  set_thetabins(1);
67  set_phibins(100);
68  set_phispan(5);
69  set_thetaspan(0);
70 }
71 
73  set_phibins(1);
74  set_phimin(1.); // do phi=1deg to avoid phi=0 in case there are discontinuities
75  set_phispan(1);
76  set_thetamin(0);
77  set_thetaspan(360);
78  set_thetabins(1000);
79 }