File indexing completed on 2025-08-03 08:22:09
0001 #ifndef MACRO_MATSCAN_C
0002 #define MACRO_MATSCAN_C
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include <fun4all/Fun4AllServer.h>
0017 #include <g4main/PHG4Reco.h>
0018
0019 R__LOAD_LIBRARY(libg4testbench.so)
0020
0021 namespace MATSCAN
0022 {
0023 float phimin = 0.;
0024 float phispan = 360.;
0025 int phibins = 10;
0026 float thetamin = 0.1;
0027 float thetaspan = 360.;
0028 int thetabins = 1;
0029 }
0030
0031 void matscan()
0032 {
0033 Fun4AllServer *se = Fun4AllServer::instance();
0034 PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
0035 g4->InitRun(se->topNode());
0036 char cmd[200];
0037
0038 sprintf(cmd, "/control/matScan/phi %d %f %f deg", MATSCAN::phibins, MATSCAN::phimin, MATSCAN::phispan);
0039 cout << "executing " << cmd << endl;
0040 g4->ApplyCommand(cmd);
0041
0042 sprintf(cmd, "/control/matScan/theta %d %f %f deg", MATSCAN::thetabins, MATSCAN::thetamin, MATSCAN::thetaspan);
0043 cout << "executing " << cmd << endl;
0044 g4->ApplyCommand(cmd);
0045
0046 cout << "starting scan - patience" << endl;
0047 g4->ApplyCommand("/control/matScan/scan");
0048 cout << "All done" << endl;
0049 }
0050
0051 void set_phimin(const float f)
0052 {
0053 MATSCAN::phimin = f;
0054 }
0055
0056 void set_phispan(const float f)
0057 {
0058 MATSCAN::phispan = f;
0059 }
0060
0061 void set_phibins(const int i)
0062 {
0063 MATSCAN::phibins = i;
0064 }
0065
0066 void set_thetamin(const float f)
0067 {
0068 MATSCAN::thetamin = f;
0069 }
0070
0071 void set_thetaspan(const float f)
0072 {
0073 MATSCAN::thetaspan = f;
0074 }
0075
0076 void set_thetabins(const int i)
0077 {
0078 MATSCAN::thetabins = i;
0079 }
0080
0081 void print()
0082 {
0083 cout << "phibins: " << MATSCAN::phibins << endl;
0084 cout << "phimin: " << MATSCAN::phimin << endl;
0085 cout << "phispan: " << MATSCAN::phispan << endl;
0086
0087 cout << "thetabins: " << MATSCAN::thetabins << endl;
0088 cout << "thetamin: " << MATSCAN::thetamin << endl;
0089 cout << "thetaspan: " << MATSCAN::thetaspan << endl;
0090 }
0091
0092
0093 void setmidrap()
0094 {
0095 set_phibins(100);
0096 set_phimin(0);
0097 set_phispan(5);
0098 set_thetabins(1);
0099 set_thetamin(0.1);
0100 set_thetaspan(0);
0101 }
0102
0103 void set_thetascan()
0104 {
0105 set_phibins(1);
0106 set_phimin(1.);
0107 set_phispan(1);
0108 set_thetamin(-60);
0109 set_thetaspan(120);
0110 set_thetabins(60);
0111 }
0112
0113 #endif