Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:22:09

0001 #ifndef MACRO_MATSCAN_C
0002 #define MACRO_MATSCAN_C
0003 
0004 // just a dumb macro to run this before I forget how this is done
0005 // to pipe the output into a file (T.T here) execute
0006 // .L matscan.C
0007 // ROOT6:
0008 // .> T.T
0009 // matscan()
0010 // .q
0011 
0012 // the span is the delta phi/theta you want to cover, not the maximum
0013 // angle. The default is 10 bins in azimuth at theta=0.1 (almost
0014 // midrapidity, exact midrapidity we have gaps in the calorimeters and inner tracking
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;  // theta = 0 is perpendicular to beam axis
0027   float thetaspan = 360.;
0028   int thetabins = 1;
0029 }  // namespace MATSCAN
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   // set the desired phi range and binning (10 bins from 0-90 deg)
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   // set theta range - one at theta=0 which is vertically w.r.t. the beam axis
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   // do the scan
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 // set values for 100 bins in phi from 0-5 degrees at midrapitity
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.);  // do phi=1deg to avoid phi=0 in case there are discontinuities
0107   set_phispan(1);
0108   set_thetamin(-60);
0109   set_thetaspan(120);
0110   set_thetabins(60);
0111 }
0112 
0113 #endif