From 85e9b9146ddd0b83b229cda333afd52c9d99ef3f Mon Sep 17 00:00:00 2001 From: deserevi <deserevi@nptool> Date: Thu, 21 Oct 2010 15:14:50 +0000 Subject: [PATCH] * Changes in NPS for GaspardTrackerDummyShape shape + new positioning method in cartesian coordinates: w = u x v where u = (128,1) - (1,1) v = (1,128) - (1,1) comment: this differs from Must2 positioning scheme where w = v x u + this ensures a full consistency between simulations and analysis when GaspardTrackerDummyShape is positioned at the *same* place with cartesion or spherical coordinates + this was checked with a GaspardTrackerDummyShape module at R = 100, THETA = 180 and PHI = 0 * Add support in NPA for GaspardTrackerSquare shape + same changes as for GaspardTrackerDummyShape both in NPS and NPA + full consistency is achieved when GaspardTrackerModule are positioned at the *same* place with cartesian or spherical coordinates + this was checked with the barrel of the gaspHyde geometry * Misc: + remove compilation warnings in ParisCluster + begin work on GaspardTrackerTrapezoid (NPS + NPA) --- .../DetectorConfiguration/gaspHyde.detector | 202 +++++-- .../gaspardTestSpheric.detector | 2 +- NPAnalysis/Gaspard/src/AnalysisNew.cc | 7 +- NPLib/GASPARD/GaspardTrackerDummyShape.cxx | 79 ++- NPLib/GASPARD/GaspardTrackerDummyShape.h | 8 + NPLib/GASPARD/GaspardTrackerNew.cxx | 7 +- NPLib/GASPARD/GaspardTrackerSquare.cxx | 503 ++++++++++++++++++ NPLib/GASPARD/GaspardTrackerSquare.h | 98 ++++ NPLib/GASPARD/GaspardTrackerTrapezoid.cxx | 33 +- NPLib/GASPARD/Makefile | 4 +- .../include/GaspardTrackerDummyShape.hh | 6 + NPSimulation/src/GaspardScorers.cc | 17 +- NPSimulation/src/GaspardTrackerDummyShape.cc | 51 +- NPSimulation/src/GaspardTrackerSquare.cc | 44 +- NPSimulation/src/GaspardTrackerTrapezoid.cc | 34 +- NPSimulation/src/ParisCluster.cc | 4 +- NPSimulation/vis.mac | 2 +- 17 files changed, 930 insertions(+), 171 deletions(-) create mode 100644 NPLib/GASPARD/GaspardTrackerSquare.cxx create mode 100644 NPLib/GASPARD/GaspardTrackerSquare.h diff --git a/Inputs/DetectorConfiguration/gaspHyde.detector b/Inputs/DetectorConfiguration/gaspHyde.detector index c84478229..a6692ec3c 100644 --- a/Inputs/DetectorConfiguration/gaspHyde.detector +++ b/Inputs/DetectorConfiguration/gaspHyde.detector @@ -27,8 +27,58 @@ Target Z= 0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GaspardTracker +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2 +%GPDDummyShape + THETA= 180 + PHI= 0 + R= 100 + BETA= 0 0 0 + FIRSTSTAGE= 1 + SECONDSTAGE= 1 + THIRDSTAGE= 1 + VIS= all +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 Barrel +%GPDDummyShape + X1_Y1= -25.0 -25.00 -100.00 + X128_Y1= -25.0 25.00 -100.00 + X1_Y128= 25.0 -25.00 -100.00 + X128_Y128= 25.0 25.00 -100.00 + FIRSTSTAGE= 1 + SECONDSTAGE= 1 + THIRDSTAGE= 1 + VIS= all +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 Barrel +%GPDDummyShape + X1_Y1= -10.0 -10.00 100.00 + X128_Y1= -10.0 10.00 100.00 + X1_Y128= 10.0 -10.00 100.00 + X128_Y128= 10.0 10.00 100.00 + FIRSTSTAGE= 1 + SECONDSTAGE= 1 + THIRDSTAGE= 1 + VIS= all +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2 +%GPDSquare + THETA= 180 + PHI= 0 + R= 100 + BETA= 0 0 0 + FIRSTSTAGE= 1 + SECONDSTAGE= 1 + THIRDSTAGE= 1 + VIS= all +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 Barrel +%GPDSquare + X1_Y1= -49.0 -49.00 -100.00 + X128_Y1= -49.0 49.00 -100.00 + X1_Y128= 49.0 -49.00 -100.00 + X128_Y128= 49.0 49.00 -100.00 + FIRSTSTAGE= 1 + SECONDSTAGE= 1 + THIRDSTAGE= 1 + VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 Annular Back -GPDAnnular +%GPDAnnular Z= -156.5 RMIN= 16 RMAX= 52 @@ -37,7 +87,7 @@ GPDAnnular THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 Annular Front -GPDAnnular +%GPDAnnular Z= 156.5 RMIN= 16 RMAX= 52 @@ -46,7 +96,7 @@ GPDAnnular THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 End-Cap Back -GPDTrapezoid +%GPDTrapezoid X1_Y1= 55.338 14.346 -146.501 X128_Y1= 138.518 48.726 -69.237 X1_Y128= 138.519 -48.717 -69.236 @@ -56,7 +106,7 @@ GPDTrapezoid THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2 -GPDTrapezoid +%GPDTrapezoid X1_Y1= 28.986 49.274 -146.501 X128_Y1= 63.492 132.401 -69.237 X1_Y128= 132.395 63.500 -69.236 @@ -66,7 +116,7 @@ GPDTrapezoid THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%3 -GPDTrapezoid +%GPDTrapezoid X1_Y1= -14.346 55.338 -146.501 X128_Y1= -48.726 138.518 -69.237 X1_Y128= 48.717 138.519 -69.236 @@ -76,7 +126,7 @@ GPDTrapezoid THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%4 -GPDTrapezoid +%GPDTrapezoid X1_Y1= -49.274 28.986 -146.501 X128_Y1= -132.401 63.492 -69.237 X1_Y128= -63.500 132.395 -69.236 @@ -86,7 +136,7 @@ GPDTrapezoid THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 -GPDTrapezoid +%GPDTrapezoid X1_Y1= -55.338 -14.346 -146.501 X128_Y1= -138.518 -48.726 -69.237 X1_Y128= -138.519 48.717 -69.236 @@ -96,7 +146,7 @@ GPDTrapezoid THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%6 -GPDTrapezoid +%GPDTrapezoid X1_Y1= -28.986 -49.274 -146.501 X128_Y1= -63.492 -132.401 -69.237 X1_Y128= -132.395 -63.500 -69.236 @@ -106,7 +156,7 @@ GPDTrapezoid THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%7 -GPDTrapezoid +%GPDTrapezoid X1_Y1= 14.346 -55.338 -146.501 X128_Y1= 48.726 -138.518 -69.237 X1_Y128= -48.717 -138.519 -69.236 @@ -116,7 +166,7 @@ GPDTrapezoid THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%8 -GPDTrapezoid +%GPDTrapezoid X1_Y1= 49.274 -28.986 -146.501 X128_Y1= 132.401 -63.492 -69.237 X1_Y128= 63.500 -132.395 -69.236 @@ -126,11 +176,91 @@ GPDTrapezoid THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 Barrel +%GPDSquare + THETA= 90 + PHI= 0 + R= 143 + BETA= 0 0 0 + FIRSTSTAGE= 1 + SECONDSTAGE= 1 + THIRDSTAGE= 1 + VIS= all +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2 +%GPDSquare + THETA= 90 + PHI= 45 + R= 143 + BETA= 0 0 0 + FIRSTSTAGE= 1 + SECONDSTAGE= 1 + THIRDSTAGE= 1 + VIS= all +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%3 +%GPDSquare + THETA= 90 + PHI= 90 + R= 143 + BETA= 0 0 0 + FIRSTSTAGE= 1 + SECONDSTAGE= 1 + THIRDSTAGE= 1 + VIS= all +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%4 +%GPDSquare + THETA= 90 + PHI= 135 + R= 143 + BETA= 0 0 0 + FIRSTSTAGE= 1 + SECONDSTAGE= 1 + THIRDSTAGE= 1 + VIS= all +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 +%GPDSquare + THETA= 90 + PHI= 180 + R= 143 + BETA= 0 0 0 + FIRSTSTAGE= 1 + SECONDSTAGE= 1 + THIRDSTAGE= 1 + VIS= all +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%6 +%GPDSquare + THETA= 90 + PHI= 225 + R= 143 + BETA= 0 0 0 + FIRSTSTAGE= 1 + SECONDSTAGE= 1 + THIRDSTAGE= 1 + VIS= all +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%7 +%GPDSquare + THETA= 90 + PHI= 270 + R= 143 + BETA= 0 0 0 + FIRSTSTAGE= 1 + SECONDSTAGE= 1 + THIRDSTAGE= 1 + VIS= all +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%8 +%GPDSquare + THETA= 90 + PHI= 315 + R= 143 + BETA= 0 0 0 + FIRSTSTAGE= 1 + SECONDSTAGE= 1 + THIRDSTAGE= 1 + VIS= all +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 Barrel GPDSquare X1_Y1= 142.516 49.00 -49.00 X128_Y1= 142.516 49.00 49.00 - X1_Y128= 142.516 -49.00 49.00 - X128_Y128= 142.516 -49.00 -49.00 + X1_Y128= 142.516 -49.00 -49.00 + X128_Y128= 142.516 -49.00 49.00 FIRSTSTAGE= 1 SECONDSTAGE= 1 THIRDSTAGE= 1 @@ -139,8 +269,8 @@ GPDSquare GPDSquare X1_Y1= 66.125 135.422 -49.00 X128_Y1= 66.125 135.422 49.00 - X1_Y128= 135.422 66.126 49.00 - X128_Y128= 135.422 66.126 -49.00 + X1_Y128= 135.422 66.126 -49.00 + X128_Y128= 135.422 66.126 49.00 FIRSTSTAGE= 1 SECONDSTAGE= 1 THIRDSTAGE= 1 @@ -149,8 +279,8 @@ GPDSquare GPDSquare X1_Y1= -49.00 142.516 -49.00 X128_Y1= -49.00 142.516 49.00 - X1_Y128= 49.00 142.516 49.00 - X128_Y128= 49.00 142.516 -49.00 + X1_Y128= 49.00 142.516 -49.00 + X128_Y128= 49.00 142.516 49.00 FIRSTSTAGE= 1 SECONDSTAGE= 1 THIRDSTAGE= 1 @@ -159,8 +289,8 @@ GPDSquare GPDSquare X1_Y1= -135.422 66.125 -49.00 X128_Y1= -135.422 66.125 49.00 - X1_Y128= -66.126 135.422 49.00 - X128_Y128= -66.126 135.422 -49.00 + X1_Y128= -66.126 135.422 -49.00 + X128_Y128= -66.126 135.422 49.00 FIRSTSTAGE= 1 SECONDSTAGE= 1 THIRDSTAGE= 1 @@ -169,8 +299,8 @@ GPDSquare GPDSquare X1_Y1= -142.516 -49.00 -49.00 X128_Y1= -142.516 -49.00 49.00 - X1_Y128= -142.516 49.00 49.00 - X128_Y128= -142.516 49.00 -49.00 + X1_Y128= -142.516 49.00 -49.00 + X128_Y128= -142.516 49.00 49.00 FIRSTSTAGE= 1 SECONDSTAGE= 1 THIRDSTAGE= 1 @@ -179,8 +309,8 @@ GPDSquare GPDSquare X1_Y1= -66.125 -135.422 -49.00 X128_Y1= -66.125 -135.422 49.00 - X1_Y128= -135.422 -66.126 49.00 - X128_Y128= -135.422 -66.126 -49.00 + X1_Y128= -135.422 -66.126 -49.00 + X128_Y128= -135.422 -66.126 49.00 FIRSTSTAGE= 1 SECONDSTAGE= 1 THIRDSTAGE= 1 @@ -189,8 +319,8 @@ GPDSquare GPDSquare X1_Y1= 49.00 -142.516 -49.00 X128_Y1= 49.00 -142.516 49.00 - X1_Y128= -49.00 -142.516 49.00 - X128_Y128= -49.00 -142.516 -49.00 + X1_Y128= -49.00 -142.516 -49.00 + X128_Y128= -49.00 -142.516 49.00 FIRSTSTAGE= 1 SECONDSTAGE= 1 THIRDSTAGE= 1 @@ -199,24 +329,24 @@ GPDSquare GPDSquare X1_Y1= 135.422 -66.125 -49.00 X128_Y1= 135.422 -66.125 49.00 - X1_Y128= 66.126 -135.422 49.00 - X128_Y128= 66.126 -135.422 -49.00 + X1_Y128= 66.126 -135.422 -49.00 + X128_Y128= 66.126 -135.422 49.00 FIRSTSTAGE= 1 SECONDSTAGE= 1 THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 Front-Cap Back -GPDTrapezoid - X1_Y1= 55.338 14.346 146.501 +%GPDTrapezoid + X1_Y1= 55.338 -14.346 146.501 X128_Y1= 138.518 48.726 69.237 X1_Y128= 138.519 -48.717 69.236 - X128_Y128= 55.338 -14.346 146.501 + X128_Y128= 55.338 14.346 146.501 FIRSTSTAGE= 1 SECONDSTAGE= 0 THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2 -GPDTrapezoid +%GPDTrapezoid X1_Y1= 28.986 49.274 146.501 X128_Y1= 63.492 132.401 69.237 X1_Y128= 132.395 63.500 69.236 @@ -226,7 +356,7 @@ GPDTrapezoid THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%3 -GPDTrapezoid +%GPDTrapezoid X1_Y1= -14.346 55.338 146.501 X128_Y1= -48.726 138.518 69.237 X1_Y128= 48.717 138.519 69.236 @@ -236,7 +366,7 @@ GPDTrapezoid THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%4 -GPDTrapezoid +%GPDTrapezoid X1_Y1= -49.274 28.986 146.501 X128_Y1= -132.401 63.492 69.237 X1_Y128= -63.500 132.395 69.236 @@ -246,7 +376,7 @@ GPDTrapezoid THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 -GPDTrapezoid +%GPDTrapezoid X1_Y1= -55.338 -14.346 146.501 X128_Y1= -138.518 -48.726 69.237 X1_Y128= -138.519 48.717 69.236 @@ -256,7 +386,7 @@ GPDTrapezoid THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%6 -GPDTrapezoid +%GPDTrapezoid X1_Y1= -28.986 -49.274 146.501 X128_Y1= -63.492 -132.401 69.237 X1_Y128= -132.395 -63.500 69.236 @@ -266,7 +396,7 @@ GPDTrapezoid THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%7 -GPDTrapezoid +%GPDTrapezoid X1_Y1= 14.346 -55.338 146.501 X128_Y1= 48.726 -138.518 69.237 X1_Y128= -48.717 -138.519 69.236 @@ -276,7 +406,7 @@ GPDTrapezoid THIRDSTAGE= 1 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%8 -GPDTrapezoid +%GPDTrapezoid X1_Y1= 49.274 -28.986 146.501 X128_Y1= 132.401 -63.492 69.237 X1_Y128= 63.500 -132.395 69.236 diff --git a/Inputs/DetectorConfiguration/gaspardTestSpheric.detector b/Inputs/DetectorConfiguration/gaspardTestSpheric.detector index 8ee8188be..f1270bae0 100644 --- a/Inputs/DetectorConfiguration/gaspardTestSpheric.detector +++ b/Inputs/DetectorConfiguration/gaspardTestSpheric.detector @@ -27,7 +27,7 @@ Target %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GaspardTracker %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%0 Central Barrel -GPDAnnular +%GPDAnnular Z= 200 RMIN= 16 RMAX= 52 diff --git a/NPAnalysis/Gaspard/src/AnalysisNew.cc b/NPAnalysis/Gaspard/src/AnalysisNew.cc index b1c7a07a4..5ecc006ee 100644 --- a/NPAnalysis/Gaspard/src/AnalysisNew.cc +++ b/NPAnalysis/Gaspard/src/AnalysisNew.cc @@ -92,7 +92,7 @@ int main(int argc,char** argv) // Get total energy double E = GPDTrack->GetEnergyDeposit(); -// cout << i << " " << E << endl; + cout << i << " " << E << endl; // if there is a hit in the detector array, treat it. double Theta, ThetaStrip, angle, ThetaCM; @@ -111,7 +111,8 @@ int main(int argc,char** argv) DetecX = interCoord->GetDetectedPositionX(0); DetecY = interCoord->GetDetectedPositionY(0); DetecZ = interCoord->GetDetectedPositionZ(0); -// cout << DetecX << " " << DetecY << " " << DetecZ << endl; + cout << "Detected position :" << endl; + cout << "\t" << DetecX << " " << DetecY << " " << DetecZ << endl; TVector3 Detec(DetecX, DetecY, DetecZ); // Get interaction position in detector @@ -154,7 +155,7 @@ int main(int argc,char** argv) // if (Theta/deg > 35 && Theta/deg < 45 && E/MeV < 17) { // if (Theta/deg < 45) { // if (E/MeV < 38) { // for (p,t) reaction - if (Theta/deg > 90) { // for (d,p) reaction + if (Theta/deg > 30) { // for (d,p) reaction ExNoStrips = myReaction->ReconstructRelativistic(E, Theta / rad); Ex = myReaction->ReconstructRelativistic(E, ThetaStrip); } diff --git a/NPLib/GASPARD/GaspardTrackerDummyShape.cxx b/NPLib/GASPARD/GaspardTrackerDummyShape.cxx index 0ab7db858..a79427a6d 100644 --- a/NPLib/GASPARD/GaspardTrackerDummyShape.cxx +++ b/NPLib/GASPARD/GaspardTrackerDummyShape.cxx @@ -16,8 +16,11 @@ GaspardTrackerDummyShape::GaspardTrackerDummyShape(map<int, GaspardTrackerModule m_EventPhysics(EventPhysics), m_EventData(0), m_PreTreatData(new TGaspardTrackerData), - m_NumberOfModule(0) + m_NumberOfModule(0), + m_FirstStageFace(50), // mm + m_NumberOfStrips(100) { + m_StripPitch = m_FirstStageFace / (double)m_NumberOfStrips; } @@ -348,9 +351,9 @@ void GaspardTrackerDummyShape::BuildSimplePhysicalEvent() void GaspardTrackerDummyShape::AddModule(TVector3 C_X1_Y1, - TVector3 C_X128_Y1, - TVector3 C_X1_Y128, - TVector3 C_X128_Y128) + TVector3 C_X128_Y1, + TVector3 C_X1_Y128, + TVector3 C_X128_Y128) { m_NumberOfModule++; @@ -370,11 +373,6 @@ void GaspardTrackerDummyShape::AddModule(TVector3 C_X1_Y1, // Position Vector of X=1 Y=1 Strip TVector3 Strip_1_1; - // Geometry Parameter - double Face = 50; // mm - double NumberOfStrip = 128; - double StripPitch = Face/NumberOfStrip; // mm - // Buffer object to fill Position Array vector<double> lineX; vector<double> lineY; @@ -385,16 +383,15 @@ void GaspardTrackerDummyShape::AddModule(TVector3 C_X1_Y1, vector< vector< double > > OneModuleStripPositionZ; // Moving StripCenter to 1.1 corner: - Strip_1_1 = C_X1_Y1 + (U+V) * (StripPitch/2.); + Strip_1_1 = C_X1_Y1 + (U+V) * (m_StripPitch/2.); - for (int i = 0; i < NumberOfStrip; i++) { + for (int i = 0; i < m_NumberOfStrips; i++) { lineX.clear(); lineY.clear(); lineZ.clear(); - for (int j = 0; j < NumberOfStrip; j++) { - StripCenter = Strip_1_1 + StripPitch*( i*U + j*V ); -// StripCenter += -TargetPosition; + for (int j = 0; j < m_NumberOfStrips; j++) { + StripCenter = Strip_1_1 + m_StripPitch*(i*U + j*V); lineX.push_back( StripCenter.X() ); lineY.push_back( StripCenter.Y() ); @@ -414,18 +411,17 @@ void GaspardTrackerDummyShape::AddModule(TVector3 C_X1_Y1, void GaspardTrackerDummyShape::AddModule(double theta, - double phi, - double distance, - double beta_u, - double beta_v, - double beta_w) + double phi, + double distance, + double beta_u, + double beta_v, + double beta_w) { m_NumberOfModule++; // convert from degree to radian: - double Pi = 3.141592654; - theta = theta * Pi/180. ; - phi = phi * Pi/180. ; + theta *= M_PI/180; + phi *= M_PI/180; // Vector U on Module Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) TVector3 U ; @@ -451,18 +447,19 @@ void GaspardTrackerDummyShape::AddModule(double theta, U = U.Unit(); V = V.Unit(); - U.Rotate( beta_u * Pi/180. , U ) ; - V.Rotate( beta_u * Pi/180. , U ) ; + U.Rotate( beta_u * M_PI/180. , U ) ; + V.Rotate( beta_u * M_PI/180. , U ) ; - U.Rotate( beta_v * Pi/180. , V ) ; - V.Rotate( beta_v * Pi/180. , V ) ; + U.Rotate( beta_v * M_PI/180. , V ) ; + V.Rotate( beta_v * M_PI/180. , V ) ; - U.Rotate( beta_w * Pi/180. , W ) ; - V.Rotate( beta_w * Pi/180. , W ) ; + U.Rotate( beta_w * M_PI/180. , W ) ; + V.Rotate( beta_w * M_PI/180. , W ) ; - double Face = 50; // mm - double NumberOfStrip = 100; - double StripPitch = Face/NumberOfStrip; // mm + // Position Vector of Strip Center + TVector3 StripCenter = TVector3(0,0,0); + // Position Vector of X=1 Y=1 Strip + TVector3 Strip_1_1; vector<double> lineX; vector<double> lineY; @@ -472,26 +469,20 @@ void GaspardTrackerDummyShape::AddModule(double theta, vector< vector< double > > OneModuleStripPositionY; vector< vector< double > > OneModuleStripPositionZ; - double X, Y, Z; - // Moving C to the 1.1 corner: - C.SetX( C.X() - ( Face/2 - StripPitch/2 ) * ( V.X() + U.X() ) ) ; - C.SetY( C.Y() - ( Face/2 - StripPitch/2 ) * ( V.Y() + U.Y() ) ) ; - C.SetZ( C.Z() - ( Face/2 - StripPitch/2 ) * ( V.Z() + U.Z() ) ) ; + Strip_1_1 = C - 0.5 * (m_FirstStageFace - m_StripPitch) * (U + V); - for (int i = 0; i < NumberOfStrip; i++) { + for (int i = 0; i < m_NumberOfStrips; i++) { lineX.clear(); lineY.clear(); lineZ.clear(); - for (int j = 0; j < NumberOfStrip; j++) { - X = C.X() + StripPitch * ( U.X()*i + V.X()*j ); - Y = C.Y() + StripPitch * ( U.Y()*i + V.Y()*j ); - Z = C.Z() + StripPitch * ( U.Z()*i + V.Z()*j ); + for (int j = 0; j < m_NumberOfStrips; j++) { + StripCenter = Strip_1_1 + m_StripPitch * (i*U + j*V); - lineX.push_back(X); - lineY.push_back(Y); - lineZ.push_back(Z); + lineX.push_back(StripCenter.X()); + lineY.push_back(StripCenter.Y()); + lineZ.push_back(StripCenter.Z()); } OneModuleStripPositionX.push_back(lineX); diff --git a/NPLib/GASPARD/GaspardTrackerDummyShape.h b/NPLib/GASPARD/GaspardTrackerDummyShape.h index 7b9606311..7bce3135d 100644 --- a/NPLib/GASPARD/GaspardTrackerDummyShape.h +++ b/NPLib/GASPARD/GaspardTrackerDummyShape.h @@ -85,6 +85,14 @@ private: vector< vector < vector < double > > > m_StripPositionX; vector< vector < vector < double > > > m_StripPositionY; vector< vector < vector < double > > > m_StripPositionZ; + +private: + ////////////////////////////// + // Geometry and stip number // + ////////////////////////////// + double m_FirstStageFace; // mm + int m_NumberOfStrips; + double m_StripPitch; }; #endif diff --git a/NPLib/GASPARD/GaspardTrackerNew.cxx b/NPLib/GASPARD/GaspardTrackerNew.cxx index f1a5a0171..d234361dd 100644 --- a/NPLib/GASPARD/GaspardTrackerNew.cxx +++ b/NPLib/GASPARD/GaspardTrackerNew.cxx @@ -43,6 +43,7 @@ #include "GaspardTrackerDummyShape.h" #include "GaspardTrackerTrapezoid.h" #include "GaspardTrackerAnnular.h" +#include "GaspardTrackerSquare.h" using namespace std ; @@ -88,9 +89,9 @@ void GaspardTrackerNew::ReadConfiguration(string Path) getline(ConfigFile, LineBuffer); if (LineBuffer.compare(0, 9, "GPDSquare") == 0 && GPDTrkSquare == false) { GPDTrkSquare = true; -/* + // instantiate a new "detector" corresponding to the Square elements - GaspardTrackerModule* myDetector = new GaspardTrackerSquare(); + GaspardTrackerModule* myDetector = new GaspardTrackerSquare(m_ModulesMap, m_EventPhysics); // Pass the data object to the GaspardTracker*** object myDetector->SetGaspardDataPointer(m_EventData); @@ -99,7 +100,7 @@ void GaspardTrackerNew::ReadConfiguration(string Path) ConfigFile.close(); myDetector->ReadConfiguration(Path); ConfigFile.open(Path.c_str()); -*/ } + } else if (LineBuffer.compare(0, 12, "GPDTrapezoid") == 0 && GPDTrkTrapezoid == false) { GPDTrkTrapezoid = true; diff --git a/NPLib/GASPARD/GaspardTrackerSquare.cxx b/NPLib/GASPARD/GaspardTrackerSquare.cxx new file mode 100644 index 000000000..5def54540 --- /dev/null +++ b/NPLib/GASPARD/GaspardTrackerSquare.cxx @@ -0,0 +1,503 @@ +#include "GaspardTrackerSquare.h" + +// C++ headers +#include <iostream> +#include <fstream> +#include <string> +#include <cmath> + +// Gaspard +#include "TGaspardTrackerPhysicsNew.h" + + +GaspardTrackerSquare::GaspardTrackerSquare(map<int, GaspardTrackerModule*> &Module, + TGaspardTrackerPhysicsNew* &EventPhysics) + : m_ModuleTest(Module), + m_EventPhysics(EventPhysics), + m_EventData(0), + m_PreTreatData(new TGaspardTrackerData), + m_NumberOfModule(0), + m_FirstStageFace(98), // mm + m_NumberOfStrips(128) +{ + m_StripPitch = m_FirstStageFace / (double)m_NumberOfStrips; +} + + + +GaspardTrackerSquare::~GaspardTrackerSquare() +{ + delete m_PreTreatData; +} + + + +void GaspardTrackerSquare::ReadConfiguration(string Path) +{ + ifstream ConfigFile; + ConfigFile.open(Path.c_str()); + string LineBuffer; + string DataBuffer; + + // A:X1_Y1 --> X:1 Y:1 + // B:X128_Y1 --> X:128 Y:1 + // C:X1_Y128 --> X:1 Y:128 + // D:X128_Y128 --> X:128 Y:128 + + double Ax, Bx, Cx, Dx, Ay, By, Cy, Dy, Az, Bz, Cz, Dz; + TVector3 A, B, C, D; + double Theta = 0, Phi = 0, R = 0, beta_u = 0 , beta_v = 0 , beta_w = 0; + + bool check_A = false; + bool check_C = false; + bool check_B = false; + bool check_D = false; + + bool check_Theta = false; + bool check_Phi = false; + bool check_R = false; + bool check_beta = false; + + bool ReadingStatus = false; + + while (!ConfigFile.eof()) { + getline(ConfigFile, LineBuffer); + + // If line is a GaspardXXX bloc, reading toggle to true + // and toggle to true flags indicating which shape is treated. + if (LineBuffer.compare(0, 9, "GPDSquare") == 0) { + cout << "///////////////////////" << endl; + cout << "Square module found:" << endl; + ReadingStatus = true; + } + + // Reading Block + while (ReadingStatus) { + ConfigFile >> DataBuffer ; + // Comment Line + if (DataBuffer.compare(0, 1, "%") == 0) { + ConfigFile.ignore(std::numeric_limits<std::streamsize>::max(), '\n' ); + } + // Finding another telescope (safety), toggle out + else if (DataBuffer.compare(0, 9, "GPDSquare") == 0) { + cout << "WARNING: Another Module is find before standard sequence of Token, Error may occured in Telecope definition" << endl; + ReadingStatus = false; + } + + // Position method + else if (DataBuffer.compare(0, 6, "X1_Y1=") == 0) { + check_A = true; + ConfigFile >> DataBuffer; + Ax = atof(DataBuffer.c_str()); + Ax = Ax; + ConfigFile >> DataBuffer; + Ay = atof(DataBuffer.c_str()); + Ay = Ay; + ConfigFile >> DataBuffer; + Az = atof(DataBuffer.c_str()); + Az = Az; + + A = TVector3(Ax, Ay, Az); + cout << "X1 Y1 corner position : (" << A.X() << ";" << A.Y() << ";" << A.Z() << ")" << endl; + } + else if (DataBuffer.compare(0, 8, "X128_Y1=") == 0) { + check_B = true; + ConfigFile >> DataBuffer; + Bx = atof(DataBuffer.c_str()); + Bx = Bx; + ConfigFile >> DataBuffer; + By = atof(DataBuffer.c_str()); + By = By; + ConfigFile >> DataBuffer; + Bz = atof(DataBuffer.c_str()); + Bz = Bz; + + B = TVector3(Bx, By, Bz); + cout << "X128 Y1 corner position : (" << B.X() << ";" << B.Y() << ";" << B.Z() << ")" << endl; + } + else if (DataBuffer.compare(0, 8, "X1_Y128=") == 0) { + check_C = true; + ConfigFile >> DataBuffer; + Cx = atof(DataBuffer.c_str()); + Cx = Cx; + ConfigFile >> DataBuffer; + Cy = atof(DataBuffer.c_str()); + Cy = Cy; + ConfigFile >> DataBuffer; + Cz = atof(DataBuffer.c_str()); + Cz = Cz; + + C = TVector3(Cx, Cy, Cz); + cout << "X1 Y128 corner position : (" << C.X() << ";" << C.Y() << ";" << C.Z() << ")" << endl; + } + else if (DataBuffer.compare(0, 10, "X128_Y128=") == 0) { + check_D = true; + ConfigFile >> DataBuffer; + Dx = atof(DataBuffer.c_str()); + Dx = Dx; + ConfigFile >> DataBuffer; + Dy = atof(DataBuffer.c_str()); + Dy = Dy; + ConfigFile >> DataBuffer; + Dz = atof(DataBuffer.c_str()); + Dz = Dz; + + D = TVector3(Dx, Dy, Dz); + cout << "X128 Y128 corner position : (" << D.X() << ";" << D.Y() << ";" << D.Z() << ")" << endl; + } // End Position Method + + // Angle method + else if (DataBuffer.compare(0, 6, "THETA=") == 0) { + check_Theta = true; + ConfigFile >> DataBuffer; + Theta = atof(DataBuffer.c_str()); + Theta = Theta; + cout << "Theta: " << Theta << endl; + } + else if (DataBuffer.compare(0, 4, "PHI=") == 0) { + check_Phi = true; + ConfigFile >> DataBuffer; + Phi = atof(DataBuffer.c_str()); + Phi = Phi; + cout << "Phi: " << Phi << endl; + } + else if (DataBuffer.compare(0, 2, "R=") == 0) { + check_R = true; + ConfigFile >> DataBuffer; + R = atof(DataBuffer.c_str()); + R = R; + cout << "R: " << R << endl; + } + else if (DataBuffer.compare(0, 5, "BETA=") == 0) { + check_beta = true; + ConfigFile >> DataBuffer; + beta_u = atof(DataBuffer.c_str()); + beta_u = beta_u; + ConfigFile >> DataBuffer; + beta_v = atof(DataBuffer.c_str()); + beta_v = beta_v; + ConfigFile >> DataBuffer; + beta_w = atof(DataBuffer.c_str()); + beta_w = beta_w; + cout << "Beta: " << beta_u << " " << beta_v << " " << beta_w << endl; + } + + ///////////////////////////////////////////////// + // If All necessary information there, toggle out + if ( (check_A && check_B && check_C && check_D) || (check_Theta && check_Phi && check_R && check_beta) ) { + ReadingStatus = false; + + // Add The previously define telescope + // With position method + if ( check_A && check_B && check_C && check_D ) { + AddModule(A, B, C, D); + m_ModuleTest[m_index["Square"] + m_NumberOfModule] = this; + } + + // with angle method + else if ( check_Theta && check_Phi && check_R && check_beta ) { + AddModule(Theta, Phi, R, beta_u, beta_v, beta_w); + m_ModuleTest[m_index["Square"] + m_NumberOfModule] = this; + } + + // reset boolean flag for point positioning + check_A = false; + check_B = false; + check_C = false; + check_D = false; + // reset boolean flag for angle positioning + check_Theta = false; + check_Phi = false; + check_R = false; + check_beta = false; + + } // end test for adding a module + } // end while for reading block + } // end while for reading file + + cout << endl << "/////////////////////////////" << endl<<endl; +} + + + +void GaspardTrackerSquare::PreTreat() +{ +} + + + +void GaspardTrackerSquare::BuildPhysicalEvent() +{ + // Check flags + bool Check_FirstStage = false; + bool Check_SecondStage = false; + bool Check_ThirdStage = false; + + // Thresholds +/* + double FirstStage_Front_E_Threshold = 0; double FirstStage_Front_T_Threshold = 0; + double FirstStage_Back_E_Threshold = 0; double FirstStage_Back_T_Threshold = 0; + double SecondStage_E_Threshold = 0; double SecondStage_T_Threshold = 0; + double ThirdStage_E_Threshold = 0; double ThirdStage_T_Threshold = 0; +*/ + // calculate multipicity in the first stage + int multXE = m_EventData->GetGPDTrkFirstStageFrontEMult(); + int multYE = m_EventData->GetGPDTrkFirstStageBackEMult(); + int multXT = m_EventData->GetGPDTrkFirstStageFrontTMult(); + int multYT = m_EventData->GetGPDTrkFirstStageBackTMult(); + // calculate multiplicity of 2nd and third stages + int mult2E = m_EventData->GetGPDTrkSecondStageEMult(); + int mult2T = m_EventData->GetGPDTrkSecondStageTMult(); + int mult3E = m_EventData->GetGPDTrkThirdStageEMult(); + int mult3T = m_EventData->GetGPDTrkThirdStageTMult(); + + // Deal with multiplicity 1 for the first layer + if (multXE==1 && multYE==1 && multXT==1 && multYT==1) { + // calculate detector number + int det_ref = m_EventData->GetGPDTrkFirstStageFrontEDetectorNbr(0); + int detecXE = m_EventData->GetGPDTrkFirstStageFrontEDetectorNbr(0) / det_ref; + int detecXT = m_EventData->GetGPDTrkFirstStageFrontTDetectorNbr(0) / det_ref; + int detecYE = m_EventData->GetGPDTrkFirstStageBackEDetectorNbr(0) / det_ref; + int detecYT = m_EventData->GetGPDTrkFirstStageBackTDetectorNbr(0) / det_ref; + + // module number starting from 0 + det_ref -= m_index["Square"]; + + // case of same detector + if (detecXE*detecXT*detecYE*detecYT == 1) { + // store module number + m_EventPhysics->SetModuleNumber(det_ref + m_index["Square"]); + // calculate strip number + int stripXE = m_EventData->GetGPDTrkFirstStageFrontEStripNbr(0); + int stripXT = m_EventData->GetGPDTrkFirstStageFrontTStripNbr(0); + int stripYE = m_EventData->GetGPDTrkFirstStageBackEStripNbr(0); + int stripYT = m_EventData->GetGPDTrkFirstStageBackTStripNbr(0); + + // case of same strips on X and Y + if (stripXE == stripXT && stripYE == stripYT) { // here we have a good strip event + // various + Check_FirstStage = true; + // store strip ID + m_EventPhysics->SetFirstStageFrontPosition(stripXE); + m_EventPhysics->SetFirstStageBackPosition(stripYE); + // get energy from strips and store it + double EnergyStripFront = m_EventData->GetGPDTrkFirstStageFrontEEnergy(0); + m_EventPhysics->SetFirstStageEnergy(EnergyStripFront); + double EnergyTot = EnergyStripFront; + // get time from strips and store it + double TimeStripBack = m_EventData->GetGPDTrkFirstStageBackEEnergy(0); + m_EventPhysics->SetFirstStageTime(TimeStripBack); + + // check if we have a 2nd stage event + if (mult2E==1 && mult2T==1) { + Check_SecondStage = true; + double EnergySecond = m_EventData->GetGPDTrkSecondStageEEnergy(0); + m_EventPhysics->SetSecondStageEnergy(EnergySecond); + EnergyTot += EnergySecond; + } + else if (mult2E>1 || mult2T>1) { + cout << "Warning: multiplicity in second stage greater than in firststage" << endl; + } + + // check if we have a third stage event + if (mult3E==1 && mult3T==1) { + Check_ThirdStage = true; + double EnergyThird = m_EventData->GetGPDTrkThirdStageEEnergy(0); + m_EventPhysics->SetThirdStageEnergy(EnergyThird); + EnergyTot += EnergyThird; + } + else if (mult3E>1 || mult3T>1) { + cout << "Warning: multiplicity in third stage greater than in firststage" << endl; + } + + // Fill total energy + m_EventPhysics->SetTotalEnergy(EnergyTot); + + // check strip position + cout << "strips X, Y : " << stripXE << " " << stripYE << endl; + cout << "position : " << endl; + cout << "\t X: " << GetStripPositionX(det_ref + m_index["Square"], stripXE, stripYE) << endl; + cout << "\t Y: " << GetStripPositionY(det_ref + m_index["Square"], stripXE, stripYE) << endl; + cout << "\t Z: " << GetStripPositionZ(det_ref + m_index["Square"], stripXE, stripYE) << endl; + + // Fill default values for second an third stages + if (!Check_SecondStage) { + m_EventPhysics->SetSecondStageEnergy(-1000); + m_EventPhysics->SetSecondStageTime(-1000); + m_EventPhysics->SetSecondStagePosition(-1000); + } + if (!Check_ThirdStage) { + m_EventPhysics->SetThirdStageEnergy(-1000); + m_EventPhysics->SetThirdStageTime(-1000); + m_EventPhysics->SetThirdStagePosition(-1000); + } + } + else { + cout << "Not same strips" << endl; + } + } + else { + cout << "Not same detector" << endl; + } + } + else { +/* cout << "Multiplicity is not one, it is: " << endl; + cout << "\tmultXE: " << multXE << endl; + cout << "\tmultXT: " << multXT << endl; + cout << "\tmultYE: " << multYE << endl; + cout << "\tmultYT: " << multYT << endl;*/ + } +} + + + +void GaspardTrackerSquare::BuildSimplePhysicalEvent() +{ +} + + + +void GaspardTrackerSquare::AddModule(TVector3 C_X1_Y1, + TVector3 C_X128_Y1, + TVector3 C_X1_Y128, + TVector3 C_X128_Y128) +{ + m_NumberOfModule++; + + // remove warning using C_X128_Y128 + C_X128_Y128.Unit(); + + // Vector U on Module Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) + TVector3 U = C_X128_Y1 - C_X1_Y1; + U = U.Unit(); + + // Vector V on Module Face (parallele to X Strip) + TVector3 V = C_X1_Y128 - C_X1_Y1; + V = V.Unit(); + + // Position Vector of Strip Center + TVector3 StripCenter = TVector3(0,0,0); + // Position Vector of X=1 Y=1 Strip + TVector3 Strip_1_1; + + // Buffer object to fill Position Array + vector<double> lineX; + vector<double> lineY; + vector<double> lineZ; + + vector< vector< double > > OneModuleStripPositionX; + vector< vector< double > > OneModuleStripPositionY; + vector< vector< double > > OneModuleStripPositionZ; + + // Moving StripCenter to 1.1 corner: + Strip_1_1 = C_X1_Y1 + (U+V) * (m_StripPitch/2.); + + for (int i = 0; i < m_NumberOfStrips; i++) { + lineX.clear(); + lineY.clear(); + lineZ.clear(); + + for (int j = 0; j < m_NumberOfStrips; j++) { + StripCenter = Strip_1_1 + m_StripPitch*(i*U + j*V); + + lineX.push_back( StripCenter.X() ); + lineY.push_back( StripCenter.Y() ); + lineZ.push_back( StripCenter.Z() ); + } + + OneModuleStripPositionX.push_back(lineX); + OneModuleStripPositionY.push_back(lineY); + OneModuleStripPositionZ.push_back(lineZ); + } + + m_StripPositionX.push_back( OneModuleStripPositionX ); + m_StripPositionY.push_back( OneModuleStripPositionY ); + m_StripPositionZ.push_back( OneModuleStripPositionZ ); +} + + + +void GaspardTrackerSquare::AddModule(double theta, + double phi, + double distance, + double beta_u, + double beta_v, + double beta_w) +{ + m_NumberOfModule++; + + // convert from degree to radian: + theta *= M_PI/180; + phi *= M_PI/180; + + // Vector U on Module Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) + TVector3 U ; + // Vector V on Module Face (parallele to X Strip) + TVector3 V ; + // Vector W normal to Module Face (pointing CsI) + TVector3 W ; + // Vector position of Module Face center + TVector3 C ; + + C = TVector3(distance * sin(theta) * cos(phi), + distance * sin(theta) * sin(phi), + distance * cos(theta)); + + TVector3 YperpW = TVector3( cos(theta) * cos(phi), + cos(theta) * sin(phi), + -sin(theta)); + + W = C.Unit(); + U = W.Cross(YperpW); + V = W.Cross(U); + + U = U.Unit(); + V = V.Unit(); + + U.Rotate( beta_u * M_PI/180. , U ) ; + V.Rotate( beta_u * M_PI/180. , U ) ; + + U.Rotate( beta_v * M_PI/180. , V ) ; + V.Rotate( beta_v * M_PI/180. , V ) ; + + U.Rotate( beta_w * M_PI/180. , W ) ; + V.Rotate( beta_w * M_PI/180. , W ) ; + + // Position Vector of Strip Center + TVector3 StripCenter = TVector3(0,0,0); + // Position Vector of X=1 Y=1 Strip + TVector3 Strip_1_1; + + vector<double> lineX; + vector<double> lineY; + vector<double> lineZ; + + vector< vector< double > > OneModuleStripPositionX; + vector< vector< double > > OneModuleStripPositionY; + vector< vector< double > > OneModuleStripPositionZ; + + // Moving C to the 1.1 corner: + Strip_1_1 = C - 0.5 * (m_FirstStageFace - m_StripPitch) * (U + V); + + for (int i = 0; i < m_NumberOfStrips; i++) { + lineX.clear(); + lineY.clear(); + lineZ.clear(); + + for (int j = 0; j < m_NumberOfStrips; j++) { + StripCenter = Strip_1_1 + m_StripPitch * (i*U + j*V); + + lineX.push_back(StripCenter.X()); + lineY.push_back(StripCenter.Y()); + lineZ.push_back(StripCenter.Z()); + } + + OneModuleStripPositionX.push_back(lineX); + OneModuleStripPositionY.push_back(lineY); + OneModuleStripPositionZ.push_back(lineZ); + } + + m_StripPositionX.push_back( OneModuleStripPositionX ); + m_StripPositionY.push_back( OneModuleStripPositionY ); + m_StripPositionZ.push_back( OneModuleStripPositionZ ); +} diff --git a/NPLib/GASPARD/GaspardTrackerSquare.h b/NPLib/GASPARD/GaspardTrackerSquare.h new file mode 100644 index 000000000..8d2a6439c --- /dev/null +++ b/NPLib/GASPARD/GaspardTrackerSquare.h @@ -0,0 +1,98 @@ +#ifndef GaspardTrackerSquare_h +#define GaspardTrackerSquare_h 1 + +// C++ headers +#include <string> +#include <map> +#include <vector> + +// ROOT headers +#include "TVector3.h" + +// Gaspard headers +#include "TGaspardTrackerData.h" +#include "TGaspardTrackerPhysicsNew.h" +#include "GaspardTrackerModule.h" + +using namespace std; + + + +class GaspardTrackerSquare : public GaspardTrackerModule +{ +public: + //////////////////////////////////////////////////// + /////// Default Constructor and Destructor ///////// + //////////////////////////////////////////////////// + GaspardTrackerSquare(map<int, GaspardTrackerModule*> &Module, TGaspardTrackerPhysicsNew* &EventPhysics); + virtual ~GaspardTrackerSquare(); + +public: + //////////////////////////////////////////////////// + //// Inherite from GaspardTrackerModule class ///// + //////////////////////////////////////////////////// + // Read stream at Configfile to pick-up parameters of detector (Position,...) + void ReadConfiguration(string Path); + + // The goal of this method is to extract physical parameters from raw data + // Method called at each event read from the Input Tree + void BuildPhysicalEvent(); + + // Same as before but with a simpler treatment + void BuildSimplePhysicalEvent(); + +private: + map<int, GaspardTrackerModule*> &m_ModuleTest; + TGaspardTrackerPhysicsNew* &m_EventPhysics; + +public: + void SetGaspardDataPointer(TGaspardTrackerData* gaspardData) {m_EventData = gaspardData;}; + void PreTreat(); + +private: + // Gaspard data coming from TGaspardTrackerPhysics through the + // SetGaspardDataPointer method + TGaspardTrackerData* m_EventData; + TGaspardTrackerData* m_PreTreatData; + +public: + //////////////////////////////// + // Specific to GaspardTracker // + //////////////////////////////// + // Add a Module using Corner Coordinate information + void AddModule(TVector3 C_X1_Y1, + TVector3 C_X128_Y1, + TVector3 C_X1_Y128, + TVector3 C_X128_Y128); + + // Add a Module using R Theta Phi of Si center information + void AddModule(double theta, + double phi, + double distance, + double beta_u, + double beta_v, + double beta_w); + + // Getters to retrieve the (X,Y,Z) coordinates of a pixel defined by strips (X,Y) + double GetStripPositionX(int N ,int X ,int Y) { return m_StripPositionX[N-1-m_index["Square"]][X-1][Y-1]; } + double GetStripPositionY(int N ,int X ,int Y) { return m_StripPositionY[N-1-m_index["Square"]][X-1][Y-1]; } + double GetStripPositionZ(int N ,int X ,int Y) { return m_StripPositionZ[N-1-m_index["Square"]][X-1][Y-1]; } + double GetNumberOfModule() { return m_NumberOfModule; } + +private: + // Spatial Position of Strip Calculated on basis of detector position + int m_NumberOfModule; + vector< vector < vector < double > > > m_StripPositionX; + vector< vector < vector < double > > > m_StripPositionY; + vector< vector < vector < double > > > m_StripPositionZ; + +private: + ////////////////////////////// + // Geometry and stip number // + ////////////////////////////// + double m_FirstStageFace; // mm + int m_NumberOfStrips; + double m_StripPitch; +}; + +#endif diff --git a/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx b/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx index df5845172..0b02f740b 100644 --- a/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx +++ b/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx @@ -348,9 +348,9 @@ void GaspardTrackerTrapezoid::BuildSimplePhysicalEvent() void GaspardTrackerTrapezoid::AddModule(TVector3 C_X1_Y1, - TVector3 C_X128_Y1, - TVector3 C_X1_Y128, - TVector3 C_X128_Y128) + TVector3 C_X128_Y1, + TVector3 C_X1_Y128, + TVector3 C_X128_Y128) { m_NumberOfModule++; @@ -414,18 +414,17 @@ void GaspardTrackerTrapezoid::AddModule(TVector3 C_X1_Y1, void GaspardTrackerTrapezoid::AddModule(double theta, - double phi, - double distance, - double beta_u, - double beta_v, - double beta_w) + double phi, + double distance, + double beta_u, + double beta_v, + double beta_w) { m_NumberOfModule++; // convert from degree to radian: - double Pi = 3.141592654; - theta = theta * Pi/180. ; - phi = phi * Pi/180. ; + theta *= M_PI/180; + phi *= M_PI/180; // Vector U on Module Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) TVector3 U ; @@ -451,14 +450,14 @@ void GaspardTrackerTrapezoid::AddModule(double theta, U = U.Unit(); V = V.Unit(); - U.Rotate( beta_u * Pi/180. , U ) ; - V.Rotate( beta_u * Pi/180. , U ) ; + U.Rotate( beta_u * M_PI/180. , U ) ; + V.Rotate( beta_u * M_PI/180. , U ) ; - U.Rotate( beta_v * Pi/180. , V ) ; - V.Rotate( beta_v * Pi/180. , V ) ; + U.Rotate( beta_v * M_PI/180. , V ) ; + V.Rotate( beta_v * M_PI/180. , V ) ; - U.Rotate( beta_w * Pi/180. , W ) ; - V.Rotate( beta_w * Pi/180. , W ) ; + U.Rotate( beta_w * M_PI/180. , W ) ; + V.Rotate( beta_w * M_PI/180. , W ) ; double Face = 50; // mm double NumberOfStrip = 100; diff --git a/NPLib/GASPARD/Makefile b/NPLib/GASPARD/Makefile index 1060750ba..7a0170c57 100644 --- a/NPLib/GASPARD/Makefile +++ b/NPLib/GASPARD/Makefile @@ -295,7 +295,8 @@ TGaspardTrackerPhysicsNewDict.cxx: TGaspardTrackerPhysicsNew.h rootcint -f $@ -c $^ libGaspardTrackerModules.so: GaspardTrackerModule.o GaspardTrackerDummyShape.o \ - GaspardTrackerTrapezoid.o GaspardTrackerAnnular.o + GaspardTrackerTrapezoid.o GaspardTrackerAnnular.o \ + GaspardTrackerSquare.o $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ @@ -310,6 +311,7 @@ GaspardTrackerModule.o: GaspardTrackerModule.cxx GaspardTrackerModule.h GaspardTrackerDummyShape.o: GaspardTrackerDummyShape.cxx GaspardTrackerDummyShape.h GaspardTrackerTrapezoid.o: GaspardTrackerTrapezoid.cxx GaspardTrackerTrapezoid.h GaspardTrackerAnnular.o: GaspardTrackerAnnular.cxx GaspardTrackerAnnular.h +GaspardTrackerSquare.o: GaspardTrackerSquare.cxx GaspardTrackerSquare.h ####################################### ############# Clean and More ########## diff --git a/NPSimulation/include/GaspardTrackerDummyShape.hh b/NPSimulation/include/GaspardTrackerDummyShape.hh index cb7c35015..bed592c4e 100644 --- a/NPSimulation/include/GaspardTrackerDummyShape.hh +++ b/NPSimulation/include/GaspardTrackerDummyShape.hh @@ -134,6 +134,12 @@ private: vector<G4double> m_beta_u ; // | vector<G4double> m_beta_v ; // > Tilt angle of the Telescope vector<G4double> m_beta_w ; // | + +private: + // debugging purposes + G4ThreeVector MMCenter; + G4ThreeVector MMu; + G4ThreeVector MMv; }; diff --git a/NPSimulation/src/GaspardScorers.cc b/NPSimulation/src/GaspardScorers.cc index 7cde5739e..d6031b89d 100644 --- a/NPSimulation/src/GaspardScorers.cc +++ b/NPSimulation/src/GaspardScorers.cc @@ -258,12 +258,15 @@ G4bool GPDScorerFirstStageFrontStripDummyShape::ProcessHits(G4Step* aStep, G4Tou // get front strip number G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); +// G4cout << "POS world: " << POS << G4endl; POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); +// G4cout << "POS local: " << POS << G4endl; G4double StripPitch = GPDDUMMYSHAPE::FirstStageFace / m_NumberOfStrip; G4double temp = (POS(0) + GPDDUMMYSHAPE::FirstStageFace / 2.) / StripPitch ; G4double X = int(temp) + 1 ; +// G4cout << "strip X: " << X << G4endl; //Rare case where particle is close to edge of silicon plan if (X == m_NumberOfStrip+1) X = m_NumberOfStrip; @@ -330,6 +333,8 @@ G4bool GPDScorerFirstStageBackStripDummyShape::ProcessHits(G4Step* aStep, G4Touc G4double temp = (POS(1) + GPDDUMMYSHAPE::FirstStageFace / 2.) / StripPitch ; G4double X = int(temp) + 1 ; +// G4cout << "strip Y: " << X << G4endl; + //Rare case where particle is close to edge of silicon plan if (X == m_NumberOfStrip+1) X = m_NumberOfStrip; G4double edep = aStep->GetTotalEnergyDeposit(); @@ -650,8 +655,8 @@ G4bool GPDScorerFirstStageFrontStripAnnular::ProcessHits(G4Step* aStep, G4Toucha // Hit position in the world frame G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); - G4cout << "world frame hit position" << G4endl; - G4cout << POS.x() << " " << POS.y() << " " << POS.z() << G4endl; +// G4cout << "world frame hit position" << G4endl; +// G4cout << POS.x() << " " << POS.y() << " " << POS.z() << G4endl; // Hit position in the detector frame POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); @@ -675,10 +680,10 @@ G4bool GPDScorerFirstStageFrontStripAnnular::ProcessHits(G4Step* aStep, G4Toucha G4double ThetaStripNumber = floor(dummy / ThetaStripPitch); ThetaStripNumber += PhiQuadrantNumber * GPDANNULAR::NbThetaStrips; - G4cout << "POS: " << POS << G4endl; - G4cout << "r, phi " << r << " " << phi << G4endl; - G4cout << "PhiWidth, PhiQuadrantNumber " << PhiWidth << " " << PhiQuadrantNumber << G4endl; - G4cout << "ThetaStripPitch, ThetaStripNumber, dummy " << ThetaStripPitch << " " << ThetaStripNumber << " " << dummy << G4endl; +// G4cout << "POS: " << POS << G4endl; +// G4cout << "r, phi " << r << " " << phi << G4endl; +// G4cout << "PhiWidth, PhiQuadrantNumber " << PhiWidth << " " << PhiQuadrantNumber << G4endl; +// G4cout << "ThetaStripPitch, ThetaStripNumber, dummy " << ThetaStripPitch << " " << ThetaStripNumber << " " << dummy << G4endl; if (ThetaStripNumber < 1e-6) { /* G4cout << "POS: " << POS << G4endl; diff --git a/NPSimulation/src/GaspardTrackerDummyShape.cc b/NPSimulation/src/GaspardTrackerDummyShape.cc index 072dc73ab..4c4f1c791 100644 --- a/NPSimulation/src/GaspardTrackerDummyShape.cc +++ b/NPSimulation/src/GaspardTrackerDummyShape.cc @@ -212,23 +212,21 @@ void GaspardTrackerDummyShape::VolumeMaker(G4int TelescopeNumber, //Uncomment to help debugging or if you want to understand the way the code work. //I should recommand to Comment it during simulation to avoid perturbation of simulation //Remember G4 is limitationg step on geometry constraints. - /* - G4ThreeVector positionMarkerU = CT*0.98 + MMu*SiliconFace/4; - G4Box* solidMarkerU = new G4Box( "solidMarkerU" , SiliconFace/4 , 1*mm , 1*mm ) ; - G4LogicalVolume* logicMarkerU = new G4LogicalVolume( solidMarkerU , Vacuum , "logicMarkerU",0,0,0) ; - PVPBuffer = new G4PVPlacement(G4Transform3D(*MMrot,positionMarkerU),logicMarkerU,"MarkerU",world,false,0) ; + G4ThreeVector positionMarkerU = MMCenter*0.8 + MMu*FirstStageFace/4; + G4Box* solidMarkerU = new G4Box("solidMarkerU", FirstStageFace/4, 1*mm, 1*mm); + G4LogicalVolume* logicMarkerU = new G4LogicalVolume(solidMarkerU, Vacuum, "logicMarkerU", 0, 0, 0); + PVPBuffer = new G4PVPlacement(G4Transform3D(*MMrot,positionMarkerU), logicMarkerU, "MarkerU", world, false, 0); - G4VisAttributes* MarkerUVisAtt= new G4VisAttributes(G4Colour(0.,0.,0.5));//blue - logicMarkerU->SetVisAttributes(MarkerUVisAtt); + G4VisAttributes* MarkerUVisAtt= new G4VisAttributes(G4Colour(0.,0.,0.5)); //blue + logicMarkerU->SetVisAttributes(MarkerUVisAtt); - G4ThreeVector positionMarkerV = CT*0.98 + MMv*SiliconFace/4; - G4Box* solidMarkerV = new G4Box( "solidMarkerU" , 1*mm , SiliconFace/4 , 1*mm ) ; - G4LogicalVolume* logicMarkerV = new G4LogicalVolume( solidMarkerV , Vacuum , "logicMarkerV",0,0,0) ; - PVPBuffer = new G4PVPlacement(G4Transform3D(*MMrot,positionMarkerV),logicMarkerV,"MarkerV",world,false,0) ; + G4ThreeVector positionMarkerV = MMCenter*0.8 + MMv*FirstStageFace/4; + G4Box* solidMarkerV = new G4Box("solidMarkerU", 1*mm, FirstStageFace/4, 1*mm); + G4LogicalVolume* logicMarkerV = new G4LogicalVolume(solidMarkerV, Vacuum, "logicMarkerV", 0, 0, 0); + PVPBuffer = new G4PVPlacement(G4Transform3D(*MMrot,positionMarkerV), logicMarkerV, "MarkerV", world, false, 0); - G4VisAttributes* MarkerVVisAtt= new G4VisAttributes(G4Colour(0.,0.5,0.5));//green - logicMarkerV->SetVisAttributes(MarkerVVisAtt); - */ + G4VisAttributes* MarkerVVisAtt= new G4VisAttributes(G4Colour(0.,0.5,0.)); //green + logicMarkerV->SetVisAttributes(MarkerVVisAtt); //////////////////////////////////////////////////////////////// ///////////////// First Stage Construction ///////////////////// @@ -252,7 +250,7 @@ void GaspardTrackerDummyShape::VolumeMaker(G4int TelescopeNumber, logicFirstStage->SetSensitiveDetector(m_FirstStageScorer); ///Visualisation of FirstStage Strip - G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(0.2, 0.2, 0.2)); + G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)); // blue logicFirstStage->SetVisAttributes(FirstStageVisAtt); } @@ -278,8 +276,8 @@ void GaspardTrackerDummyShape::VolumeMaker(G4int TelescopeNumber, logicSecondStage->SetSensitiveDetector(m_SecondStageScorer); ///Visualisation of SecondStage Strip - G4VisAttributes* SecondStageVisAtt = new G4VisAttributes(G4Colour(0.5, 0.5, 0.5)) ; - logicSecondStage->SetVisAttributes(SecondStageVisAtt) ; + G4VisAttributes* SecondStageVisAtt = new G4VisAttributes(G4Colour(0.5, 0.5, 0.5)); + logicSecondStage->SetVisAttributes(SecondStageVisAtt); } //////////////////////////////////////////////////////////////// @@ -304,7 +302,7 @@ void GaspardTrackerDummyShape::VolumeMaker(G4int TelescopeNumber, logicThirdStage->SetSensitiveDetector(m_ThirdStageScorer); ///Visualisation of Third Stage - G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.7, 0.7, 0.7)); + G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.9, 0.0)); // green logicThirdStage->SetVisAttributes(ThirdStageVisAtt); } } @@ -536,10 +534,10 @@ void GaspardTrackerDummyShape::ConstructDetector(G4LogicalVolume* world) { G4RotationMatrix* MMrot = NULL ; G4ThreeVector MMpos = G4ThreeVector(0, 0, 0) ; - G4ThreeVector MMu = G4ThreeVector(0, 0, 0) ; - G4ThreeVector MMv = G4ThreeVector(0, 0, 0) ; +// G4ThreeVector MMu = G4ThreeVector(0, 0, 0) ; +// G4ThreeVector MMv = G4ThreeVector(0, 0, 0) ; G4ThreeVector MMw = G4ThreeVector(0, 0, 0) ; - G4ThreeVector MMCenter = G4ThreeVector(0, 0, 0) ; +// G4ThreeVector MMCenter = G4ThreeVector(0, 0, 0) ; bool FirstStage = true ; bool SecondStage = true ; bool ThirdStage = true ; @@ -558,16 +556,12 @@ void GaspardTrackerDummyShape::ConstructDetector(G4LogicalVolume* world) MMv = m_X1_Y128[i] - m_X1_Y1[i]; MMv = MMv.unit(); - G4ThreeVector MMscal = MMu.dot(MMv); - MMw = MMu.cross(MMv); -// if (MMw.z() > 0) MMw = MMv.cross(MMu) ; MMw = MMw.unit(); MMCenter = (m_X1_Y1[i] + m_X1_Y128[i] + m_X128_Y1[i] + m_X128_Y128[i]) / 4; // Passage Matrix from Lab Referential to Telescope Referential - // MUST2 MMrot = new G4RotationMatrix(MMu, MMv, MMw); // translation to place Telescope MMpos = MMw * Length * 0.5 + MMCenter; @@ -589,7 +583,7 @@ void GaspardTrackerDummyShape::ConstructDetector(G4LogicalVolume* world) MMw = G4ThreeVector(wX, wY, wZ); // vector corresponding to the center of the module - G4ThreeVector CT = MMw; + MMCenter = MMw; // vector parallel to one axis of silicon plane G4double ii = cos(Theta / rad) * cos(Phi / rad); @@ -604,21 +598,20 @@ void GaspardTrackerDummyShape::ConstructDetector(G4LogicalVolume* world) MMu = MMu.unit(); // Passage Matrix from Lab Referential to Telescope Referential - // MUST2 MMrot = new G4RotationMatrix(MMu, MMv, MMw); // Telescope is rotate of Beta angle around MMv axis. MMrot->rotate(m_beta_u[i], MMu); MMrot->rotate(m_beta_v[i], MMv); MMrot->rotate(m_beta_w[i], MMw); // translation to place Telescope - MMpos = MMw * Length * 0.5 + CT ; + MMpos = MMw * Length * 0.5 + MMCenter; } FirstStage = m_wFirstStage[i] ; SecondStage = m_wSecondStage[i] ; ThirdStage = m_wThirdStage[i] ; - VolumeMaker(i + 1, MMpos, MMrot, FirstStage, SecondStage, ThirdStage , world); + VolumeMaker(i + 1, MMpos, MMrot, FirstStage, SecondStage, ThirdStage, world); } delete MMrot ; diff --git a/NPSimulation/src/GaspardTrackerSquare.cc b/NPSimulation/src/GaspardTrackerSquare.cc index 1666396be..c8ba9e5a9 100644 --- a/NPSimulation/src/GaspardTrackerSquare.cc +++ b/NPSimulation/src/GaspardTrackerSquare.cc @@ -283,7 +283,7 @@ void GaspardTrackerSquare::VolumeMaker(G4int TelescopeNumber, logicFirstStage->SetSensitiveDetector(m_FirstStageScorer); ///Visualisation of FirstStage Strip - G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(0.2, 0.2, 0.2)); + G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)); // blue logicFirstStage->SetVisAttributes(FirstStageVisAtt); } @@ -335,7 +335,7 @@ void GaspardTrackerSquare::VolumeMaker(G4int TelescopeNumber, logicThirdStage->SetSensitiveDetector(m_ThirdStageScorer); ///Visualisation of Third Stage - G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.7, 0.7, 0.7)); + G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.9, 0.0)); // green logicThirdStage->SetVisAttributes(ThirdStageVisAtt); } } @@ -587,9 +587,9 @@ void GaspardTrackerSquare::ConstructDetector(G4LogicalVolume* world) G4ThreeVector MMv = G4ThreeVector(0, 0, 0) ; G4ThreeVector MMw = G4ThreeVector(0, 0, 0) ; G4ThreeVector MMCenter = G4ThreeVector(0, 0, 0) ; - bool FirstStage = true ; - bool SecondStage = true ; - bool ThirdStage = true ; + bool FirstStage = true; + bool SecondStage = true; + bool ThirdStage = true; G4int NumberOfTelescope = m_DefinitionType.size() ; @@ -599,25 +599,21 @@ void GaspardTrackerSquare::ConstructDetector(G4LogicalVolume* world) // (u,v,w) unitary vector associated to telescope referencial // (u,v) // to silicon plan // w perpendicular to (u,v) plan and pointing ThirdStage - MMu = m_X128_Y1[i] - m_X1_Y1[i] ; - MMu = MMu.unit() ; - - MMv = m_X1_Y128[i] - m_X1_Y1[i] ; - MMv = MMv.unit() ; + MMu = m_X128_Y1[i] - m_X1_Y1[i]; + MMu = MMu.unit(); - G4ThreeVector MMscal = MMu.dot(MMv); + MMv = m_X1_Y128[i] - m_X1_Y1[i]; + MMv = MMv.unit(); - MMw = MMu.cross(MMv) ; -// if (MMw.z() > 0) MMw = MMv.cross(MMu) ; - MMw = MMw.unit() ; + MMw = MMu.cross(MMv); + MMw = MMw.unit(); - MMCenter = (m_X1_Y1[i] + m_X1_Y128[i] + m_X128_Y1[i] + m_X128_Y128[i]) / 4 ; + MMCenter = (m_X1_Y1[i] + m_X1_Y128[i] + m_X128_Y1[i] + m_X128_Y128[i]) / 4; // Passage Matrix from Lab Referential to Telescope Referential - // MUST2 - MMrot = new G4RotationMatrix(MMu, MMv, MMw) ; + MMrot = new G4RotationMatrix(MMu, MMv, MMw); // translation to place Telescope - MMpos = MMw * Length * 0.5 + MMCenter ; + MMpos = MMw * Length * 0.5 + MMCenter; } // By Angle @@ -630,13 +626,13 @@ void GaspardTrackerSquare::ConstructDetector(G4LogicalVolume* world) // w perpendicular to (u,v) plan and pointing ThirdStage // Phi is angle between X axis and projection in (X,Y) plan // Theta is angle between position vector and z axis - G4double wX = m_R[i] * sin(Theta / rad) * cos(Phi / rad) ; - G4double wY = m_R[i] * sin(Theta / rad) * sin(Phi / rad) ; - G4double wZ = m_R[i] * cos(Theta / rad) ; - MMw = G4ThreeVector(wX, wY, wZ) ; + G4double wX = m_R[i] * sin(Theta / rad) * cos(Phi / rad); + G4double wY = m_R[i] * sin(Theta / rad) * sin(Phi / rad); + G4double wZ = m_R[i] * cos(Theta / rad); + MMw = G4ThreeVector(wX, wY, wZ); // vector corresponding to the center of the module - G4ThreeVector CT = MMw; + MMCenter = MMw; // vector parallel to one axis of silicon plane G4double ii = cos(Theta / rad) * cos(Phi / rad); @@ -658,7 +654,7 @@ void GaspardTrackerSquare::ConstructDetector(G4LogicalVolume* world) MMrot->rotate(m_beta_v[i], MMv); MMrot->rotate(m_beta_w[i], MMw); // translation to place Telescope - MMpos = MMw * Length * 0.5 + CT ; + MMpos = MMw * Length * 0.5 + MMCenter; } FirstStage = m_wFirstStage[i] ; diff --git a/NPSimulation/src/GaspardTrackerTrapezoid.cc b/NPSimulation/src/GaspardTrackerTrapezoid.cc index 72f269bad..a82558cc5 100644 --- a/NPSimulation/src/GaspardTrackerTrapezoid.cc +++ b/NPSimulation/src/GaspardTrackerTrapezoid.cc @@ -286,7 +286,7 @@ void GaspardTrackerTrapezoid::VolumeMaker(G4int TelescopeNumber , logicFirstStage->SetSensitiveDetector(m_FirstStageScorer); ///Visualisation of FirstStage Strip - G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(0.2, 0.2, 0.2)); + G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)); // blue logicFirstStage->SetVisAttributes(FirstStageVisAtt); } @@ -315,8 +315,8 @@ void GaspardTrackerTrapezoid::VolumeMaker(G4int TelescopeNumber , logicSecondStage->SetSensitiveDetector(m_SecondStageScorer); ///Visualisation of SecondStage Strip - G4VisAttributes* SecondStageVisAtt = new G4VisAttributes(G4Colour(0.5, 0.5, 0.5)) ; - logicSecondStage->SetVisAttributes(SecondStageVisAtt) ; + G4VisAttributes* SecondStageVisAtt = new G4VisAttributes(G4Colour(0.5, 0.5, 0.5)); + logicSecondStage->SetVisAttributes(SecondStageVisAtt); } //////////////////////////////////////////////////////////////// @@ -344,7 +344,7 @@ void GaspardTrackerTrapezoid::VolumeMaker(G4int TelescopeNumber , logicThirdStage->SetSensitiveDetector(m_ThirdStageScorer); ///Visualisation of Third Stage - G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.7, 0.7, 0.7)); + G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.9, 0.0)); // red logicThirdStage->SetVisAttributes(ThirdStageVisAtt); } } @@ -612,7 +612,30 @@ void GaspardTrackerTrapezoid::ConstructDetector(G4LogicalVolume* world) // (u,v,w) unitary vector associated to telescope referencial // (u,v) // to silicon plan // w perpendicular to (u,v) plan and pointing ThirdStage + // new positioning scheme ? G4cout << "############ Gaspard Trapezoid " << i << " #############" << G4endl; + MMu = m_X128_Y1[i] - m_X1_Y1[i] ; + MMu *= -1; + G4cout << "MMu: " << MMu << G4endl; + MMu = MMu.unit() ; + G4cout << "Norm MMu: " << MMu << G4endl; + + MMv = -0.5 * (m_X1_Y128[i] + m_X128_Y128[i] - m_X1_Y1[i] - m_X1_Y128[i]); + G4cout << "MMv: " << MMv << G4endl; + MMv = MMv.unit() ; + G4cout << "Norm MMv: " << MMv << G4endl; + + G4ThreeVector MMscal = MMu.dot(MMv); + G4cout << "Norm MMu.MMv: " << MMscal << G4endl; + +// MMw = MMu.cross(MMv) ; + MMw = MMv.cross(MMu) ; +// if (MMw.z() > 0) MMw = MMv.cross(MMu) ; + MMw = MMw.unit() ; + G4cout << "Norm MMw: " << MMw << G4endl; + + // old positioning scheme +/* G4cout << "############ Gaspard Trapezoid " << i << " #############" << G4endl; MMu = m_X128_Y1[i] - m_X1_Y128[i] ; G4cout << "MMu: " << MMu << G4endl; MMu = MMu.unit() ; @@ -627,10 +650,11 @@ void GaspardTrackerTrapezoid::ConstructDetector(G4LogicalVolume* world) G4cout << "Norm MMu.MMv: " << MMscal << G4endl; MMw = MMu.cross(MMv) ; +// MMw = MMv.cross(MMu) ; // if (MMw.z() > 0) MMw = MMv.cross(MMu) ; MMw = MMw.unit() ; G4cout << "Norm MMw: " << MMw << G4endl; - +*/ // Center of the module MMCenter = (m_X1_Y1[i] + m_X1_Y128[i] + m_X128_Y1[i] + m_X128_Y128[i]) / 4 ; diff --git a/NPSimulation/src/ParisCluster.cc b/NPSimulation/src/ParisCluster.cc index 464b611fe..9f35358a8 100644 --- a/NPSimulation/src/ParisCluster.cc +++ b/NPSimulation/src/ParisCluster.cc @@ -774,6 +774,8 @@ void ParisCluster::ReadSensitive(const G4Event* event) G4int sizeNCsI= CsIDetectorNumberHitMap->entries(); G4int sizeECsI= CsIStageEnergyHitMap->entries(); + sizeC *= 1; // remove warning at compilation + sizeECsI *= 1; // remove warning at compilation //G4cout <<"SizeN=" << sizeN << endl; //G4cout <<"SizeC=" << sizeC << endl; //G4cout <<"SizeN CsI =" << sizeNCsI << endl; @@ -806,7 +808,7 @@ void ParisCluster::ReadSensitive(const G4Event* event) G4double T = *(Time_itr->second); G4int NCryst= *(CrystalNumber_itr->second); - + NCryst *= 1; //remove warning at compilation //G4cout <<"NTrackID=" << NTrackID << G4endl; //G4cout <<"N_first=" << N_first << G4endl; //G4cout <<"CrystalNumber_first=" << NCryst << G4endl; diff --git a/NPSimulation/vis.mac b/NPSimulation/vis.mac index b669de374..486ab51ef 100644 --- a/NPSimulation/vis.mac +++ b/NPSimulation/vis.mac @@ -24,4 +24,4 @@ # run event #/run/beamOn 0 -/run/beamOn 1 +#/run/beamOn 1 -- GitLab