Notes on using the EPD fast simulator (StEpdFastSim)
Updated on Mon, 2021-02-22 23:47. Originally created by lxy1122 on 2021-02-22 14:27.
Mike wrote a fast simulator for EPD: https://drupal.star.bnl.gov/STAR/blog/lisa/epd-fast-simulator
1. fix bug in StEpdFastSim/StEpdFastSim.cxx
>>Fix:
2) Use "fabs" instead of "abs"! "abs" is for integers.
2. Required modifications related to StPicoEvent/StPicoEpdHit
StPicoEpdHit has the following method for the real STAR data:
2) modify StEpdFastSim.cxx (this should be a better way, because I don't have to change and checkout StPicoEpdHit.h in my working directory every time I need to use the simulation):
When a StPicoEpdHit was initialized, besides setId() and setnMIP(), also setQTdata() to a value (to be decided) that will get the isGood() method return "true".
3. Use the EPD simulator on RCF
Following is how I got it work on RCF, however I have no idea why it worked or why other ways failed :(
PS: it seems that cons only works two levels down
vim StRoot/StEpdFastSim/StEpdFastSimLinkDef.h
5) cons
1. fix bug in StEpdFastSim/StEpdFastSim.cxx
double xHit = PrimVertex.X() + deltaZ*sin(mom->Theta())*cos(mom->Phi()); double yHit = PrimVertex.Y() + deltaZ*sin(mom->Theta())*sin(mom->Phi());
>>Fix:
double xHit = PrimVertex.X() + deltaZ*fabs(tan(mom->Theta()))*cos(mom->Phi()); double yHit = PrimVertex.Y() + deltaZ*fabs(tan(mom->Theta()))*sin(mom->Phi());Note: 1) the absolute value is IMPORTANT, otherwise the second term in xHit (or yHit) will have a wrong sign for the East EPD (i.e pi/2<\theta<pi).
2) Use "fabs" instead of "abs"! "abs" is for integers.
2. Required modifications related to StPicoEvent/StPicoEpdHit
StPicoEpdHit has the following method for the real STAR data:
/// if the tile is identified as bad in the database, returns zero. Note you /// can always access the raw ADC value, regardless of good/bad Float_t nMIP() const { return this->isGood() ? mnMIP : 0.0; }
However, in the simulation, no tile has the "isGood()" information (i.e ->isGood() always returns zero) therefore nMIP() will always return 0. There are two ways to get it work for the simulation:
1) modify StPicoEvent/StPicoEpdHit.h to:
Float_t nMIP() const { return mnMIP; }
2) modify StEpdFastSim.cxx (this should be a better way, because I don't have to change and checkout StPicoEpdHit.h in my working directory every time I need to use the simulation):
When a StPicoEpdHit was initialized, besides setId() and setnMIP(), also setQTdata() to a value (to be decided) that will get the isGood() method return "true".
3. Use the EPD simulator on RCF
Following is how I got it work on RCF, however I have no idea why it worked or why other ways failed :(
PS: it seems that cons only works two levels down
1) cvs co StRoot/StEpdUtil : there will be a sub-directory called StEpdFastSim/
2) cp -r StRoot/StEpdUtil/StEpdFastSim/ StRoot/
3) need to change the path of StEpdGeom in StRoot/StEpdFastSim/StEpdFastSim.cxx
4) add a linkDef file in StRoot /StEpdFastSim/:
2) cp -r StRoot/StEpdUtil/StEpdFastSim/ StRoot/
3) need to change the path of StEpdGeom in StRoot/StEpdFastSim/StEpdFastSim.cxx
4) add a linkDef file in StRoot /StEpdFastSim/:
vim StRoot/StEpdFastSim/StEpdFastSimLinkDef.h
#ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class StEpdFastSim; #pragma link C++ class StEpdTrivialEventGenerator; #endif
Note: there is no “+” behind the class name
5) cons
6) error about TVector3
7) vim .sl73_gcc485/obj/StRoot/StEpdFastSim/StEpdFastSim_Cint.cxx
Add #include "TVector3.h”
8) cons
9) Now it should be good to go! Weirdly, StRoot/StEpdFastSim/ is now useless and can be deleted, it will not even be called (modifications in the code won't have any effect).
10) In RunSimulator.C:
7) vim .sl73_gcc485/obj/StRoot/StEpdFastSim/StEpdFastSim_Cint.cxx
Add #include "TVector3.h”
8) cons
9) Now it should be good to go! Weirdly, StRoot/StEpdFastSim/ is now useless and can be deleted, it will not even be called (modifications in the code won't have any effect).
10) In RunSimulator.C:
gSystem->Load(“StEpdUtil”); gSystem->Load(“StPicoEvent”); gSystem->Load(“StEpdFastSim.so”);
4. "Move EPD/beam around"
The EPD fast simulator is also a good tool to study what will happen if the EPD/beam "move around" (e.g shift, tilt, shift+tilt...). It only requires some change in the macro RunSimulator.C(in principle, you don't need to change StEpdFastSim.cxx at all. But in practice, It could be useful to change it a little bit depending on what exactly you are interested in, you will see soon):
The EPD fast simulator is also a good tool to study what will happen if the EPD/beam "move around" (e.g shift, tilt, shift+tilt...). It only requires some change in the macro RunSimulator.C(in principle, you don't need to change StEpdFastSim.cxx at all. But in practice, It could be useful to change it a little bit depending on what exactly you are interested in, you will see soon):
1) Shift
In order to shift the EPD/Beam, just give the Primary Vertex an offset. e.g setting PV to (1.0, 0.0, 0.0) (step c in RunSimulator.C) equals shifting the beam pipe 1 cm along x or shifting the EPD 1 cm along -x. As a result, there will be a peak around 0 in the dN/dphi distribution for a EPD ring and the b will be the same for east and west EPD.
Side note:
a) need to modify StEpdFastSim.cxx otherwise it will not allow Vx>0.5 or Vy >0.5
In order to shift the EPD/Beam, just give the Primary Vertex an offset. e.g setting PV to (1.0, 0.0, 0.0) (step c in RunSimulator.C) equals shifting the beam pipe 1 cm along x or shifting the EPD 1 cm along -x. As a result, there will be a peak around 0 in the dN/dphi distribution for a EPD ring and the b will be the same for east and west EPD.
Side note:
a) need to modify StEpdFastSim.cxx otherwise it will not allow Vx>0.5 or Vy >0.5
b) If you want the number of particles hitting each tile instead of the "nMIP" value (e.g when plotting dN/dphi), you can change dE from mRan->Landau(1.0,mWID) to 1.0 in StEpdFastSim.cxx
2) Tilt
In order to tilt the beam or the EPD with an angle, just Rotate the generated tracks with an angle. e.g mom->RotateX(0.1) (step b in RunSimulator) is to rotate the beam couter-clockwise around the X-axis for 0.1 rad (Note: I believe it is not the same as rotating the EPD around x-axis by 0,1 rad). As a result, there will be a peak around -pi/2 on the west and around pi/2 on the east.
3) Shift+tilt
e.g when simulating a tilted beam effect and vz is not at zero, then both "shit" and "tilt" are needed.
In order to tilt the beam or the EPD with an angle, just Rotate the generated tracks with an angle. e.g mom->RotateX(0.1) (step b in RunSimulator) is to rotate the beam couter-clockwise around the X-axis for 0.1 rad (Note: I believe it is not the same as rotating the EPD around x-axis by 0,1 rad). As a result, there will be a peak around -pi/2 on the west and around pi/2 on the east.
3) Shift+tilt
e.g when simulating a tilted beam effect and vz is not at zero, then both "shit" and "tilt" are needed.
5. Studies using the EPD Fast Simulator:
https://drupal.star.bnl.gov/STAR/system/files/FCV_Feb32021.pdf
https://drupal.star.bnl.gov/STAR/system/files/FCV_Feb32021.pdf
»
- lxy1122's blog
- Login or register to post comments