diff --git a/Inputs/DetectorConfiguration/MUGAST.detector b/Inputs/DetectorConfiguration/MUGAST.detector index 81bedc3612d86061d5594a47774c463be4f26e76..c73db9923394a55b5332e6d31061ebd213379f62 100644 --- a/Inputs/DetectorConfiguration/MUGAST.detector +++ b/Inputs/DetectorConfiguration/MUGAST.detector @@ -1,9 +1,9 @@ -}%%%%%%%%%%Detector%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%Detector%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 GeneralTarget %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 Target - THICKNESS= 18 + THICKNESS= 1 RADIUS= 7.5 MATERIAL= CD2 X= 0 @@ -29,8 +29,8 @@ GPDTrapezoid X128_Y1= 122.368 54.712 -71.098 X1_Y1= 57.084 119.996 -71.098 FIRSTSTAGE= 1 - SECONDSTAGE= 1 - THIRDSTAGE= 1 + SECONDSTAGE= 0 + THIRDSTAGE= 0 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2 GPDTrapezoid @@ -62,33 +62,26 @@ GPDTrapezoid SECONDSTAGE= 0 THIRDSTAGE= 0 VIS= all + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 Barrel -<<<<<<< HEAD -%GPDSquare - X1_Y1= -61.823 128.742 53.5 - X128_Y1= -61.823 128.742 -58.5 - X1_Y128= -132.251 58.314 -58.5 - X128_Y128= -132.251 58.314 53.5 -======= -GPDSquare - X128_Y1= -61.823 128.742 53.5 - X1_Y128= -61.823 128.742 -58.5 - X128_Y128= -132.251 58.314 -58.5 - X1_Y1= -132.251 58.314 53.5 ->>>>>>> f6b4686ada3bd21e20e035ddb4e9549f9980aa08 +GPDRectangle + X1_Y1= -132.251 58.314 53.5 + X128_Y1= -61.823 128.742 53.5 + X1_Y128= -132.251 58.314 -58.5 + X128_Y128= -61.823 128.742 -58.5 FIRSTSTAGE= 1 - SECONDSTAGE= 1 - THIRDSTAGE= 1 + SECONDSTAGE= 0 + THIRDSTAGE= 0 VIS= all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2 -%GPDSquare - X1_Y1= -134.75 47.281 53.5 - X128_Y1= -134.75 47.281 -58.5 - X1_Y128= -134.75 -52.319 -58.5 - X128_Y128= -134.75 -52.319 53.5 +GPDRectangle + X1_Y1= -134.75 -52.319 53.5 + X128_Y1= -134.75 47.281 53.5 + X1_Y128= -134.75 -52.319 -58.5 + X128_Y128= -134.75 47.281 -58.5 FIRSTSTAGE= 1 - SECONDSTAGE= 1 - THIRDSTAGE= 1 + SECONDSTAGE= 0 + THIRDSTAGE= 0 VIS= all diff --git a/NPLib/GASPARD/GaspardTracker.cxx b/NPLib/GASPARD/GaspardTracker.cxx index c3f1479bd4795c0fc228f640d87916031b58e2e4..af49f5ef6362b41c5bb382358be8446a99b5a43a 100644 --- a/NPLib/GASPARD/GaspardTracker.cxx +++ b/NPLib/GASPARD/GaspardTracker.cxx @@ -44,6 +44,7 @@ #include "GaspardTrackerTrapezoid.h" #include "GaspardTrackerAnnular.h" #include "GaspardTrackerSquare.h" +#include "GaspardTrackerRectangle.h" using namespace std ; @@ -80,6 +81,7 @@ void GaspardTracker::ReadConfiguration(string Path) ConfigFile.open(Path.c_str()); bool GPDTrkSquare = false; + bool GPDTrkRectangle = false; bool GPDTrkTrapezoid = false; bool GPDTrkAnnular = false; bool GPDTrkDummyShape = false; @@ -101,6 +103,20 @@ void GaspardTracker::ReadConfiguration(string Path) myDetector->ReadConfiguration(Path); ConfigFile.open(Path.c_str()); } + else if (LineBuffer.compare(0, 12, "GPDRectangle") == 0 && GPDTrkRectangle == false) { + GPDTrkRectangle = true; + + // instantiate a new "detector" corresponding to the Rectangle elements + GaspardTrackerModule* myDetector = new GaspardTrackerRectangle(m_ModulesMap, m_EventPhysics); + + // Pass the data object to the GaspardTracker*** object + myDetector->SetGaspardDataPointer(m_EventData); + + // read part of the configuration file corresponding to trapezoid elements + 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/GaspardTrackerRectangle.cxx b/NPLib/GASPARD/GaspardTrackerRectangle.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f8e4e1a30f803af9d49a817fb4a38c7fa0ba6a52 --- /dev/null +++ b/NPLib/GASPARD/GaspardTrackerRectangle.cxx @@ -0,0 +1,526 @@ +/***************************************************************************** + * Copyright (C) 2009-2014 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: contact address: * + * * + * Creation Date : * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * * + * * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ +#include "GaspardTrackerRectangle.h" + +// C++ headers +#include <limits> +#include <iostream> +#include <fstream> +#include <string> +#include <cmath> +#include <stdlib.h> + +// Gaspard +#include "TGaspardTrackerPhysics.h" + + +GaspardTrackerRectangle::GaspardTrackerRectangle(map<int, GaspardTrackerModule*> &Module, + TGaspardTrackerPhysics* &EventPhysics) + : m_ModuleTest(Module), + m_EventPhysics(EventPhysics), + m_EventData(0), + m_PreTreatData(new TGaspardTrackerData), + m_NumberOfModule(0), + m_FirstStageLength(112), // mm + m_FirstStageWidth(99.6), // mm + m_NumberOfStrips(128) +{ + m_StripPitchX = m_FirstStageWidth / (double)m_NumberOfStrips; + m_StripPitchY = m_FirstStageLength / (double)m_NumberOfStrips; +} + + + +GaspardTrackerRectangle::~GaspardTrackerRectangle() +{ + delete m_PreTreatData; +} + + + +void GaspardTrackerRectangle::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, 12, "GPDRectangle") == 0) { + cout << "///////////////////////" << endl; + cout << "Rectangle 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, 12, "GPDRectangle") == 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["Rectangle"] + 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["Rectangle"] + 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 GaspardTrackerRectangle::PreTreat() +{ +} + + + +void GaspardTrackerRectangle::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; + + // case of same detector + if (detecXE*detecXT*detecYE*detecYT == 1) { + // store module number + m_EventPhysics->SetModuleNumber(det_ref); + // 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); + + // 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 GaspardTrackerRectangle::BuildSimplePhysicalEvent() +{ +} + + + +void GaspardTrackerRectangle::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(); + + // Definition of vectors U and V are *identical* with definition + // in NPS. + // Vector U parallel to BaseLarge + TVector3 U = C_X128_Y1 - C_X1_Y1; + U = U.Unit(); + + // Vector V parallel to height + 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 + m_StripPitchX/2*U + m_StripPitchY/2*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 + i*m_StripPitchX*U + j*m_StripPitchY*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 GaspardTrackerRectangle::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 ) ; + + double Face = 50; // mm + double NumberOfStrip = 100; + double StripPitch = Face/NumberOfStrip; // mm + + vector<double> lineX; + vector<double> lineY; + vector<double> lineZ; + + vector< vector< double > > OneModuleStripPositionX; + 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() ) ) ; + + for (int i = 0; i < NumberOfStrip; 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 ); + + lineX.push_back(X); + lineY.push_back(Y); + lineZ.push_back(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/GaspardTrackerRectangle.h b/NPLib/GASPARD/GaspardTrackerRectangle.h new file mode 100644 index 0000000000000000000000000000000000000000..5abf984e1127c4560a98723d49f5a77e08f4e548 --- /dev/null +++ b/NPLib/GASPARD/GaspardTrackerRectangle.h @@ -0,0 +1,119 @@ +#ifndef GaspardTrackerRectangle_h +#define GaspardTrackerRectangle_h 1 +/***************************************************************************** + * Copyright (C) 2009-2014 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: contact address: * + * * + * Creation Date : * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + *****************************************************************************/ +// C++ headers +#include <string> +#include <map> +#include <vector> + +// ROOT headers +#include "TVector3.h" + +// Gaspard headers +#include "TGaspardTrackerData.h" +#include "TGaspardTrackerPhysics.h" +#include "GaspardTrackerModule.h" + +using namespace std; + + + +class GaspardTrackerRectangle : public GaspardTrackerModule +{ +public: + //////////////////////////////////////////////////// + /////// Default Constructor and Destructor ///////// + //////////////////////////////////////////////////// + GaspardTrackerRectangle(map<int, GaspardTrackerModule*> &Module, TGaspardTrackerPhysics* &EventPhysics); + virtual ~GaspardTrackerRectangle(); + +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; + TGaspardTrackerPhysics* &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["Rectangle"]][X-1][Y-1]; } + double GetStripPositionY(int N ,int X ,int Y) { return m_StripPositionY[N-1-m_index["Rectangle"]][X-1][Y-1]; } + double GetStripPositionZ(int N ,int X ,int Y) { return m_StripPositionZ[N-1-m_index["Rectangle"]][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_FirstStageLength; // mm + double m_FirstStageWidth; // mm + int m_NumberOfStrips; + double m_StripPitchX; // mm + double m_StripPitchY; // mm +}; + +#endif diff --git a/NPLib/GASPARD/GaspardTrackerRectangle.o b/NPLib/GASPARD/GaspardTrackerRectangle.o new file mode 100644 index 0000000000000000000000000000000000000000..af156dc3d708f33496dbb6b958dc4a3118683d90 Binary files /dev/null and b/NPLib/GASPARD/GaspardTrackerRectangle.o differ diff --git a/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx b/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx index 6fb4980caaf4947c7a91545364565cfc95b3093d..f8208749ee9c4e43e4e9bb2e128e5799b587ebf5 100644 --- a/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx +++ b/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx @@ -42,11 +42,11 @@ GaspardTrackerTrapezoid::GaspardTrackerTrapezoid(map<int, GaspardTrackerModule*> m_PreTreatData(new TGaspardTrackerData), m_NumberOfModule(0), // gaspHyde - m_FirstStageBaseLarge(97.5), // mm - m_FirstStageHeight(113.5), // mm +// m_FirstStageBaseLarge(97.5), // mm +// m_FirstStageHeight(113.5), // mm // mugast -// m_FirstStageBaseLarge(92.326), // mm -// m_FirstStageHeight(105), // mm + m_FirstStageBaseLarge(92.326), // mm + m_FirstStageHeight(105), // mm m_NumberOfStripsX(128), m_NumberOfStripsY(128) { diff --git a/NPLib/GASPARD/Makefile b/NPLib/GASPARD/Makefile index 4dabe04811eb3e92658774a94c924ea70865a2da..c291681ba464226f63117c7eedc5aae7e9044413 100644 --- a/NPLib/GASPARD/Makefile +++ b/NPLib/GASPARD/Makefile @@ -7,8 +7,7 @@ all: $(SHARELIB) ############### Detector ############## ## Gaspard ## -libGaspard.so: TGaspardTrackerData.o TGaspardTrackerDataDict.o GaspardTracker.o TGaspardTrackerPhysics.o TGaspardTrackerPhysicsDict.o GaspardTrackerModule.o GaspardTrackerDummyShape.o GaspardTrackerTrapezoid.o GaspardTrackerAnnular.o GaspardTrackerSquare.o - +libGaspard.so: TGaspardTrackerData.o TGaspardTrackerDataDict.o GaspardTracker.o TGaspardTrackerPhysics.o TGaspardTrackerPhysicsDict.o GaspardTrackerModule.o GaspardTrackerDummyShape.o GaspardTrackerTrapezoid.o GaspardTrackerAnnular.o GaspardTrackerSquare.o GaspardTrackerRectangle.o $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ TGaspardTrackerDataDict.cxx: TGaspardTrackerData.h @@ -28,6 +27,7 @@ GaspardTrackerDummyShape.o: GaspardTrackerDummyShape.cxx GaspardTrackerDummyShap GaspardTrackerTrapezoid.o: GaspardTrackerTrapezoid.cxx GaspardTrackerTrapezoid.h GaspardTrackerAnnular.o: GaspardTrackerAnnular.cxx GaspardTrackerAnnular.h GaspardTrackerSquare.o: GaspardTrackerSquare.cxx GaspardTrackerSquare.h +GaspardTrackerRectangle.o: GaspardTrackerRectangle.cxx GaspardTrackerRectangle.h ####################################### ############# Clean and More ########## diff --git a/NPSimulation/GASPARD/GaspardTracker.cc b/NPSimulation/GASPARD/GaspardTracker.cc index 3130225d0df25ff77d5e19fa35206cd3672b5282..b993cf0d921323368ccdc868bb880244c5edc799 100644 --- a/NPSimulation/GASPARD/GaspardTracker.cc +++ b/NPSimulation/GASPARD/GaspardTracker.cc @@ -29,6 +29,7 @@ // NPTool headers #include "GaspardTracker.hh" #include "GaspardTrackerSquare.hh" +#include "GaspardTrackerRectangle.hh" #include "GaspardTrackerTrapezoid.hh" #include "GaspardTrackerAnnular.hh" #include "GaspardTrackerDummyShape.hh" @@ -57,6 +58,7 @@ void GaspardTracker::ReadConfiguration(string Path) ConfigFile.open(Path.c_str()); bool GPDTrkSquare = false; + bool GPDTrkRectangle = false; bool GPDTrkTrapezoid = false; bool GPDTrkAnnular = false; bool GPDTrkDummyShape = false; @@ -81,6 +83,23 @@ void GaspardTracker::ReadConfiguration(string Path) // store GaspardTrackerSquare "detector" m_Modules.push_back(myDetector); } + else if (LineBuffer.compare(0, 12, "GPDRectangle") == 0 && GPDTrkRectangle == false) { + GPDTrkRectangle = true; + + // instantiate a new "detector" corresponding to the Square elements + GaspardTrackerModule* myDetector = new GaspardTrackerRectangle(); + + // read part of the configuration file corresponding to square elements + ConfigFile.close(); + myDetector->ReadConfiguration(Path); + ConfigFile.open(Path.c_str()); + + // ms_InterCoord comes from VDetector + myDetector->SetInterCoordPointer(ms_InterCoord); + + // store GaspardTrackerSquare "detector" + m_Modules.push_back(myDetector); + } else if (LineBuffer.compare(0, 12, "GPDTrapezoid") == 0 && GPDTrkTrapezoid == false) { GPDTrkTrapezoid = true; diff --git a/NPSimulation/GASPARD/GaspardTrackerAnnular.hh b/NPSimulation/GASPARD/GaspardTrackerAnnular.hh index 68f162721534af4bf914548537e1b08efc6e01b7..bb2abde4f9baa7790ad1e934585c2226958c5b46 100644 --- a/NPSimulation/GASPARD/GaspardTrackerAnnular.hh +++ b/NPSimulation/GASPARD/GaspardTrackerAnnular.hh @@ -142,9 +142,9 @@ namespace GPDANNULAR const G4double FirstStageThickness = 300*micrometer; const G4double FirstStageRmin = 16*mm; // MUGAST -// const G4double FirstStageRmax = 45*mm; + const G4double FirstStageRmax = 45*mm; // gaspHyde - const G4double FirstStageRmax = 52*mm; +// const G4double FirstStageRmax = 52*mm; // const G4double VacBoxThickness = 3*cm ; const G4double VacBoxThickness = 0.4*cm; diff --git a/NPSimulation/GASPARD/GaspardTrackerModule.cc b/NPSimulation/GASPARD/GaspardTrackerModule.cc index 0907c7508c04604e239e478ddb951d53b67f6ccd..6d460fb4e3f54fcd769d331e545a451a793d7d75 100644 --- a/NPSimulation/GASPARD/GaspardTrackerModule.cc +++ b/NPSimulation/GASPARD/GaspardTrackerModule.cc @@ -61,6 +61,7 @@ void GaspardTrackerModule::InitializeRootOutput() void GaspardTrackerModule::InitializeIndex() { m_index["Square"] = 0; + m_index["Rectangle"] = 0; m_index["Trapezoid"] = 100; m_index["Annular"] = 200; m_index["DummyShape"] = 1000; diff --git a/NPSimulation/GASPARD/GaspardTrackerRectangle.cc b/NPSimulation/GASPARD/GaspardTrackerRectangle.cc new file mode 100644 index 0000000000000000000000000000000000000000..c2bf95fd0743cb0252acaab99730545421aa2904 --- /dev/null +++ b/NPSimulation/GASPARD/GaspardTrackerRectangle.cc @@ -0,0 +1,821 @@ +/***************************************************************************** + * Copyright (C) 2009-2013 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : 15/07/09 * + * Last update : 12/10/09 * + *---------------------------------------------------------------------------* + * Decription: Define a module of trapezoidal shape for the Gaspard tracker * + * * + *---------------------------------------------------------------------------* + * Comment: * + * + 12/10/09: Change scorer scheme (N. de Sereville) * + * + 01/10/10: Fix bug with TInteractionCoordinate map size in Read * + * Sensitive (N. de Sereville) * + * * + * * + *****************************************************************************/ + +// C++ headers +#include <sstream> +#include <string> +#include <cmath> + +// G4 Geometry headers +#include "G4Box.hh" + +// G4 various headers +#include "G4MaterialTable.hh" +#include "G4Element.hh" +#include "G4ElementTable.hh" +#include "G4VisAttributes.hh" +#include "G4Colour.hh" +#include "G4RotationMatrix.hh" +#include "G4Transform3D.hh" +#include "G4PVPlacement.hh" +#include "G4PVDivision.hh" + +// G4 sensitive +#include "G4SDManager.hh" +#include "G4MultiFunctionalDetector.hh" + +// NPTool headers +#include "GaspardTrackerRectangle.hh" +#include "ObsoleteGeneralScorers.hh" +#include "GaspardScorers.hh" +#include "SiliconScorers.hh" +#include "MaterialManager.hh" +#include "RootOutput.h" +#include "VDetector.hh" +// CLHEP +#include "CLHEP/Random/RandGauss.h" + +using namespace std; +using namespace CLHEP; + +using namespace GPDRECT; +using namespace GPDSCORERS; + + + + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +GaspardTrackerRectangle::GaspardTrackerRectangle() +{ + ms_InterCoord = 0; +} + + + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +GaspardTrackerRectangle::~GaspardTrackerRectangle() +{ +} + + + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +void GaspardTrackerRectangle::AddModule(G4ThreeVector X1_Y1 , + G4ThreeVector X128_Y1 , + G4ThreeVector X1_Y128 , + G4ThreeVector X128_Y128 , + bool wFirstStage , + bool wSecondStage , + bool wThirdStage) +{ + m_DefinitionType.push_back(true) ; + + m_X1_Y1.push_back(X1_Y1) ; + m_X128_Y1.push_back(X128_Y1) ; + m_X1_Y128.push_back(X1_Y128) ; + m_X128_Y128.push_back(X128_Y128) ; + m_wFirstStage.push_back(wFirstStage) ; + m_wSecondStage.push_back(wSecondStage) ; + m_wThirdStage.push_back(wThirdStage) ; + + m_R.push_back(0) ; + m_Theta.push_back(0) ; + m_Phi.push_back(0) ; + m_beta_u.push_back(0) ; + m_beta_v.push_back(0) ; + m_beta_w.push_back(0) ; +} + + + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +void GaspardTrackerRectangle::AddModule(G4double R , + G4double Theta , + G4double Phi , + G4double beta_u , + G4double beta_v , + G4double beta_w , + bool wFirstStage , + bool wSecondStage , + bool wThirdStage) +{ + G4ThreeVector empty = G4ThreeVector(0, 0, 0); + + m_DefinitionType.push_back(false); + + m_R.push_back(R) ; + m_Theta.push_back(Theta) ; + m_Phi.push_back(Phi) ; + m_beta_u.push_back(beta_u) ; + m_beta_v.push_back(beta_v) ; + m_beta_w.push_back(beta_w) ; + m_wFirstStage.push_back(wFirstStage) ; + m_wSecondStage.push_back(wSecondStage) ; + m_wThirdStage.push_back(wThirdStage) ; + + m_X1_Y1.push_back(empty) ; + m_X128_Y1.push_back(empty) ; + m_X1_Y128.push_back(empty) ; + m_X128_Y128.push_back(empty) ; +} + + + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +void GaspardTrackerRectangle::VolumeMaker(G4int DetectorNumber, + G4ThreeVector MMpos, + G4RotationMatrix* MMrot, + bool wFirstStage, + bool wSecondStage, + bool wThirdStage, + G4LogicalVolume* world) +{ + G4double NbrTelescopes = DetectorNumber ; + G4String DetNumber ; + ostringstream Number ; + Number << NbrTelescopes ; + DetNumber = Number.str() ; + + //////////////////////////////////////////////////////////////// + ////////////// Starting Volume Definition ////////////////////// + //////////////////////////////////////////////////////////////// + G4String Name = "GPDRectangle" + DetNumber ; + + // Definition of the volume containing the sensitive detector + G4Box* solidGPDRectangle = new G4Box(Name, 0.5*Width, 0.5*Length, Depth/2); + G4LogicalVolume* logicGPDRectangle = new G4LogicalVolume(solidGPDRectangle, m_MaterialVacuum, Name, 0, 0, 0); + + new G4PVPlacement(G4Transform3D(*MMrot, MMpos), logicGPDRectangle, Name, world, false, DetectorNumber); + + G4VisAttributes* RectangleeVisAtt = new G4VisAttributes(G4Colour(0.90, 0.90, 0.90)); + RectangleeVisAtt->SetForceWireframe(true); + logicGPDRectangle->SetVisAttributes(RectangleeVisAtt); + + //Place two marker to identify the u and v axis on silicon face: + //marker are placed a bit before the silicon itself so they don't perturbate simulation + //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 , m_MaterialVacuum , "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); + + G4ThreeVector positionMarkerV = CT*0.98 + MMv*SiliconFace/4; + G4Box* solidMarkerV = new G4Box( "solidMarkerU" , 1*mm , SiliconFace/4 , 1*mm ) ; + G4LogicalVolume* logicMarkerV = new G4LogicalVolume( solidMarkerV , m_MaterialVacuum , "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); + */ + + //////////////////////////////////////////////////////////////// + /////////////////// First Stage Construction//////////////////// + //////////////////////////////////////////////////////////////// + if (wFirstStage) { + // Silicon detector itself + G4ThreeVector positionFirstStage = G4ThreeVector(0, 0, FirstStage_PosZ); + + G4Box* solidFirstStage = new G4Box("solidFirstStage", 0.5*FirstStageWidth, 0.5*FirstStageLength, 0.5*FirstStageThickness); + G4LogicalVolume* logicFirstStage = new G4LogicalVolume(solidFirstStage, m_MaterialSilicon, "logicFirstStage", 0, 0, 0); + + new G4PVPlacement(0, + positionFirstStage, + logicFirstStage, + Name + "_FirstStage", + logicGPDRectangle, + false, + DetectorNumber); + + // Set First Stage sensible + logicFirstStage->SetSensitiveDetector(m_FirstStageScorer); + + ///Visualisation of FirstStage Strip + G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(0.3, 0.3, 0.3)); // blue + logicFirstStage->SetVisAttributes(FirstStageVisAtt); + } + + //////////////////////////////////////////////////////////////// + //////////////// Second Stage Construction //////////////////// + //////////////////////////////////////////////////////////////// + if (wSecondStage) { + // Second stage silicon detector + G4ThreeVector positionSecondStage = G4ThreeVector(0, 0, SecondStage_PosZ); + + G4Box* solidSecondStage = new G4Box("solidSecondStage", 0.5*SecondStageWidth, 0.5*SecondStageLength, 0.5*SecondStageThickness); + G4LogicalVolume* logicSecondStage = new G4LogicalVolume(solidSecondStage, m_MaterialSilicon, "logicSecondStage", 0, 0, 0); + + new G4PVPlacement(0, + positionSecondStage, + logicSecondStage, + Name + "_SecondStage", + logicGPDRectangle, + false, + DetectorNumber); + + // Set Second Stage sensible + logicSecondStage->SetSensitiveDetector(m_SecondStageScorer); + + ///Visualisation of SecondStage Strip + G4VisAttributes* SecondStageVisAtt = new G4VisAttributes(G4Colour(0.3, 0.3, 0.3)); + logicSecondStage->SetVisAttributes(SecondStageVisAtt); + } + + //////////////////////////////////////////////////////////////// + ///////////////// Third Stage Construction ///////////////////// + //////////////////////////////////////////////////////////////// + if (wThirdStage) { + // Third stage silicon detector + G4ThreeVector positionThirdStage = G4ThreeVector(0, 0, ThirdStage_PosZ); + + G4Box* solidThirdStage = new G4Box("solidThirdStage", 0.5*ThirdStageWidth, 0.5*ThirdStageLength, 0.5*ThirdStageThickness); + G4LogicalVolume* logicThirdStage = new G4LogicalVolume(solidThirdStage, m_MaterialSilicon, "logicThirdStage", 0, 0, 0); + + new G4PVPlacement(0, + positionThirdStage, + logicThirdStage, + Name + "_ThirdStage", + logicGPDRectangle, + false, + DetectorNumber); + + // Set Third Stage sensible + logicThirdStage->SetSensitiveDetector(m_ThirdStageScorer); + + ///Visualisation of Third Stage + G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.3, 0.3, 0.3)); // red + logicThirdStage->SetVisAttributes(ThirdStageVisAtt); + } +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +// Virtual Method of VDetector class + +// Read stream at Configfile to pick-up parameters of detector (Position,...) +// Called in DetecorConstruction::ReadDetextorConfiguration Method +void GaspardTrackerRectangle::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 + + G4double Ax , Bx , Cx , Dx , Ay , By , Cy , Dy , Az , Bz , Cz , Dz ; + G4ThreeVector A , B , C , D ; + G4double Theta = 0 , Phi = 0 , R = 0 , beta_u = 0 , beta_v = 0 , beta_w = 0 ; + int FIRSTSTAGE = 0 , SECONDSTAGE = 0 , THIRDSTAGE = 0 ; + + bool ReadingStatus = false ; + + 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_FirstStage = false ; + bool check_SecondStage = false ; + bool check_ThirdStage = false ; + bool checkVis = false ; + + while (!ConfigFile.eof()) { + getline(ConfigFile, LineBuffer); + if (LineBuffer.compare(0, 12, "GPDRectangle") == 0) { + G4cout << "///" << G4endl ; + G4cout << "Rectangle element found: " << G4endl ; + ReadingStatus = true ; + } + + while(ReadingStatus){ + + ConfigFile >> DataBuffer; + // Comment Line + if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} + + // Position method + else if (DataBuffer.compare(0, 6, "X1_Y1=") == 0) { + check_A = true; + ConfigFile >> DataBuffer ; + Ax = atof(DataBuffer.c_str()) ; + Ax = Ax * mm ; + ConfigFile >> DataBuffer ; + Ay = atof(DataBuffer.c_str()) ; + Ay = Ay * mm ; + ConfigFile >> DataBuffer ; + Az = atof(DataBuffer.c_str()) ; + Az = Az * mm ; + + A = G4ThreeVector(Ax, Ay, Az); + G4cout << "X1 Y1 corner position : " << A << G4endl; + } + + else if (DataBuffer.compare(0, 8, "X128_Y1=") == 0) { + check_B = true; + ConfigFile >> DataBuffer ; + Bx = atof(DataBuffer.c_str()) ; + Bx = Bx * mm ; + ConfigFile >> DataBuffer ; + By = atof(DataBuffer.c_str()) ; + By = By * mm ; + ConfigFile >> DataBuffer ; + Bz = atof(DataBuffer.c_str()) ; + Bz = Bz * mm ; + + B = G4ThreeVector(Bx, By, Bz); + G4cout << "X128 Y1 corner position : " << B << G4endl; + } + + else if (DataBuffer.compare(0, 8, "X1_Y128=") == 0) { + check_C = true; + ConfigFile >> DataBuffer ; + Cx = atof(DataBuffer.c_str()) ; + Cx = Cx * mm ; + ConfigFile >> DataBuffer ; + Cy = atof(DataBuffer.c_str()) ; + Cy = Cy * mm ; + ConfigFile >> DataBuffer ; + Cz = atof(DataBuffer.c_str()) ; + Cz = Cz * mm ; + + C = G4ThreeVector(Cx, Cy, Cz); + G4cout << "X1 Y128 corner position : " << C << G4endl; + } + + else if (DataBuffer.compare(0, 10, "X128_Y128=") == 0) { + check_D = true; + ConfigFile >> DataBuffer ; + Dx = atof(DataBuffer.c_str()) ; + Dx = Dx * mm ; + ConfigFile >> DataBuffer ; + Dy = atof(DataBuffer.c_str()) ; + Dy = Dy * mm ; + ConfigFile >> DataBuffer ; + Dz = atof(DataBuffer.c_str()) ; + Dz = Dz * mm ; + + D = G4ThreeVector(Dx, Dy, Dz); + G4cout << "X128 Y128 corner position : " << D << G4endl; + } + + + // Angle method + else if (DataBuffer.compare(0, 6, "THETA=") == 0) { + check_Theta = true; + ConfigFile >> DataBuffer ; + Theta = atof(DataBuffer.c_str()) ; + Theta = Theta * deg; + G4cout << "Theta: " << Theta / deg << G4endl; + } + + else if (DataBuffer.compare(0, 4, "PHI=") == 0) { + check_Phi = true; + ConfigFile >> DataBuffer ; + Phi = atof(DataBuffer.c_str()) ; + Phi = Phi * deg; + G4cout << "Phi: " << Phi / deg << G4endl; + } + + else if (DataBuffer.compare(0, 2, "R=") == 0) { + check_R = true; + ConfigFile >> DataBuffer ; + R = atof(DataBuffer.c_str()) ; + R = R * mm; + G4cout << "R: " << R / mm << G4endl; + } + + else if (DataBuffer.compare(0, 5, "BETA=") == 0) { + ConfigFile >> DataBuffer ; + beta_u = atof(DataBuffer.c_str()) ; + beta_u = beta_u * deg ; + ConfigFile >> DataBuffer ; + beta_v = atof(DataBuffer.c_str()) ; + beta_v = beta_v * deg ; + ConfigFile >> DataBuffer ; + beta_w = atof(DataBuffer.c_str()) ; + beta_w = beta_w * deg ; + G4cout << "Beta: " << beta_u / deg << " " << beta_v / deg << " " << beta_w / deg << G4endl ; + } + + else if (DataBuffer.compare(0, 11, "FIRSTSTAGE=") == 0) { + check_FirstStage = true ; + ConfigFile >> DataBuffer; + FIRSTSTAGE = atof(DataBuffer.c_str()) ; + } + + else if (DataBuffer.compare(0, 12, "SECONDSTAGE=") == 0) { + check_SecondStage = true ; + ConfigFile >> DataBuffer; + SECONDSTAGE = atof(DataBuffer.c_str()) ; + } + + else if (DataBuffer.compare(0, 11, "THIRDSTAGE=") == 0) { + check_ThirdStage = true ; + ConfigFile >> DataBuffer; + THIRDSTAGE = atof(DataBuffer.c_str()) ; + } + + else if (DataBuffer.compare(0, 4, "VIS=") == 0) { + checkVis = true ; + ConfigFile >> DataBuffer; + if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; + } + + else G4cout << "WARNING: Wrong Token, GaspardTrackerRectangle: Rectangle Element not added" << G4endl; + + //Add The previously define telescope + //With position method + if ((check_A && check_B && check_C && check_D && check_FirstStage && check_SecondStage && check_ThirdStage && checkVis) && !(check_Theta && check_Phi && check_R)) { + + ReadingStatus = false ; + check_A = false ; + check_C = false ; + check_B = false ; + check_D = false ; + check_FirstStage = false ; + check_SecondStage = false ; + check_ThirdStage = false ; + checkVis = false ; + + AddModule(A , + B , + C , + D , + FIRSTSTAGE == 1 , + SECONDSTAGE == 1 , + THIRDSTAGE == 1); + } + + //with angle method + if ((check_Theta && check_Phi && check_R && check_FirstStage && check_SecondStage && check_ThirdStage && checkVis) && !(check_A && check_B && check_C && check_D)) { + ReadingStatus = false ; + check_Theta = false ; + check_Phi = false ; + check_R = false ; + check_FirstStage = false ; + check_SecondStage = false ; + check_ThirdStage = false ; + checkVis = false ; + + AddModule(R , + Theta , + Phi , + beta_u , + beta_v , + beta_w , + FIRSTSTAGE == 1 , + SECONDSTAGE == 1 , + THIRDSTAGE == 1); + } + + + } + } +} + +// Construct detector and inialise sensitive part. +// Called After DetecorConstruction::AddDetector Method +void GaspardTrackerRectangle::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 MMw = G4ThreeVector(0, 0, 0); + G4ThreeVector MMCenter = G4ThreeVector(0, 0, 0); + + bool FirstStage = true ; + bool SecondStage = true ; + bool ThirdStage = true ; + + G4int NumberOfModule = m_DefinitionType.size() ; + + for (G4int i = 0; i < NumberOfModule; i++) { + // By Point + if (m_DefinitionType[i]) { + // (u,v,w) unitary vector associated to trapezoidal referencial + // (u,v) // to silicon plan + // ------ + // | | ^ + // | | | v + // | | | + // ------ <------ + // u + // w perpendicular to (u,v) plan and pointing ThirdStage + G4cout << "XXXXXXXXXXXX Rectangle " << i << " XXXXXXXXXXXXX" << G4endl; + MMu = m_X128_Y1[i] - m_X1_Y1[i]; + MMu = MMu.unit(); + G4cout << "MMu: " << MMu << G4endl; + + MMv = 0.5 * (m_X1_Y128[i] + m_X128_Y128[i] - m_X1_Y1[i] - m_X128_Y1[i]); + MMv = MMv.unit(); + G4cout << "MMv: " << MMv << G4endl; + + MMw = MMu.cross(MMv); + MMw = MMw.unit(); + G4cout << "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; + + // Passage Matrix from Lab Referential to Module Referential + MMrot = new G4RotationMatrix(MMu, MMv, MMw); + // translation to place Module + MMpos = MMw * Depth * 0.5 + MMCenter; + } + + // By Angle + else { + G4double Theta = m_Theta[i]; + G4double Phi = m_Phi[i]; + + // (u,v,w) unitary vector associated to telescope referencial + // (u,v) // to silicon plan + // ------- + // / \ ^ + // / \ | v + // / \ | + // --------------- <------ + // u + // 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); + + // vector corresponding to the center of the module + MMCenter = MMw; + + // vector parallel to one axis of silicon plane + // in fact, this is vector u + G4double ii = cos(Theta / rad) * cos(Phi / rad); + G4double jj = cos(Theta / rad) * sin(Phi / rad); + G4double kk = -sin(Theta / rad); + G4ThreeVector Y = G4ThreeVector(ii, jj, kk); + + MMw = MMw.unit(); + MMv = MMw.cross(Y); + MMu = MMv.cross(MMw); + MMv = MMv.unit(); + MMu = MMu.unit(); + + G4cout << "XXXXXXXXXXXX Rectangle " << i << " XXXXXXXXXXXXX" << G4endl; + G4cout << "MMu: " << MMu << G4endl; + G4cout << "MMv: " << MMv << G4endl; + G4cout << "MMw: " << MMw << G4endl; + + // Passage Matrix from Lab Referential to Telescope Referential + 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 * Depth * 0.5 + MMCenter; + } + + FirstStage = m_wFirstStage[i]; + SecondStage = m_wSecondStage[i]; + ThirdStage = m_wThirdStage[i]; + + VolumeMaker(i + 1, MMpos, MMrot, FirstStage, SecondStage, ThirdStage, world); + } + + delete MMrot; +} + + + +// Connect the GaspardTrackingData class to the output TTree +// of the simulation +void GaspardTrackerRectangle::InitializeRootOutput() +{ +} + + + +// Set the TinteractionCoordinates object from VDetector to the present class +void GaspardTrackerRectangle::SetInterCoordPointer(TInteractionCoordinates* interCoord) +{ + ms_InterCoord = interCoord; +} + + + +// Read sensitive part and fill the Root tree. +// Called at in the EventAction::EndOfEventAvtion +void GaspardTrackerRectangle::ReadSensitive(const G4Event* event) +{ + ////////////// + // First stage + G4THitsMap<G4double*>* GPD1HitMap; + std::map<G4int, G4double**>::iterator GPD1_itr; + + G4int GPD1CollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerGPDRectangle/GPDRectangleFirstStage"); + GPD1HitMap = (G4THitsMap<G4double*>*)(event->GetHCofThisEvent()->GetHC(GPD1CollectionID)); + + // Loop on the GPD map + for (GPD1_itr = GPD1HitMap->GetMap()->begin(); GPD1_itr != GPD1HitMap->GetMap()->end(); GPD1_itr++) { + G4double* Info = *(GPD1_itr->second); + + double Energy = Info[0]; + if (Energy > EnergyThreshold) { + double Time = Info[1]; + int DetNbr = (int) Info[7]; + int StripFront = (int) Info[8]; + int StripBack = (int) Info[9]; + + // detector number + ms_Event->SetGPDTrkFirstStageFrontEDetectorNbr(m_index["Rectangle"] + DetNbr); + ms_Event->SetGPDTrkFirstStageFrontTDetectorNbr(m_index["Rectangle"] + DetNbr); + ms_Event->SetGPDTrkFirstStageBackEDetectorNbr(m_index["Rectangle"] + DetNbr); + ms_Event->SetGPDTrkFirstStageBackTDetectorNbr(m_index["Rectangle"] + DetNbr); + + // energy + ms_Event->SetGPDTrkFirstStageFrontEEnergy(RandGauss::shoot(Energy, ResoFirstStage)); + ms_Event->SetGPDTrkFirstStageBackEEnergy(RandGauss::shoot(Energy, ResoFirstStage)); + + // time + Time = RandGauss::shoot(Time, ResoTimePPAC); + ms_Event->SetGPDTrkFirstStageFrontTTime(RandGauss::shoot(Time, ResoTimeGpd)); + ms_Event->SetGPDTrkFirstStageBackTTime(RandGauss::shoot(Time, ResoTimeGpd)); + + // strips X and Y + ms_Event->SetGPDTrkFirstStageFrontEStripNbr(StripFront); + ms_Event->SetGPDTrkFirstStageFrontTStripNbr(StripFront); + ms_Event->SetGPDTrkFirstStageBackEStripNbr(StripBack); + ms_Event->SetGPDTrkFirstStageBackTStripNbr(StripBack); + + // Interaction Coordinates + ms_InterCoord->SetDetectedPositionX(Info[2]); + ms_InterCoord->SetDetectedPositionY(Info[3]); + ms_InterCoord->SetDetectedPositionZ(Info[4]); + ms_InterCoord->SetDetectedAngleTheta(Info[5]/deg); + ms_InterCoord->SetDetectedAnglePhi(Info[6]/deg); + } + } + // clear map for next event + GPD1HitMap->clear(); + + + ////////////// + // Second stage + G4THitsMap<G4double*>* GPD2HitMap; + std::map<G4int, G4double**>::iterator GPD2_itr; + + G4int GPD2CollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("SecondStageScorerGPDRectangle/GPDRectangleSecondStage"); + GPD2HitMap = (G4THitsMap<G4double*>*)(event->GetHCofThisEvent()->GetHC(GPD2CollectionID)); + + // Loop on the GPD map + for (GPD2_itr = GPD2HitMap->GetMap()->begin(); GPD2_itr != GPD2HitMap->GetMap()->end(); GPD2_itr++) { + G4double* Info = *(GPD2_itr->second); + + double Energy = Info[0]; + if (Energy > EnergyThreshold) { + double Time = Info[1]; + int DetNbr = (int) Info[7]; + int StripFront = (int) Info[8]; + + // detector number + ms_Event->SetGPDTrkSecondStageEDetectorNbr(m_index["Rectangle"] + DetNbr); + ms_Event->SetGPDTrkSecondStageTDetectorNbr(m_index["Rectangle"] + DetNbr); + + // energy + ms_Event->SetGPDTrkSecondStageEEnergy(RandGauss::shoot(Energy, ResoSecondStage)); + + // time + Time = RandGauss::shoot(Time, ResoTimePPAC); + ms_Event->SetGPDTrkSecondStageTTime(RandGauss::shoot(Time, ResoTimeGpd)); + + // strips X and Y + ms_Event->SetGPDTrkSecondStageEPadNbr(StripFront); + ms_Event->SetGPDTrkSecondStageTPadNbr(StripFront); + } + } + // clear map for next event + GPD2HitMap->clear(); + + + ////////////// + // Third stage + G4THitsMap<G4double*>* GPD3HitMap; + std::map<G4int, G4double**>::iterator GPD3_itr; + + G4int GPD3CollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("ThirdStageScorerGPDRectangle/GPDRectangleThirdStage"); + GPD3HitMap = (G4THitsMap<G4double*>*)(event->GetHCofThisEvent()->GetHC(GPD3CollectionID)); + + // Loop on the GPD map + for (GPD3_itr = GPD3HitMap->GetMap()->begin(); GPD3_itr != GPD3HitMap->GetMap()->end(); GPD3_itr++) { + G4double* Info = *(GPD3_itr->second); + + double Energy = Info[0]; + if (Energy > EnergyThreshold) { + double Time = Info[1]; + int DetNbr = (int) Info[7]; + int StripFront = (int) Info[8]; + + // detector number + ms_Event->SetGPDTrkThirdStageEDetectorNbr(m_index["Rectangle"] + DetNbr); + ms_Event->SetGPDTrkThirdStageTDetectorNbr(m_index["Rectangle"] + DetNbr); + + // energy + ms_Event->SetGPDTrkThirdStageEEnergy(RandGauss::shoot(Energy, ResoThirdStage)); + + // time + Time = RandGauss::shoot(Time, ResoTimePPAC); + ms_Event->SetGPDTrkThirdStageTTime(RandGauss::shoot(Time, ResoTimeGpd)); + + // strips X and Y + ms_Event->SetGPDTrkThirdStageEPadNbr(StripFront); + ms_Event->SetGPDTrkThirdStageTPadNbr(StripFront); + } + } + // clear map for next event + GPD3HitMap->clear(); +} + + + +void GaspardTrackerRectangle::InitializeScorers() +{ + // check whether scorers are already defined + bool already_exist = false; + m_FirstStageScorer = VDetector::CheckScorer("FirstStageScorerGPDRectangle", already_exist); + m_SecondStageScorer = VDetector::CheckScorer("SecondStageScorerGPDRectangle", already_exist); + m_ThirdStageScorer = VDetector::CheckScorer("ThirdStageScorerGPDRectangle", already_exist); + if (already_exist) return; + + // First stage scorer + G4VPrimitiveScorer* GPDScorerFirstStage = + new SILICONSCORERS::PS_Silicon_Rectangle("GPDRectangleFirstStage", + 0, + FirstStageWidth, + FirstStageLength, + NumberOfStrips, + NumberOfStrips); + + // Second stage scorer + G4VPrimitiveScorer* GPDScorerSecondStage = + new SILICONSCORERS::PS_Silicon_Rectangle("GPDRectangleSecondStage", + 0, + SecondStageWidth, + SecondStageLength, + 1, + 1); + + // Third stage scorer + G4VPrimitiveScorer* GPDScorerThirdStage = + new SILICONSCORERS::PS_Silicon_Rectangle("GPDRectangleThirdStage", + 0, + ThirdStageWidth, + ThirdStageLength, + 1, + 1); + + // register scorers to the multifunctionnal detector + m_FirstStageScorer ->RegisterPrimitive(GPDScorerFirstStage); + m_SecondStageScorer ->RegisterPrimitive(GPDScorerSecondStage); + m_ThirdStageScorer ->RegisterPrimitive(GPDScorerThirdStage); + + // Add All Scorer to the Global Scorer Manager + G4SDManager::GetSDMpointer()->AddNewDetector(m_FirstStageScorer); + G4SDManager::GetSDMpointer()->AddNewDetector(m_SecondStageScorer); + G4SDManager::GetSDMpointer()->AddNewDetector(m_ThirdStageScorer); +} diff --git a/NPSimulation/GASPARD/GaspardTrackerRectangle.hh b/NPSimulation/GASPARD/GaspardTrackerRectangle.hh new file mode 100644 index 0000000000000000000000000000000000000000..51f160cb8175de12bdd6ec7e71cde18b8cb6dd7e --- /dev/null +++ b/NPSimulation/GASPARD/GaspardTrackerRectangle.hh @@ -0,0 +1,182 @@ +#ifndef GaspardTrackerRectangle_h +#define GaspardTrackerRectangle_h 1 +/***************************************************************************** + * Copyright (C) 2009-2013 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : 15/07/09 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: Define a module of trapezoidal shape for the Gaspard tracker * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ + + + +// C++ headers +#include <vector> + +// NPTool header +#include "GaspardTrackerModule.hh" +#include "TInteractionCoordinates.h" + +using namespace std; + using namespace CLHEP; + + + +class GaspardTrackerRectangle : public GaspardTrackerModule +{ + //////////////////////////////////////////////////// + /////// Default Constructor and Destructor ///////// + //////////////////////////////////////////////////// +public: + GaspardTrackerRectangle(); + virtual ~GaspardTrackerRectangle(); + + //////////////////////////////////////////////////// + //////// Specific Function of this Class /////////// + //////////////////////////////////////////////////// +public: + // By Position Method + void AddModule(G4ThreeVector TL , + G4ThreeVector BL , + G4ThreeVector BR , + G4ThreeVector CT , + bool wFirstStage , + bool wSecondStage , + bool wThirdStage); + + // By Angle Method + void AddModule(G4double R , + G4double Theta , + G4double Phi , + G4double beta_u , + G4double beta_v , + G4double beta_w , + bool wFirstStage , + bool wSecondStage , + bool wThirdStage); + + // Effectively construct Volume + // Avoid to have two time same code for Angle and Point definition + void VolumeMaker(G4int DetectorNumber, + G4ThreeVector MMpos, + G4RotationMatrix* MMrot, + bool wFirstStage, + bool wSecondStage, + bool wThirdStage, + G4LogicalVolume* world); + + + //////////////////////////////////////////////////// + //// Inherite from GaspardTrackerModule class ///// + //////////////////////////////////////////////////// +public: + // Read stream at Configfile to pick-up parameters of detector (Position,...) + // Called in DetecorConstruction::ReadDetextorConfiguration Method + void ReadConfiguration(string Path); + + // Construct detector and inialise sensitive part. + // Called After DetecorConstruction::AddDetector Method + void ConstructDetector(G4LogicalVolume* world); + + // Add Detector branch to the EventTree. + // Called After DetecorConstruction::AddDetector Method + void InitializeRootOutput(); + + // Initialize all scorers necessary for the detector + void InitializeScorers(); + + // Read sensitive part and fill the Root tree. + // Called at in the EventAction::EndOfEventAvtion + void ReadSensitive(const G4Event* event); + + // Give the static TInteractionCoordinates from VDetector to the classes + // deriving from GaspardTrackerModule + // This is mandatory since the GaspardTracker*** does not derive from VDetector + void SetInterCoordPointer(TInteractionCoordinates* interCoord); + TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; + + + //////////////////////////////////////////////////// + ///////////////Private intern Data////////////////// + //////////////////////////////////////////////////// +private: + // Interaction Coordinates coming from VDetector through the + // SetInteractionCoordinatesPointer method + TInteractionCoordinates* ms_InterCoord; + + // True if Define by Position, False is Define by angle + vector<bool> m_DefinitionType ; + + // Used for "By Point Definition" + vector<G4ThreeVector> m_X1_Y1 ; // Top Left Corner Position Vector + vector<G4ThreeVector> m_X1_Y128 ; // Bottom Left Corner Position Vector + vector<G4ThreeVector> m_X128_Y1 ; // Bottom Right Corner Position Vector + vector<G4ThreeVector> m_X128_Y128 ; // Center Corner Position Vector + + // Used for "By Angle Definition" + vector<G4double> m_R ; // | + vector<G4double> m_Theta ; // > Spherical coordinate of Strips Silicium Plate + vector<G4double> m_Phi ; // | + + vector<G4double> m_beta_u ; // | + vector<G4double> m_beta_v ; // > Tilt angle of the Telescope + vector<G4double> m_beta_w ; // | +}; + + + +namespace GPDRECT +{ + // Energy/Time resolutions for the different layers + const G4double ResoFirstStage = 0.021 ;// = 52keV of Resolution // Unit is MeV/2.35 + const G4double ResoSecondStage = 0.043 ;// = 130 keV of resolution // Unit is MeV/2.35 + const G4double ResoThirdStage = 0.043 ;// = 100 kev of resolution // Unit is MeV/2.35 + const G4double ResoTimeGpd = 0.212765957 ;// = 500ps // Unit is ns/2.35 + const G4double ResoTimePPAC = 0.106382979 ;// = 250ps // Unit is ns/2.35 + + + // Threshold + const G4double EnergyThreshold = 0.2*MeV; + + // Geometry + const G4double Length = 115*mm; + const G4double Width = 101*mm; + const G4double Depth = 20*mm; + const G4double InterStageDistance = 7*mm; + + // First stage + const G4double FirstStageLength = 112.0*mm; + const G4double FirstStageWidth = 99.6*mm; + const G4double FirstStageThickness = 500*micrometer; + const G4int NumberOfStrips = 128; + + // Second stage + const G4double SecondStageLength = FirstStageLength; + const G4double SecondStageWidth = FirstStageWidth; + const G4double SecondStageThickness = 1.5*mm; + + // Third stage + const G4double ThirdStageLength = FirstStageLength; + const G4double ThirdStageWidth = FirstStageWidth; + const G4double ThirdStageThickness = 1.5*mm; + + // Starting at the front of the first stage and pointing to the third stage + const G4double FirstStage_PosZ = Depth* -0.5 + 0.5*FirstStageThickness; + const G4double SecondStage_PosZ = Depth* -0.5 + 0.5*SecondStageThickness + 1*InterStageDistance; + const G4double ThirdStage_PosZ = Depth* -0.5 + 0.5*ThirdStageThickness + 2*InterStageDistance; +} + +#endif diff --git a/NPSimulation/GASPARD/GaspardTrackerTrapezoid.hh b/NPSimulation/GASPARD/GaspardTrackerTrapezoid.hh index f6993c11ca73e586e60d94eb31378cf3139cba48..5e564cf44a2ce33d5ed19201ea4c4e4a4e5411df 100644 --- a/NPSimulation/GASPARD/GaspardTrackerTrapezoid.hh +++ b/NPSimulation/GASPARD/GaspardTrackerTrapezoid.hh @@ -154,17 +154,17 @@ namespace GPDTRAP // const G4double BaseSmall = 35*mm; // const G4double Length = 20*mm; // gaspHyde - const G4double Height = 115*mm; - const G4double BaseLarge = 98*mm; - const G4double BaseSmall = 30*mm; - const G4double Length = 20*mm; - const G4double InterStageDistance = 7*mm; - // mugast -// const G4double Height = 106*mm; -// const G4double BaseLarge = 93*mm; -// const G4double BaseSmall = 26*mm; +// const G4double Height = 115*mm; +// const G4double BaseLarge = 98*mm; +// const G4double BaseSmall = 30*mm; // const G4double Length = 20*mm; // const G4double InterStageDistance = 7*mm; + // mugast + const G4double Height = 106*mm; + const G4double BaseLarge = 93*mm; + const G4double BaseSmall = 26*mm; + const G4double Length = 20*mm; + const G4double InterStageDistance = 7*mm; // First stage // const G4double FirstStageThickness = 300*micrometer; @@ -177,13 +177,13 @@ namespace GPDTRAP // const G4double FirstStageBaseLarge = 78*mm; // const G4double FirstStageBaseSmall = 29*mm; // gaspHyde - const G4double FirstStageHeight = 113.5*mm; - const G4double FirstStageBaseLarge = 97.5*mm; - const G4double FirstStageBaseSmall = 28.5*mm; +// const G4double FirstStageHeight = 113.5*mm; +// const G4double FirstStageBaseLarge = 97.5*mm; +// const G4double FirstStageBaseSmall = 28.5*mm; // mugast -// const G4double FirstStageHeight = 105*mm; -// const G4double FirstStageBaseLarge = 92.326*mm; -// const G4double FirstStageBaseSmall = 25.77*mm; + const G4double FirstStageHeight = 105*mm; + const G4double FirstStageBaseLarge = 92.326*mm; + const G4double FirstStageBaseSmall = 25.77*mm; // Second stage const G4double SecondStageHeight = FirstStageHeight;