How to use StFlowMaker to retrieve ZDC-SMD info The current working directory is on RCF: /star/data01/pwg/rexwg/run14 and the library is SL15j. To compile StRoot, and test-run it do ///////////////////// starver SL15j cons root4star -b .x doFlowEvents.C(999,"./","test.run14.MuDst.root") ///////////////////// There will be some warnings during the compilation, but just ignore them. Make sure the right trigger ID be put into line 349-419 of the maker: StRoot/StFlowMaker/StFlowCutEvent.cxx Also put into line 1959-2003 of the maker: StRoot/StFlowMaker/StFlowMaker.cxx. The vertex cut on Vr is in line 551 of StFlowCutEvent.cxx The rest cuts can be applied in line 373 and below of the macro doFlowEvents.C Remember to set line 441 in this macro StFlowEvent::SetUseZDCSMD(kTRUE); 1. StRoot/StFlowMaker/StFlowConstants.cxx and .h The header .h file contains one useful info: "nRuns200 = 120" which is the number of days you want to include. Correspondingly, each day of the run you want is listed in "Int_t Flow::runNumber200[nRuns200]" in StFlowConstants.cxx. It's ok to list more than you need, but don't list fewer. Also, you need to check line 506-520 in StRoot/StFlowMaker/StFlowMaker.cxx For example, "mRealRunID-1506000" has the correct start day: the first 5 digits. Don't touch other digits. Also, you need to check mZDCSMDBeamCenter (line 727) in StRoot/StFlowAnalysisMaker/StFlowAnalysisMaker.cxx Make sure the first 5 digits of the upper and lower bounds on the y-axis correspond to the first and last day in "Int_t Flow::runNumber200[nRuns200]". And make sure the bin number is the difference between the upper and lower bounds. The first step is to calibrate the gain of ADC. uncomment this part: //////////////////////////////////////////// Double_t Flow::zdcsmdGainFac[2][2][8] = { { { 1,1,1,1,1,1,1,1} , { 1,1,1,1,1,1,1,1} } , { { 1,1,1,1,1,1,1,1} , { 1,1,1,1,1,1,1,1} } }; //////////////////////////////////////////// and comment out any other "zdcsmdGainFac". So now there's no gain correction applied. After we compile and run the code, the result file flow.hist.root will contain the ADC distributions for each channel. We can fit the distributions to retrieve the gain correction, and put them into a new "zdcsmdGainFac", while comment out the "unity" array above. We don't need to modify any other places in StFlowConstants.cxx. 2. Fit the gain The macro is fitGain.C. After you set all the gain to unity in Step 1, compile and run the code over many events. Merge the results of flow.hist.root, and rename it to gain.before.root as the input for this macro. If you open gain.before.root, you can find the histogram for each ZDC-SMD channel: ZDCSMD_east_ver?, ZDCSMD_east_hor?, ZDCSMD_west_ver?, ZDCSMD_west_hor?, where ?=1 to 8. For the vertical channels, #8 doesn't contain any real signal. Looking at each distribution, we will know if they work. Note the pedestals have been subtracted. Run the macro fitGain.C, it will output the gain for one of the 4 cases: e.g line 8 histTitle = new TString("ZDCSMD_west_ver"); means the macro will output the gain for west vertical channels. "west" can be changed to "east", and "ver" can be changed to "hor". Copy and paste the gains into their arrays in the macro, line 29-33, e.g est_v[8]. When all the 4 arrays are updated, (run the macro 4 times each time with a specific west or east, ver or hor), run the macro again to output the gain correction factors. Then copy and paste these factors into StFlowConstants.cxx, as indicated by Step 1. 3. Calibrate the beam centers After the gain correction factors have been set, we need to set StRoot/StFlowMaker/StFlowEvent.cxx into calibration mode. Go to the function Float_t StFlowEvent::ZDCSMD_GetPosition and comment out if(eastwest==0 && verthori==0) return zdcsmd_x[strip-1]-mZDCSMDCenterex; if(eastwest==1 && verthori==0) return mZDCSMDCenterwx-zdcsmd_x[strip-1]; if(eastwest==0 && verthori==1) return zdcsmd_y[strip-1]/sqrt(2.)-mZDCSMDCenterey; if(eastwest==1 && verthori==1) return zdcsmd_y[strip-1]/sqrt(2.)-mZDCSMDCenterwy; and uncomment // if(eastwest==0 && verthori==0) return zdcsmd_x[strip-1]; // if(eastwest==1 && verthori==0) return -zdcsmd_x[strip-1]; // if(eastwest==0 && verthori==1) return zdcsmd_y[strip-1]/sqrt(2.); // if(eastwest==1 && verthori==1) return zdcsmd_y[strip-1]/sqrt(2.); Later when we obtain the calibration of beam centers, remember to come here again, and do the opposite action to turn back into working mode. After setting StFlowEvent.cxx into calibration mode, compile and run over all the events you need to analyze. Merge the files of flow.hist.root, read out the histogram ZDCSMDBeamCenter and write it into the calibration file zdcsmdConstants.root. This file will be read into the analysis code to calculate the event planes from ZDC-SMD. Remember to turn StFlowEvent.cxx back into the working mode, before compiling and run the code again to retrieve the ready-to-use ZDC EP. 4. Locate the ZDC EP The azimuth angle and the magnitude of the flow vector of the ZDC EPs can be found in line 1642-1645 of StRoot/StFlowAnalysisMaker/StFlowAnalysisMaker.cxx: mPsi_ZDCSMD[1] to mPsi_ZDCSMD[4]. You can either only use the angles, or reconstruct the vector from the angle and the magnitude. About how to flatten the EP distribution, and use ZDC EP in a specific analysis, it's beyond this note. From here you can actually trace back to StFlowMaker.cxx to see which function returns such values.