small improvement

This commit is contained in:
splitPoleDAQ 2024-02-05 16:44:44 -05:00
parent a668f64ab7
commit 3b0b6be47e
3 changed files with 37 additions and 9 deletions

View File

@ -190,12 +190,27 @@ inline void SX3::FindSX3Pos(TVector3 pos, TVector3 direction, bool verbose){
inline TVector3 SX3::GetHitPosWithSigma(double sigmaY_mm, double sigmaZ_mm){ inline TVector3 SX3::GetHitPosWithSigma(double sigmaY_mm, double sigmaZ_mm){
double phi = SNorml[id].Phi(); double phi = SNorml[id%numDet].Phi();
TVector3 haha = hitPos; TVector3 haha = hitPos;
haha.RotateZ(-phi); haha.RotateZ(-phi);
double y = haha.Y() + gRandom->Gaus(0, sigmaY_mm); double y = haha.Y() + gRandom->Gaus(0, sigmaY_mm);
if( sigmaY_mm < 0 ){
double deltaW = width/4;
y = TMath::Floor((haha.Y()-deltaW)/deltaW)*deltaW + deltaW*1.5; // when ever land on each strip, set the position to be center of the strip.
if( y >= 25 ) y = 15;
}
double z = haha.Z() + gRandom->Gaus(0, sigmaZ_mm); double z = haha.Z() + gRandom->Gaus(0, sigmaZ_mm);
if( sigmaZ_mm < 0 ){
haha.Z();
double delta = length/4;
int sign = z > 0 ? 1 : -1;
z = TMath::Floor( (abs(z)-gap/2)/delta )*delta + 0.5 * delta + gap/2;
if( z >= 107.375 ) z = 88.625;
z = sign * z;
}
haha.SetY(y); haha.SetY(y);
haha.SetZ(z); haha.SetZ(z);

View File

@ -35,16 +35,27 @@ int main(int argc, char **argv){
std::vector<float> ExAList = {0}; std::vector<float> ExAList = {0};
std::vector<float> ExList = {0, 1, 2}; std::vector<float> ExList = {0, 1, 2};
double vertexXRange[2] = { -10, 10}; // mm double vertexXRange[2] = { -5, 5}; // mm
double vertexYRange[2] = { -10, 10}; double vertexYRange[2] = { -5, 5};
double vertexZRange[2] = { -70, 70}; double vertexZRange[2] = {-70, 70};
double sigmaSX3_W = 10; // mm double sigmaSX3_W = -1; // mm, < 0 use mid-point
double sigmaSX3_L = 0; // mm double sigmaSX3_L = 5; // mm, < 0 use mid-point
double sigmaPW_A = 0; // from 0 to 1. double sigmaPW_A = 3; // from 0 to 1.
double sigmaPW_C = 0; // from 0 to 1. double sigmaPW_C = 3; // from 0 to 1.
//################################################### //###################################################
printf("------------ Vertex :\n");
printf("X : %7.2f - %7.2f mm\n", vertexXRange[0], vertexXRange[1]);
printf("Y : %7.2f - %7.2f mm\n", vertexYRange[0], vertexYRange[1]);
printf("Z : %7.2f - %7.2f mm\n", vertexZRange[0], vertexZRange[1]);
printf("------------ Uncertainty :\n");
printf(" SX3 horizontal : %.1f\n", sigmaSX3_W);
printf(" SX3 vertical : %.1f\n", sigmaSX3_L);
printf(" Anode : %.1f mm\n", sigmaPW_A);
printf(" Cathode : %.1f mm\n", sigmaPW_C);
transfer.CalReactionConstant(); transfer.CalReactionConstant();
int nExA = ExAList.size(); int nExA = ExAList.size();
@ -138,6 +149,8 @@ int main(int argc, char **argv){
Ex = ExList[ExID]; Ex = ExList[ExID];
transfer.SetExB(Ex); transfer.SetExB(Ex);
transfer.CalReactionConstant();
thetaCM = TMath::ACos(2 * gRandom->Rndm() - 1) ; thetaCM = TMath::ACos(2 * gRandom->Rndm() - 1) ;
phiCM = (gRandom->Rndm() - 0.5) * TMath::TwoPi(); phiCM = (gRandom->Rndm() - 0.5) * TMath::TwoPi();

View File

@ -250,7 +250,7 @@ void script(TString fileName = "", int maxEvent = -1){
ANASEN * haha = new ANASEN(); ANASEN * haha = new ANASEN();
haha->SetUncertainties(10, 10, 1, 1); haha->SetUncertainties(0, 0, 0, 0);
PW * pw = haha->GetPW(); PW * pw = haha->GetPW();
SX3 * sx3 = haha->GetSX3(); SX3 * sx3 = haha->GetSX3();