From 75c60272a0f2c340fa62c280764041995dc0dfa2 Mon Sep 17 00:00:00 2001 From: nicolas <nicolas@nptool> Date: Fri, 15 Feb 2013 23:20:40 +0000 Subject: [PATCH] * remove Hyde project since it is now replaced by the Hyde2 project --- NPLib/HYDE/HydeTracker.cxx | 894 ------------- NPLib/HYDE/HydeTracker.h | 143 -- NPLib/HYDE/Makefile | 39 - NPLib/HYDE/THydeTrackerData.cxx | 133 -- NPLib/HYDE/THydeTrackerData.h | 292 ----- NPLib/HYDE/THydeTrackerPhysics.cxx | 207 --- NPLib/HYDE/THydeTrackerPhysics.h | 79 -- NPSimulation/include/HydeScorers.hh | 300 ----- NPSimulation/include/HydeTracker.hh | 73 -- NPSimulation/include/HydeTrackerAnnular.hh | 157 --- NPSimulation/include/HydeTrackerDummyShape.hh | 194 --- NPSimulation/include/HydeTrackerModule.hh | 101 -- NPSimulation/include/HydeTrackerSquare.hh | 191 --- NPSimulation/include/HydeTrackerTrapezoid.hh | 196 --- NPSimulation/src/HydeScorers.cc | 764 ----------- NPSimulation/src/HydeTracker.cc | 191 --- NPSimulation/src/HydeTrackerAnnular.cc | 804 ------------ NPSimulation/src/HydeTrackerDummyShape.cc | 977 -------------- NPSimulation/src/HydeTrackerModule.cc | 63 - NPSimulation/src/HydeTrackerSquare.cc | 1161 ----------------- NPSimulation/src/HydeTrackerTrapezoid.cc | 1029 --------------- NPSimulation/src/MUST2Array.cc | 6 +- NPSimulation/src/Must2Scorers.cc | 5 +- 23 files changed, 6 insertions(+), 7993 deletions(-) delete mode 100644 NPLib/HYDE/HydeTracker.cxx delete mode 100644 NPLib/HYDE/HydeTracker.h delete mode 100644 NPLib/HYDE/Makefile delete mode 100644 NPLib/HYDE/THydeTrackerData.cxx delete mode 100644 NPLib/HYDE/THydeTrackerData.h delete mode 100644 NPLib/HYDE/THydeTrackerPhysics.cxx delete mode 100644 NPLib/HYDE/THydeTrackerPhysics.h delete mode 100644 NPSimulation/include/HydeScorers.hh delete mode 100644 NPSimulation/include/HydeTracker.hh delete mode 100644 NPSimulation/include/HydeTrackerAnnular.hh delete mode 100644 NPSimulation/include/HydeTrackerDummyShape.hh delete mode 100644 NPSimulation/include/HydeTrackerModule.hh delete mode 100644 NPSimulation/include/HydeTrackerSquare.hh delete mode 100644 NPSimulation/include/HydeTrackerTrapezoid.hh delete mode 100644 NPSimulation/src/HydeScorers.cc delete mode 100644 NPSimulation/src/HydeTracker.cc delete mode 100644 NPSimulation/src/HydeTrackerAnnular.cc delete mode 100644 NPSimulation/src/HydeTrackerDummyShape.cc delete mode 100644 NPSimulation/src/HydeTrackerModule.cc delete mode 100644 NPSimulation/src/HydeTrackerSquare.cc delete mode 100644 NPSimulation/src/HydeTrackerTrapezoid.cc diff --git a/NPLib/HYDE/HydeTracker.cxx b/NPLib/HYDE/HydeTracker.cxx deleted file mode 100644 index 9fbfe9357..000000000 --- a/NPLib/HYDE/HydeTracker.cxx +++ /dev/null @@ -1,894 +0,0 @@ -/***************************************************************************** - * 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 : 31/08/09 * - * Last update : 10/09/09 * - *---------------------------------------------------------------------------* - * Decription: This class is mainly an interface to the * - * THydeTrackerPhysics class and it deals with the geometrical* - * correspondance between strip number and absolute coordinates * - * (X, Y, Z) of interaction. * - *---------------------------------------------------------------------------* - * Comment: * - * + 10/09/09: Add support for Square and DummyShape shapes * - * (N. de Sereville) * - * * - * * - *****************************************************************************/ - -#include "HydeTracker.h" - -// C++ headers -#include <iostream> -#include <fstream> -#include <string> -#include <cmath> -#include <stdlib.h> - -// NPL headers -#include "RootInput.h" -#include "RootOutput.h" - -// ROOT headers -#include "TChain.h" - -using namespace std ; - -// Default Constructor - -HydeTracker::HydeTracker() -{ - m_NumberOfModule = 0; - m_EventData = new THydeTrackerData(); - m_EventPhysics = new THydeTrackerPhysics(); -} - - - -HydeTracker::~HydeTracker() -{ - m_NumberOfModule = 0; - delete m_EventData; - delete m_EventPhysics; -} - - - -// Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token -void HydeTracker::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; - - bool isSquare = false; - bool isDummyShape = false; - bool isTrapezoid = false; - bool isAnnular = false; - - while (!ConfigFile.eof()) { - getline(ConfigFile, LineBuffer); - - // If line is a HydeXXX bloc, reading toggle to true - // and toggle to true flags indicating which shape is treated. - if (LineBuffer.compare(0, 9, "HYDSquare") == 0 || - LineBuffer.compare(0, 12, "HYDTrapezoid") == 0 || - LineBuffer.compare(0, 10, "HYDAnnular") == 0 || - LineBuffer.compare(0, 13, "HYDDummyShape") == 0) { - cout << "///////////////////////" << endl; - cout << "Module found:" << endl; - - if (LineBuffer.compare(0, 9, "HYDSquare") == 0) isSquare = true; - if (LineBuffer.compare(0, 13, "HYDDummyShape") == 0) isDummyShape = true; - if (LineBuffer.compare(0, 12, "HYDTrapezoid") == 0) isTrapezoid = true; - if (LineBuffer.compare(0, 10, "HYDAnnular") == 0) isAnnular = true; - ReadingStatus = true; - } - // Else don't toggle to Reading Block Status - else ReadingStatus = false; - - // Reading Block - while (ReadingStatus) { - if (isSquare) { // square shape - 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, "HYDSquare") == 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 ) { - AddModuleSquare(A , - B , - C , - D ) ; - } - - // with angle method - else if ( check_Theta && check_Phi && check_R && check_beta ) { - AddModuleSquare(Theta , - Phi , - R , - beta_u , - beta_v , - beta_w ); - } - - // 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; - - // reset boolean flag for shape determination - isSquare = false; - isDummyShape = false; - isTrapezoid = false; - isAnnular = false; - } // end test for adding a module - } // end test for Square shape - - else if (isDummyShape) { // dummyshape shape - 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, 13, "HYDDummyShape") == 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 ) { - AddModuleDummyShape(A , - B , - C , - D ) ; - } - - // with angle method - else if ( check_Theta && check_Phi && check_R && check_beta ) { - AddModuleDummyShape(Theta, - Phi, - R, - beta_u, - beta_v, - beta_w); - } - - // 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; - - // reset boolean flag for shape determination - isSquare = false; - isDummyShape = false; - isTrapezoid = false; - isAnnular = false; - } // end test for adding a module - } // end test for DummyShape shape - - else if (isTrapezoid) { // trapezoid shape - cout << "Trapezoid treatment not implemented yet!" << endl; - } // end test for Trapezoid shape - - else if (isAnnular) { // annular shape - cout << "Annular treatment not implemented yet!" << endl; - } // end test for Annular shape - - } // end while for reading block - } // end while for reading file - - cout << endl << "/////////////////////////////" << endl<<endl; -} - - -// Read stream at Path and pick-up calibration parameter using Token -// If argument is "Simulation" no change calibration is loaded -void HydeTracker::ReadCalibrationFile(string Path) -{ - // Order of Polynom function used for calibration -/* int Calibration_Si_E_Order; - int Calibration_Si_T_Order; - int Calibration_SiLi_E_Order; - int Calibration_CsI_E_Order; -*/ - // Calibration_Si_X_E[DetectorNumber][StripNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_Si_X_E ; - vector< vector< vector< double > > > Calibration_Si_X_T ; - vector< vector< vector< double > > > Calibration_Si_Y_E ; - vector< vector< vector< double > > > Calibration_Si_Y_T ; - - // Calibration_SiLi_E[DetectorNumber][PadNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_SiLi_E ; - - // Calibration_SiLi_E[DetectorNumber][CrystalNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_CsI_E ; - - if (Path == "Simulation") { // Simulation case: data already calibrated - /* Calibration_Si_E_Order = 1; - Calibration_Si_T_Order = 1; - Calibration_SiLi_E_Order = 1; - Calibration_CsI_E_Order = 1; -*/ - vector<double> Coef; - // Order 0 Order 1 - Coef.push_back(0) ; Coef.push_back(1) ; - - vector< vector<double> > StripLine ; - StripLine.resize( 128 , Coef) ; - - Calibration_Si_X_E.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_X_T.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_Y_E.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_Y_T.resize( m_NumberOfModule , StripLine) ; - - Calibration_SiLi_E.resize( m_NumberOfModule , StripLine) ; - Calibration_CsI_E .resize( m_NumberOfModule , StripLine) ; - } - else { - } -} - - - -// Activated associated Branches and link it to the private member DetectorData address -// In this method mother Branches (Detector) AND daughter leaf (fDetector_parameter) have to be activated -void HydeTracker::InitializeRootInputRaw() -{ - TChain* inputChain = RootInput::getInstance()->GetChain(); - inputChain->SetBranchStatus("HYDE", true); - inputChain->SetBranchStatus("fHYD*", true); - inputChain->SetBranchAddress("HYDE", &m_EventData); -} - - - -// Create associated branches and associated private member DetectorPhysics address -void HydeTracker::InitializeRootOutput() -{ - TTree* outputTree = RootOutput::getInstance()->GetTree(); - outputTree->Branch("HYDE", "THydeTrackerPhysics", &m_EventPhysics); -} - - - -// This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. -void HydeTracker::BuildPhysicalEvent() -{ - m_EventPhysics -> BuildPhysicalEvent(m_EventData); -} - - - -// Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). -// This method aimed to be used for analysis performed during experiment, when speed is requiered. -// NB: This method can eventually be the same as BuildPhysicalEvent. -void HydeTracker::BuildSimplePhysicalEvent() -{ - m_EventPhysics -> BuildSimplePhysicalEvent(m_EventData); -} - - - -void HydeTracker::AddModuleSquare(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; - - // Geometry Parameter - double Face = 98; // mm - double NumberOfStrip = 16; - double StripPitch = Face/NumberOfStrip; // mm - - // 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) * (StripPitch/2.); - - for (int i = 0; i < NumberOfStrip; 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; - - 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 HydeTracker::AddModuleSquare(double theta, - 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. ; - - // 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 YperpC = TVector3( cos(theta) * cos(phi), - cos(theta) * sin(phi), - -sin(theta)); - - W = C.Unit(); - U = W.Cross(YperpC); - V = W.Cross(U); - - U = U.Unit(); - V = V.Unit(); - - U.Rotate( beta_u * Pi/180. , U ) ; - V.Rotate( beta_u * Pi/180. , U ) ; - - U.Rotate( beta_v * Pi/180. , V ) ; - V.Rotate( beta_v * Pi/180. , V ) ; - - U.Rotate( beta_w * Pi/180. , W ) ; - V.Rotate( beta_w * Pi/180. , W ) ; - - double Face = 98; // mm - //double NumberOfStrip = 25; angelmsb - double NumberOfStrip = 16; - 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 ); -} - - - -void HydeTracker::AddModuleDummyShape(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; - - // 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; - 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) * (StripPitch/2.); - - for (int i = 0; i < NumberOfStrip; 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; - - 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 ); -} - - -///////////////////// relevant angelmsb -void HydeTracker::AddModuleDummyShape(double theta, - 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. ; - - // 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 * Pi/180. , U ) ; - V.Rotate( beta_u * Pi/180. , U ) ; - - U.Rotate( beta_v * Pi/180. , V ) ; - V.Rotate( beta_v * Pi/180. , V ) ; - - U.Rotate( beta_w * Pi/180. , W ) ; - V.Rotate( beta_w * Pi/180. , W ) ; - - double Face = 50; // mm -///////////////////// Fri Feb 4 13:29:51 CET 2011 angelmsb - double NumberOfStrip = 16; - 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 ); -} - - - -double HydeTracker::GetEnergyDeposit() -{ - if (m_EventPhysics->TotalEnergy.size() > 0) - return m_EventPhysics->TotalEnergy[0]; - else - return -1000; -} - - - -TVector3 HydeTracker::GetPositionOfInteraction() -{ - TVector3 Position = TVector3(-1000,-1000,-1000); - - if (m_EventPhysics->ModuleNumber.size() == 1) { - Position = TVector3(GetStripPositionX(m_EventPhysics->ModuleNumber[0], m_EventPhysics->FirstStage_X[0], m_EventPhysics->FirstStage_Y[0]), - GetStripPositionY(m_EventPhysics->ModuleNumber[0], m_EventPhysics->FirstStage_X[0], m_EventPhysics->FirstStage_Y[0]), - GetStripPositionZ(m_EventPhysics->ModuleNumber[0], m_EventPhysics->FirstStage_X[0], m_EventPhysics->FirstStage_Y[0])); - } - - return(Position); -} - - - -void HydeTracker::Print() -{ - cout << "Number of Modules: " << m_NumberOfModule << endl; - - for (int f = 0; f < m_NumberOfModule; f++) { - cout << "Module " << f+1 << endl; - - for (int i = 0; i < 128; i++) { - for (int j = 0; j < 128; j++) { - cout << i+1 << " "<< j+1 << " " - << m_StripPositionX[f][i][j] << " " - << m_StripPositionY[f][i][j] << " " - << m_StripPositionZ[f][i][j] << " " - << endl ; - } - } - } -} diff --git a/NPLib/HYDE/HydeTracker.h b/NPLib/HYDE/HydeTracker.h deleted file mode 100644 index e624de618..000000000 --- a/NPLib/HYDE/HydeTracker.h +++ /dev/null @@ -1,143 +0,0 @@ -#ifndef HydeTracker_H -#define HydeTracker_H -/***************************************************************************** - * 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 : 31/08/09 * - * Last update : 10/09/09 * - *---------------------------------------------------------------------------* - * Decription: This class is mainly an interface to the * - * THydeTrackerPhysics class and it deals with the geometrical* - * correspondance between strip number and absolute coordinates * - * (X, Y, Z) of interaction. * - *---------------------------------------------------------------------------* - * Comment: * - * + 10/09/09: Add support for Square and DummyShape shapes * - * (N. de Sereville) * - * * - * * - *****************************************************************************/ - - - -// NPL -#include "../include/VDetector.h" -#include "THydeTrackerData.h" -#include "THydeTrackerPhysics.h" - -// Root -#include "TVector3.h" - -class HydeTracker : public NPA::VDetector -{ -public: - HydeTracker(); - virtual ~HydeTracker(); - -public: - ///////////////////////////////////// - // Innherited from VDetector Class // - ///////////////////////////////////// - // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token - void ReadConfiguration(string); - - // Read stream at CalibFile and pick-up calibration parameter using Token - // If argument is "Simulation" no change calibration is loaded - void ReadCalibrationFile(string); - - // Activated associated Branches and link it to the private member DetectorData address - // In this method mother Branches (Detector) AND daughter leaf (fDetector_parameter) have to be activated - void InitializeRootInputRaw(); - - // Create associated branches and associated private member DetectorPhysics address - void InitializeRootOutput(); - - // This method is called at each event read from the Input Tree. - // The aim is to build treat Raw dat in order to extract physical parameter. - void BuildPhysicalEvent(); - - // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). - // This method aimed to be used for analysis performed during experiment, when speed is requiered. - // NB: This method can eventually be the same as BuildPhysicalEvent. - void BuildSimplePhysicalEvent(); - - // Those two method all to clear the Event Physics or Data - void ClearEventPhysics() {m_EventPhysics->Clear();} - void ClearEventData() {m_EventData->Clear();} - - -public: - //////////////////////////////// - // Specific to HydeTracker // - //////////////////////////////// - // Case of a Square module - // Add a Module using Corner Coordinate information - void AddModuleSquare(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 AddModuleSquare(double theta, - double phi, - double distance, - double beta_u, - double beta_v, - double beta_w); - - // Case of a DummyShape module - // Add a Module using Corner Coordinate information - void AddModuleDummyShape(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 AddModuleDummyShape(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][X-1][Y-1]; } - double GetStripPositionY(int N ,int X ,int Y) { return m_StripPositionY[N-1][X-1][Y-1]; } - double GetStripPositionZ(int N ,int X ,int Y) { return m_StripPositionZ[N-1][X-1][Y-1]; } - double GetNumberOfModule() { return m_NumberOfModule; } - - // Get Root input and output objects - THydeTrackerData* GetEventData() {return m_EventData;} - THydeTrackerPhysics* GetEventPhysics() {return m_EventPhysics;} - - // To be called after a build Physical Event - double GetEnergyDeposit(); - TVector3 GetPositionOfInteraction(); - - void Print(); - - -private: - //////////////////////////////////////// - // Root Input and Output tree classes // - //////////////////////////////////////// - THydeTrackerData* m_EventData; - THydeTrackerPhysics* m_EventPhysics; - - -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; -}; - -#endif diff --git a/NPLib/HYDE/Makefile b/NPLib/HYDE/Makefile deleted file mode 100644 index 7613a31f0..000000000 --- a/NPLib/HYDE/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -include ../Makefile.arch - -#------------------------------------------------------------------------------ -SHARELIB = libHyde.so -all: $(SHARELIB) -#------------------------------------------------------------------------------ -############### Detector ############## - -## Hyde ## -libHyde.so: THydeTrackerData.o THydeTrackerDataDict.o HydeTracker.o THydeTrackerPhysics.o THydeTrackerPhysicsDict.o - $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ - -THydeTrackerDataDict.cxx: THydeTrackerData.h - rootcint -f $@ -c $^ - -THydeTrackerPhysicsDict.cxx: THydeTrackerPhysics.h - rootcint -f $@ -c $^ - -# dependances -HydeTracker.o: HydeTracker.cxx HydeTracker.h -THydeTrackerData.o: THydeTrackerData.cxx THydeTrackerData.h -THydeTrackerPhysics.o: THydeTrackerPhysics.cxx THydeTrackerPhysics.h -####################################### - -############# Clean and More ########## -clean: - @rm -f core *~ *.o *Dict* - -distclean: - make clean; rm -f *.so - -.SUFFIXES: .$(SrcSuf) - -### - -.$(SrcSuf).$(ObjSuf): - $(CXX) $(CXXFLAGS) $(INCLUDE) -c $< - - diff --git a/NPLib/HYDE/THydeTrackerData.cxx b/NPLib/HYDE/THydeTrackerData.cxx deleted file mode 100644 index a2d76a5fc..000000000 --- a/NPLib/HYDE/THydeTrackerData.cxx +++ /dev/null @@ -1,133 +0,0 @@ -/***************************************************************************** - * 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 : 10/06/09 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: This class stores the results of the G4 simulation for the * - * tracker part of the Hyde detector. * - * The format mimics what was used for the GANIL experiments * - * after conversion of the raw data with GRU. Ask * - * N. de Sereville for more informations. * - * This class derives from TObject (ROOT) and its aim is to be * - * stored in the output TTree of the G4 simulation * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -#include <iostream> -using namespace std; - -#include "THydeTrackerData.h" - -ClassImp(THydeTrackerData) - -THydeTrackerData::THydeTrackerData() -{ - // Default constructor - - Clear(); -} - - - -THydeTrackerData::~THydeTrackerData() -{ -} - - - -void THydeTrackerData::Clear() -{ - // DSSD - // (X,E) - fHYDTrk_FirstStage_FrontE_DetectorNbr.clear(); - fHYDTrk_FirstStage_FrontE_StripNbr.clear() ; - fHYDTrk_FirstStage_FrontE_Energy.clear() ; - // (X,T) - fHYDTrk_FirstStage_FrontT_DetectorNbr.clear(); - fHYDTrk_FirstStage_FrontT_StripNbr.clear() ; - fHYDTrk_FirstStage_FrontT_Time.clear() ; - // (Y,E) - fHYDTrk_FirstStage_BackE_DetectorNbr.clear() ; - fHYDTrk_FirstStage_BackE_StripNbr.clear() ; - fHYDTrk_FirstStage_BackE_Energy.clear() ; - // (Y,T) - fHYDTrk_FirstStage_BackT_DetectorNbr.clear() ; - fHYDTrk_FirstStage_BackT_StripNbr.clear() ; - fHYDTrk_FirstStage_BackT_Time.clear() ; - - // Second Stage - // E - fHYDTrk_SecondStage_E_DetectorNbr.clear() ; - fHYDTrk_SecondStage_E_PadNbr.clear() ; - fHYDTrk_SecondStage_E_Energy.clear() ; - // T - fHYDTrk_SecondStage_T_DetectorNbr.clear() ; - fHYDTrk_SecondStage_T_PadNbr.clear() ; - fHYDTrk_SecondStage_T_Time.clear() ; - - // Third Stage - // E - fHYDTrk_ThirdStage_E_DetectorNbr.clear() ; - fHYDTrk_ThirdStage_E_PadNbr.clear() ; - fHYDTrk_ThirdStage_E_Energy.clear() ; - // T - fHYDTrk_ThirdStage_T_DetectorNbr.clear() ; - fHYDTrk_ThirdStage_T_PadNbr.clear() ; - fHYDTrk_ThirdStage_T_Time.clear() ; -} - - - -void THydeTrackerData::Dump() const -{ - cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event XXXXXXXXXXXXXXXXX" << endl; - - // DSSD - // (X,E) - cout << "HYDTrk_FirstStage_FrontE_Mult = " << fHYDTrk_FirstStage_FrontE_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fHYDTrk_FirstStage_FrontE_DetectorNbr.size(); i++) - cout << "DetNbr: " << fHYDTrk_FirstStage_FrontE_DetectorNbr[i] << " Strip: " << fHYDTrk_FirstStage_FrontE_StripNbr[i] << " Energy: " << fHYDTrk_FirstStage_FrontE_Energy[i] << endl; - // (X,T) - cout << "HYDTrk_FirstStage_FrontT_Mult = " << fHYDTrk_FirstStage_FrontT_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fHYDTrk_FirstStage_FrontT_DetectorNbr.size(); i++) - cout << "DetNbr: " << fHYDTrk_FirstStage_FrontT_DetectorNbr[i] << " Strip: " << fHYDTrk_FirstStage_FrontT_StripNbr[i] << " Time: " << fHYDTrk_FirstStage_FrontT_Time[i] << endl; - // (Y,E) - cout << "HYDTrk_FirstStage_BackE_Mult = " << fHYDTrk_FirstStage_BackE_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fHYDTrk_FirstStage_BackE_DetectorNbr.size(); i++) - cout << "DetNbr: " << fHYDTrk_FirstStage_BackE_DetectorNbr[i] << " Strip: " << fHYDTrk_FirstStage_BackE_StripNbr[i] << " Energy: " << fHYDTrk_FirstStage_BackE_Energy[i] << endl; - // (Y,T) - cout << "HYDTrk_FirstStage_BackT_Mult = " << fHYDTrk_FirstStage_BackT_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fHYDTrk_FirstStage_BackT_DetectorNbr.size(); i++) - cout << "DetNbr: " << fHYDTrk_FirstStage_BackT_DetectorNbr[i] << " Strip: " << fHYDTrk_FirstStage_BackT_StripNbr[i] << " Time: " << fHYDTrk_FirstStage_BackT_Time[i] << endl; - - // Second Stage - // Energy - cout << "HYDTrk_SecondStage_E_Mult = " << fHYDTrk_SecondStage_E_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fHYDTrk_SecondStage_E_DetectorNbr.size(); i++) - cout << "Det: " << fHYDTrk_SecondStage_E_DetectorNbr[i] << " Pad: " << fHYDTrk_SecondStage_E_PadNbr[i] << " Energy: " << fHYDTrk_SecondStage_E_Energy[i] << endl; - // Time - cout << "HYDTrk_SecondStage_T_Mult = " << fHYDTrk_SecondStage_T_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fHYDTrk_SecondStage_T_DetectorNbr.size(); i++) - cout << "Det: " << fHYDTrk_SecondStage_T_DetectorNbr[i] << " Pad: " << fHYDTrk_SecondStage_T_PadNbr[i] << " Time: " << fHYDTrk_SecondStage_T_Time[i] << endl; - - // Third Stage - // Energy - cout << "HYDTrk_ThirdStage_E_Mult = " << fHYDTrk_ThirdStage_E_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fHYDTrk_ThirdStage_E_DetectorNbr.size(); i++) - cout << "Det: " << fHYDTrk_ThirdStage_E_DetectorNbr[i] << " Pad: " << fHYDTrk_ThirdStage_E_PadNbr[i] << " Energy: " << fHYDTrk_ThirdStage_E_Energy[i] << endl; - // Time - cout << "HYDTrk_ThirdStage_T_Mult = " << fHYDTrk_ThirdStage_T_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fHYDTrk_ThirdStage_T_DetectorNbr.size(); i++) - cout << "Det: " << fHYDTrk_ThirdStage_T_DetectorNbr[i] << " Pad: " << fHYDTrk_ThirdStage_T_PadNbr[i] << " Time: " << fHYDTrk_ThirdStage_T_Time[i] << endl; -} diff --git a/NPLib/HYDE/THydeTrackerData.h b/NPLib/HYDE/THydeTrackerData.h deleted file mode 100644 index d03e80514..000000000 --- a/NPLib/HYDE/THydeTrackerData.h +++ /dev/null @@ -1,292 +0,0 @@ -#ifndef __HYDETRACKERDATA__ -#define __HYDETRACKERDATA__ -/***************************************************************************** - * 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 : 10/06/09 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: This class stores the results of the G4 simulation for the * - * tracker part of the Hyde detector. * - * The format mimics what was used for the GANIL experiments * - * after conversion of the raw data with GRU. Ask * - * N. de Sereville for more informations. * - * This class derives from TObject (ROOT) and its aim is to be * - * stored in the output TTree of the G4 simulation * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - - - -#include <vector> -#include "TObject.h" - -using namespace std ; - -class THydeTrackerData : public TObject -{ -protected: - // First Stage - // Double Sided Silicon Detector - // Front - // Energy - vector<UShort_t> fHYDTrk_FirstStage_FrontE_DetectorNbr; - vector<UShort_t> fHYDTrk_FirstStage_FrontE_StripNbr; - vector<Double_t> fHYDTrk_FirstStage_FrontE_Energy; - // Time - vector<UShort_t> fHYDTrk_FirstStage_FrontT_DetectorNbr; - vector<UShort_t> fHYDTrk_FirstStage_FrontT_StripNbr; - vector<Double_t> fHYDTrk_FirstStage_FrontT_Time; - // Back - // Energy - vector<UShort_t> fHYDTrk_FirstStage_BackE_DetectorNbr; - vector<UShort_t> fHYDTrk_FirstStage_BackE_StripNbr; - vector<Double_t> fHYDTrk_FirstStage_BackE_Energy; - // Time - vector<UShort_t> fHYDTrk_FirstStage_BackT_DetectorNbr; - vector<UShort_t> fHYDTrk_FirstStage_BackT_StripNbr; - vector<Double_t> fHYDTrk_FirstStage_BackT_Time; - - // Second Stage - // Energy - vector<UShort_t> fHYDTrk_SecondStage_E_DetectorNbr; - vector<UShort_t> fHYDTrk_SecondStage_E_PadNbr; - vector<Double_t> fHYDTrk_SecondStage_E_Energy; - // Time - vector<UShort_t> fHYDTrk_SecondStage_T_DetectorNbr; - vector<UShort_t> fHYDTrk_SecondStage_T_PadNbr; - vector<Double_t> fHYDTrk_SecondStage_T_Time; - - // Third Stage - // Energy - vector<UShort_t> fHYDTrk_ThirdStage_E_DetectorNbr; - vector<UShort_t> fHYDTrk_ThirdStage_E_PadNbr; - vector<Double_t> fHYDTrk_ThirdStage_E_Energy; - // Time - vector<UShort_t> fHYDTrk_ThirdStage_T_DetectorNbr; - vector<UShort_t> fHYDTrk_ThirdStage_T_PadNbr; - vector<Double_t> fHYDTrk_ThirdStage_T_Time; - - -public: - THydeTrackerData(); - virtual ~THydeTrackerData(); - - void Clear(); - void Clear(const Option_t*) {}; - void Dump() const; - - ///////////////////// SETTERS //////////////////////// - // DSSD - // (Front, E) - void SetHYDTrkFirstStageFrontEDetectorNbr(UShort_t DetNbr) { - fHYDTrk_FirstStage_FrontE_DetectorNbr.push_back(DetNbr); - } - void SetHYDTrkFirstStageFrontEStripNbr(UShort_t StripNbr) { - fHYDTrk_FirstStage_FrontE_StripNbr.push_back(StripNbr); - } - void SetHYDTrkFirstStageFrontEEnergy(Double_t Energy) { - fHYDTrk_FirstStage_FrontE_Energy.push_back(Energy); - } - // (Front, T) - void SetHYDTrkFirstStageFrontTDetectorNbr(UShort_t DetNbr) { - fHYDTrk_FirstStage_FrontT_DetectorNbr.push_back(DetNbr); - } - void SetHYDTrkFirstStageFrontTStripNbr(UShort_t StripNbr) { - fHYDTrk_FirstStage_FrontT_StripNbr.push_back(StripNbr); - } - void SetHYDTrkFirstStageFrontTTime(Double_t Time) { - fHYDTrk_FirstStage_FrontT_Time.push_back(Time); - } - - // (Back, E) - void SetHYDTrkFirstStageBackEDetectorNbr(UShort_t DetNbr) { - fHYDTrk_FirstStage_BackE_DetectorNbr.push_back(DetNbr); - } - void SetHYDTrkFirstStageBackEStripNbr(UShort_t StripNbr) { - fHYDTrk_FirstStage_BackE_StripNbr.push_back(StripNbr); - } - void SetHYDTrkFirstStageBackEEnergy(Double_t Energy) { - fHYDTrk_FirstStage_BackE_Energy.push_back(Energy); - } - // (Back, T) - void SetHYDTrkFirstStageBackTDetectorNbr(UShort_t DetNbr) { - fHYDTrk_FirstStage_BackT_DetectorNbr.push_back(DetNbr); - } - void SetHYDTrkFirstStageBackTStripNbr(UShort_t StripNbr) { - fHYDTrk_FirstStage_BackT_StripNbr.push_back(StripNbr); - } - void SetHYDTrkFirstStageBackTTime(Double_t Time) { - fHYDTrk_FirstStage_BackT_Time.push_back(Time); - } - - // Second Stage - // (E) - void SetHYDTrkSecondStageEDetectorNbr(UShort_t DetNbr) { - fHYDTrk_SecondStage_E_DetectorNbr.push_back(DetNbr); - } - void SetHYDTrkSecondStageEPadNbr(UShort_t PadNbr) { - fHYDTrk_SecondStage_E_PadNbr.push_back(PadNbr); - } - void SetHYDTrkSecondStageEEnergy(Double_t Energy) { - fHYDTrk_SecondStage_E_Energy.push_back(Energy); - } - // (T) - void SetHYDTrkSecondStageTDetectorNbr(UShort_t DetNbr) { - fHYDTrk_SecondStage_T_DetectorNbr.push_back(DetNbr); - } - void SetHYDTrkSecondStageTPadNbr(UShort_t PadNbr) { - fHYDTrk_SecondStage_T_PadNbr.push_back(PadNbr); - } - void SetHYDTrkSecondStageTTime(Double_t Time) { - fHYDTrk_SecondStage_T_Time.push_back(Time); - } - - // Third Stage - // (E) - void SetHYDTrkThirdStageEDetectorNbr(UShort_t DetNbr) { - fHYDTrk_ThirdStage_E_DetectorNbr.push_back(DetNbr); - } - void SetHYDTrkThirdStageEPadNbr(UShort_t PadNbr) { - fHYDTrk_ThirdStage_E_PadNbr.push_back(PadNbr); - } - void SetHYDTrkThirdStageEEnergy(Double_t Energy) { - fHYDTrk_ThirdStage_E_Energy.push_back(Energy); - } - // (T) - void SetHYDTrkThirdStageTDetectorNbr(UShort_t DetNbr) { - fHYDTrk_ThirdStage_T_DetectorNbr.push_back(DetNbr); - } - void SetHYDTrkThirdStageTPadNbr(UShort_t PadNbr) { - fHYDTrk_ThirdStage_T_PadNbr.push_back(PadNbr); - } - void SetHYDTrkThirdStageTTime(Double_t Time) { - fHYDTrk_ThirdStage_T_Time.push_back(Time); - } - - - ///////////////////// GETTERS //////////////////////// - // DSSD - // (Front, E) - UShort_t GetHYDTrkFirstStageFrontEMult() { - return fHYDTrk_FirstStage_FrontE_DetectorNbr.size(); - } - UShort_t GetHYDTrkFirstStageFrontEDetectorNbr(Int_t i) { - return fHYDTrk_FirstStage_FrontE_DetectorNbr.at(i); - } - UShort_t GetHYDTrkFirstStageFrontEStripNbr(Int_t i) { - return fHYDTrk_FirstStage_FrontE_StripNbr.at(i); - } - Double_t GetHYDTrkFirstStageFrontEEnergy(Int_t i) { - return fHYDTrk_FirstStage_FrontE_Energy.at(i); - } - // (Front, T) - UShort_t GetHYDTrkFirstStageFrontTMult() { - return fHYDTrk_FirstStage_FrontT_DetectorNbr.size(); - } - UShort_t GetHYDTrkFirstStageFrontTDetectorNbr(Int_t i) { - return fHYDTrk_FirstStage_FrontT_DetectorNbr.at(i); - } - UShort_t GetHYDTrkFirstStageFrontTStripNbr(Int_t i) { - return fHYDTrk_FirstStage_FrontT_StripNbr.at(i); - } - Double_t GetHYDTrkFirstStageFrontTTnergy(Int_t i) { - return fHYDTrk_FirstStage_FrontT_Time.at(i); - } - // (Back, E) - UShort_t GetHYDTrkFirstStageBackEMult() { - return fHYDTrk_FirstStage_BackE_DetectorNbr.size(); - } - UShort_t GetHYDTrkFirstStageBackEDetectorNbr(Int_t i) { - return fHYDTrk_FirstStage_BackE_DetectorNbr.at(i); - } - UShort_t GetHYDTrkFirstStageBackEStripNbr(Int_t i) { - return fHYDTrk_FirstStage_BackE_StripNbr.at(i); - } - Double_t GetHYDTrkFirstStageBackEEnergy(Int_t i) { - return fHYDTrk_FirstStage_BackE_Energy.at(i); - } - // (Back, T) - UShort_t GetHYDTrkFirstStageBackTMult() { - return fHYDTrk_FirstStage_BackT_DetectorNbr.size(); - } - UShort_t GetHYDTrkFirstStageBackTDetectorNbr(Int_t i) { - return fHYDTrk_FirstStage_BackT_DetectorNbr.at(i); - } - UShort_t GetHYDTrkFirstStageBackTStripNbr(Int_t i) { - return fHYDTrk_FirstStage_BackT_StripNbr.at(i); - } - Double_t GetHYDTrkFirstStageBackTTnergy(Int_t i) { - return fHYDTrk_FirstStage_BackT_Time.at(i); - } - - // Second Stage - // (E) - UShort_t GetHYDTrkSecondStageEMult() { - return fHYDTrk_SecondStage_E_DetectorNbr.size(); - } - UShort_t GetHYDTrkSecondStageEDetectorNbr(Int_t i) { - return fHYDTrk_SecondStage_E_DetectorNbr.at(i); - } - UShort_t GetHYDTrkSecondStageEPadNbr(Int_t i) { - return fHYDTrk_SecondStage_E_PadNbr.at(i); - } - Double_t GetHYDTrkSecondStageEEnergy(Int_t i) { - return fHYDTrk_SecondStage_E_Energy.at(i); - } - // (T) - UShort_t GetHYDTrkSecondStageTMult() { - return fHYDTrk_SecondStage_T_DetectorNbr.size(); - } - UShort_t GetHYDTrkSecondStageTDetectorNbr(Int_t i) { - return fHYDTrk_SecondStage_T_DetectorNbr.at(i); - } - UShort_t GetHYDTrkSecondStageTPadNbr(Int_t i) { - return fHYDTrk_SecondStage_T_PadNbr.at(i); - } - Double_t GetHYDTrkSecondStageTTime(Int_t i) { - return fHYDTrk_SecondStage_T_Time.at(i); - } - - // Third Stage - // (E) - UShort_t GetHYDTrkThirdStageEMult() { - return fHYDTrk_ThirdStage_E_DetectorNbr.size(); - } - UShort_t GetHYDTrkThirdStageEDetectorNbr(Int_t i) { - return fHYDTrk_ThirdStage_E_DetectorNbr.at(i); - } - UShort_t GetHYDTrkThirdStageEPadNbr(Int_t i) { - return fHYDTrk_ThirdStage_E_PadNbr.at(i); - } - Double_t GetHYDTrkThirdStageEEnergy(Int_t i) { - return fHYDTrk_ThirdStage_E_Energy.at(i); - } - // (T) - UShort_t GetHYDTrkThirdStageTMult() { - return fHYDTrk_ThirdStage_T_DetectorNbr.size(); - } - UShort_t GetHYDTrkThirdStageTDetectorNbr(Int_t i) { - return fHYDTrk_ThirdStage_T_DetectorNbr.at(i); - } - UShort_t GetHYDTrkThirdStageTPadNbr(Int_t i) { - return fHYDTrk_ThirdStage_T_PadNbr.at(i); - } - Double_t GetHYDTrkThirdStageTTime(Int_t i) { - return fHYDTrk_ThirdStage_T_Time.at(i); - } - - ClassDef(THydeTrackerData, 1) // HydeTrackerData structure -}; - -#endif diff --git a/NPLib/HYDE/THydeTrackerPhysics.cxx b/NPLib/HYDE/THydeTrackerPhysics.cxx deleted file mode 100644 index 613ea75ed..000000000 --- a/NPLib/HYDE/THydeTrackerPhysics.cxx +++ /dev/null @@ -1,207 +0,0 @@ -/***************************************************************************** - * 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 : 31/08/09 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: This class stores the physical results after NPAnalysis is run* - * for the tracker part of the Hyde detector. * - * This class derives from TObject (ROOT) and its aim is to be * - * stored in the output TTree of NPAnalysis. * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -#include "THydeTrackerPhysics.h" -#include <iostream> -#include <cstdlib> - - -ClassImp(THydeTrackerPhysics) - - -THydeTrackerPhysics::THydeTrackerPhysics() -{ - EventMultiplicity = 0; -} - - - -THydeTrackerPhysics::~THydeTrackerPhysics() -{ - Clear(); -} - - - -void THydeTrackerPhysics::BuildSimplePhysicalEvent(THydeTrackerData* Data) -{ - BuildPhysicalEvent(Data); -} - - - -void THydeTrackerPhysics::BuildPhysicalEvent(THydeTrackerData* Data) -{ - // indexes for each kind of detector - // this should follow the indexes given in NPSimulation - // 0: Square - // 100: Trapezoid - // 200: Annular - // 1000: DummyShape - const int dim = 4; - int index[dim] = {0, 100, 200, 1000}; - - // Check -// 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 = Data->GetHYDTrkFirstStageFrontEMult(); - int multYE = Data->GetHYDTrkFirstStageBackEMult(); - int multXT = Data->GetHYDTrkFirstStageFrontTMult(); - int multYT = Data->GetHYDTrkFirstStageBackTMult(); - // calculate multiplicity of 2nd and third stages - int mult2E = Data->GetHYDTrkSecondStageEMult(); - int mult2T = Data->GetHYDTrkSecondStageTMult(); - int mult3E = Data->GetHYDTrkThirdStageEMult(); - int mult3T = Data->GetHYDTrkThirdStageTMult(); - - // Deal with multiplicity 1 for the first layer - if (multXE==1 && multYE==1 && multXT==1 && multYT==1) { - // calculate detector number - int det_ref = Data->GetHYDTrkFirstStageFrontEDetectorNbr(0); - int detecXE = Data->GetHYDTrkFirstStageFrontEDetectorNbr(0) / det_ref; - int detecXT = Data->GetHYDTrkFirstStageFrontTDetectorNbr(0) / det_ref; - int detecYE = Data->GetHYDTrkFirstStageBackEDetectorNbr(0) / det_ref; - int detecYT = Data->GetHYDTrkFirstStageBackTDetectorNbr(0) / det_ref; - // convert detector number in order to it begins at 0 - // this is needed to access the strip position information - // WARNING: this method may not work for an heteregneous detector - // configuration, e.g. Trapezoid + Annular - int good_index = -100; - int diff_ref = 10000; - for (int i = 0; i < dim; i++) { - int diff = abs(det_ref - index[i]); - if (diff < diff_ref) { - diff_ref = diff; - good_index = i; - } - } - det_ref -= index[good_index]; - - // case of same detector - if (detecXE*detecXT*detecYE*detecYT == 1) { - // store module number - ModuleNumber.push_back(det_ref); - // calculate strip number - int stripXE = Data->GetHYDTrkFirstStageFrontEStripNbr(0); - int stripXT = Data->GetHYDTrkFirstStageFrontTStripNbr(0); - int stripYE = Data->GetHYDTrkFirstStageBackEStripNbr(0); - int stripYT = Data->GetHYDTrkFirstStageBackTStripNbr(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; - EventMultiplicity = 1; - // store strip ID - FirstStage_X.push_back(stripXE); - FirstStage_Y.push_back(stripYE); - // get energy from strips and store it - double EnergyStripFront = Data->GetHYDTrkFirstStageFrontEEnergy(0); -// double EnergyStripBack = Data->GetHYDTrkFirstStageBackEEnergy(0); -// double EnergyStrip = 0.5 * (EnergyStripFront + EnergyStripBack); - double EnergyStrip = EnergyStripFront; -// if (EnergyStripBack > EnergyStrip) EnergyStrip = EnergyStripBack; - FirstStage_E.push_back(EnergyStrip); - double EnergyTot = EnergyStrip; - // get time from strips and store it - double TimeStripFront = Data->GetHYDTrkFirstStageFrontEEnergy(0); - double TimeStripBack = Data->GetHYDTrkFirstStageBackEEnergy(0); - double TimeStrip = 0.5 * (TimeStripFront + TimeStripBack); -// double TimeStrip = TimeStripFront; -// if (TimeStripBack > TimeStrip) TimeStrip = TimeStripBack; - FirstStage_T.push_back(TimeStrip); - - // check if we have a 2nd stage event - if (mult2E==1 && mult2T==1) { -// Check_SecondStage = true; - double EnergySecond = Data->GetHYDTrkSecondStageEEnergy(0); - SecondStage_E.push_back(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 = Data->GetHYDTrkThirdStageEEnergy(0); - ThirdStage_E.push_back(EnergyThird); - EnergyTot += EnergyThird; - } - else if (mult3E>1 || mult3T>1) { - cout << "Warning: multiplicity in third stage greater than in firststage" << endl; - } - - // Fill total energy - TotalEnergy.push_back(EnergyTot); - } - 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 THydeTrackerPhysics::Clear() -{ - EventMultiplicity= 0; - ModuleNumber.clear(); - EventType.clear(); - TotalEnergy.clear(); - - // Si X - FirstStage_E.clear(); - FirstStage_T.clear(); - FirstStage_X.clear(); - FirstStage_Y.clear(); - - // Si(Li) - SecondStage_E.clear(); - SecondStage_T.clear(); - SecondStage_N.clear(); - - // CsI - ThirdStage_E.clear(); - ThirdStage_T.clear(); - ThirdStage_N.clear(); -} diff --git a/NPLib/HYDE/THydeTrackerPhysics.h b/NPLib/HYDE/THydeTrackerPhysics.h deleted file mode 100644 index 65b5d7d4a..000000000 --- a/NPLib/HYDE/THydeTrackerPhysics.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef THYDETRACKERPHYSICS_H -#define THYDETRACKERPHYSICS_H -/***************************************************************************** - * 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 : 31/08/09 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: This class stores the physical results after NPAnalysis is run* - * for the tracker part of the Hyde detector. * - * This class derives from TObject (ROOT) and its aim is to be * - * stored in the output TTree of NPAnalysis. * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - - - -#include <vector> -#include "TObject.h" -#include "THydeTrackerData.h" -#include <cstdlib> - -using namespace std ; - -class THydeTrackerPhysics : public TObject -{ -public: - THydeTrackerPhysics(); - ~THydeTrackerPhysics(); - -public: - void Clear(); - void Clear(const Option_t*) {}; - void BuildPhysicalEvent(THydeTrackerData* Data); - void BuildSimplePhysicalEvent(THydeTrackerData* Data); - -public: - // Provide Physical Multiplicity - Int_t EventMultiplicity; - - // Provide a Classification of Event - vector<int> EventType; - - // Telescope - vector<int> ModuleNumber; - - // FirstStage - vector<double> FirstStage_E; - vector<double> FirstStage_T; - vector<int> FirstStage_X; - vector<int> FirstStage_Y; - - // SecondStage - vector<double> SecondStage_E; - vector<double> SecondStage_T; - vector<int> SecondStage_N; - - // ThirdStage - vector<double> ThirdStage_E; - vector<double> ThirdStage_T; - vector<int> ThirdStage_N; - - // Physical Value - vector<double> TotalEnergy; - - ClassDef(THydeTrackerPhysics,1) // HydeTrackerPHysics structure -}; - -#endif diff --git a/NPSimulation/include/HydeScorers.hh b/NPSimulation/include/HydeScorers.hh deleted file mode 100644 index 8f28a3e49..000000000 --- a/NPSimulation/include/HydeScorers.hh +++ /dev/null @@ -1,300 +0,0 @@ -#ifndef HYDScorer_h -#define HYDScorer_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 : 11/07/09 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: This class holds all the scorers needed by the * - * HydeTracker*** objects. * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -#include "G4VPrimitiveScorer.hh" -#include "G4THitsMap.hh" - -namespace HYDSCORERS -{ - // This Threshold is used in all scorers - // Any energy deposit under this threshold will not create an entry - const double TriggerThreshold = 0.1 * keV; - -class HYDScorerFirstStageEnergy : public G4VPrimitiveScorer -{ -public: // with description - HYDScorerFirstStageEnergy(G4String name, G4String volumeName, G4int depth = 0); - virtual ~HYDScorerFirstStageEnergy(); - -protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - -public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void Clear(); - virtual void DrawAll(); - virtual void PrintAll(); - -private: - G4String m_VolumeName; - G4int HCID; - G4THitsMap<G4double>* EvtMap; -}; - - - -class HYDScorerSecondStageEnergy : public G4VPrimitiveScorer -{ -public: // with description - HYDScorerSecondStageEnergy(G4String name, G4String volumeName, G4int depth = 0); - virtual ~HYDScorerSecondStageEnergy(); - -protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - -public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void Clear(); - virtual void DrawAll(); - virtual void PrintAll(); - -private: - G4String m_VolumeName; - G4int HCID; - G4THitsMap<G4double>* EvtMap; -}; - - - -class HYDScorerThirdStageEnergy : public G4VPrimitiveScorer -{ -public: // with description - HYDScorerThirdStageEnergy(G4String name, G4String volumeName, G4int depth = 0); - virtual ~HYDScorerThirdStageEnergy(); - -protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - -public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void Clear(); - virtual void DrawAll(); - virtual void PrintAll(); - -private: - G4String m_VolumeName; - G4int HCID; - G4THitsMap<G4double>* EvtMap; -}; - - - - -class HYDScorerFirstStageFrontStripDummyShape : public G4VPrimitiveScorer -{ -public: // with description - HYDScorerFirstStageFrontStripDummyShape(G4String name, G4int depth = 0, G4int NumberOfStrip = 128); - virtual ~HYDScorerFirstStageFrontStripDummyShape(); - -protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - -public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void Clear(); - virtual void DrawAll(); - virtual void PrintAll(); - -private: - G4int m_NumberOfStrip ; - G4int HCID; - G4THitsMap<G4double>* EvtMap; -}; - - - -class HYDScorerFirstStageBackStripDummyShape : public G4VPrimitiveScorer -{ -public: // with description - HYDScorerFirstStageBackStripDummyShape(G4String name, G4int depth = 0, G4int NumberOfStrip = 128); - virtual ~HYDScorerFirstStageBackStripDummyShape(); - -protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - -public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void Clear(); - virtual void DrawAll(); - virtual void PrintAll(); - -private: - G4int m_NumberOfStrip ; - G4int HCID; - G4THitsMap<G4double>* EvtMap; -}; - - - -class HYDScorerFirstStageFrontStripSquare : public G4VPrimitiveScorer -{ -public: // with description - HYDScorerFirstStageFrontStripSquare(G4String name, G4int depth = 0, G4int NumberOfStrip = 128); - virtual ~HYDScorerFirstStageFrontStripSquare(); - -protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - -public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void Clear(); - virtual void DrawAll(); - virtual void PrintAll(); - -private: - G4int m_NumberOfStrip ; - G4int HCID; - G4THitsMap<G4double>* EvtMap; -}; - - - -class HYDScorerFirstStageBackStripSquare : public G4VPrimitiveScorer -{ -public: // with description - HYDScorerFirstStageBackStripSquare(G4String name, G4int depth = 0, G4int NumberOfStrip = 128); - virtual ~HYDScorerFirstStageBackStripSquare(); - -protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - -public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void Clear(); - virtual void DrawAll(); - virtual void PrintAll(); - -private: - G4int m_NumberOfStrip ; - G4int HCID; - G4THitsMap<G4double>* EvtMap; -}; - - - -class HYDScorerFirstStageFrontStripTrapezoid : public G4VPrimitiveScorer -{ -public: // with description - HYDScorerFirstStageFrontStripTrapezoid(G4String name, G4int depth = 0, G4int NumberOfStrip = 128); - virtual ~HYDScorerFirstStageFrontStripTrapezoid(); - -protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - -public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void Clear(); - virtual void DrawAll(); - virtual void PrintAll(); - -private: - G4int m_NumberOfStrip ; - G4int HCID; - G4THitsMap<G4double>* EvtMap; -}; - - - -class HYDScorerFirstStageBackStripTrapezoid : public G4VPrimitiveScorer -{ -public: // with description - HYDScorerFirstStageBackStripTrapezoid(G4String name, G4int depth = 0, G4int NumberOfStrip = 128); - virtual ~HYDScorerFirstStageBackStripTrapezoid(); - -protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - -public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void Clear(); - virtual void DrawAll(); - virtual void PrintAll(); - -private: - G4int m_NumberOfStrip ; - G4int HCID; - G4THitsMap<G4double>* EvtMap; -}; - - - -class HYDScorerFirstStageFrontStripAnnular : public G4VPrimitiveScorer -{ -public: // with description - HYDScorerFirstStageFrontStripAnnular(G4String name, G4int depth = 0, G4double StripPlaneSize = 98, G4int NumberOfStrip = 128); - virtual ~HYDScorerFirstStageFrontStripAnnular(); - -protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - -public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void Clear(); - virtual void DrawAll(); - virtual void PrintAll(); - -private: - G4double m_StripPlaneSize; - G4int m_NumberOfStrip ; - G4int HCID; - G4THitsMap<G4double>* EvtMap; -}; - - - -class HYDScorerFirstStageBackStripAnnular : public G4VPrimitiveScorer -{ -public: // with description - HYDScorerFirstStageBackStripAnnular(G4String name, G4int depth = 0, G4double StripPlaneSize = 98, G4int NumberOfStrip = 128); - virtual ~HYDScorerFirstStageBackStripAnnular(); - -protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - -public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void Clear(); - virtual void DrawAll(); - virtual void PrintAll(); - -private: - G4double m_StripPlaneSize; - G4int m_NumberOfStrip ; - G4int HCID; - G4THitsMap<G4double>* EvtMap; -}; - -} - -#endif diff --git a/NPSimulation/include/HydeTracker.hh b/NPSimulation/include/HydeTracker.hh deleted file mode 100644 index 0ada0c5ed..000000000 --- a/NPSimulation/include/HydeTracker.hh +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef HydeTracker_h -#define HydeTracker_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 : 10/06/09 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: This class manages different shapes of module for the Hyde * - * tracker. It allows to have Hyde geometries with an * - * heterogeneous set of modules * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -// C++ headers -#include <vector> - -// NPTool header -#include "VDetector.hh" -#include "HydeTrackerModule.hh" - -using namespace std; - - - -class HydeTracker : public VDetector -{ - //////////////////////////////////////////////////// - /////// Default Constructor and Destructor ///////// - //////////////////////////////////////////////////// -public: - HydeTracker(); - virtual ~HydeTracker(); - - //////////////////////////////////////////////////// - ///////// Inherite from VDetector 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(); - - // Read sensitive part and fill the Root tree. - // Called at in the EventAction::EndOfEventAvtion - void ReadSensitive(const G4Event* event); - -public: - // Initialize all scorers necessary for each detector - void InitializeScorers(); - -private: - vector<HydeTrackerModule*> m_Modules; -}; -#endif diff --git a/NPSimulation/include/HydeTrackerAnnular.hh b/NPSimulation/include/HydeTrackerAnnular.hh deleted file mode 100644 index 9ddc9ce89..000000000 --- a/NPSimulation/include/HydeTrackerAnnular.hh +++ /dev/null @@ -1,157 +0,0 @@ -#ifndef HydeTrackerAnnular_h -#define HydeTrackerAnnular_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 annular shape for the Hyde tracker * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -// C++ headers -#include <vector> - -// NPTool header -#include "HydeTrackerModule.hh" -#include "TInteractionCoordinates.h" - -using namespace std; - - - -class HydeTrackerAnnular : public HydeTrackerModule -{ - //////////////////////////////////////////////////// - /////// Default Constructor and Destructor ///////// - //////////////////////////////////////////////////// -public: - HydeTrackerAnnular(); - virtual ~HydeTrackerAnnular(); - - //////////////////////////////////////////////////// - //////// Specific Function of this Class /////////// - //////////////////////////////////////////////////// -public: - // By Position Method - void AddModule(G4double PosZ, - G4double Rmin, - G4double Rmax, - bool wFirstStage , - bool wSecondStage , - bool wThirdStage); - - // Effectively construct Volume - // Avoid to have two time same code for Angle and Point definition - void VolumeMaker(G4int TelescopeNumber , - G4ThreeVector MMpos , - G4RotationMatrix* MMrot , - bool wFirstStage , - bool wSecondStage , - bool wThirdStage , - G4LogicalVolume* world); - - - //////////////////////////////////////////////////// - //// Inherite from HydeTrackerModule 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 HydeTrackerModule - // This is mandatory since the HydeTracker*** 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; - - // Used for "By Point Definition" - vector<G4double> m_PosZ; - vector<G4double> m_Rmin; - vector<G4double> m_Rmax; - - // for debugging purpose - G4ThreeVector MMpos; - G4ThreeVector MMu; - G4ThreeVector MMv; - G4ThreeVector MMw; - G4ThreeVector CT; -}; - - - -namespace HYDANNULAR -{ - // Energy/Time resolutions for the different layers - const G4double ResoFirstStage = 0 ;// = 52keV of Resolution // Unit is MeV/2.35 -// const G4double ResoFirstStage = 0.022 ;// = 52keV of Resolution // Unit is MeV/2.35 - const G4double ResoSecondStage = 0.055 ;// = 130 keV of resolution // Unit is MeV/2.35 - const G4double ResoThirdStage = 0 ;// = 100 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 - - // Geometry - const G4double Rmin = 15*mm; - const G4double Rmax = 55*mm; - const G4double Length = 10*mm; - - // First stage -// const G4double AluStripThickness = 0.00000001*micrometer; - const G4double AluStripThickness = 0.4*micrometer; - const G4double FirstStageThickness = 300*micrometer; - const G4double FirstStageRmin = 16*mm; - const G4double FirstStageRmax = 52*mm; -// const G4double VacBoxThickness = 3*cm ; - const G4double VacBoxThickness = 0.4*cm; - - // Third stage - const G4double MylarCsIThickness = 3*micrometer; - const G4double ThirdStageThickness = 1.5*mm; - - // Starting at the front and going in direction of third stage - const G4double AluStripFront_PosZ = Length* -0.5 + 0.5*AluStripThickness ; - const G4double Silicon_PosZ = AluStripFront_PosZ + 0.5*AluStripThickness + 0.5*FirstStageThickness ; - const G4double AluStripBack_PosZ = Silicon_PosZ + 0.5*FirstStageThickness + 0.5*AluStripThickness ; - const G4double VacBox_PosZ = AluStripBack_PosZ + 0.5*AluStripThickness + 0.5* VacBoxThickness ; - const G4double ThirdStage_PosZ = VacBox_PosZ + 0.5*VacBoxThickness + 0.5*ThirdStageThickness ; -} - -#endif diff --git a/NPSimulation/include/HydeTrackerDummyShape.hh b/NPSimulation/include/HydeTrackerDummyShape.hh deleted file mode 100644 index 0ca74aa31..000000000 --- a/NPSimulation/include/HydeTrackerDummyShape.hh +++ /dev/null @@ -1,194 +0,0 @@ -#ifndef HydeTrackerDummyShape_h -#define HydeTrackerDummyShape_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 : 03/09/09 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: Define a dummy module for the Hyde tracker * - * The goal of this class is to be a starting point to create a * - * new shape to be added to the Hyde tracker. * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -// C++ headers -#include <vector> - -// NPTool header -#include "HydeTrackerModule.hh" -#include "TInteractionCoordinates.h" - -using namespace std; - - - -class HydeTrackerDummyShape : public HydeTrackerModule -{ - //////////////////////////////////////////////////// - /////// Default Constructor and Destructor ///////// - //////////////////////////////////////////////////// -public: - HydeTrackerDummyShape(); - virtual ~HydeTrackerDummyShape(); - - //////////////////////////////////////////////////// - //////// 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 TelescopeNumber , - G4ThreeVector MMpos , - G4RotationMatrix* MMrot , - bool wFirstStage , - bool wSecondStage , - bool wThirdStage , - G4LogicalVolume* world); - - - //////////////////////////////////////////////////// - //// Inherite from HydeTrackerModule 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 HydeTrackerModule - // This is mandatory since the HydeTracker*** 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 HYDDUMMYSHAPE -{ - // Resolution -// const G4double ResoFirstStage = 0; // = 50 keV of Resolution // Unit is MeV/2.35 - //const G4double ResoFirstStage = 0.0213; // = 50 keV of Resolution // Unit is MeV/2.35 - const G4double ResoFirstStage = 0.0426; // = 100 keV of Resolution // Unit is MeV/2.35 - //const G4double ResoSecondStage = 0.00426426; // = 100 keV of resolution // Unit is MeV/2.35 - const G4double ResoSecondStage = 0.0128; // = 30 keV of resolution // Unit is MeV/2.35 - //const G4double ResoThirdStage = 0.0426; // = 100 keV of resolution // Unit is MeV/2.35 - const G4double ResoThirdStage = 0.0128; // = 30 keV of resolution // Unit is MeV/2.35 - const G4double ResoTimeGpd = 0.212765957;// = 500ps // Unit is ns/2.35 - - // Geometry for the mother volume containing the different layers of your dummy shape module - const G4double FaceFront = 5.1*cm; - const G4double FaceBack = 5.1*cm; - const G4double Length = 1.5*cm; - const G4double InterStageDistance = 7*mm; - // for testing the excitation energy reconstruction -// const G4double Length = 4*cm; -// const G4double InterStageDistance = 15*mm; - - // First stage - const G4double FirstStageFace = 5.0*cm; - //const G4double FirstStageThickness = 300*micrometer; - //const G4double FirstStageThickness = 20*micrometer; - const G4double FirstStageThickness = 100*micrometer; -// const G4double FirstStageThickness = 2*mm; - // for testing the excitation energy reconstruction -// const G4double FirstStageThickness = 1.3*cm; -// const G4int NumberOfStrips = 10; // 5 mm strip pitch -// const G4int NumberOfStrips = 16; // 3.125 mm strip pitch -// const G4int NumberOfStrips = 25; // 2 mm strip pitch -// const G4int NumberOfStrips = 50; // 1 mm strip pitch -// const G4int NumberOfStrips = 64; // 0.781 mm strip pitch -// const G4int NumberOfStrips = 100; // 0.5 mm strip pitch - const G4int NumberOfStrips = 16; // 0.391 mm strip pitch -// const G4int NumberOfStrips = 500; // 0.1 mm strip pitch - - // Second stage - const G4double SecondStageFace = FirstStageFace; - //const G4double SecondStageThickness = 1.5*mm; - const G4double SecondStageThickness = 100*micrometer; - - // Third stage - const G4double ThirdStageFace = FirstStageFace; - //const G4double ThirdStageThickness = 1.5*mm; - const G4double ThirdStageThickness = 10*mm; - - // Starting at the front of the first stage and going to the third stage - const G4double FirstStage_PosZ = Length* -0.5 + 0.5*FirstStageThickness; - const G4double SecondStage_PosZ = Length* -0.5 + 0.5*SecondStageThickness + 1*InterStageDistance; - const G4double ThirdStage_PosZ = Length* -0.5 + 0.5*ThirdStageThickness + 2*InterStageDistance; -} - -#endif diff --git a/NPSimulation/include/HydeTrackerModule.hh b/NPSimulation/include/HydeTrackerModule.hh deleted file mode 100644 index e2429960e..000000000 --- a/NPSimulation/include/HydeTrackerModule.hh +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef HydeTrackerModule_h -#define HydeTrackerModule_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 : 10/06/09 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: This class is an Abstract Base Class (ABC) from which should * - * derive all different modules from the Hyde tracker. * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -// C++ headers -#include <string> -#include <vector> - -// G4 headers -#include "G4LogicalVolume.hh" -#include "G4Event.hh" -#include "G4MultiFunctionalDetector.hh" - -// NPTool - ROOT headers -#include "TInteractionCoordinates.h" -#include "THydeTrackerData.h" - -using namespace std; - - - -class HydeTrackerModule -{ -public: - HydeTrackerModule(); - virtual ~HydeTrackerModule(); - -public: - // Read stream at Configfile to pick-up parameters of detector (Position,...) - virtual void ReadConfiguration(string Path) = 0; - - // Construct detector and inialise sensitive part. - virtual void ConstructDetector(G4LogicalVolume* world) = 0; - - // Read sensitive part of a the HydeTrackerModule detector and fill the Root tree. - virtual void ReadSensitive(const G4Event* event) = 0; - - // Add Detector branch to the ROOT output tree - virtual void InitializeRootOutput(); - - // Initialize all scorers necessary for each detector - virtual void InitializeScorers() = 0; - - // Give the static TInteractionCoordinates from VDetector to the classes - // deriving from HydeTrackerModule - // This is mandatory since the HydeTracker*** does not derive from VDetector - virtual void SetInterCoordPointer(TInteractionCoordinates* interCoord) = 0; - virtual TInteractionCoordinates* GetInterCoordPointer() = 0; - - // Initialize the Index map for the different modules of Hyde - void InitializeIndex(); - -public: - THydeTrackerData* GetEventPointer() {return ms_Event;}; - -protected: - // Class to store the result of simulation - static THydeTrackerData* ms_Event; - - // Set to true if you want this stage on you telescope - vector<bool> m_wFirstStage; - vector<bool> m_wSecondStage; - vector<bool> m_wThirdStage; - - // Set to true if you want to see Telescope Frame in your visualisation - bool m_non_sensitive_part_visiualisation; - -protected: - // First stage Associate Scorer - G4MultiFunctionalDetector* m_FirstStageScorer; - - // Second stage Associate Scorer - G4MultiFunctionalDetector* m_SecondStageScorer; - - // Third stage Associate Scorer - G4MultiFunctionalDetector* m_ThirdStageScorer; - -protected: - map<string, int> m_index; -}; - -#endif diff --git a/NPSimulation/include/HydeTrackerSquare.hh b/NPSimulation/include/HydeTrackerSquare.hh deleted file mode 100644 index 6d317558a..000000000 --- a/NPSimulation/include/HydeTrackerSquare.hh +++ /dev/null @@ -1,191 +0,0 @@ -#ifndef HydeTrackerSquare_h -#define HydeTrackerSquare_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 : 10/06/09 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: Define a module of square shape for the Hyde tracker * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -// C++ headers -#include <vector> - -// NPTool header -#include "HydeTrackerModule.hh" -#include "TInteractionCoordinates.h" - -using namespace std; - - - -class HydeTrackerSquare : public HydeTrackerModule -{ - //////////////////////////////////////////////////// - /////// Default Constructor and Destructor ///////// - //////////////////////////////////////////////////// -public: - HydeTrackerSquare(); - virtual ~HydeTrackerSquare(); - - //////////////////////////////////////////////////// - //////// 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 TelescopeNumber , - G4ThreeVector MMpos , - G4RotationMatrix* MMrot , - bool wFirstStage , - bool wSecondStage , - bool wThirdStage , - G4LogicalVolume* world); - - - //////////////////////////////////////////////////// - //// Inherite from HydeTrackerModule 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 HydeTrackerModule - // This is mandatory since the HydeTracker*** 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 ; // | - - // for debugging purpose - G4ThreeVector MMpos; - G4ThreeVector MMu; - G4ThreeVector MMv; - G4ThreeVector MMw; - G4ThreeVector CT; -}; - - - -namespace HYDSQUARE -{ - // Resolution - const G4double ResoFirstStage = 0 ;// = 52keV of Resolution // Unit is MeV/2.35 -// const G4double ResoFirstStage = 0.022 ;// = 52keV of Resolution // Unit is MeV/2.35 - const G4double ResoSecondStage = 0.055 ;// = 130 keV of resolution // Unit is MeV/2.35 - const G4double ResoThirdStage = 0 ;// = 100 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 - - // Geometry - const G4double FaceFront = 11.*cm ; - const G4double FaceBack = 16.5*cm ; -// const G4double Length = 7.2*cm ; - const G4double Length = 2.0*cm ; - - // First stage -// const G4double AluStripThickness = 0.00000001*micrometer; - const G4double AluStripThickness = 0.4*micrometer ; - const G4double SiliconThickness = 300*micrometer ; - const G4double SiliconFace = 98*mm ; -// const G4double VacBoxThickness = 3*cm ; - const G4double VacBoxThickness = 0.5*cm ; - const G4int NumberOfStrips = 128; - - // Second stage - const G4double SiLiThickness = 5.1*mm ; // Must be checked - const G4double SiLiFaceX = 48.25*mm ; - const G4double SiLiFaceY = 92*mm ; - - // Third stage - const G4double MylarCsIThickness = 3*micrometer; -// const G4double ThirdStageThickness = 1.5*mm; - const G4double ThirdStageThickness = 8.5*mm; - const G4double ThirdStageFaceFront = FaceFront; - const G4double ThirdStageFaceBack = FaceBack; - - // Starting at the front and going to CsI - const G4double AluStripFront_PosZ = Length* -0.5 + 0.5*AluStripThickness ; - const G4double Silicon_PosZ = AluStripFront_PosZ + 0.5*AluStripThickness + 0.5*SiliconThickness ; - const G4double AluStripBack_PosZ = Silicon_PosZ + 0.5*SiliconThickness + 0.5*AluStripThickness ; - const G4double VacBox_PosZ = AluStripBack_PosZ + 0.5*AluStripThickness + 0.5* VacBoxThickness ; - const G4double ThirdStage_PosZ = VacBox_PosZ + 0.5*VacBoxThickness + 0.5*ThirdStageThickness ; -} - -#endif diff --git a/NPSimulation/include/HydeTrackerTrapezoid.hh b/NPSimulation/include/HydeTrackerTrapezoid.hh deleted file mode 100644 index d1a833c97..000000000 --- a/NPSimulation/include/HydeTrackerTrapezoid.hh +++ /dev/null @@ -1,196 +0,0 @@ -#ifndef HydeTrackerTrapezoid_h -#define HydeTrackerTrapezoid_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 Hyde tracker * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - - - -// C++ headers -#include <vector> - -// NPTool header -#include "HydeTrackerModule.hh" -#include "TInteractionCoordinates.h" - -using namespace std; - - - -class HydeTrackerTrapezoid : public HydeTrackerModule -{ - //////////////////////////////////////////////////// - /////// Default Constructor and Destructor ///////// - //////////////////////////////////////////////////// -public: - HydeTrackerTrapezoid(); - virtual ~HydeTrackerTrapezoid(); - - //////////////////////////////////////////////////// - //////// 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 TelescopeNumber , - G4ThreeVector MMpos , - G4RotationMatrix* MMrot , - bool wFirstStage , - bool wSecondStage , - bool wThirdStage , - G4LogicalVolume* world); - - - //////////////////////////////////////////////////// - //// Inherite from HydeTrackerModule 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 HydeTrackerModule - // This is mandatory since the HydeTracker*** 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 ; // | - - // for debugging purpose - G4ThreeVector MMpos; - G4ThreeVector MMu; - G4ThreeVector MMv; - G4ThreeVector MMw; - G4ThreeVector CT; -}; - - - -namespace HYDTRAP -{ - // Energy/Time resolutions for the different layers - const G4double ResoFirstStage = 0 ;// = 52keV of Resolution // Unit is MeV/2.35 -// const G4double ResoFirstStage = 0.022 ;// = 52keV of Resolution // Unit is MeV/2.35 - const G4double ResoSecondStage = 0.055 ;// = 130 keV of resolution // Unit is MeV/2.35 - const G4double ResoThirdStage = 0 ;// = 100 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 - - // Geometry - const G4double Height = 90*mm; - const G4double BaseLarge = 85*mm; - const G4double BaseSmall = 35*mm; - const G4double Length = 20*mm; - - // First stage -// const G4double AluStripThickness = 0.00000001*micrometer; - const G4double AluStripThickness = 0.4*micrometer; - const G4double FirstStageThickness = 300*micrometer; - const G4double FirstStageHeight = 81*mm; - const G4double FirstStageBaseLarge = 78*mm; - const G4double FirstStageBaseSmall = 29*mm; -// const G4double VacBoxThickness = 3*cm ; - const G4double VacBoxThickness = 0.5*cm; - const G4int NumberOfStripsX = 128; - const G4int NumberOfStripsY = 128; - - // Second stage - const G4double SiLiThickness = 5.1*mm ; // Must be checked - const G4double SiLiFaceX = 48.25*mm ; - const G4double SiLiFaceY = 92*mm ; - - // Third stage - const G4double MylarCsIThickness = 3*micrometer; -// const G4double ThirdStageThickness = 1.5*mm; - const G4double ThirdStageThickness = 8.5*mm; -// const G4double ThirdStageFaceFront = FaceFront; -// const G4double ThirdStageFaceBack = FaceBack; - - // Starting at the front and going to CsI - const G4double AluStripFront_PosZ = Length* -0.5 + 0.5*AluStripThickness ; - const G4double Silicon_PosZ = AluStripFront_PosZ + 0.5*AluStripThickness + 0.5*FirstStageThickness ; - const G4double AluStripBack_PosZ = Silicon_PosZ + 0.5*FirstStageThickness + 0.5*AluStripThickness ; - const G4double VacBox_PosZ = AluStripBack_PosZ + 0.5*AluStripThickness + 0.5* VacBoxThickness ; - const G4double ThirdStage_PosZ = VacBox_PosZ + 0.5*VacBoxThickness + 0.5*ThirdStageThickness ; -} - -#endif diff --git a/NPSimulation/src/HydeScorers.cc b/NPSimulation/src/HydeScorers.cc deleted file mode 100644 index 59409ac25..000000000 --- a/NPSimulation/src/HydeScorers.cc +++ /dev/null @@ -1,764 +0,0 @@ -/***************************************************************************** - * 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 : 11/07/09 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: This class holds all the scorers needed by the * - * HydeTracker*** objects. * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -// G4 headers -#include "G4UnitsTable.hh" - -// NPTool headers -#include "GeneralScorers.hh" -#include "HydeScorers.hh" - -#include "HydeTrackerDummyShape.hh" -#include "HydeTrackerSquare.hh" -#include "HydeTrackerTrapezoid.hh" -#include "HydeTrackerAnnular.hh" -using namespace HYDSQUARE; -using namespace HYDTRAP; -using namespace HYDANNULAR; -using namespace HYDDUMMYSHAPE; - -using namespace HYDSCORERS; - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Added by Adrien MATTA: -// Those Scorer use TrackID as map index. This way ones can rebuild energy deposit, -// time of flight or position,... particle by particle for each event. Because standard -// scorer provide by G4 don't work this way but using a global ID for each event you should -// not use those scorer with some G4 provided ones or being very carefull doing so. - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// FirstStage Energy Scorer (deal with multiple particle hit) -HYDScorerFirstStageEnergy::HYDScorerFirstStageEnergy(G4String name, G4String volumeName, G4int depth) - : G4VPrimitiveScorer(name, depth), HCID(-1) -{ - m_VolumeName = volumeName; -} - -HYDScorerFirstStageEnergy::~HYDScorerFirstStageEnergy() -{ -} - -G4bool HYDScorerFirstStageEnergy::ProcessHits(G4Step* aStep, G4TouchableHistory*) -{ - // get detector number - int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, m_VolumeName); - - // get energy - G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); - POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); - - G4double edep = aStep->GetTotalEnergyDeposit(); - if (edep < TriggerThreshold) return FALSE; - G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->add(DetNbr + index, edep); - return TRUE; -} - -void HYDScorerFirstStageEnergy::Initialize(G4HCofThisEvent* HCE) -{ - EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName()); - if (HCID < 0) { - HCID = GetCollectionID(0); - } - HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); -} - -void HYDScorerFirstStageEnergy::EndOfEvent(G4HCofThisEvent*) -{ -} - -void HYDScorerFirstStageEnergy::Clear() -{ - EvtMap->clear(); -} - -void HYDScorerFirstStageEnergy::DrawAll() -{ -} - -void HYDScorerFirstStageEnergy::PrintAll() -{ - G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl; - G4cout << " PrimitiveScorer " << GetName() << G4endl; - G4cout << " Number of entries " << EvtMap->entries() << G4endl; - std::map<G4int, G4double*>::iterator itr = EvtMap->GetMap()->begin(); - for (; itr != EvtMap->GetMap()->end(); itr++) { - G4cout << " copy no.: " << itr->first - << " energy deposit: " << G4BestUnit(*(itr->second), "Energy") - << G4endl; - } -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// SecondStage Energy Scorer (deal with multiple particle hit) -HYDScorerSecondStageEnergy::HYDScorerSecondStageEnergy(G4String name, G4String volumeName, G4int depth) - : G4VPrimitiveScorer(name, depth), HCID(-1) -{ - m_VolumeName = volumeName; -} - -HYDScorerSecondStageEnergy::~HYDScorerSecondStageEnergy() -{ -} - -G4bool HYDScorerSecondStageEnergy::ProcessHits(G4Step* aStep, G4TouchableHistory*) -{ - // get detector number - int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, m_VolumeName); - - // get energy - G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); - POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); - - G4double edep = aStep->GetTotalEnergyDeposit(); - if (edep < TriggerThreshold) return FALSE; - G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->add(DetNbr + index, edep); - return TRUE; -} - -void HYDScorerSecondStageEnergy::Initialize(G4HCofThisEvent* HCE) -{ - EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName()); - if (HCID < 0) { - HCID = GetCollectionID(0); - } - HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); -} - -void HYDScorerSecondStageEnergy::EndOfEvent(G4HCofThisEvent*) -{ -} - -void HYDScorerSecondStageEnergy::Clear() -{ - EvtMap->clear(); -} - -void HYDScorerSecondStageEnergy::DrawAll() -{ -} - -void HYDScorerSecondStageEnergy::PrintAll() -{ - G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl; - G4cout << " PrimitiveScorer " << GetName() << G4endl; - G4cout << " Number of entries " << EvtMap->entries() << G4endl; - std::map<G4int, G4double*>::iterator itr = EvtMap->GetMap()->begin(); - for (; itr != EvtMap->GetMap()->end(); itr++) { - G4cout << " copy no.: " << itr->first - << " energy deposit: " << G4BestUnit(*(itr->second), "Energy") - << G4endl; - } -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// ThirdStage Energy Scorer (deal with multiple particle hit) -HYDScorerThirdStageEnergy::HYDScorerThirdStageEnergy(G4String name, G4String volumeName, G4int depth) - : G4VPrimitiveScorer(name, depth), HCID(-1) -{ - m_VolumeName = volumeName; -} - -HYDScorerThirdStageEnergy::~HYDScorerThirdStageEnergy() -{ -} - -G4bool HYDScorerThirdStageEnergy::ProcessHits(G4Step* aStep, G4TouchableHistory*) -{ - // get detector number - int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, m_VolumeName); - - // get energy - G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); - POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); - - G4double edep = aStep->GetTotalEnergyDeposit(); - if (edep < TriggerThreshold) return FALSE; - G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->add(DetNbr + index, edep); - return TRUE; -} - -void HYDScorerThirdStageEnergy::Initialize(G4HCofThisEvent* HCE) -{ - EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName()); - if (HCID < 0) { - HCID = GetCollectionID(0); - } - HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); -} - -void HYDScorerThirdStageEnergy::EndOfEvent(G4HCofThisEvent*) -{ -} - -void HYDScorerThirdStageEnergy::Clear() -{ - EvtMap->clear(); -} - -void HYDScorerThirdStageEnergy::DrawAll() -{ -} - -void HYDScorerThirdStageEnergy::PrintAll() -{ - G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl; - G4cout << " PrimitiveScorer " << GetName() << G4endl; - G4cout << " Number of entries " << EvtMap->entries() << G4endl; - std::map<G4int, G4double*>::iterator itr = EvtMap->GetMap()->begin(); - for (; itr != EvtMap->GetMap()->end(); itr++) { - G4cout << " copy no.: " << itr->first - << " energy deposit: " << G4BestUnit(*(itr->second), "Energy") - << G4endl; - } -} - - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// FirstStage Front Strip position Scorer for DummyShape geometry -HYDScorerFirstStageFrontStripDummyShape::HYDScorerFirstStageFrontStripDummyShape(G4String name, G4int depth, G4int NumberOfStrip) - : G4VPrimitiveScorer(name, depth), HCID(-1) -{ - m_NumberOfStrip = NumberOfStrip ; -} - -HYDScorerFirstStageFrontStripDummyShape::~HYDScorerFirstStageFrontStripDummyShape() -{ -} - -G4bool HYDScorerFirstStageFrontStripDummyShape::ProcessHits(G4Step* aStep, G4TouchableHistory*) -{ - // get detector number - int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "HYDDummyShape"); - - // get front strip number - G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); - POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); - - G4double StripPitch = HYDDUMMYSHAPE::FirstStageFace / m_NumberOfStrip; - - G4double temp = (POS(0) + HYDDUMMYSHAPE::FirstStageFace / 2.) / StripPitch ; - G4double X = int(temp) + 1 ; - - //Rare case where particle is close to edge of silicon plan - if (X == m_NumberOfStrip+1) X = m_NumberOfStrip; - G4double edep = aStep->GetTotalEnergyDeposit(); - if (edep < TriggerThreshold) return FALSE; - G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->set(DetNbr + index, X); - return TRUE; -} - -void HYDScorerFirstStageFrontStripDummyShape::Initialize(G4HCofThisEvent* HCE) -{ - EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName()); - if (HCID < 0) { - HCID = GetCollectionID(0); - } - HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); -} - -void HYDScorerFirstStageFrontStripDummyShape::EndOfEvent(G4HCofThisEvent*) -{ -} - -void HYDScorerFirstStageFrontStripDummyShape::Clear() -{ - EvtMap->clear(); -} - -void HYDScorerFirstStageFrontStripDummyShape::DrawAll() -{ -} - -void HYDScorerFirstStageFrontStripDummyShape::PrintAll() -{ - G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl ; - G4cout << " PrimitiveScorer " << GetName() << G4endl ; - G4cout << " Number of entries " << EvtMap->entries() << G4endl ; -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// FirstStage Back Strip position Scorer for DummyShape geometry -HYDScorerFirstStageBackStripDummyShape::HYDScorerFirstStageBackStripDummyShape(G4String name, G4int depth, G4int NumberOfStrip) - : G4VPrimitiveScorer(name, depth), HCID(-1) -{ - m_NumberOfStrip = NumberOfStrip ; -} - -HYDScorerFirstStageBackStripDummyShape::~HYDScorerFirstStageBackStripDummyShape() -{ -} - -G4bool HYDScorerFirstStageBackStripDummyShape::ProcessHits(G4Step* aStep, G4TouchableHistory*) -{ - // get detector number - int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "HYDDummyShape"); - - // get back strip number - G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); - POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); - - G4double StripPitch = HYDDUMMYSHAPE::FirstStageFace / m_NumberOfStrip; - - G4double temp = (POS(1) + HYDDUMMYSHAPE::FirstStageFace / 2.) / StripPitch ; - G4double X = int(temp) + 1 ; - //Rare case where particle is close to edge of silicon plan - if (X == m_NumberOfStrip+1) X = m_NumberOfStrip; - G4double edep = aStep->GetTotalEnergyDeposit(); - if (edep < TriggerThreshold) return FALSE; - G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->set(DetNbr + index, X); - return TRUE; -} - -void HYDScorerFirstStageBackStripDummyShape::Initialize(G4HCofThisEvent* HCE) -{ - EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName()); - if (HCID < 0) { - HCID = GetCollectionID(0); - } - HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); -} - -void HYDScorerFirstStageBackStripDummyShape::EndOfEvent(G4HCofThisEvent*) -{ -} - -void HYDScorerFirstStageBackStripDummyShape::Clear() -{ - EvtMap->clear(); -} - -void HYDScorerFirstStageBackStripDummyShape::DrawAll() -{ -} - -void HYDScorerFirstStageBackStripDummyShape::PrintAll() -{ - G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl ; - G4cout << " PrimitiveScorer " << GetName() << G4endl ; - G4cout << " Number of entries " << EvtMap->entries() << G4endl ; -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// FirstStage Front Strip position Scorer for Square geometry -HYDScorerFirstStageFrontStripSquare::HYDScorerFirstStageFrontStripSquare(G4String name, G4int depth, G4int NumberOfStrip) - : G4VPrimitiveScorer(name, depth), HCID(-1) -{ - m_NumberOfStrip = NumberOfStrip ; -} - -HYDScorerFirstStageFrontStripSquare::~HYDScorerFirstStageFrontStripSquare() -{ -} - -G4bool HYDScorerFirstStageFrontStripSquare::ProcessHits(G4Step* aStep, G4TouchableHistory*) -{ - // get detector number - int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "HYDSquare"); - - // get front strip - G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); - POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); - - G4double StripPitch = HYDSQUARE::SiliconFace / m_NumberOfStrip; - - G4double temp = (POS(0) + HYDSQUARE::SiliconFace / 2.) / StripPitch ; - G4double X = int(temp) + 1 ; - //Rare case where particle is close to edge of silicon plan - if (X == 129) X = 128; - G4double edep = aStep->GetTotalEnergyDeposit(); - if (edep < TriggerThreshold) return FALSE; - G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->set(DetNbr + index, X); - return TRUE; -} - -void HYDScorerFirstStageFrontStripSquare::Initialize(G4HCofThisEvent* HCE) -{ - EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName()); - if (HCID < 0) { - HCID = GetCollectionID(0); - } - HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); -} - -void HYDScorerFirstStageFrontStripSquare::EndOfEvent(G4HCofThisEvent*) -{ -} - -void HYDScorerFirstStageFrontStripSquare::Clear() -{ - EvtMap->clear(); -} - -void HYDScorerFirstStageFrontStripSquare::DrawAll() -{ -} - -void HYDScorerFirstStageFrontStripSquare::PrintAll() -{ - G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl ; - G4cout << " PrimitiveScorer " << GetName() << G4endl ; - G4cout << " Number of entries " << EvtMap->entries() << G4endl ; -} - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// FirstStage Back Strip position Scorer for Square geometry -HYDScorerFirstStageBackStripSquare::HYDScorerFirstStageBackStripSquare(G4String name, G4int depth, G4int NumberOfStrip) - : G4VPrimitiveScorer(name, depth), HCID(-1) -{ - m_NumberOfStrip = NumberOfStrip ; -} - -HYDScorerFirstStageBackStripSquare::~HYDScorerFirstStageBackStripSquare() -{ -} - -G4bool HYDScorerFirstStageBackStripSquare::ProcessHits(G4Step* aStep, G4TouchableHistory*) -{ - // get detector number - int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "HYDSquare"); - - // get back strip - G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); - POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); - - G4double StripPitch = HYDSQUARE::SiliconFace / m_NumberOfStrip; - - G4double temp = (POS(1) + HYDSQUARE::SiliconFace / 2.) / StripPitch ; - G4int temp2 = temp ; - G4double Y = temp2 + 1 ; - //Rare case where particle is close to edge of silicon plan - if (Y == 129) Y = 128; - - G4double edep = aStep->GetTotalEnergyDeposit(); - if (edep < TriggerThreshold) return FALSE; - G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->set(DetNbr + index, Y); - return TRUE; -} - -void HYDScorerFirstStageBackStripSquare::Initialize(G4HCofThisEvent* HCE) -{ - EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName()); - if (HCID < 0) { - HCID = GetCollectionID(0); - } - HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); -} - -void HYDScorerFirstStageBackStripSquare::EndOfEvent(G4HCofThisEvent*) -{ -} - -void HYDScorerFirstStageBackStripSquare::Clear() -{ - EvtMap->clear(); -} - -void HYDScorerFirstStageBackStripSquare::DrawAll() -{ -} - -void HYDScorerFirstStageBackStripSquare::PrintAll() -{ - G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl ; - G4cout << " PrimitiveScorer " << GetName() << G4endl ; - G4cout << " Number of entries " << EvtMap->entries() << G4endl ; -} - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// FirstStage Front Strip position Scorer for Trapezoid geometry -HYDScorerFirstStageFrontStripTrapezoid::HYDScorerFirstStageFrontStripTrapezoid(G4String name, G4int depth, G4int NumberOfStrip) - : G4VPrimitiveScorer(name, depth), HCID(-1) -{ - m_NumberOfStrip = NumberOfStrip; -} - -HYDScorerFirstStageFrontStripTrapezoid::~HYDScorerFirstStageFrontStripTrapezoid() -{ -} - -G4bool HYDScorerFirstStageFrontStripTrapezoid::ProcessHits(G4Step* aStep, G4TouchableHistory*) -{ - // get detector number - int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "HYDTrapezoid"); - - // get front strip - G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); - POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); - - G4double StripPitch = HYDTRAP::FirstStageBaseLarge / m_NumberOfStrip; - - G4double temp = (POS(0) + HYDTRAP::FirstStageBaseLarge / 2.) / StripPitch ; - G4double X = int(temp) + 1 ; - //Rare case where particle is close to edge of silicon plan - if (X == 129) X = 128; - G4double edep = aStep->GetTotalEnergyDeposit(); - if (edep < TriggerThreshold) return FALSE; - G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->set(DetNbr + index, X); - return TRUE; -} - -void HYDScorerFirstStageFrontStripTrapezoid::Initialize(G4HCofThisEvent* HCE) -{ - EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName()); - if (HCID < 0) { - HCID = GetCollectionID(0); - } - HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); -} - -void HYDScorerFirstStageFrontStripTrapezoid::EndOfEvent(G4HCofThisEvent*) -{ -} - -void HYDScorerFirstStageFrontStripTrapezoid::Clear() -{ - EvtMap->clear(); -} - -void HYDScorerFirstStageFrontStripTrapezoid::DrawAll() -{ -} - -void HYDScorerFirstStageFrontStripTrapezoid::PrintAll() -{ - G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl ; - G4cout << " PrimitiveScorer " << GetName() << G4endl ; - G4cout << " Number of entries " << EvtMap->entries() << G4endl ; -} - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// FirstStage Back Strip position Scorer for Trapezoid geometry -HYDScorerFirstStageBackStripTrapezoid::HYDScorerFirstStageBackStripTrapezoid(G4String name, G4int depth, G4int NumberOfStrip) - : G4VPrimitiveScorer(name, depth), HCID(-1) -{ - m_NumberOfStrip = NumberOfStrip; -} - -HYDScorerFirstStageBackStripTrapezoid::~HYDScorerFirstStageBackStripTrapezoid() -{ -} - -G4bool HYDScorerFirstStageBackStripTrapezoid::ProcessHits(G4Step* aStep, G4TouchableHistory*) -{ - // get detector number - int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "HYDTrapezoid"); - - // get back strip - G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); - POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); - - G4double StripPitch = HYDTRAP::FirstStageHeight / m_NumberOfStrip; - - G4double temp = (POS(1) + HYDTRAP::FirstStageHeight / 2.) / StripPitch ; - G4int temp2 = temp ; - G4double Y = temp2 + 1 ; - //Rare case where particle is close to edge of silicon plan - if (Y == 129) Y = 128; - - G4double edep = aStep->GetTotalEnergyDeposit(); - if (edep < TriggerThreshold) return FALSE; - G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->set(DetNbr + index, Y); - return TRUE; -} - -void HYDScorerFirstStageBackStripTrapezoid::Initialize(G4HCofThisEvent* HCE) -{ - EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName()); - if (HCID < 0) { - HCID = GetCollectionID(0); - } - HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); -} - -void HYDScorerFirstStageBackStripTrapezoid::EndOfEvent(G4HCofThisEvent*) -{ -} - -void HYDScorerFirstStageBackStripTrapezoid::Clear() -{ - EvtMap->clear(); -} - -void HYDScorerFirstStageBackStripTrapezoid::DrawAll() -{ -} - -void HYDScorerFirstStageBackStripTrapezoid::PrintAll() -{ - G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl ; - G4cout << " PrimitiveScorer " << GetName() << G4endl ; - G4cout << " Number of entries " << EvtMap->entries() << G4endl ; -} - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// FirstStage Front Strip position Scorer for Annular geometry -HYDScorerFirstStageFrontStripAnnular::HYDScorerFirstStageFrontStripAnnular(G4String name, G4int depth, G4double StripPlaneSize, G4int NumberOfStrip) - : G4VPrimitiveScorer(name, depth), HCID(-1) -{ - m_StripPlaneSize = StripPlaneSize ; - m_NumberOfStrip = NumberOfStrip ; -} - -HYDScorerFirstStageFrontStripAnnular::~HYDScorerFirstStageFrontStripAnnular() -{ -} - -G4bool HYDScorerFirstStageFrontStripAnnular::ProcessHits(G4Step* aStep, G4TouchableHistory*) -{ - // get detector number - int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "HYDAnnular"); - - // get front strip - G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); - POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); - - G4double StripPitch = m_StripPlaneSize / m_NumberOfStrip; - - G4double temp = (POS(0) + m_StripPlaneSize / 2.) / StripPitch ; - G4double X = int(temp) + 1 ; - //Rare case where particle is close to edge of silicon plan - if (X == 129) X = 128; - G4double edep = aStep->GetTotalEnergyDeposit(); - if (edep < TriggerThreshold) return FALSE; - G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->set(DetNbr + index, X); - return TRUE; -} - -void HYDScorerFirstStageFrontStripAnnular::Initialize(G4HCofThisEvent* HCE) -{ - EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName()); - if (HCID < 0) { - HCID = GetCollectionID(0); - } - HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); -} - -void HYDScorerFirstStageFrontStripAnnular::EndOfEvent(G4HCofThisEvent*) -{ -} - -void HYDScorerFirstStageFrontStripAnnular::Clear() -{ - EvtMap->clear(); -} - -void HYDScorerFirstStageFrontStripAnnular::DrawAll() -{ -} - -void HYDScorerFirstStageFrontStripAnnular::PrintAll() -{ - G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl ; - G4cout << " PrimitiveScorer " << GetName() << G4endl ; - G4cout << " Number of entries " << EvtMap->entries() << G4endl ; -} - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// FirstStage Back Strip position Scorer for Annular geometry -HYDScorerFirstStageBackStripAnnular::HYDScorerFirstStageBackStripAnnular(G4String name, G4int depth, G4double StripPlaneSize, G4int NumberOfStrip) - : G4VPrimitiveScorer(name, depth), HCID(-1) -{ - m_StripPlaneSize = StripPlaneSize ; - m_NumberOfStrip = NumberOfStrip ; -} - -HYDScorerFirstStageBackStripAnnular::~HYDScorerFirstStageBackStripAnnular() -{ -} - -G4bool HYDScorerFirstStageBackStripAnnular::ProcessHits(G4Step* aStep, G4TouchableHistory*) -{ - // get detector number - int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "HYDAnnular"); - - // get back strip - G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); - POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); - - G4double StripPitch = m_StripPlaneSize / m_NumberOfStrip; - - G4double temp = (POS(1) + m_StripPlaneSize / 2.) / StripPitch ; - G4int temp2 = temp ; - G4double Y = temp2 + 1 ; - //Rare case where particle is close to edge of silicon plan - if (Y == 129) Y = 128; - - G4double edep = aStep->GetTotalEnergyDeposit(); - if (edep < TriggerThreshold) return FALSE; - G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->set(DetNbr + index, Y); - return TRUE; -} - -void HYDScorerFirstStageBackStripAnnular::Initialize(G4HCofThisEvent* HCE) -{ - EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName()); - if (HCID < 0) { - HCID = GetCollectionID(0); - } - HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); -} - -void HYDScorerFirstStageBackStripAnnular::EndOfEvent(G4HCofThisEvent*) -{ -} - -void HYDScorerFirstStageBackStripAnnular::Clear() -{ - EvtMap->clear(); -} - -void HYDScorerFirstStageBackStripAnnular::DrawAll() -{ -} - -void HYDScorerFirstStageBackStripAnnular::PrintAll() -{ - G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl ; - G4cout << " PrimitiveScorer " << GetName() << G4endl ; - G4cout << " Number of entries " << EvtMap->entries() << G4endl ; -} diff --git a/NPSimulation/src/HydeTracker.cc b/NPSimulation/src/HydeTracker.cc deleted file mode 100644 index 6d5599773..000000000 --- a/NPSimulation/src/HydeTracker.cc +++ /dev/null @@ -1,191 +0,0 @@ -/***************************************************************************** - * 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 : 10/06/09 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: This class manages different shapes of module for the Hyde * - * tracker. It allows to have Hyde geometries with an * - * heterogeneous set of modules * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -// C++ headers -#include <fstream> -#include <sstream> -#include <string> -#include <cmath> - -// NPTool headers -#include "HydeTracker.hh" -#include "HydeTrackerSquare.hh" -#include "HydeTrackerTrapezoid.hh" -#include "HydeTrackerAnnular.hh" -#include "HydeTrackerDummyShape.hh" - -using namespace std; - - -HydeTracker::HydeTracker() -{ -} - - - -HydeTracker::~HydeTracker() -{ -} - - - -// Read stream at Configfile to pick-up parameters of detector (Position,...) -// Called in DetecorConstruction::ReadDetextorConfiguration Method -void HydeTracker::ReadConfiguration(string Path) -{ - // open configuration file - ifstream ConfigFile; - ConfigFile.open(Path.c_str()); - - bool HYDTrkSquare = false; - bool HYDTrkTrapezoid = false; - bool HYDTrkAnnular = false; - bool HYDTrkDummyShape = false; - - string LineBuffer; - while (!ConfigFile.eof()) { - getline(ConfigFile, LineBuffer); - if (LineBuffer.compare(0, 9, "HYDSquare") == 0 && HYDTrkSquare == false) { - HYDTrkSquare = true; - - // instantiate a new "detector" corresponding to the Square elements - HydeTrackerModule* myDetector = new HydeTrackerSquare(); - - // 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 HydeTrackerSquare "detector" - m_Modules.push_back(myDetector); - } - else if (LineBuffer.compare(0, 12, "HYDTrapezoid") == 0 && HYDTrkTrapezoid == false) { - HYDTrkTrapezoid = true; - - // instantiate a new "detector" corresponding to the Trapezoid elements - HydeTrackerModule* myDetector = new HydeTrackerTrapezoid(); - - // read part of the configuration file corresponding to trapezoid elements - ConfigFile.close(); - myDetector->ReadConfiguration(Path); - ConfigFile.open(Path.c_str()); - - // ms_InterCoord comes from VDetector - myDetector->SetInterCoordPointer(ms_InterCoord); - - // store HydeTrackerTrapezoid "detector" - m_Modules.push_back(myDetector); - } - else if (LineBuffer.compare(0, 10, "HYDAnnular") == 0 && HYDTrkAnnular == false) { - HYDTrkAnnular = true; - - // instantiate a new "detector" corresponding to the Trapezoid elements - HydeTrackerModule* myDetector = new HydeTrackerAnnular(); - - // read part of the configuration file corresponding to trapezoid elements - ConfigFile.close(); - myDetector->ReadConfiguration(Path); - ConfigFile.open(Path.c_str()); - - // ms_InterCoord comes from VDetector - myDetector->SetInterCoordPointer(ms_InterCoord); - - // store HydeTrackerTrapezoid "detector" - m_Modules.push_back(myDetector); - } - else if (LineBuffer.compare(0, 13, "HYDDummyShape") == 0 && HYDTrkDummyShape == false) { - HYDTrkDummyShape = true; - - // instantiate a new "detector" corresponding to the Shape elements - // The HydeTrackerSquare class should be replaced by the - // HydeTrackerShape class you need to define - HydeTrackerModule* myDetector = new HydeTrackerDummyShape(); - - // read part of the configuration file corresponding to shape elements - ConfigFile.close(); - myDetector->ReadConfiguration(Path); - ConfigFile.open(Path.c_str()); - - // ms_InterCoord comes from VDetector - myDetector->SetInterCoordPointer(ms_InterCoord); - - // store HydeTrackerShape "detector" - m_Modules.push_back(myDetector); - } - } -} - - - -// Construct detector and initialize sensitive part. -// Called After DetecorConstruction::AddDetector Method -void HydeTracker::ConstructDetector(G4LogicalVolume* world) -{ - // loop on sub-detectors belonging to HydeTracker - int nbDetectors = m_Modules.size(); - for (int i = 0; i < nbDetectors; i++) m_Modules[i]->ConstructDetector(world); -} - - - -// Connect the HydeTrackingData class to the output TTree -// of the simulation -void HydeTracker::InitializeRootOutput() -{ - // loop on sub-detectors belonging to HydeTracker - int nbDetectors = m_Modules.size(); - for (int i = 0; i < nbDetectors; i++) m_Modules[i]->InitializeRootOutput(); -} - - - -// Initialize all scorers necessary for each detector -void HydeTracker::InitializeScorers() -{ - // loop on sub-detectors belonging to HydeTracker - int nbDetectors = m_Modules.size(); - for (int i = 0; i < nbDetectors; i++) m_Modules[i]->InitializeScorers(); -} - - - -// Read sensitive part and fill the Root tree. -// Called at in the EventAction::EndOfEventAction -void HydeTracker::ReadSensitive(const G4Event* event) -{ - // Before looping on each sub-detector, clear the static variable - // ms_InterCoord - // This is done on the first element of the m_Modules vector. - // This should be done here since this variable (of type TIneractionCoordinates) - // deals with multiplicity of events > 1. - m_Modules[0]->GetInterCoordPointer()->Clear(); - - // We do the same for the static variable ms_Event - m_Modules[0]->GetEventPointer()->Clear(); - - // loop on sub-detectors belonging to HydeTracker - int nbDetectors = m_Modules.size(); - for (int i = 0; i < nbDetectors; i++) m_Modules[i]->ReadSensitive(event); -} diff --git a/NPSimulation/src/HydeTrackerAnnular.cc b/NPSimulation/src/HydeTrackerAnnular.cc deleted file mode 100644 index a67b86f0b..000000000 --- a/NPSimulation/src/HydeTrackerAnnular.cc +++ /dev/null @@ -1,804 +0,0 @@ -/***************************************************************************** - * 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 annular shape for the Hyde tracker * - * * - *---------------------------------------------------------------------------* - * Comment: * - * + 12/10/09: Change scorer scheme (N. de Sereville) * - * * - * * - *****************************************************************************/ - -// C++ headers -#include <sstream> -#include <string> -#include <cmath> - -// G4 Geometry headers -#include "G4Box.hh" -#include "G4Tubs.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 "HydeTrackerAnnular.hh" -#include "GeneralScorers.hh" -#include "HydeScorers.hh" -#include "THydeTrackerData.h" -#include "RootOutput.h" - -// CLHEP -#include "CLHEP/Random/RandGauss.h" - -using namespace std; -using namespace CLHEP; -using namespace HYDANNULAR; - -using namespace HYDSCORERS; - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -HydeTrackerAnnular::HydeTrackerAnnular() -{ - ms_InterCoord = 0; -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -HydeTrackerAnnular::~HydeTrackerAnnular() -{ -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void HydeTrackerAnnular::AddModule(G4double PosZ, - G4double Rmin, - G4double Rmax, - bool wFirstStage, - bool wSecondStage, - bool wThirdStage) -{ - m_PosZ.push_back(PosZ); - m_Rmin.push_back(Rmin); - m_Rmax.push_back(Rmax); - - m_wFirstStage.push_back(wFirstStage) ; - m_wSecondStage.push_back(wSecondStage) ; - m_wThirdStage.push_back(wThirdStage) ; -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void HydeTrackerAnnular::VolumeMaker(G4int TelescopeNumber , - G4ThreeVector MMpos , - G4RotationMatrix* MMrot , - bool wFirstStage , - bool wSecondStage , - bool wThirdStage , - G4LogicalVolume* world) -{ - G4double NbrTelescopes = TelescopeNumber ; - G4String DetectorNumber ; - ostringstream Number ; - Number << NbrTelescopes ; - DetectorNumber = Number.str() ; - - //////////////////////////////////////////////////////////////// - /////////////////Element Definition /////////////////////////// - //////////////////////////////////////////////////////////////// - G4String symbol ; - G4double density = 0. , a = 0, z = 0 ; - G4int ncomponents = 0, natoms = 0 ; - - G4Element* H = new G4Element("Hydrogen" , symbol = "H" , z = 1 , a = 1.01 * g / mole); - G4Element* C = new G4Element("Carbon" , symbol = "C" , z = 6 , a = 12.011 * g / mole); - G4Element* N = new G4Element("Nitrogen" , symbol = "N" , z = 7 , a = 14.01 * g / mole); - G4Element* O = new G4Element("Oxigen" , symbol = "O" , z = 8 , a = 16.00 * g / mole); - G4Element* I = new G4Element("Iode" , symbol = "I" , z = 53 , a = 126.9 * g / mole); - G4Element* Cs = new G4Element("Cesium" , symbol = "Cs" , z = 55 , a = 132.9 * g / mole); - - G4Element* Co = new G4Element("Cobalt" , symbol = "Co" , z = 27 , a = 58.933 * g / mole); - G4Element* Cr = new G4Element("Cromium" , symbol = "Cr" , z = 24 , a = 51.996 * g / mole); - G4Element* Ni = new G4Element("Nickel" , symbol = "Ni" , z = 28 , a = 58.69 * g / mole); - G4Element* Fe = new G4Element("Iron" , symbol = "Fe" , z = 26 , a = 55.847 * g / mole); - G4Element* W = new G4Element("Tungsten" , symbol = "W" , z = 74 , a = 183.5 * g / mole); - - //////////////////////////////////////////////////////////////// - /////////////////Material Definition /////////////////////////// - //////////////////////////////////////////////////////////////// - // Si - a = 28.0855 * g / mole; - density = 2.321 * g / cm3; - G4Material* Silicon = new G4Material("Si", z = 14., a, density); - - // Al -// density = 2.702 * g / cm3; -// a = 26.98 * g / mole; -// G4Material* Aluminium = new G4Material("Aluminium", z = 13., a, density); - - // Iron -// density = 7.874 * g / cm3; -// a = 55.847 * g / mole; -// G4Material* Iron = new G4Material("Iron", z = 26., a, density); - - // CsI - density = 4.51 * g / cm3; - G4Material* CsI = new G4Material("CsI", density, ncomponents = 2); - CsI->AddElement(Cs , natoms = 1); - CsI->AddElement(I , natoms = 1); - - // Vacuum - density = 0.000000001 * mg / cm3; - G4Material* Vacuum = new G4Material("Vacuum", density, ncomponents = 2); - Vacuum->AddElement(N, .7); - Vacuum->AddElement(O, .3); - - // Mylar - density = 1.397 * g / cm3; - G4Material* Myl = new G4Material("Mylar", density, ncomponents = 3); - Myl->AddElement(C, natoms = 10); - Myl->AddElement(H, natoms = 8); - Myl->AddElement(O, natoms = 4); - - // Havar - G4Material* Harvar = new G4Material("Havar", 8.3*g / cm3, 5); - Harvar->AddElement(Co , 42); - Harvar->AddElement(Cr , 20); - Harvar->AddElement(Ni , 13); - Harvar->AddElement(Fe , 19); - Harvar->AddElement(W , 1); - - //////////////////////////////////////////////////////////////// - ////////////// Starting Volume Definition ////////////////////// - //////////////////////////////////////////////////////////////// - // Name of the module - G4String Name = "HYDAnnular" + DetectorNumber; - - // Definition of the volume containing the sensitive detector - G4Tubs* solidMM = new G4Tubs(Name, - Rmin, - Rmax, - Length/2, - 0*deg, - 360*deg); - -// G4LogicalVolume* logicMM = new G4LogicalVolume(solidMM, Iron, Name, 0, 0, 0); - G4LogicalVolume* logicMM = new G4LogicalVolume(solidMM, Vacuum, Name, 0, 0, 0); - - new G4PVPlacement(G4Transform3D(*MMrot, MMpos) , - logicMM , - Name , - world , - false , - 0); - - logicMM->SetVisAttributes(G4VisAttributes::Invisible); - if (m_non_sensitive_part_visiualisation) logicMM->SetVisAttributes(G4VisAttributes(G4Colour(0.90, 0.90, 0.90))); - - // Definition of a vaccuum volume - G4ThreeVector positionVacBox = G4ThreeVector(0, 0, VacBox_PosZ); - - G4Tubs* solidVacBox = new G4Tubs("solidVacBox", - FirstStageRmin, - FirstStageRmax, - VacBoxThickness/2, - 0*deg, - 360*deg); - - G4LogicalVolume* logicVacBox = new G4LogicalVolume(solidVacBox, Vacuum, "logicVacBox", 0, 0, 0); - - new G4PVPlacement(0, positionVacBox, logicVacBox, "G" + DetectorNumber + "VacBox", logicMM, false, 0); - - logicVacBox->SetVisAttributes(G4VisAttributes::Invisible); - - // Add a degrader plate between Si and CsI: - /* - G4Box* Degrader = new G4Box("Degrader" , 50*mm , 50*mm , 0.1*mm ); - G4LogicalVolume* logicDegrader = new G4LogicalVolume( Degrader , Harvar, "logicDegrader",0,0,0); - PVPBuffer = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicDegrader,"Degrader",logicVacBox,false,0) ; - */ - - //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 , 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); - - 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) ; - - G4VisAttributes* MarkerVVisAtt= new G4VisAttributes(G4Colour(0.,0.5,0.5));//green - logicMarkerV->SetVisAttributes(MarkerVVisAtt); - */ - - //////////////////////////////////////////////////////////////// - /////////////////// First Stage Construction//////////////////// - //////////////////////////////////////////////////////////////// - if (wFirstStage) { - // Aluminium dead layers - G4ThreeVector positionAluStripFront = G4ThreeVector(0, 0, AluStripFront_PosZ); - G4ThreeVector positionAluStripBack = G4ThreeVector(0, 0, AluStripBack_PosZ); - - G4Tubs* solidAluStrip = new G4Tubs("AluBox", - FirstStageRmin, - FirstStageRmax, - AluStripThickness/2, - 0*deg, - 360*deg); - -// G4LogicalVolume* logicAluStrip = new G4LogicalVolume(solidAluStrip, Aluminium, "logicAluStrip", 0, 0, 0); - G4LogicalVolume* logicAluStrip = new G4LogicalVolume(solidAluStrip, Vacuum, "logicAluStrip", 0, 0, 0); - - new G4PVPlacement(0, positionAluStripFront, logicAluStrip, "G" + DetectorNumber + "AluStripFront", logicMM, false, 0); - new G4PVPlacement(0, positionAluStripBack, logicAluStrip, "G" + DetectorNumber + "AluStripBack", logicMM, false, 0); - - logicAluStrip->SetVisAttributes(G4VisAttributes::Invisible); - - // Silicon detector itself - G4ThreeVector positionSilicon = G4ThreeVector(0, 0, Silicon_PosZ); - - G4Tubs* solidSilicon = new G4Tubs("solidSilicon", - FirstStageRmin, - FirstStageRmax, - FirstStageThickness/2, - 0*deg, - 360*deg); - G4LogicalVolume* logicSilicon = new G4LogicalVolume(solidSilicon, Silicon, "logicSilicon", 0, 0, 0); - - new G4PVPlacement(0, positionSilicon, logicSilicon, Name + "_Silicon", logicMM, false, 0); - - // Set First Stage sensible - logicSilicon->SetSensitiveDetector(m_FirstStageScorer); - - ///Visualisation of Silicon Strip -// G4VisAttributes* SiliconVisAtt = new G4VisAttributes(G4Colour(0.5, 0.5, 0.5)) ; - G4VisAttributes* SiliconVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)) ; - logicSilicon->SetVisAttributes(SiliconVisAtt) ; - } - - //////////////////////////////////////////////////////////////// - //////////////// Second Stage Construction //////////////////// - //////////////////////////////////////////////////////////////// - if (wSecondStage) { - } - - //////////////////////////////////////////////////////////////// - ///////////////// Third Stage Construction ///////////////////// - //////////////////////////////////////////////////////////////// - if (wThirdStage) { - // Third stage silicon detector - G4ThreeVector positionThirdStage = G4ThreeVector(0, 0, ThirdStage_PosZ); - - G4Tubs* solidThirdStage = new G4Tubs("solidThirdStage", - FirstStageRmin, - FirstStageRmax, - ThirdStageThickness/2, - 0*deg, - 360*deg); - - G4LogicalVolume* logicThirdStage = new G4LogicalVolume(solidThirdStage, Silicon, "logicThirdStage", 0, 0, 0); - - new G4PVPlacement(0, positionThirdStage, logicThirdStage, Name + "_ThirdStage", logicMM, false, 0); - - ///Visualisation of Third Stage - G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.9, 0.)) ; - logicThirdStage->SetVisAttributes(ThirdStageVisAtt) ; -// logicThirdStage->SetVisAttributes(G4VisAttributes::Invisible); - - // Set Third Stage sensible - logicThirdStage->SetSensitiveDetector(m_ThirdStageScorer); - } -} - -//....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 HydeTrackerAnnular::ReadConfiguration(string Path) -{ - ifstream ConfigFile ; - ConfigFile.open(Path.c_str()) ; - string LineBuffer ; - string DataBuffer ; - - G4double Z = 0, Rmin = 0, Rmax = 0; - int FIRSTSTAGE = 0 , SECONDSTAGE = 0 , THIRDSTAGE = 0; - - - bool ReadingStatus = false ; - bool check_Z = false ; - bool check_Rmin = false ; - bool check_Rmax = false ; - bool check_FirstStage = false ; - bool check_SecondStage = false ; - bool check_ThirdStage = false ; - - while (!ConfigFile.eof()) { - getline(ConfigFile, LineBuffer); - if (LineBuffer.compare(0, 10, "HYDAnnular") == 0) { - G4cout << "///" << G4endl ; - G4cout << "Annular 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, 2, "Z=") == 0) { - check_Z = true; - ConfigFile >> DataBuffer ; - Z = atof(DataBuffer.c_str()) ; - Z = Z * mm; - cout << "Z: " << Z / mm << endl; - } - - //Position method - else if (DataBuffer.compare(0, 5, "RMIN=") == 0) { - check_Rmin = true; - ConfigFile >> DataBuffer ; - Rmin = atof(DataBuffer.c_str()) ; - Rmin = Rmin * mm; - cout << "Rmin: " << Rmin / mm << endl; - } - - //Position method - else if (DataBuffer.compare(0, 5, "RMAX=") == 0) { - check_Rmax = true; - ConfigFile >> DataBuffer ; - Rmax = atof(DataBuffer.c_str()) ; - Rmax = Rmax * mm; - cout << "Rmax: " << Rmax / mm << endl; - } - - 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) { - ConfigFile >> DataBuffer; - if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; - } - - else { - G4cout << "WARNIG: Wrong Token Sequence, HydeTrackerAnnular: Annular Element not added" << G4endl; - } - - if (check_Z && check_Rmin && check_Rmax && check_FirstStage && check_SecondStage && check_ThirdStage) { - - ReadingStatus = false ; - check_Z = false ; - check_Rmin = false ; - check_Rmax = false ; - check_FirstStage = false ; - check_SecondStage = false ; - check_ThirdStage = false ; - - AddModule(Z, - Rmin, - Rmax, - FIRSTSTAGE == 1 , - SECONDSTAGE == 1 , - THIRDSTAGE == 1); - } - - - } - } -} - -// Construct detector and inialise sensitive part. -// Called After DetecorConstruction::AddDetector Method -void HydeTrackerAnnular::ConstructDetector(G4LogicalVolume* world) -{ - G4RotationMatrix* MMrot = NULL ; -// G4ThreeVector MMpos = G4ThreeVector(0, 0, 0) ; - MMpos = G4ThreeVector(0, 0, 0) ; - - bool FirstStage = true ; - bool SecondStage = true ; - bool ThirdStage = true ; - - G4int NumberOfModule = m_PosZ.size() ; - - for (G4int i = 0; i < NumberOfModule; i++) { - // translation to position the module - MMpos = G4ThreeVector(0, 0, m_PosZ[i]); - - // Passage Matrix from Lab Referential to Module Referential - // Identity matrix by default - MMrot = new G4RotationMatrix(); - if (MMpos.z() < 0) MMrot->rotateX(180*deg); - - // Presence of 1st, 2nd and 3rd stage - FirstStage = m_wFirstStage[i] ; - SecondStage = m_wSecondStage[i] ; - ThirdStage = m_wThirdStage[i] ; - - // Build geometry and declare scorers - VolumeMaker(i + 1, MMpos, MMrot, FirstStage, SecondStage, ThirdStage , world); - } - - delete MMrot ; -} - - - -// Connect the HydeTrackingData class to the output TTree -// of the simulation -void HydeTrackerAnnular::InitializeRootOutput() -{ -} - - - -// Set the TinteractionCoordinates object from VDetector to the present class -void HydeTrackerAnnular::SetInterCoordPointer(TInteractionCoordinates* interCoord) -{ - ms_InterCoord = interCoord; -} - - - -// Read sensitive part and fill the Root tree. -// Called at in the EventAction::EndOfEventAvtion -void HydeTrackerAnnular::ReadSensitive(const G4Event* event) -{ -////////////////////////////////////////////////////////////////////////////////////// -//////////////////////// Used to Read Event Map of detector ////////////////////////// -////////////////////////////////////////////////////////////////////////////////////// - // First Stage - std::map<G4int, G4int*>::iterator DetectorNumber_itr; - std::map<G4int, G4double*>::iterator Energy_itr; - std::map<G4int, G4double*>::iterator Time_itr; - std::map<G4int, G4double*>::iterator X_itr; - std::map<G4int, G4double*>::iterator Y_itr; - std::map<G4int, G4double*>::iterator Pos_X_itr; - std::map<G4int, G4double*>::iterator Pos_Y_itr; - std::map<G4int, G4double*>::iterator Pos_Z_itr; - std::map<G4int, G4double*>::iterator Ang_Theta_itr; - std::map<G4int, G4double*>::iterator Ang_Phi_itr; - - G4THitsMap<G4int>* DetectorNumberHitMap; - G4THitsMap<G4double>* EnergyHitMap; - G4THitsMap<G4double>* TimeHitMap; - G4THitsMap<G4double>* XHitMap; - G4THitsMap<G4double>* YHitMap; - G4THitsMap<G4double>* PosXHitMap; - G4THitsMap<G4double>* PosYHitMap; - G4THitsMap<G4double>* PosZHitMap; - G4THitsMap<G4double>* AngThetaHitMap; - G4THitsMap<G4double>* AngPhiHitMap; - - // NULL pointer are given to avoid warning at compilation - // Third Stage - std::map<G4int, G4double*>::iterator ThirdStageEnergy_itr; - G4THitsMap<G4double>* ThirdStageEnergyHitMap = NULL; - - - // Read the Scorer associated to the first Stage - //Detector Number - G4int StripDetCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDAnnular/DetectorNumber") ; - DetectorNumberHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripDetCollectionID)) ; - DetectorNumber_itr = DetectorNumberHitMap->GetMap()->begin() ; - - //Energy - G4int StripEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDAnnular/StripEnergy") ; - EnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripEnergyCollectionID)) ; - Energy_itr = EnergyHitMap->GetMap()->begin() ; - - //Time of Flight - G4int StripTimeCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDAnnular/StripTime") ; - TimeHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripTimeCollectionID)) ; - Time_itr = TimeHitMap->GetMap()->begin() ; - - //Strip Number X - G4int StripXCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDAnnular/StripNumberX") ; - XHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripXCollectionID)) ; - X_itr = XHitMap->GetMap()->begin() ; - - //Strip Number Y - G4int StripYCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDAnnular/StripNumberY") ; - YHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripYCollectionID)) ; - Y_itr = YHitMap->GetMap()->begin() ; - - //Interaction Coordinate X - G4int InterCoordXCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDAnnular/InterCoordX") ; - PosXHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordXCollectionID)) ; - Pos_X_itr = PosXHitMap->GetMap()->begin() ; - - //Interaction Coordinate Y - G4int InterCoordYCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDAnnular/InterCoordY") ; - PosYHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordYCollectionID)) ; - Pos_Y_itr = PosYHitMap->GetMap()->begin() ; - - //Interaction Coordinate Z - G4int InterCoordZCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDAnnular/InterCoordZ") ; - PosZHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordZCollectionID)) ; - Pos_Z_itr = PosXHitMap->GetMap()->begin() ; - - //Interaction Coordinate Angle Theta - G4int InterCoordAngThetaCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDAnnular/InterCoordAngTheta") ; - AngThetaHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordAngThetaCollectionID)) ; - Ang_Theta_itr = AngThetaHitMap->GetMap()->begin() ; - - //Interaction Coordinate Angle Phi - G4int InterCoordAngPhiCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDAnnular/InterCoordAngPhi") ; - AngPhiHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordAngPhiCollectionID)) ; - Ang_Phi_itr = AngPhiHitMap->GetMap()->begin() ; - - // Read the Scorer associated to the Third Stage - //Energy - G4int ThirdStageEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("ThirdStageScorerHYDAnnular/ThirdStageEnergy") ; - ThirdStageEnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(ThirdStageEnergyCollectionID)) ; - ThirdStageEnergy_itr = ThirdStageEnergyHitMap->GetMap()->begin() ; - - // Check the size of different map - G4int sizeN = DetectorNumberHitMap->entries(); - G4int sizeE = EnergyHitMap->entries(); - G4int sizeT = TimeHitMap->entries(); - G4int sizeX = XHitMap->entries(); - G4int sizeY = YHitMap->entries(); - - if (sizeE != sizeT || sizeT != sizeX || sizeX != sizeY) { - G4cout << "No match size Si Event Map: sE:" - << sizeE << " sT:" << sizeT << " sX:" << sizeX << " sY:" << sizeY << endl ; - return; - } - - // Loop on FirstStage number - for (G4int l = 0; l < sizeN; l++) { - G4double N = *(DetectorNumber_itr->second); - G4int NTrackID = DetectorNumber_itr->first - N; - - if (N > 0) { - // Fill detector number - ms_Event->SetHYDTrkFirstStageFrontEDetectorNbr(m_index["Annular"] + N); - ms_Event->SetHYDTrkFirstStageFrontTDetectorNbr(m_index["Annular"] + N); - ms_Event->SetHYDTrkFirstStageBackEDetectorNbr(m_index["Annular"] + N); - ms_Event->SetHYDTrkFirstStageBackTDetectorNbr(m_index["Annular"] + N); - - // Energy - for (G4int l = 0 ; l < sizeE ; l++) { - G4int ETrackID = Energy_itr->first - N; - G4double E = *(Energy_itr->second); - if (ETrackID == NTrackID) { - ms_Event->SetHYDTrkFirstStageFrontEEnergy(RandGauss::shoot(E, ResoFirstStage)); - ms_Event->SetHYDTrkFirstStageBackEEnergy(RandGauss::shoot(E, ResoFirstStage)); - } - Energy_itr++; - } - - // Time - Time_itr = TimeHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeT ; h++) { - G4int TTrackID = Time_itr->first - N; - G4double T = *(Time_itr->second) ; - if (TTrackID == NTrackID) { - T = RandGauss::shoot(T, ResoTimePPAC) ; - ms_Event->SetHYDTrkFirstStageFrontTTime(RandGauss::shoot(T, ResoTimeGpd)) ; - ms_Event->SetHYDTrkFirstStageBackTTime(RandGauss::shoot(T, ResoTimeGpd)) ; - } - Time_itr++; - } - - // X - X_itr = XHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int XTrackID = X_itr->first - N; - G4double X = *(X_itr->second); - if (XTrackID == NTrackID) { - ms_Event->SetHYDTrkFirstStageFrontEStripNbr(X) ; - ms_Event->SetHYDTrkFirstStageFrontTStripNbr(X) ; - } - - X_itr++; - } - - // Y - Y_itr = YHitMap->GetMap()->begin() ; - for (G4int h = 0 ; h < sizeY ; h++) { - G4int YTrackID = Y_itr->first - N ; - G4double Y = *(Y_itr->second) ; - if (YTrackID == NTrackID) { - ms_Event->SetHYDTrkFirstStageBackEStripNbr(Y) ; - ms_Event->SetHYDTrkFirstStageBackTStripNbr(Y) ; - } - - Y_itr++; - } - - // Pos X - Pos_X_itr = PosXHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int PosXTrackID = Pos_X_itr->first - N ; - G4double PosX = *(Pos_X_itr->second) ; - if (PosXTrackID == NTrackID) { - ms_InterCoord->SetDetectedPositionX(PosX) ; - } - Pos_X_itr++; - } - - // Pos Y - Pos_Y_itr = PosYHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int PosYTrackID = Pos_Y_itr->first - N ; - G4double PosY = *(Pos_Y_itr->second) ; - if (PosYTrackID == NTrackID) { - ms_InterCoord->SetDetectedPositionY(PosY) ; - } - Pos_Y_itr++; - } - - // Pos Z - Pos_Z_itr = PosZHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int PosZTrackID = Pos_Z_itr->first - N ; - G4double PosZ = *(Pos_Z_itr->second) ; - if (PosZTrackID == NTrackID) { - ms_InterCoord->SetDetectedPositionZ(PosZ) ; - } - Pos_Z_itr++; - } - - // Angle Theta - Ang_Theta_itr = AngThetaHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int AngThetaTrackID = Ang_Theta_itr->first - N ; - G4double AngTheta = *(Ang_Theta_itr->second) ; - if (AngThetaTrackID == NTrackID) { - ms_InterCoord->SetDetectedAngleTheta(AngTheta) ; - } - Ang_Theta_itr++; - } - - // Angle Phi - Ang_Phi_itr = AngPhiHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int AngPhiTrackID = Ang_Phi_itr->first - N; - G4double AngPhi = *(Ang_Phi_itr->second); - if (AngPhiTrackID == NTrackID) { - ms_InterCoord->SetDetectedAnglePhi(AngPhi); - } - Ang_Phi_itr++; - } - - // Second Stage - - // Third Stage - ThirdStageEnergy_itr = ThirdStageEnergyHitMap->GetMap()->begin() ; - for (G4int h = 0 ; h < ThirdStageEnergyHitMap->entries() ; h++) { - G4int ThirdStageEnergyTrackID = ThirdStageEnergy_itr->first - N; - G4double ThirdStageEnergy = *(ThirdStageEnergy_itr->second); - - if (ThirdStageEnergyTrackID == NTrackID) { - ms_Event->SetHYDTrkThirdStageEEnergy(RandGauss::shoot(ThirdStageEnergy, ResoThirdStage)); - ms_Event->SetHYDTrkThirdStageEPadNbr(1); - ms_Event->SetHYDTrkThirdStageTPadNbr(1); - ms_Event->SetHYDTrkThirdStageTTime(1); - ms_Event->SetHYDTrkThirdStageTDetectorNbr(m_index["Annular"] + N); - ms_Event->SetHYDTrkThirdStageEDetectorNbr(m_index["Annular"] + N); - } - - ThirdStageEnergy_itr++; - } - - DetectorNumber_itr++; - } - - // clear map for next event - DetectorNumberHitMap ->clear(); - EnergyHitMap ->clear(); - TimeHitMap ->clear(); - XHitMap ->clear(); - YHitMap ->clear(); - PosXHitMap ->clear(); - PosYHitMap ->clear(); - PosZHitMap ->clear(); - AngThetaHitMap ->clear(); - AngPhiHitMap ->clear(); - ThirdStageEnergyHitMap ->clear(); - } -} - - - -void HydeTrackerAnnular::InitializeScorers() -{ - // First stage Associate Scorer - m_FirstStageScorer = new G4MultiFunctionalDetector("FirstStageScorerHYDAnnular"); - G4VPrimitiveScorer* DetNbr = new GENERALSCORERS::PSDetectorNumber("DetectorNumber", "HYDAnnular", 0); - G4VPrimitiveScorer* TOF = new GENERALSCORERS::PSTOF("StripTime","HYDAnnular", 0); - G4VPrimitiveScorer* InteractionCoordinatesX = new GENERALSCORERS::PSInteractionCoordinatesX("InterCoordX","HYDAnnular", 0); - G4VPrimitiveScorer* InteractionCoordinatesY = new GENERALSCORERS::PSInteractionCoordinatesY("InterCoordY","HYDAnnular", 0); - G4VPrimitiveScorer* InteractionCoordinatesZ = new GENERALSCORERS::PSInteractionCoordinatesZ("InterCoordZ","HYDAnnular", 0); - G4VPrimitiveScorer* InteractionCoordinatesAngleTheta = new GENERALSCORERS::PSInteractionCoordinatesAngleTheta("InterCoordAngTheta","HYDAnnular", 0); - G4VPrimitiveScorer* InteractionCoordinatesAnglePhi = new GENERALSCORERS::PSInteractionCoordinatesAnglePhi("InterCoordAngPhi","HYDAnnular", 0); - G4VPrimitiveScorer* Energy = new HYDScorerFirstStageEnergy("StripEnergy", "HYDAnnular", 0); - G4VPrimitiveScorer* StripPositionX = new HYDScorerFirstStageFrontStripAnnular("StripNumberX", 0, FirstStageRmax, 128); - G4VPrimitiveScorer* StripPositionY = new HYDScorerFirstStageBackStripAnnular("StripNumberY", 0, FirstStageRmax, 128); - - //and register it to the multifunctionnal detector - m_FirstStageScorer->RegisterPrimitive(DetNbr); - m_FirstStageScorer->RegisterPrimitive(Energy); - m_FirstStageScorer->RegisterPrimitive(TOF); - m_FirstStageScorer->RegisterPrimitive(StripPositionX); - m_FirstStageScorer->RegisterPrimitive(StripPositionY); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesX); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesY); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesZ); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesAngleTheta); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesAnglePhi); - - // Second stage Associate Scorer - m_SecondStageScorer = new G4MultiFunctionalDetector("SecondStageScorerHYDAnnular"); - G4VPrimitiveScorer* SecondStageEnergy = new HYDScorerSecondStageEnergy("SecondStageEnergy", "HYDAnnular", 0); - m_SecondStageScorer->RegisterPrimitive(SecondStageEnergy); - - // Third stage Associate Scorer - m_ThirdStageScorer = new G4MultiFunctionalDetector("ThirdStageScorerHYDAnnular"); - G4VPrimitiveScorer* ThirdStageEnergy = new HYDScorerThirdStageEnergy("ThirdStageEnergy", "HYDAnnular", 0); - m_ThirdStageScorer->RegisterPrimitive(ThirdStageEnergy); - - // 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/src/HydeTrackerDummyShape.cc b/NPSimulation/src/HydeTrackerDummyShape.cc deleted file mode 100644 index 965c3b25f..000000000 --- a/NPSimulation/src/HydeTrackerDummyShape.cc +++ /dev/null @@ -1,977 +0,0 @@ -/***************************************************************************** - * 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 : 03/09/09 * - * Last update : 12/10/09 * - *---------------------------------------------------------------------------* - * Decription: Define a dummy module for the Hyde tracker * - * The goal of this class is to be a starting point to create a * - * new shape to be added to the Hyde tracker. * - * * - *---------------------------------------------------------------------------* - * Comment: * - * + 07/09/09: Fix bug for placing module with (r,theta,phi) method. * - * (N. de Sereville) * - * + 12/10/09: Change scorer scheme (N. de Sereville) * - * * - * * - *****************************************************************************/ - -// C++ headers -#include <sstream> -#include <string> -#include <cmath> - -// G4 Geometry headers -#include "G4Trd.hh" -#include "G4Box.hh" -#include "G4Trap.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 "HydeTrackerDummyShape.hh" -#include "GeneralScorers.hh" -#include "HydeScorers.hh" -#include "RootOutput.h" - -// CLHEP -#include "CLHEP/Random/RandGauss.h" - -using namespace std; -using namespace CLHEP; -using namespace HYDDUMMYSHAPE; - -using namespace HYDSCORERS; - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -HydeTrackerDummyShape::HydeTrackerDummyShape() -{ - ms_InterCoord = 0; -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -HydeTrackerDummyShape::~HydeTrackerDummyShape() -{ -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void HydeTrackerDummyShape::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_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) ; - - m_wFirstStage.push_back(wFirstStage) ; - m_wSecondStage.push_back(wSecondStage) ; - m_wThirdStage.push_back(wThirdStage) ; - -// m_wNumberStrip.push_back(wNumberStrip); -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void HydeTrackerDummyShape::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_X1_Y1.push_back(empty) ; - m_X128_Y1.push_back(empty) ; - m_X1_Y128.push_back(empty) ; - m_X128_Y128.push_back(empty) ; - - 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) ; -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void HydeTrackerDummyShape::VolumeMaker(G4int TelescopeNumber, - G4ThreeVector MMpos, - G4RotationMatrix* MMrot, - bool wFirstStage, - bool wSecondStage, - bool wThirdStage, - G4LogicalVolume* world) -{ - G4double NbrTelescopes = TelescopeNumber ; - G4String DetectorNumber ; - ostringstream Number ; - Number << NbrTelescopes ; - DetectorNumber = Number.str() ; - - ///////////////////////////////////////////////////////////////// - /////////////////Element Definition /////////////////////////// - //////////////////////////////////////////////////////////////// - G4String symbol; - G4double density = 0. , a = 0, z = 0; - G4int ncomponents = 0; - - //////////////////////////////////////////////////////////////// - /////////////////Material Definition /////////////////////////// - //////////////////////////////////////////////////////////////// - // Si - a = 28.0855 * g / mole; - density = 2.321 * g / cm3; - G4Material* Silicon = new G4Material("Si", z = 14., a, density); - - // Vacuum - G4Element* N = new G4Element("Nitrogen" , symbol = "N" , z = 7 , a = 14.01 * g / mole); - G4Element* O = new G4Element("Oxigen" , symbol = "O" , z = 8 , a = 16.00 * g / mole); - - density = 0.000000001 * mg / cm3; - G4Material* Vacuum = new G4Material("Vacuum", density, ncomponents = 2); - Vacuum->AddElement(N, .7); - Vacuum->AddElement(O, .3); - - //////////////////////////////////////////////////////////////// - ////////////// Starting Volume Definition ////////////////////// - //////////////////////////////////////////////////////////////// - // Little trick to avoid warning in compilation: Use a PVPlacement "buffer". - // If don't you will have a Warning unused variable 'myPVP' - G4PVPlacement* PVPBuffer; - G4String Name = "HYDDummyShape" + DetectorNumber ; - - G4Box* solidHYDDummyShape = new G4Box(Name, 0.5*FaceFront, 0.5*FaceFront, 0.5*Length); - G4LogicalVolume* logicHYDDummyShape = new G4LogicalVolume(solidHYDDummyShape, Vacuum, Name, 0, 0, 0); - - PVPBuffer = new G4PVPlacement(G4Transform3D(*MMrot, MMpos) , - logicHYDDummyShape , - Name , - world , - false , - 0); - - logicHYDDummyShape->SetVisAttributes(G4VisAttributes::Invisible); - if (m_non_sensitive_part_visiualisation) logicHYDDummyShape->SetVisAttributes(G4VisAttributes(G4Colour(0.90, 0.90, 0.90))); - - //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 , 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); - - 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) ; - - 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*FirstStageFace, 0.5*FirstStageFace, 0.5*FirstStageThickness); - G4LogicalVolume* logicFirstStage = new G4LogicalVolume(solidFirstStage, Silicon, "logicFirstStage", 0, 0, 0); - - PVPBuffer = new G4PVPlacement(0, - positionFirstStage, - logicFirstStage, -// "G" + DetectorNumber + "FirstStage", - Name + "_FirstStage", - logicHYDDummyShape, - false, - 0); - - // Set First Stage sensible - logicFirstStage->SetSensitiveDetector(m_FirstStageScorer); - - ///Visualisation of FirstStage Strip - G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(0.2, 0.2, 0.2)); - 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*SecondStageFace, 0.5*SecondStageFace, 0.5*SecondStageThickness); - G4LogicalVolume* logicSecondStage = new G4LogicalVolume(solidSecondStage, Silicon, "logicSecondStage", 0, 0, 0); - - PVPBuffer = new G4PVPlacement(0, - positionSecondStage, - logicSecondStage, -// "G" + DetectorNumber + "SecondStage", - Name + "_SecondStage", - logicHYDDummyShape, - false, - 0); - - // Set Second Stage sensible - logicSecondStage->SetSensitiveDetector(m_SecondStageScorer); - - ///Visualisation of SecondStage Strip - G4VisAttributes* SecondStageVisAtt = new G4VisAttributes(G4Colour(0.5, 0.5, 0.5)) ; - 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*ThirdStageFace, 0.5*ThirdStageFace, 0.5*ThirdStageThickness); - G4LogicalVolume* logicThirdStage = new G4LogicalVolume(solidThirdStage, Silicon, "logicThirdStage", 0, 0, 0); - - PVPBuffer = new G4PVPlacement(0, - positionThirdStage, - logicThirdStage, -// "G" + DetectorNumber + "ThirdStage", - Name + "_ThirdStage", - logicHYDDummyShape, - false, - 0); - - // Set Third Stage sensible - logicThirdStage->SetSensitiveDetector(m_ThirdStageScorer); - - ///Visualisation of Third Stage - G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.7, 0.7, 0.7)); - logicThirdStage->SetVisAttributes(ThirdStageVisAtt); - } -} - - - -//....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 HydeTrackerDummyShape::ReadConfiguration(string Path) -{ - ifstream ConfigFile; - ConfigFile.open(Path.c_str()); - string LineBuffer, 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 ; - int NSTRIP = 128; - - 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_beta = false; - - bool check_FirstStage = false; - bool check_SecondStage = false; - bool check_ThirdStage = false; - bool check_NStrip = false; - bool checkVis = false; - - while (!ConfigFile.eof()) { - getline(ConfigFile, LineBuffer); - if (LineBuffer.compare(0, 13, "HYDDummyShape") == 0) { - G4cout << "///" << G4endl ; - G4cout << "DummyShape 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); - cout << "X1 Y1 corner position : " << A << endl; - } - 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); - cout << "X128 Y1 corner position : " << B << endl; - } - 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); - cout << "X1 Y128 corner position : " << C << endl; - } - 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); - cout << "X128 Y128 corner position : " << D << endl; - } - - // Angle method - else if (DataBuffer.compare(0, 6, "THETA=") == 0) { - check_Theta = true; - ConfigFile >> DataBuffer ; - Theta = atof(DataBuffer.c_str()) ; - Theta = Theta * deg; - cout << "Theta: " << Theta / deg << endl; - } - else if (DataBuffer.compare(0, 4, "PHI=") == 0) { - check_Phi = true; - ConfigFile >> DataBuffer ; - Phi = atof(DataBuffer.c_str()) ; - Phi = Phi * deg; - cout << "Phi: " << Phi / deg << endl; - } - else if (DataBuffer.compare(0, 2, "R=") == 0) { - check_R = true; - ConfigFile >> DataBuffer ; - R = atof(DataBuffer.c_str()) ; - R = R * mm; - cout << "R: " << R / mm << endl; - } - else if (DataBuffer.compare(0, 5, "BETA=") == 0) { - check_beta = true; - 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, 7, "NSTRIP=") == 0) { - check_NStrip = true ; - ConfigFile >> DataBuffer; - NSTRIP = 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, HydeTrackerDummyShape: DummyShape 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_beta = 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 HydeTrackerDummyShape::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 NumberOfTelescope = m_DefinitionType.size() ; - - for (G4int i = 0; i < NumberOfTelescope; i++) { - // By Point - if (m_DefinitionType[i]) { - // (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(); - - 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; - } - - // 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 - // 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 - G4ThreeVector CT = MMw; - - // vector parallel to one axis of silicon plane - 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(); - MMu = MMw.cross(Y); - MMv = MMw.cross(MMu); - MMv = MMv.unit(); - 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 ; - } - - 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 HydeTrackingData class to the output TTree -// of the simulation -void HydeTrackerDummyShape::InitializeRootOutput() -{ -} - - - -// Set the TinteractionCoordinates object from VDetector to the present class -void HydeTrackerDummyShape::SetInterCoordPointer(TInteractionCoordinates* interCoord) -{ - ms_InterCoord = interCoord; -} - - - -// Read sensitive part and fill the Root tree. -// Called at in the EventAction::EndOfEventAvtion -void HydeTrackerDummyShape::ReadSensitive(const G4Event* event) -{ - ////////////////////////////////////////////////////////////////////////////////////// - //////////////////////// Used to Read Event Map of detector ////////////////////////// - ////////////////////////////////////////////////////////////////////////////////////// - // First Stage - std::map<G4int, G4int*>::iterator DetectorNumber_itr; - std::map<G4int, G4double*>::iterator Energy_itr; - std::map<G4int, G4double*>::iterator Time_itr; - std::map<G4int, G4double*>::iterator X_itr; - std::map<G4int, G4double*>::iterator Y_itr; - std::map<G4int, G4double*>::iterator Pos_X_itr; - std::map<G4int, G4double*>::iterator Pos_Y_itr; - std::map<G4int, G4double*>::iterator Pos_Z_itr; - std::map<G4int, G4double*>::iterator Ang_Theta_itr; - std::map<G4int, G4double*>::iterator Ang_Phi_itr; - - G4THitsMap<G4int>* DetectorNumberHitMap; - G4THitsMap<G4double>* EnergyHitMap; - G4THitsMap<G4double>* TimeHitMap; - G4THitsMap<G4double>* XHitMap; - G4THitsMap<G4double>* YHitMap; - G4THitsMap<G4double>* PosXHitMap; - G4THitsMap<G4double>* PosYHitMap; - G4THitsMap<G4double>* PosZHitMap; - G4THitsMap<G4double>* AngThetaHitMap; - G4THitsMap<G4double>* AngPhiHitMap; - - // NULL pointer are given to avoid warning at compilation - // Second Stage - std::map<G4int, G4double*>::iterator SecondStageEnergy_itr ; - G4THitsMap<G4double>* SecondStageEnergyHitMap = NULL ; - // Third Stage - std::map<G4int, G4double*>::iterator ThirdStageEnergy_itr ; - G4THitsMap<G4double>* ThirdStageEnergyHitMap = NULL ; - - - // Read the Scorer associate to the Silicon Strip - //Detector Number - G4int StripDetCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDDummyShape/DetectorNumber") ; - DetectorNumberHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripDetCollectionID)) ; - DetectorNumber_itr = DetectorNumberHitMap->GetMap()->begin() ; - - //Energy - G4int StripEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDDummyShape/StripEnergy") ; - EnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripEnergyCollectionID)) ; - Energy_itr = EnergyHitMap->GetMap()->begin() ; - - //Time of Flight - G4int StripTimeCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDDummyShape/StripTime") ; - TimeHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripTimeCollectionID)) ; - Time_itr = TimeHitMap->GetMap()->begin() ; - - //Strip Number X - G4int StripXCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDDummyShape/StripIDFront") ; - XHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripXCollectionID)) ; - X_itr = XHitMap->GetMap()->begin() ; - - //Strip Number Y - G4int StripYCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDDummyShape/StripIDBack"); - YHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripYCollectionID)) ; - Y_itr = YHitMap->GetMap()->begin() ; - - //Interaction Coordinate X - G4int InterCoordXCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDDummyShape/InterCoordX") ; - PosXHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordXCollectionID)) ; - Pos_X_itr = PosXHitMap->GetMap()->begin() ; - - //Interaction Coordinate Y - G4int InterCoordYCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDDummyShape/InterCoordY") ; - PosYHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordYCollectionID)) ; - Pos_Y_itr = PosYHitMap->GetMap()->begin() ; - - //Interaction Coordinate Z - G4int InterCoordZCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDDummyShape/InterCoordZ") ; - PosZHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordZCollectionID)) ; - Pos_Z_itr = PosXHitMap->GetMap()->begin() ; - - //Interaction Coordinate Angle Theta - G4int InterCoordAngThetaCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDDummyShape/InterCoordAngTheta") ; - AngThetaHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordAngThetaCollectionID)) ; - Ang_Theta_itr = AngThetaHitMap->GetMap()->begin() ; - - //Interaction Coordinate Angle Phi - G4int InterCoordAngPhiCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDDummyShape/InterCoordAngPhi") ; - AngPhiHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordAngPhiCollectionID)) ; - Ang_Phi_itr = AngPhiHitMap->GetMap()->begin() ; - - - // Read the Scorer associate to the SecondStage - //Energy - G4int SecondStageEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("SecondStageScorerHYDDummyShape/SecondStageEnergy") ; - SecondStageEnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(SecondStageEnergyCollectionID)) ; - SecondStageEnergy_itr = SecondStageEnergyHitMap->GetMap()->begin() ; - - - // Read the Scorer associate to the ThirdStage - //Energy - G4int ThirdStageEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("ThirdStageScorerHYDDummyShape/ThirdStageEnergy"); - ThirdStageEnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(ThirdStageEnergyCollectionID)); - ThirdStageEnergy_itr = ThirdStageEnergyHitMap->GetMap()->begin(); - - - // Check the size of different map - G4int sizeN = DetectorNumberHitMap->entries(); - G4int sizeE = EnergyHitMap->entries(); - G4int sizeT = TimeHitMap->entries(); - G4int sizeX = XHitMap->entries(); - G4int sizeY = YHitMap->entries(); - - if (sizeE != sizeT || sizeT != sizeX || sizeX != sizeY) { - G4cout << "No match size Si Event Map: sE:" - << sizeE << " sT:" << sizeT << " sX:" << sizeX << " sY:" << sizeY << endl ; - return; - } - - // Loop on FirstStage number - for (G4int l = 0; l < sizeN; l++) { - G4double N = *(DetectorNumber_itr->second); - G4int NTrackID = DetectorNumber_itr->first - N; - - if (N > 0) { - // Fill detector number - ms_Event->SetHYDTrkFirstStageFrontEDetectorNbr(m_index["DummyShape"] + N); - ms_Event->SetHYDTrkFirstStageFrontTDetectorNbr(m_index["DummyShape"] + N); - ms_Event->SetHYDTrkFirstStageBackEDetectorNbr(m_index["DummyShape"] + N); - ms_Event->SetHYDTrkFirstStageBackTDetectorNbr(m_index["DummyShape"] + N); - - // Energy - for (G4int l = 0 ; l < sizeE ; l++) { - G4int ETrackID = Energy_itr->first - N; - G4double E = *(Energy_itr->second); - if (ETrackID == NTrackID) { - ms_Event->SetHYDTrkFirstStageFrontEEnergy(RandGauss::shoot(E, ResoFirstStage)); - ms_Event->SetHYDTrkFirstStageBackEEnergy(RandGauss::shoot(E, ResoFirstStage)); - } - Energy_itr++; - } - - // Time - Time_itr = TimeHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeT ; h++) { - G4int TTrackID = Time_itr->first - N; - G4double T = *(Time_itr->second); - if (TTrackID == NTrackID) { - T = RandGauss::shoot(T, ResoTimeGpd); - ms_Event->SetHYDTrkFirstStageFrontTTime(RandGauss::shoot(T, ResoTimeGpd)); - ms_Event->SetHYDTrkFirstStageBackTTime(RandGauss::shoot(T, ResoTimeGpd)); - } - Time_itr++; - } - - // Strip X - X_itr = XHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int XTrackID = X_itr->first - N; - G4double X = *(X_itr->second); - if (XTrackID == NTrackID) { - ms_Event->SetHYDTrkFirstStageFrontEStripNbr(X); - ms_Event->SetHYDTrkFirstStageFrontTStripNbr(X); - } - X_itr++; - } - - // Strip Y - Y_itr = YHitMap->GetMap()->begin() ; - for (G4int h = 0 ; h < sizeY ; h++) { - G4int YTrackID = Y_itr->first - N; - G4double Y = *(Y_itr->second); - if (YTrackID == NTrackID) { - ms_Event->SetHYDTrkFirstStageBackEStripNbr(Y); - ms_Event->SetHYDTrkFirstStageBackTStripNbr(Y); - } - Y_itr++; - } - - // Pos X - Pos_X_itr = PosXHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int PosXTrackID = Pos_X_itr->first - N ; - G4double PosX = *(Pos_X_itr->second) ; - if (PosXTrackID == NTrackID) { - ms_InterCoord->SetDetectedPositionX(PosX) ; - } - Pos_X_itr++; - } - - // Pos Y - Pos_Y_itr = PosYHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int PosYTrackID = Pos_Y_itr->first - N ; - G4double PosY = *(Pos_Y_itr->second) ; - if (PosYTrackID == NTrackID) { - ms_InterCoord->SetDetectedPositionY(PosY) ; - } - Pos_Y_itr++; - } - - // Pos Z - Pos_Z_itr = PosZHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int PosZTrackID = Pos_Z_itr->first - N ; - G4double PosZ = *(Pos_Z_itr->second) ; - if (PosZTrackID == NTrackID) { - ms_InterCoord->SetDetectedPositionZ(PosZ) ; - } - Pos_Z_itr++; - } - - // Angle Theta - Ang_Theta_itr = AngThetaHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int AngThetaTrackID = Ang_Theta_itr->first - N ; - G4double AngTheta = *(Ang_Theta_itr->second) ; - if (AngThetaTrackID == NTrackID) { - ms_InterCoord->SetDetectedAngleTheta(AngTheta) ; - } - Ang_Theta_itr++; - } - - // Angle Phi - Ang_Phi_itr = AngPhiHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int AngPhiTrackID = Ang_Phi_itr->first - N ; - G4double AngPhi = *(Ang_Phi_itr->second) ; - if (AngPhiTrackID == NTrackID) { - ms_InterCoord->SetDetectedAnglePhi(AngPhi) ; - } - Ang_Phi_itr++; - } - - // Second Stage - SecondStageEnergy_itr = SecondStageEnergyHitMap->GetMap()->begin() ; - for (G4int h = 0 ; h < SecondStageEnergyHitMap->entries() ; h++) { - G4int SecondStageEnergyTrackID = SecondStageEnergy_itr->first - N; - G4double SecondStageEnergy = *(SecondStageEnergy_itr->second); - - if (SecondStageEnergyTrackID == NTrackID) { - ms_Event->SetHYDTrkSecondStageEEnergy(RandGauss::shoot(SecondStageEnergy, ResoSecondStage)) ; - ms_Event->SetHYDTrkSecondStageEPadNbr(1); - ms_Event->SetHYDTrkSecondStageTPadNbr(1); - ms_Event->SetHYDTrkSecondStageTTime(1); - ms_Event->SetHYDTrkSecondStageTDetectorNbr(m_index["DummyShape"] + N); - ms_Event->SetHYDTrkSecondStageEDetectorNbr(m_index["DummyShape"] + N); - } - SecondStageEnergy_itr++; - } - - // Third Stage - ThirdStageEnergy_itr = ThirdStageEnergyHitMap->GetMap()->begin() ; - for (G4int h = 0 ; h < ThirdStageEnergyHitMap->entries() ; h++) { - G4int ThirdStageEnergyTrackID = ThirdStageEnergy_itr->first - N; - G4double ThirdStageEnergy = *(ThirdStageEnergy_itr->second); - - if (ThirdStageEnergyTrackID == NTrackID) { - ms_Event->SetHYDTrkThirdStageEEnergy(RandGauss::shoot(ThirdStageEnergy, ResoThirdStage)); - ms_Event->SetHYDTrkThirdStageEPadNbr(1); - ms_Event->SetHYDTrkThirdStageTPadNbr(1); - ms_Event->SetHYDTrkThirdStageTTime(1); - ms_Event->SetHYDTrkThirdStageTDetectorNbr(m_index["DummyShape"] + N); - ms_Event->SetHYDTrkThirdStageEDetectorNbr(m_index["DummyShape"] + N); - } - ThirdStageEnergy_itr++; - } - - DetectorNumber_itr++; - } - - // clear map for next event - DetectorNumberHitMap -> clear(); - EnergyHitMap -> clear(); - TimeHitMap -> clear(); - XHitMap -> clear(); - YHitMap -> clear(); - PosXHitMap -> clear(); - PosYHitMap -> clear(); - PosZHitMap -> clear(); - AngThetaHitMap -> clear(); - AngPhiHitMap -> clear(); - SecondStageEnergyHitMap -> clear(); - ThirdStageEnergyHitMap -> clear(); - } -} - - - -void HydeTrackerDummyShape::InitializeScorers() -{ - // First stage Associate Scorer - m_FirstStageScorer = new G4MultiFunctionalDetector("FirstStageScorerHYDDummyShape"); - G4VPrimitiveScorer* DetNbr = new GENERALSCORERS::PSDetectorNumber("DetectorNumber", "HYDDummyShape", 0); - G4VPrimitiveScorer* TOF = new GENERALSCORERS::PSTOF("StripTime","HYDDummyShape", 0); - G4VPrimitiveScorer* InteractionCoordinatesX = new GENERALSCORERS::PSInteractionCoordinatesX("InterCoordX","HYDDummyShape", 0); - G4VPrimitiveScorer* InteractionCoordinatesY = new GENERALSCORERS::PSInteractionCoordinatesY("InterCoordY","HYDDummyShape", 0); - G4VPrimitiveScorer* InteractionCoordinatesZ = new GENERALSCORERS::PSInteractionCoordinatesZ("InterCoordZ","HYDDummyShape", 0); - G4VPrimitiveScorer* InteractionCoordinatesAngleTheta = new GENERALSCORERS::PSInteractionCoordinatesAngleTheta("InterCoordAngTheta","HYDDummyShape", 0); - G4VPrimitiveScorer* InteractionCoordinatesAnglePhi = new GENERALSCORERS::PSInteractionCoordinatesAnglePhi("InterCoordAngPhi","HYDDummyShape", 0); - G4VPrimitiveScorer* Energy = new HYDScorerFirstStageEnergy("StripEnergy", "HYDDummyShape", 0); - G4VPrimitiveScorer* StripPositionX = new HYDScorerFirstStageFrontStripDummyShape("StripIDFront", 0, NumberOfStrips); - G4VPrimitiveScorer* StripPositionY = new HYDScorerFirstStageBackStripDummyShape("StripIDBack", 0, NumberOfStrips); - - //and register it to the multifunctionnal detector - m_FirstStageScorer->RegisterPrimitive(DetNbr); - m_FirstStageScorer->RegisterPrimitive(Energy); - m_FirstStageScorer->RegisterPrimitive(TOF); - m_FirstStageScorer->RegisterPrimitive(StripPositionX); - m_FirstStageScorer->RegisterPrimitive(StripPositionY); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesX); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesY); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesZ); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesAngleTheta); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesAnglePhi); - - - // Second stage Associate Scorer - m_SecondStageScorer = new G4MultiFunctionalDetector("SecondStageScorerHYDDummyShape"); - G4VPrimitiveScorer* SecondStageEnergy = new HYDScorerSecondStageEnergy("SecondStageEnergy", "HYDDummyShape", 0); - m_SecondStageScorer->RegisterPrimitive(SecondStageEnergy); - - - // Third stage Associate Scorer - m_ThirdStageScorer = new G4MultiFunctionalDetector("ThirdStageScorerHYDDummyShape"); - G4VPrimitiveScorer* ThirdStageEnergy = new HYDScorerThirdStageEnergy("ThirdStageEnergy", "HYDDummyShape", 0); - m_ThirdStageScorer->RegisterPrimitive(ThirdStageEnergy); - - - // 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/src/HydeTrackerModule.cc b/NPSimulation/src/HydeTrackerModule.cc deleted file mode 100644 index a2d20980d..000000000 --- a/NPSimulation/src/HydeTrackerModule.cc +++ /dev/null @@ -1,63 +0,0 @@ -/***************************************************************************** - * 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 : 10/06/09 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: This class is an Abstract Base Class (ABC) from which should * - * derive all different modules from the Hyde tracker. * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -#include "HydeTrackerModule.hh" -#include "RootOutput.h" - - -THydeTrackerData *HydeTrackerModule::ms_Event = 0; - - - -HydeTrackerModule::HydeTrackerModule() -{ - if (ms_Event == 0) ms_Event = new THydeTrackerData(); - - InitializeRootOutput(); - InitializeIndex(); -} - - - -HydeTrackerModule::~HydeTrackerModule() -{ -} - - - -void HydeTrackerModule::InitializeRootOutput() -{ - RootOutput *pAnalysis = RootOutput::getInstance(); - TTree *pTree = pAnalysis->GetTree(); - // if the branch does not exist yet, create it - if (!pTree->GetBranch("HYDE")) - pTree->Branch("HYDE", "THydeTrackerData", &ms_Event); -} - - - -void HydeTrackerModule::InitializeIndex() -{ - m_index["Square"] = 0; - m_index["Trapezoid"] = 100; - m_index["Annular"] = 200; - m_index["DummyShape"] = 1000; -} diff --git a/NPSimulation/src/HydeTrackerSquare.cc b/NPSimulation/src/HydeTrackerSquare.cc deleted file mode 100644 index 500296145..000000000 --- a/NPSimulation/src/HydeTrackerSquare.cc +++ /dev/null @@ -1,1161 +0,0 @@ -/***************************************************************************** - * 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 : 10/06/09 * - * Last update : 12/10/09 * - *---------------------------------------------------------------------------* - * Decription: Define a module of square shape for the Hyde tracker * - * * - *---------------------------------------------------------------------------* - * Comment: * - * + 07/09/09: Fix bug for placing module with (r,theta,phi) method. * - * (N. de Sereville) * - * + 12/10/09: Change scorer scheme (N. de Sereville) * - * * - * * - *****************************************************************************/ - -// C++ headers -#include <sstream> -#include <string> -#include <cmath> - -// G4 Geometry headers -#include "G4Trd.hh" -#include "G4Box.hh" -#include "G4Trap.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 "HydeTrackerSquare.hh" -#include "GeneralScorers.hh" -#include "HydeScorers.hh" -#include "RootOutput.h" -#include "MUST2Array.hh" - -// CLHEP -#include "CLHEP/Random/RandGauss.h" - -using namespace std; -using namespace CLHEP; -using namespace HYDSQUARE; - -using namespace HYDSCORERS; - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -HydeTrackerSquare::HydeTrackerSquare() -{ - ms_InterCoord = 0; -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -HydeTrackerSquare::~HydeTrackerSquare() -{ -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void HydeTrackerSquare::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 HydeTrackerSquare::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 HydeTrackerSquare::VolumeMaker(G4int TelescopeNumber, - G4ThreeVector MMpos, - G4RotationMatrix* MMrot, - bool wFirstStage, - bool wSecondStage, - bool wThirdStage, - G4LogicalVolume* world) -{ - G4double NbrTelescopes = TelescopeNumber ; - G4String DetectorNumber ; - ostringstream Number ; - Number << NbrTelescopes ; - DetectorNumber = Number.str() ; - - ///////////////////////////////////////////////////////////////// - /////////////////Element Definition /////////////////////////// - //////////////////////////////////////////////////////////////// - G4String symbol ; - G4double density = 0. , a = 0, z = 0 ; - G4int ncomponents = 0, natoms = 0 ; - - G4Element* H = new G4Element("Hydrogen" , symbol = "H" , z = 1 , a = 1.01 * g / mole); - G4Element* C = new G4Element("Carbon" , symbol = "C" , z = 6 , a = 12.011 * g / mole); - G4Element* N = new G4Element("Nitrogen" , symbol = "N" , z = 7 , a = 14.01 * g / mole); - G4Element* O = new G4Element("Oxigen" , symbol = "O" , z = 8 , a = 16.00 * g / mole); - G4Element* I = new G4Element("Iode" , symbol = "I" , z = 53 , a = 126.9 * g / mole); - G4Element* Cs = new G4Element("Cesium" , symbol = "Cs" , z = 55 , a = 132.9 * g / mole); - - G4Element* Co = new G4Element("Cobalt" , symbol = "Co" , z = 27 , a = 58.933 * g / mole); - G4Element* Cr = new G4Element("Cromium" , symbol = "Cr" , z = 24 , a = 51.996 * g / mole); - G4Element* Ni = new G4Element("Nickel" , symbol = "Ni" , z = 28 , a = 58.69 * g / mole); - G4Element* Fe = new G4Element("Iron" , symbol = "Fe" , z = 26 , a = 55.847 * g / mole); - G4Element* W = new G4Element("Tungsten" , symbol = "W" , z = 74 , a = 183.5 * g / mole); - - //////////////////////////////////////////////////////////////// - /////////////////Material Definition /////////////////////////// - //////////////////////////////////////////////////////////////// - // Si - a = 28.0855 * g / mole; - density = 2.321 * g / cm3; - G4Material* Silicon = new G4Material("Si", z = 14., a, density); - - // Al - density = 2.702 * g / cm3; - a = 26.98 * g / mole; - G4Material* Aluminium = new G4Material("Aluminium", z = 13., a, density); - - // Iron -// density = 7.874 * g / cm3; -// a = 55.847 * g / mole; -// G4Material* Iron = new G4Material("Iron", z = 26., a, density); - - // CsI - density = 4.51 * g / cm3; - G4Material* CsI = new G4Material("CsI", density, ncomponents = 2); - CsI->AddElement(Cs , natoms = 1); - CsI->AddElement(I , natoms = 1); - - // Vacuum - density = 0.000000001 * mg / cm3; - G4Material* Vacuum = new G4Material("Vacuum", density, ncomponents = 2); - Vacuum->AddElement(N, .7); - Vacuum->AddElement(O, .3); - - // Mylar - density = 1.397 * g / cm3; - G4Material* Myl = new G4Material("Mylar", density, ncomponents = 3); - Myl->AddElement(C, natoms = 10); - Myl->AddElement(H, natoms = 8); - Myl->AddElement(O, natoms = 4); - - // Havar - G4Material* Harvar = new G4Material("Havar", 8.3*g / cm3, 5); - Harvar->AddElement(Co , 42); - Harvar->AddElement(Cr , 20); - Harvar->AddElement(Ni , 13); - Harvar->AddElement(Fe , 19); - Harvar->AddElement(W , 1); - - //////////////////////////////////////////////////////////////// - ////////////// Starting Volume Definition ////////////////////// - //////////////////////////////////////////////////////////////// - // Little trick to avoid warning in compilation: Use a PVPlacement "buffer". - // If don't you will have a Warning unused variable 'myPVP' - G4PVPlacement* PVPBuffer ; - - G4Trd* solidMM = new G4Trd("HYDSquare" + DetectorNumber, 0.5*FaceFront, 0.5*FaceFront, 0.5*FaceFront, 0.5*FaceFront, 0.5*Length); -// G4LogicalVolume* logicMM = new G4LogicalVolume(solidMM, Iron, "HYDSquare" + DetectorNumber, 0, 0, 0) ; - G4LogicalVolume* logicMM = new G4LogicalVolume(solidMM, Vacuum, "HYDSquare" + DetectorNumber, 0, 0, 0) ; - - G4String Name = "HYDSquare" + DetectorNumber ; - PVPBuffer = new G4PVPlacement(G4Transform3D(*MMrot, MMpos) , - logicMM , - Name , - world , - false , - 0); - - logicMM->SetVisAttributes(G4VisAttributes::Invisible); - if (m_non_sensitive_part_visiualisation) logicMM->SetVisAttributes(G4VisAttributes(G4Colour(0.90, 0.90, 0.90))); - - G4ThreeVector positionVacBox = G4ThreeVector(0, 0, VacBox_PosZ); - - G4Trd* solidVacBox = new G4Trd("solidVacBox", 0.5*SiliconFace, 0.5*SiliconFace, 0.5*SiliconFace, 0.5*SiliconFace, 0.5*VacBoxThickness); - G4LogicalVolume* logicVacBox = new G4LogicalVolume(solidVacBox, Vacuum, "logicVacBox", 0, 0, 0); - - PVPBuffer = new G4PVPlacement(0, positionVacBox, logicVacBox, "G" + DetectorNumber + "VacBox", logicMM, false, 0); - - logicVacBox->SetVisAttributes(G4VisAttributes::Invisible); - - // Add a degrader plate between Si and CsI: - /* - G4Box* Degrader = new G4Box("Degrader" , 50*mm , 50*mm , 0.1*mm ); - G4LogicalVolume* logicDegrader = new G4LogicalVolume( Degrader , Harvar, "logicDegrader",0,0,0); - PVPBuffer = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicDegrader,"Degrader",logicVacBox,false,0) ; - */ - - //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 , 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); - - 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) ; - - G4VisAttributes* MarkerVVisAtt= new G4VisAttributes(G4Colour(0.,0.5,0.5));//green - logicMarkerV->SetVisAttributes(MarkerVVisAtt); - */ - - //////////////////////////////////////////////////////////////// - /////////////////Si Strip Construction////////////////////////// - //////////////////////////////////////////////////////////////// - if (wFirstStage) { - // Aluminium dead layers - G4ThreeVector positionAluStripFront = G4ThreeVector(0, 0, AluStripFront_PosZ); - G4ThreeVector positionAluStripBack = G4ThreeVector(0, 0, AluStripBack_PosZ); - - G4Box* solidAluStrip = new G4Box("AluBox", 0.5*SiliconFace, 0.5*SiliconFace, 0.5*AluStripThickness); -// G4LogicalVolume* logicAluStrip = new G4LogicalVolume(solidAluStrip, Aluminium, "logicAluStrip", 0, 0, 0); - G4LogicalVolume* logicAluStrip = new G4LogicalVolume(solidAluStrip, Vacuum, "logicAluStrip", 0, 0, 0); - - PVPBuffer = new G4PVPlacement(0, positionAluStripFront, logicAluStrip, "G" + DetectorNumber + "AluStripFront", logicMM, false, 0); - PVPBuffer = new G4PVPlacement(0, positionAluStripBack, logicAluStrip, "G" + DetectorNumber + "AluStripBack", logicMM, false, 0); - - logicAluStrip->SetVisAttributes(G4VisAttributes::Invisible); - - // Silicon detector itself - G4ThreeVector positionSilicon = G4ThreeVector(0, 0, Silicon_PosZ); - - G4Box* solidSilicon = new G4Box("solidSilicon", 0.5*SiliconFace, 0.5*SiliconFace, 0.5*SiliconThickness); - G4LogicalVolume* logicSilicon = new G4LogicalVolume(solidSilicon, Silicon, "logicSilicon", 0, 0, 0); - - PVPBuffer = new G4PVPlacement(0, positionSilicon, logicSilicon, Name + "_Silicon", logicMM, false, 0); - - - // Set First Stage sensible - logicSilicon->SetSensitiveDetector(m_FirstStageScorer); - - ///Visualisation of Silicon Strip - G4VisAttributes* SiliconVisAtt = new G4VisAttributes(G4Colour(0.5, 0.5, 0.5)) ; - logicSilicon->SetVisAttributes(SiliconVisAtt) ; - } - - //////////////////////////////////////////////////////////////// - //////////////////// SiLi Construction //////////////////////// - //////////////////////////////////////////////////////////////// - if (wSecondStage) { - G4double SiLiSpace = 8 * mm; - - G4RotationMatrix* rotSiLi = Rotation(0., 0., 0.); - - G4ThreeVector positionSiLi = G4ThreeVector(-0.25 * SiliconFace - 0.5 * SiLiSpace, 0, 0); - G4ThreeVector positionSiLi2 = G4ThreeVector(0.25 * SiliconFace + 0.5 * SiLiSpace, 0, 0); - - G4Box* solidSiLi = new G4Box("SiLi", 0.5*SiLiFaceX, 0.5*SiLiFaceY, 0.5*SiLiThickness); - - G4LogicalVolume* logicSiLi = new G4LogicalVolume(solidSiLi, Aluminium, "SiLi" + DetectorNumber, 0, 0, 0); - - // First Si(Li) 2 time 4 detectore - PVPBuffer = new G4PVPlacement(G4Transform3D(*rotSiLi, positionSiLi) , - logicSiLi , - "SiLi" + DetectorNumber , - logicVacBox , - false , - 0); - - // Second Si(Li) 2 time 4 detectore - PVPBuffer = new G4PVPlacement(G4Transform3D(*rotSiLi, positionSiLi2) , - logicSiLi , - "SiLi" + DetectorNumber , - logicVacBox , - false , - 1); - - // SiLi are placed inside of the VacBox... - // Left/Right define when looking to detector from Si to CsI - G4double SiLi_HighY_Upper = 19.86 * mm; - G4double SiLi_HighY_Center = 25.39 * mm ; - G4double SiLi_WidthX_Left = 22.85 * mm; - G4double SiLi_WidthX_Right = 24.9 * mm ; - G4double SiLi_ShiftX = 0.775 * mm ; - - // SiLi : left side of SiLi detector - G4Box* solidSiLi_LT = new G4Box("SiLi_LT" , 0.5*SiLi_WidthX_Left , 0.5*SiLi_HighY_Upper , 0.5*SiLiThickness); - G4Box* solidSiLi_RT = new G4Box("SiLi_RT" , 0.5*SiLi_WidthX_Right , 0.5*SiLi_HighY_Upper , 0.5*SiLiThickness); - G4Box* solidSiLi_LC1 = new G4Box("SiLi_LC1" , 0.5*SiLi_WidthX_Left , 0.5*SiLi_HighY_Center , 0.5*SiLiThickness); - G4Box* solidSiLi_RC1 = new G4Box("SiLi_RC1" , 0.5*SiLi_WidthX_Right , 0.5*SiLi_HighY_Center , 0.5*SiLiThickness); - G4Box* solidSiLi_LB = new G4Box("SiLi_LB" , 0.5*SiLi_WidthX_Left , 0.5*SiLi_HighY_Upper , 0.5*SiLiThickness); - G4Box* solidSiLi_RB = new G4Box("SiLi_RB" , 0.5*SiLi_WidthX_Right , 0.5*SiLi_HighY_Upper , 0.5*SiLiThickness); - G4Box* solidSiLi_LC2 = new G4Box("SiLi_LC2" , 0.5*SiLi_WidthX_Left , 0.5*SiLi_HighY_Center , 0.5*SiLiThickness); - G4Box* solidSiLi_RC2 = new G4Box("SiLi_RC2" , 0.5*SiLi_WidthX_Right , 0.5*SiLi_HighY_Center , 0.5*SiLiThickness); - - G4LogicalVolume* logicSiLi_LT = new G4LogicalVolume(solidSiLi_LT , Silicon , "SiLi_LT" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_RT = new G4LogicalVolume(solidSiLi_RT , Silicon , "SiLi_RT" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_LC1 = new G4LogicalVolume(solidSiLi_LC1 , Silicon , "SiLi_LC1" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_RC1 = new G4LogicalVolume(solidSiLi_RC1 , Silicon , "SiLi_RC1" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_LB = new G4LogicalVolume(solidSiLi_LB , Silicon , "SiLi_LB" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_RB = new G4LogicalVolume(solidSiLi_RB , Silicon , "SiLi_RB" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_LC2 = new G4LogicalVolume(solidSiLi_LC2 , Silicon , "SiLi_LC2" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_RC2 = new G4LogicalVolume(solidSiLi_RC2 , Silicon , "SiLi_RC2" , 0 , 0 , 0); - - G4double interSiLi = 0.5 * mm; - - // Top - G4ThreeVector positionSiLi_LT = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - 0.5 * SiLi_HighY_Upper + SiLi_HighY_Center + 1.5 * interSiLi , - 0); - - G4ThreeVector positionSiLi_RT = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - 0.5 * SiLi_HighY_Upper + SiLi_HighY_Center + 1.5 * interSiLi , - 0); - - G4ThreeVector positionSiLi_LC1 = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - 0.5 * SiLi_HighY_Center + 0.5 * interSiLi , - 0); - - G4ThreeVector positionSiLi_RC1 = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - 0.5 * SiLi_HighY_Center + 0.5 * interSiLi , - 0); - - // Bottom - G4ThreeVector positionSiLi_LB = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - -0.5 * SiLi_HighY_Upper - SiLi_HighY_Center - 1.5 * interSiLi , - 0); - - G4ThreeVector positionSiLi_RB = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - -0.5 * SiLi_HighY_Upper - SiLi_HighY_Center - 1.5 * interSiLi , - 0); - - G4ThreeVector positionSiLi_LC2 = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - -0.5 * SiLi_HighY_Center - 0.5 * interSiLi , - 0); - - G4ThreeVector positionSiLi_RC2 = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - -0.5 * SiLi_HighY_Center - 0.5 * interSiLi , - 0); - - PVPBuffer = new G4PVPlacement(0 , positionSiLi_LT , logicSiLi_LT , Name + "_SiLi_LT" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_RT , logicSiLi_RT , Name + "_SiLi_RT" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_LC1 , logicSiLi_LC1 , Name + "_SiLi_LC1" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_RC1 , logicSiLi_RC1 , Name + "_SiLi_RC1" , logicSiLi , false , 0) ; - - PVPBuffer = new G4PVPlacement(0 , positionSiLi_LB , logicSiLi_LB , Name + "_SiLi_LB" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_RB , logicSiLi_RB , Name + "_SiLi_RB" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_LC2 , logicSiLi_LC2 , Name + "_SiLi_LC2" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_RC2 , logicSiLi_RC2 , Name + "_SiLi_RC2" , logicSiLi , false , 0) ; - - logicSiLi->SetVisAttributes(G4VisAttributes(G4Colour(1, 1., 1.))); - - // Set Second Stage sensible - logicSiLi_LT->SetSensitiveDetector(m_SecondStageScorer); - logicSiLi_RT->SetSensitiveDetector(m_SecondStageScorer); - logicSiLi_LC1->SetSensitiveDetector(m_SecondStageScorer); - logicSiLi_RC1->SetSensitiveDetector(m_SecondStageScorer); - - logicSiLi_LB->SetSensitiveDetector(m_SecondStageScorer); - logicSiLi_RB->SetSensitiveDetector(m_SecondStageScorer); - logicSiLi_LC2->SetSensitiveDetector(m_SecondStageScorer); - logicSiLi_RC2->SetSensitiveDetector(m_SecondStageScorer); - - // Mark blue a SiLi to see telescope orientation - logicSiLi_LT->SetVisAttributes(G4VisAttributes(G4Colour(0, 0., 1.))); - logicSiLi_RT->SetVisAttributes(G4VisAttributes(G4Colour(0, 1., 0))); - logicSiLi_LC1->SetVisAttributes(G4VisAttributes(G4Colour(0, 1., 0))); - logicSiLi_RC1->SetVisAttributes(G4VisAttributes(G4Colour(0, 1., 0))); - - logicSiLi_LB->SetVisAttributes(G4VisAttributes(G4Colour(0, 1., 0))); - logicSiLi_RB->SetVisAttributes(G4VisAttributes(G4Colour(0, 1., 0))); - logicSiLi_LC2->SetVisAttributes(G4VisAttributes(G4Colour(0, 1., 0))); - logicSiLi_RC2->SetVisAttributes(G4VisAttributes(G4Colour(0, 1., 0))); - } - - //////////////////////////////////////////////////////////////// - ///////////////// Third Stage Construction ///////////////////// - //////////////////////////////////////////////////////////////// - if (wThirdStage) { - // Third stage silicon detector - G4ThreeVector positionThirdStage = G4ThreeVector(0, 0, ThirdStage_PosZ); - -// G4Box* solidThirdStage = new G4Box("solidThirdStage", 0.5*SiliconFace, 0.5*SiliconFace, 0.5*ThirdStageThickness); - G4Box* solidThirdStage = new G4Box("solidThirdStage", 0.5*FaceFront, 0.5*FaceFront, 0.5*ThirdStageThickness); - G4LogicalVolume* logicThirdStage = new G4LogicalVolume(solidThirdStage, Silicon, "logicThirdStage", 0, 0, 0); - - PVPBuffer = new G4PVPlacement(0, positionThirdStage, logicThirdStage, Name + "_ThirdStage", logicMM, false, 0); - - ///Visualisation of Third Stage - G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.7, 0.7, 0.7)) ; - logicThirdStage->SetVisAttributes(ThirdStageVisAtt) ; -// logicThirdStage->SetVisAttributes(G4VisAttributes::Invisible); - - // Set Third Stage sensible - logicThirdStage->SetSensitiveDetector(m_ThirdStageScorer); - } -} - -//....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 HydeTrackerSquare::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_beta = 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, 9, "HYDSquare") == 0) { - G4cout << "///" << G4endl ; - G4cout << "Square 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); - cout << "X1 Y1 corner position : " << A << endl; - } - - 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); - cout << "X128 Y1 corner position : " << B << endl; - } - - 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); - cout << "X1 Y128 corner position : " << C << endl; - } - - 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); - cout << "X128 Y128 corner position : " << D << endl; - } - - - // Angle method - else if (DataBuffer.compare(0, 6, "THETA=") == 0) { - check_Theta = true; - ConfigFile >> DataBuffer ; - Theta = atof(DataBuffer.c_str()) ; - Theta = Theta * deg; - cout << "Theta: " << Theta / deg << endl; - } - - else if (DataBuffer.compare(0, 4, "PHI=") == 0) { - check_Phi = true; - ConfigFile >> DataBuffer ; - Phi = atof(DataBuffer.c_str()) ; - Phi = Phi * deg; - cout << "Phi: " << Phi / deg << endl; - } - - else if (DataBuffer.compare(0, 2, "R=") == 0) { - check_R = true; - ConfigFile >> DataBuffer ; - R = atof(DataBuffer.c_str()) ; - R = R * mm; - cout << "R: " << R / mm << endl; - } - - else if (DataBuffer.compare(0, 5, "BETA=") == 0) { - check_beta = true; - 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, HydeTrackerSquare: Square 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_beta = 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 HydeTrackerSquare::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) ;*/ - MMpos = G4ThreeVector(0, 0, 0) ; - MMu = G4ThreeVector(0, 0, 0) ; - MMv = G4ThreeVector(0, 0, 0) ; - MMw = G4ThreeVector(0, 0, 0) ; - G4ThreeVector MMCenter = G4ThreeVector(0, 0, 0) ; - bool FirstStage = true ; - bool SecondStage = true ; - bool ThirdStage = true ; - - G4int NumberOfTelescope = m_DefinitionType.size() ; - - for (G4int i = 0; i < NumberOfTelescope; i++) { - // By Point - if (m_DefinitionType[i]) { - // (u,v,w) unitary vector associated to telescope referencial - // (u,v) // to silicon plan - // w perpendicular to (u,v) plan and pointing ThirdStage - G4cout << "############ Hyde " << i << " #############" << G4endl; - MMu = m_X128_Y1[i] - m_X1_Y1[i] ; - G4cout << "MMu: X = " << MMu(0) << " , Y = " << MMu(1) << " , Z = " << MMu(2) << G4endl; - MMu = MMu.unit() ; - G4cout << "Norm MMu: X = " << MMu(0) << " , Y = " << MMu(1) << " , Z = " << MMu(2) << G4endl; - - MMv = m_X1_Y128[i] - m_X1_Y1[i] ; - G4cout << "MMv X = " << MMv(0) << " , Y = " << MMv(1) << " , Z = " << MMv(2) << G4endl; - MMv = MMv.unit() ; - G4cout << "Norm MMv X = " << MMv(0) << " , Y = " << MMv(1) << " , Z = " << MMv(2) << G4endl; - - G4cout << "Norm MMu.MMv X = " << MMv(0) << " , Y = " << MMv(1) << " , Z = " << MMv(2) << G4endl; - - 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 ; - } - - // 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 - // 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 - CT = MMw; - - // vector parallel to one axis of silicon plane - 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(); - MMu = MMw.cross(Y); - MMv = MMw.cross(MMu); - MMv = MMv.unit(); - 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 ; - } - - 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 HydeTrackingData class to the output TTree -// of the simulation -void HydeTrackerSquare::InitializeRootOutput() -{ -} - - - -// Set the TinteractionCoordinates object from VDetector to the present class -void HydeTrackerSquare::SetInterCoordPointer(TInteractionCoordinates* interCoord) -{ - ms_InterCoord = interCoord; -} - - - -// Read sensitive part and fill the Root tree. -// Called at in the EventAction::EndOfEventAvtion -void HydeTrackerSquare::ReadSensitive(const G4Event* event) -{ -////////////////////////////////////////////////////////////////////////////////////// -//////////////////////// Used to Read Event Map of detector ////////////////////////// -////////////////////////////////////////////////////////////////////////////////////// - // First Stage - std::map<G4int, G4int*>::iterator DetectorNumber_itr; - std::map<G4int, G4double*>::iterator Energy_itr; - std::map<G4int, G4double*>::iterator Time_itr; - std::map<G4int, G4double*>::iterator X_itr; - std::map<G4int, G4double*>::iterator Y_itr; - std::map<G4int, G4double*>::iterator Pos_X_itr; - std::map<G4int, G4double*>::iterator Pos_Y_itr; - std::map<G4int, G4double*>::iterator Pos_Z_itr; - std::map<G4int, G4double*>::iterator Ang_Theta_itr; - std::map<G4int, G4double*>::iterator Ang_Phi_itr; - - G4THitsMap<G4int>* DetectorNumberHitMap; - G4THitsMap<G4double>* EnergyHitMap; - G4THitsMap<G4double>* TimeHitMap; - G4THitsMap<G4double>* XHitMap; - G4THitsMap<G4double>* YHitMap; - G4THitsMap<G4double>* PosXHitMap; - G4THitsMap<G4double>* PosYHitMap; - G4THitsMap<G4double>* PosZHitMap; - G4THitsMap<G4double>* AngThetaHitMap; - G4THitsMap<G4double>* AngPhiHitMap; - - // NULL pointer are given to avoid warning at compilation - // Si(Li) - std::map<G4int, G4double*>::iterator SiLiEnergy_itr ; - G4THitsMap<G4double>* SiLiEnergyHitMap = NULL ; - // Third Stage - std::map<G4int, G4double*>::iterator ThirdStageEnergy_itr ; - G4THitsMap<G4double>* ThirdStageEnergyHitMap = NULL ; - - - // Read the Scorer associate to the Silicon Strip - //Detector Number - G4int StripDetCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDSquare/DetectorNumber") ; - DetectorNumberHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripDetCollectionID)) ; - DetectorNumber_itr = DetectorNumberHitMap->GetMap()->begin() ; - - //Energy - G4int StripEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDSquare/StripEnergy") ; - EnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripEnergyCollectionID)) ; - Energy_itr = EnergyHitMap->GetMap()->begin() ; - - //Time of Flight - G4int StripTimeCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDSquare/StripTime") ; - TimeHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripTimeCollectionID)) ; - Time_itr = TimeHitMap->GetMap()->begin() ; - - //Strip Number X - G4int StripXCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDSquare/StripNumberX") ; - XHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripXCollectionID)) ; - X_itr = XHitMap->GetMap()->begin() ; - - //Strip Number Y - G4int StripYCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDSquare/StripNumberY") ; - YHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripYCollectionID)) ; - Y_itr = YHitMap->GetMap()->begin() ; - - //Interaction Coordinate X - G4int InterCoordXCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDSquare/InterCoordX") ; - PosXHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordXCollectionID)) ; - Pos_X_itr = PosXHitMap->GetMap()->begin() ; - - //Interaction Coordinate Y - G4int InterCoordYCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDSquare/InterCoordY") ; - PosYHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordYCollectionID)) ; - Pos_Y_itr = PosYHitMap->GetMap()->begin() ; - - //Interaction Coordinate Z - G4int InterCoordZCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDSquare/InterCoordZ") ; - PosZHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordZCollectionID)) ; - Pos_Z_itr = PosXHitMap->GetMap()->begin() ; - - //Interaction Coordinate Angle Theta - G4int InterCoordAngThetaCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDSquare/InterCoordAngTheta") ; - AngThetaHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordAngThetaCollectionID)) ; - Ang_Theta_itr = AngThetaHitMap->GetMap()->begin() ; - - //Interaction Coordinate Angle Phi - G4int InterCoordAngPhiCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDSquare/InterCoordAngPhi") ; - AngPhiHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordAngPhiCollectionID)) ; - Ang_Phi_itr = AngPhiHitMap->GetMap()->begin() ; - - - // Read the Scorer associate to the SiLi - //Energy - G4int SiLiEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("SecondStageScorerHYDSquare/SecondStageEnergy") ; - SiLiEnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(SiLiEnergyCollectionID)) ; - SiLiEnergy_itr = SiLiEnergyHitMap->GetMap()->begin() ; - - - // Read the Scorer associate to the CsI crystal - //Energy - G4int ThirdStageEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("ThirdStageScorerHYDSquare/ThirdStageEnergy"); - ThirdStageEnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(ThirdStageEnergyCollectionID)); - ThirdStageEnergy_itr = ThirdStageEnergyHitMap->GetMap()->begin(); - - // Check the size of different map - G4int sizeN = DetectorNumberHitMap->entries(); - G4int sizeE = EnergyHitMap->entries(); - G4int sizeT = TimeHitMap->entries(); - G4int sizeX = XHitMap->entries(); - G4int sizeY = YHitMap->entries(); - - if (sizeE != sizeT || sizeT != sizeX || sizeX != sizeY) { - G4cout << "No match size Si Event Map: sE:" - << sizeE << " sT:" << sizeT << " sX:" << sizeX << " sY:" << sizeY << endl ; - return; - } - - // Loop on FirstStage number - for (G4int l = 0; l < sizeN; l++) { - G4double N = *(DetectorNumber_itr->second); - G4int NTrackID = DetectorNumber_itr->first - N; - - if (N > 0) { - // Fill detector number - ms_Event->SetHYDTrkFirstStageFrontEDetectorNbr(m_index["Square"] + N); - ms_Event->SetHYDTrkFirstStageFrontTDetectorNbr(m_index["Square"] + N); - ms_Event->SetHYDTrkFirstStageBackEDetectorNbr(m_index["Square"] + N); - ms_Event->SetHYDTrkFirstStageBackTDetectorNbr(m_index["Square"] + N); - - // Energy - for (G4int l = 0 ; l < sizeE ; l++) { - G4int ETrackID = Energy_itr->first - N; - G4double E = *(Energy_itr->second); - if (ETrackID == NTrackID) { - ms_Event->SetHYDTrkFirstStageFrontEEnergy(RandGauss::shoot(E, ResoFirstStage)); - ms_Event->SetHYDTrkFirstStageBackEEnergy(RandGauss::shoot(E, ResoFirstStage)); - } - Energy_itr++; - } - - // Time - Time_itr = TimeHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeT ; h++) { - G4int TTrackID = Time_itr->first - N; - G4double T = *(Time_itr->second); - if (TTrackID == NTrackID) { - T = RandGauss::shoot(T, ResoTimePPAC) ; - ms_Event->SetHYDTrkFirstStageFrontTTime(RandGauss::shoot(T, ResoTimeGpd)) ; - ms_Event->SetHYDTrkFirstStageBackTTime(RandGauss::shoot(T, ResoTimeGpd)) ; - } - Time_itr++; - } - - // X - X_itr = XHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int XTrackID = X_itr->first - N; - G4double X = *(X_itr->second); - if (XTrackID == NTrackID) { - ms_Event->SetHYDTrkFirstStageFrontEStripNbr(X); - ms_Event->SetHYDTrkFirstStageFrontTStripNbr(X); - } - - X_itr++; - } - - // Y - Y_itr = YHitMap->GetMap()->begin() ; - for (G4int h = 0 ; h < sizeY ; h++) { - G4int YTrackID = Y_itr->first - N; - G4double Y = *(Y_itr->second); - if (YTrackID == NTrackID) { - ms_Event->SetHYDTrkFirstStageBackEStripNbr(Y); - ms_Event->SetHYDTrkFirstStageBackTStripNbr(Y); - } - - Y_itr++; - } - - // Pos X - Pos_X_itr = PosXHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int PosXTrackID = Pos_X_itr->first - N ; - G4double PosX = *(Pos_X_itr->second) ; - if (PosXTrackID == NTrackID) { - ms_InterCoord->SetDetectedPositionX(PosX) ; - } - Pos_X_itr++; - } - - // Pos Y - Pos_Y_itr = PosYHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int PosYTrackID = Pos_Y_itr->first - N ; - G4double PosY = *(Pos_Y_itr->second) ; - if (PosYTrackID == NTrackID) { - ms_InterCoord->SetDetectedPositionY(PosY) ; - } - Pos_Y_itr++; - } - - // Pos Z - Pos_Z_itr = PosZHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int PosZTrackID = Pos_Z_itr->first - N ; - G4double PosZ = *(Pos_Z_itr->second) ; - if (PosZTrackID == NTrackID) { - ms_InterCoord->SetDetectedPositionZ(PosZ) ; - } - Pos_Z_itr++; - } - - // Angle Theta - Ang_Theta_itr = AngThetaHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int AngThetaTrackID = Ang_Theta_itr->first - N ; - G4double AngTheta = *(Ang_Theta_itr->second) ; - if (AngThetaTrackID == NTrackID) { - ms_InterCoord->SetDetectedAngleTheta(AngTheta) ; - } - Ang_Theta_itr++; - } - - // Angle Phi - Ang_Phi_itr = AngPhiHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int AngPhiTrackID = Ang_Phi_itr->first - N ; - G4double AngPhi = *(Ang_Phi_itr->second) ; - if (AngPhiTrackID == NTrackID) { - ms_InterCoord->SetDetectedAnglePhi(AngPhi) ; - } - Ang_Phi_itr++; - } - - // Second Stage - SiLiEnergy_itr = SiLiEnergyHitMap->GetMap()->begin() ; - for (G4int h = 0 ; h < SiLiEnergyHitMap->entries() ; h++) { - G4int SiLiEnergyTrackID = SiLiEnergy_itr->first - N; - G4double SiLiEnergy = *(SiLiEnergy_itr->second); - - if (SiLiEnergyTrackID == NTrackID) { - ms_Event->SetHYDTrkSecondStageEEnergy(RandGauss::shoot(SiLiEnergy, ResoSecondStage)) ; - ms_Event->SetHYDTrkSecondStageEPadNbr(1); - ms_Event->SetHYDTrkSecondStageTPadNbr(1); - ms_Event->SetHYDTrkSecondStageTTime(1); - ms_Event->SetHYDTrkSecondStageTDetectorNbr(m_index["Square"] + N); - ms_Event->SetHYDTrkSecondStageEDetectorNbr(m_index["Square"] + N); - } - - SiLiEnergy_itr++; - } - - // Third Stage - ThirdStageEnergy_itr = ThirdStageEnergyHitMap->GetMap()->begin() ; - for (G4int h = 0 ; h < ThirdStageEnergyHitMap->entries() ; h++) { - G4int ThirdStageEnergyTrackID = ThirdStageEnergy_itr->first - N; - G4double ThirdStageEnergy = *(ThirdStageEnergy_itr->second) ; - - if (ThirdStageEnergyTrackID == NTrackID) { - ms_Event->SetHYDTrkThirdStageEEnergy(RandGauss::shoot(ThirdStageEnergy, ResoThirdStage)); - ms_Event->SetHYDTrkThirdStageEPadNbr(1); - ms_Event->SetHYDTrkThirdStageTPadNbr(1); - ms_Event->SetHYDTrkThirdStageTTime(1); - ms_Event->SetHYDTrkThirdStageTDetectorNbr(m_index["Square"] + N); - ms_Event->SetHYDTrkThirdStageEDetectorNbr(m_index["Square"] + N); - } - - ThirdStageEnergy_itr++; - } - - DetectorNumber_itr++; - } - - // clear map for next event - DetectorNumberHitMap ->clear(); - EnergyHitMap ->clear() ; - TimeHitMap ->clear() ; - XHitMap ->clear() ; - YHitMap ->clear() ; - PosXHitMap ->clear(); - PosYHitMap ->clear(); - PosZHitMap ->clear(); - AngThetaHitMap ->clear(); - AngPhiHitMap ->clear(); - SiLiEnergyHitMap ->clear() ; - ThirdStageEnergyHitMap ->clear() ; - } -} - - - -void HydeTrackerSquare::InitializeScorers() -{ - // First stage Associate Scorer - m_FirstStageScorer = new G4MultiFunctionalDetector("FirstStageScorerHYDSquare"); - G4VPrimitiveScorer* DetNbr = new GENERALSCORERS::PSDetectorNumber("DetectorNumber", "HYDSquare", 0); - G4VPrimitiveScorer* TOF = new GENERALSCORERS::PSTOF("StripTime","HYDSquare", 0); - G4VPrimitiveScorer* InteractionCoordinatesX = new GENERALSCORERS::PSInteractionCoordinatesX("InterCoordX","HYDSquare", 0); - G4VPrimitiveScorer* InteractionCoordinatesY = new GENERALSCORERS::PSInteractionCoordinatesY("InterCoordY","HYDSquare", 0); - G4VPrimitiveScorer* InteractionCoordinatesZ = new GENERALSCORERS::PSInteractionCoordinatesZ("InterCoordZ","HYDSquare", 0); - G4VPrimitiveScorer* InteractionCoordinatesAngleTheta = new GENERALSCORERS::PSInteractionCoordinatesAngleTheta("InterCoordAngTheta","HYDSquare", 0); - G4VPrimitiveScorer* InteractionCoordinatesAnglePhi = new GENERALSCORERS::PSInteractionCoordinatesAnglePhi("InterCoordAngPhi","HYDSquare", 0); - G4VPrimitiveScorer* Energy = new HYDScorerFirstStageEnergy("StripEnergy", "HYDSquare", 0); - G4VPrimitiveScorer* StripPositionX = new HYDScorerFirstStageFrontStripSquare("StripNumberX", 0, NumberOfStrips); - G4VPrimitiveScorer* StripPositionY = new HYDScorerFirstStageBackStripSquare("StripNumberY", 0, NumberOfStrips); - - //and register it to the multifunctionnal detector - m_FirstStageScorer->RegisterPrimitive(DetNbr); - m_FirstStageScorer->RegisterPrimitive(Energy); - m_FirstStageScorer->RegisterPrimitive(TOF); - m_FirstStageScorer->RegisterPrimitive(StripPositionX); - m_FirstStageScorer->RegisterPrimitive(StripPositionY); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesX); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesY); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesZ); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesAngleTheta); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesAnglePhi); - - // Second stage Associate Scorer - m_SecondStageScorer = new G4MultiFunctionalDetector("SecondStageScorerHYDSquare"); - G4VPrimitiveScorer* SecondStageEnergy = new HYDScorerSecondStageEnergy("SecondStageEnergy", "HYDSquare", 0); - m_SecondStageScorer->RegisterPrimitive(SecondStageEnergy); - - // Third stage Associate Scorer - m_ThirdStageScorer = new G4MultiFunctionalDetector("ThirdStageScorerHYDSquare"); - G4VPrimitiveScorer* ThirdStageEnergy = new HYDScorerThirdStageEnergy("ThirdStageEnergy", "HYDSquare", 0); - m_ThirdStageScorer->RegisterPrimitive(ThirdStageEnergy); - - // 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/src/HydeTrackerTrapezoid.cc b/NPSimulation/src/HydeTrackerTrapezoid.cc deleted file mode 100644 index 4252bfcd9..000000000 --- a/NPSimulation/src/HydeTrackerTrapezoid.cc +++ /dev/null @@ -1,1029 +0,0 @@ -/***************************************************************************** - * 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 Hyde tracker * - * * - *---------------------------------------------------------------------------* - * Comment: * - * + 12/10/09: Change scorer scheme (N. de Sereville) * - * * - * * - *****************************************************************************/ - -// C++ headers -#include <sstream> -#include <string> -#include <cmath> - -// G4 Geometry headers -#include "G4Box.hh" -#include "G4Trap.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 "HydeTrackerTrapezoid.hh" -#include "GeneralScorers.hh" -#include "HydeScorers.hh" -#include "RootOutput.h" - -// CLHEP -#include "CLHEP/Random/RandGauss.h" - -using namespace std; -using namespace CLHEP; -using namespace HYDTRAP ; - -using namespace HYDSCORERS; - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -HydeTrackerTrapezoid::HydeTrackerTrapezoid() -{ - ms_InterCoord = 0; -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -HydeTrackerTrapezoid::~HydeTrackerTrapezoid() -{ -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void HydeTrackerTrapezoid::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 HydeTrackerTrapezoid::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 HydeTrackerTrapezoid::VolumeMaker(G4int TelescopeNumber , - G4ThreeVector MMpos , - G4RotationMatrix* MMrot , - bool wFirstStage , - bool wSecondStage , - bool wThirdStage , - G4LogicalVolume* world) -{ - G4double NbrTelescopes = TelescopeNumber ; - G4String DetectorNumber ; - ostringstream Number ; - Number << NbrTelescopes ; - DetectorNumber = Number.str() ; - - //////////////////////////////////////////////////////////////// - /////////////////Element Definition /////////////////////////// - //////////////////////////////////////////////////////////////// - G4String symbol ; - G4double density = 0. , a = 0, z = 0 ; - G4int ncomponents = 0, natoms = 0 ; - - G4Element* H = new G4Element("Hydrogen" , symbol = "H" , z = 1 , a = 1.01 * g / mole); - G4Element* C = new G4Element("Carbon" , symbol = "C" , z = 6 , a = 12.011 * g / mole); - G4Element* N = new G4Element("Nitrogen" , symbol = "N" , z = 7 , a = 14.01 * g / mole); - G4Element* O = new G4Element("Oxigen" , symbol = "O" , z = 8 , a = 16.00 * g / mole); - G4Element* I = new G4Element("Iode" , symbol = "I" , z = 53 , a = 126.9 * g / mole); - G4Element* Cs = new G4Element("Cesium" , symbol = "Cs" , z = 55 , a = 132.9 * g / mole); - - G4Element* Co = new G4Element("Cobalt" , symbol = "Co" , z = 27 , a = 58.933 * g / mole); - G4Element* Cr = new G4Element("Cromium" , symbol = "Cr" , z = 24 , a = 51.996 * g / mole); - G4Element* Ni = new G4Element("Nickel" , symbol = "Ni" , z = 28 , a = 58.69 * g / mole); - G4Element* Fe = new G4Element("Iron" , symbol = "Fe" , z = 26 , a = 55.847 * g / mole); - G4Element* W = new G4Element("Tungsten" , symbol = "W" , z = 74 , a = 183.5 * g / mole); - - //////////////////////////////////////////////////////////////// - /////////////////Material Definition /////////////////////////// - //////////////////////////////////////////////////////////////// - // Si - a = 28.0855 * g / mole; - density = 2.321 * g / cm3; - G4Material* Silicon = new G4Material("Si", z = 14., a, density); - - // Al -// density = 2.702 * g / cm3; -// a = 26.98 * g / mole; -// G4Material* Aluminium = new G4Material("Aluminium", z = 13., a, density); - - // Iron -// density = 7.874 * g / cm3; -// a = 55.847 * g / mole; -// G4Material* Iron = new G4Material("Iron", z = 26., a, density); - - // CsI - density = 4.51 * g / cm3; - G4Material* CsI = new G4Material("CsI", density, ncomponents = 2); - CsI->AddElement(Cs , natoms = 1); - CsI->AddElement(I , natoms = 1); - - // Vacuum - density = 0.000000001 * mg / cm3; - G4Material* Vacuum = new G4Material("Vacuum", density, ncomponents = 2); - Vacuum->AddElement(N, .7); - Vacuum->AddElement(O, .3); - - // Mylar - density = 1.397 * g / cm3; - G4Material* Myl = new G4Material("Mylar", density, ncomponents = 3); - Myl->AddElement(C, natoms = 10); - Myl->AddElement(H, natoms = 8); - Myl->AddElement(O, natoms = 4); - - // Havar - G4Material* Harvar = new G4Material("Havar", 8.3*g / cm3, 5); - Harvar->AddElement(Co , 42); - Harvar->AddElement(Cr , 20); - Harvar->AddElement(Ni , 13); - Harvar->AddElement(Fe , 19); - Harvar->AddElement(W , 1); - - //////////////////////////////////////////////////////////////// - ////////////// Starting Volume Definition ////////////////////// - //////////////////////////////////////////////////////////////// - // Little trick to avoid warning in compilation: Use a PVPlacement "buffer". - // If don't you will have a Warning unused variable 'myPVP' - G4PVPlacement* PVPBuffer ; - - // Definition of the volume containing the sensitive detector - G4Trap* solidMM = new G4Trap("HYDTrapezoid" + DetectorNumber, - Length/2, 0*deg, 0*deg, - Height/2, BaseSmall/2, BaseLarge/2, 0*deg, - Height/2, BaseSmall/2, BaseLarge/2, 0*deg); - -// G4LogicalVolume* logicMM = new G4LogicalVolume(solidMM, Iron, "HYDTrapezoid" + DetectorNumber, 0, 0, 0) ; - G4LogicalVolume* logicMM = new G4LogicalVolume(solidMM, Vacuum, "HYDTrapezoid" + DetectorNumber, 0, 0, 0) ; - - G4String Name = "HYDTrapezoid" + DetectorNumber ; - PVPBuffer = new G4PVPlacement(G4Transform3D(*MMrot, MMpos) , - logicMM , - Name , - world , - false , - 0); - - logicMM->SetVisAttributes(G4VisAttributes::Invisible); - if (m_non_sensitive_part_visiualisation) logicMM->SetVisAttributes(G4VisAttributes(G4Colour(0.90, 0.90, 0.90))); - - // Definition of a vaccuum volume - G4ThreeVector positionVacBox = G4ThreeVector(0, 0, VacBox_PosZ); - - G4Trap* solidVacBox = new G4Trap("solidVacBox", - VacBoxThickness/2, 0*deg, 0*deg, - FirstStageHeight/2, FirstStageBaseSmall/2, FirstStageBaseLarge/2, 0*deg, - FirstStageHeight/2, FirstStageBaseSmall/2, FirstStageBaseLarge/2, 0*deg); - - G4LogicalVolume* logicVacBox = new G4LogicalVolume(solidVacBox, Vacuum, "logicVacBox", 0, 0, 0); - - PVPBuffer = new G4PVPlacement(0, positionVacBox, logicVacBox, "G" + DetectorNumber + "VacBox", logicMM, false, 0); - - logicVacBox->SetVisAttributes(G4VisAttributes::Invisible); - - // Add a degrader plate between Si and CsI: - /* - G4Box* Degrader = new G4Box("Degrader" , 50*mm , 50*mm , 0.1*mm ); - G4LogicalVolume* logicDegrader = new G4LogicalVolume( Degrader , Harvar, "logicDegrader",0,0,0); - PVPBuffer = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicDegrader,"Degrader",logicVacBox,false,0) ; - */ - - //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 , 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); - - 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) ; - - G4VisAttributes* MarkerVVisAtt= new G4VisAttributes(G4Colour(0.,0.5,0.5));//green - logicMarkerV->SetVisAttributes(MarkerVVisAtt); - */ - - //////////////////////////////////////////////////////////////// - /////////////////// First Stage Construction//////////////////// - //////////////////////////////////////////////////////////////// - if (wFirstStage) { - // Aluminium dead layers - G4ThreeVector positionAluStripFront = G4ThreeVector(0, 0, AluStripFront_PosZ); - G4ThreeVector positionAluStripBack = G4ThreeVector(0, 0, AluStripBack_PosZ); - - G4Trap* solidAluStrip = new G4Trap("AluBox", - AluStripThickness/2, 0*deg, 0*deg, - FirstStageHeight/2, FirstStageBaseSmall/2, FirstStageBaseLarge/2, 0*deg, - FirstStageHeight/2, FirstStageBaseSmall/2, FirstStageBaseLarge/2, 0*deg); - -// G4LogicalVolume* logicAluStrip = new G4LogicalVolume(solidAluStrip, Aluminium, "logicAluStrip", 0, 0, 0); - G4LogicalVolume* logicAluStrip = new G4LogicalVolume(solidAluStrip, Vacuum, "logicAluStrip", 0, 0, 0); - - PVPBuffer = new G4PVPlacement(0, positionAluStripFront, logicAluStrip, "G" + DetectorNumber + "AluStripFront", logicMM, false, 0); - PVPBuffer = new G4PVPlacement(0, positionAluStripBack, logicAluStrip, "G" + DetectorNumber + "AluStripBack", logicMM, false, 0); - - logicAluStrip->SetVisAttributes(G4VisAttributes::Invisible); - - // Silicon detector itself - G4ThreeVector positionSilicon = G4ThreeVector(0, 0, Silicon_PosZ); - - G4Trap* solidSilicon = new G4Trap("solidSilicon", - FirstStageThickness/2, 0*deg, 0*deg, - FirstStageHeight/2, FirstStageBaseSmall/2, FirstStageBaseLarge/2, 0*deg, - FirstStageHeight/2, FirstStageBaseSmall/2, FirstStageBaseLarge/2, 0*deg); - G4LogicalVolume* logicSilicon = new G4LogicalVolume(solidSilicon, Silicon, "logicSilicon", 0, 0, 0); - - PVPBuffer = new G4PVPlacement(0, positionSilicon, logicSilicon, Name + "_Silicon", logicMM, false, 0); - - // Set First Stage sensible - logicSilicon->SetSensitiveDetector(m_FirstStageScorer); - - // Visualisation of Silicon Strip - G4VisAttributes* SiliconVisAtt = new G4VisAttributes(G4Colour(0.5, 0.5, 0.5)) ; - logicSilicon->SetVisAttributes(SiliconVisAtt) ; - } - - //////////////////////////////////////////////////////////////// - //////////////// Second Stage Construction //////////////////// - //////////////////////////////////////////////////////////////// - if (wSecondStage) { - } - - //////////////////////////////////////////////////////////////// - ///////////////// Third Stage Construction ///////////////////// - //////////////////////////////////////////////////////////////// - if (wThirdStage) { - // Third stage silicon detector - G4ThreeVector positionThirdStage = G4ThreeVector(0, 0, ThirdStage_PosZ); - - G4Trap* solidThirdStage = new G4Trap("solidThirdStage", - ThirdStageThickness/2, 0*deg, 0*deg, - Height/2, BaseSmall/2, BaseLarge/2, 0*deg, - Height/2, BaseSmall/2, BaseLarge/2, 0*deg); - - G4LogicalVolume* logicThirdStage = new G4LogicalVolume(solidThirdStage, Silicon, "logicThirdStage", 0, 0, 0); - - PVPBuffer = new G4PVPlacement(0, positionThirdStage, logicThirdStage, Name + "_ThirdStage", logicMM, false, 0); - - // Visualisation of Third Stage - G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.7, 0.7, 0.7)) ; - logicThirdStage->SetVisAttributes(ThirdStageVisAtt) ; -// logicThirdStage->SetVisAttributes(G4VisAttributes::Invisible); - - // Set Third Stage sensible - logicThirdStage->SetSensitiveDetector(m_ThirdStageScorer); - } -} - -//....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 HydeTrackerTrapezoid::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_beta = 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, "HYDTrapezoid") == 0) { - G4cout << "///" << G4endl ; - G4cout << "Trapezoid 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); - cout << "X1 Y1 corner position : " << A << endl; - } - - 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); - cout << "X128 Y1 corner position : " << B << endl; - } - - 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); - cout << "X1 Y128 corner position : " << C << endl; - } - - 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); - cout << "X128 Y128 corner position : " << D << endl; - } - - - // Angle method - else if (DataBuffer.compare(0, 6, "THETA=") == 0) { - check_Theta = true; - ConfigFile >> DataBuffer ; - Theta = atof(DataBuffer.c_str()) ; - Theta = Theta * deg; - cout << "Theta: " << Theta / deg << endl; - } - - else if (DataBuffer.compare(0, 4, "PHI=") == 0) { - check_Phi = true; - ConfigFile >> DataBuffer ; - Phi = atof(DataBuffer.c_str()) ; - Phi = Phi * deg; - cout << "Phi: " << Phi / deg << endl; - } - - else if (DataBuffer.compare(0, 2, "R=") == 0) { - check_R = true; - ConfigFile >> DataBuffer ; - R = atof(DataBuffer.c_str()) ; - R = R * mm; - cout << "R: " << R / mm << endl; - } - - else if (DataBuffer.compare(0, 5, "BETA=") == 0) { - check_beta = true; - 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, HydeTrackerTrapezoid: Trapezoid 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_beta = 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 HydeTrackerTrapezoid::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) ;*/ - MMpos = G4ThreeVector(0, 0, 0) ; - MMu = G4ThreeVector(0, 0, 0) ; - MMv = G4ThreeVector(0, 0, 0) ; - 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 telescope referencial - // (u,v) // to silicon plan - // w perpendicular to (u,v) plan and pointing ThirdStage - G4cout << "############ Hyde Trapezoid " << i << " #############" << G4endl; - MMu = m_X128_Y1[i] - m_X1_Y128[i] ; - G4cout << "MMu: " << MMu << G4endl; - MMu = MMu.unit() ; - G4cout << "Norm MMu: " << MMu << G4endl; - - MMv = -0.5 * (m_X1_Y1[i] + m_X128_Y128[i] - m_X1_Y128[i] - m_X128_Y1[i]); - G4cout << "MMv: " << MMv << G4endl; - MMv = MMv.unit() ; - G4cout << "Norm MMv: " << MMv << G4endl; - - G4int MMscal = MMu.dot(MMv); - G4cout << "Norm MMu.MMv: " << MMscal << G4endl; - - MMw = MMu.cross(MMv) ; -// 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 ; - - // Passage Matrix from Lab Referential to Module Referential - MMrot = new G4RotationMatrix(MMu, MMv, MMw) ; - // translation to place Module - MMpos = MMw * Length * 0.5 + MMCenter ; - } - - // By Angle - else { - G4double Theta = m_Theta[i] ; - G4double Phi = m_Phi[i] ; - //This part because if Phi and Theta = 0 equation are false - if (Theta == 0) Theta = 0.0001 ; - if (Theta == 2*cos(0)) Theta = 2 * acos(0) - 0.00001 ; - if (Phi == 0) Phi = 0.0001 ; - - // (u,v,w) unitary vector associated to telescope referencial - // (u,v) // to silicon plan - // 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) ; -// G4ThreeVector CT = MMw ; - CT = MMw ; - MMw = MMw.unit() ; - - G4ThreeVector Y = G4ThreeVector(0 , 1 , 0) ; - - MMu = MMw.cross(Y) ; - MMv = MMw.cross(MMu) ; - - MMv = MMv.unit(); - 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 ; - } - - 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 HydeTrackingData class to the output TTree -// of the simulation -void HydeTrackerTrapezoid::InitializeRootOutput() -{ -} - - - -// Set the TinteractionCoordinates object from VDetector to the present class -void HydeTrackerTrapezoid::SetInterCoordPointer(TInteractionCoordinates* interCoord) -{ - ms_InterCoord = interCoord; -} - - - -// Read sensitive part and fill the Root tree. -// Called at in the EventAction::EndOfEventAvtion -void HydeTrackerTrapezoid::ReadSensitive(const G4Event* event) -{ -////////////////////////////////////////////////////////////////////////////////////// -//////////////////////// Used to Read Event Map of detector ////////////////////////// -////////////////////////////////////////////////////////////////////////////////////// - // First Stage - std::map<G4int, G4int*>::iterator DetectorNumber_itr; - std::map<G4int, G4double*>::iterator Energy_itr; - std::map<G4int, G4double*>::iterator Time_itr; - std::map<G4int, G4double*>::iterator X_itr; - std::map<G4int, G4double*>::iterator Y_itr; - std::map<G4int, G4double*>::iterator Pos_X_itr; - std::map<G4int, G4double*>::iterator Pos_Y_itr; - std::map<G4int, G4double*>::iterator Pos_Z_itr; - std::map<G4int, G4double*>::iterator Ang_Theta_itr; - std::map<G4int, G4double*>::iterator Ang_Phi_itr; - - G4THitsMap<G4int>* DetectorNumberHitMap; - G4THitsMap<G4double>* EnergyHitMap; - G4THitsMap<G4double>* TimeHitMap; - G4THitsMap<G4double>* XHitMap; - G4THitsMap<G4double>* YHitMap; - G4THitsMap<G4double>* PosXHitMap; - G4THitsMap<G4double>* PosYHitMap; - G4THitsMap<G4double>* PosZHitMap; - G4THitsMap<G4double>* AngThetaHitMap; - G4THitsMap<G4double>* AngPhiHitMap; - - // NULL pointer are given to avoid warning at compilation - - // Third Stage - std::map<G4int, G4double*>::iterator ThirdStageEnergy_itr; - G4THitsMap<G4double>* ThirdStageEnergyHitMap = NULL; - - - // Read the Scorer associated to the first Stage - //Detector Number - G4int StripDetCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDTrapezoid/DetectorNumber") ; - DetectorNumberHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripDetCollectionID)) ; - DetectorNumber_itr = DetectorNumberHitMap->GetMap()->begin() ; - - //Energy - G4int StripEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDTrapezoid/StripEnergy") ; - EnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripEnergyCollectionID)) ; - Energy_itr = EnergyHitMap->GetMap()->begin() ; - - //Time of Flight - G4int StripTimeCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDTrapezoid/StripTime") ; - TimeHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripTimeCollectionID)) ; - Time_itr = TimeHitMap->GetMap()->begin() ; - - //Strip Number X - G4int StripXCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDTrapezoid/StripNumberX") ; - XHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripXCollectionID)) ; - X_itr = XHitMap->GetMap()->begin() ; - - //Strip Number Y - G4int StripYCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDTrapezoid/StripNumberY") ; - YHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripYCollectionID)) ; - Y_itr = YHitMap->GetMap()->begin() ; - - //Interaction Coordinate X - G4int InterCoordXCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDTrapezoid/InterCoordX") ; - PosXHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordXCollectionID)) ; - Pos_X_itr = PosXHitMap->GetMap()->begin() ; - - //Interaction Coordinate Y - G4int InterCoordYCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDTrapezoid/InterCoordY") ; - PosYHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordYCollectionID)) ; - Pos_Y_itr = PosYHitMap->GetMap()->begin() ; - - //Interaction Coordinate Z - G4int InterCoordZCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDTrapezoid/InterCoordZ") ; - PosZHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordZCollectionID)) ; - Pos_Z_itr = PosXHitMap->GetMap()->begin() ; - - //Interaction Coordinate Angle Theta - G4int InterCoordAngThetaCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDTrapezoid/InterCoordAngTheta") ; - AngThetaHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordAngThetaCollectionID)) ; - Ang_Theta_itr = AngThetaHitMap->GetMap()->begin() ; - - //Interaction Coordinate Angle Phi - G4int InterCoordAngPhiCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHYDTrapezoid/InterCoordAngPhi") ; - AngPhiHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordAngPhiCollectionID)) ; - Ang_Phi_itr = AngPhiHitMap->GetMap()->begin() ; - - // Read the Scorer associated to the Third Stage - //Energy - G4int ThirdStageEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("ThirdStageScorerHYDTrapezoid/ThirdStageEnergy") ; - ThirdStageEnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(ThirdStageEnergyCollectionID)) ; - ThirdStageEnergy_itr = ThirdStageEnergyHitMap->GetMap()->begin() ; - - // Check the size of different map - G4int sizeN = DetectorNumberHitMap->entries(); - G4int sizeE = EnergyHitMap->entries(); - G4int sizeT = TimeHitMap->entries(); - G4int sizeX = XHitMap->entries(); - G4int sizeY = YHitMap->entries(); - - if (sizeE != sizeT || sizeT != sizeX || sizeX != sizeY) { - G4cout << "No match size Si Event Map: sE:" - << sizeE << " sT:" << sizeT << " sX:" << sizeX << " sY:" << sizeY << endl ; - return; - } - - // Loop on FirstStage number - for (G4int l = 0; l < sizeN; l++) { - G4double N = *(DetectorNumber_itr->second); - G4int NTrackID = DetectorNumber_itr->first - N; - - if (N > 0) { - // Fill detector number - ms_Event->SetHYDTrkFirstStageFrontEDetectorNbr(m_index["Trapezoid"] + N); - ms_Event->SetHYDTrkFirstStageFrontTDetectorNbr(m_index["Trapezoid"] + N); - ms_Event->SetHYDTrkFirstStageBackEDetectorNbr(m_index["Trapezoid"] + N); - ms_Event->SetHYDTrkFirstStageBackTDetectorNbr(m_index["Trapezoid"] + N); - - // Energy - for (G4int l = 0 ; l < sizeE ; l++) { - G4int ETrackID = Energy_itr->first - N; - G4double E = *(Energy_itr->second); - if (ETrackID == NTrackID) { - ms_Event->SetHYDTrkFirstStageFrontEEnergy(RandGauss::shoot(E, ResoFirstStage)); - ms_Event->SetHYDTrkFirstStageBackEEnergy(RandGauss::shoot(E, ResoFirstStage)); - } - Energy_itr++; - } - - // Time - Time_itr = TimeHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeT ; h++) { - G4int TTrackID = Time_itr->first - N; - G4double T = *(Time_itr->second); - - if (TTrackID == NTrackID) { - T = RandGauss::shoot(T, ResoTimePPAC) ; - ms_Event->SetHYDTrkFirstStageFrontTTime(RandGauss::shoot(T, ResoTimeGpd)) ; - ms_Event->SetHYDTrkFirstStageBackTTime(RandGauss::shoot(T, ResoTimeGpd)) ; - } - Time_itr++; - } - - // X - X_itr = XHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int XTrackID = X_itr->first - N; - G4double X = *(X_itr->second); - if (XTrackID == NTrackID) { - ms_Event->SetHYDTrkFirstStageFrontEStripNbr(X); - ms_Event->SetHYDTrkFirstStageFrontTStripNbr(X); - } - - X_itr++; - } - - // Y - Y_itr = YHitMap->GetMap()->begin() ; - for (G4int h = 0 ; h < sizeY ; h++) { - G4int YTrackID = Y_itr->first - N; - G4double Y = *(Y_itr->second); - if (YTrackID == NTrackID) { - ms_Event->SetHYDTrkFirstStageBackEStripNbr(Y); - ms_Event->SetHYDTrkFirstStageBackTStripNbr(Y); - } - - Y_itr++; - } - - // Pos X - Pos_X_itr = PosXHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int PosXTrackID = Pos_X_itr->first - N ; - G4double PosX = *(Pos_X_itr->second) ; - if (PosXTrackID == NTrackID) { - ms_InterCoord->SetDetectedPositionX(PosX) ; - } - Pos_X_itr++; - } - - // Pos Y - Pos_Y_itr = PosYHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int PosYTrackID = Pos_Y_itr->first - N ; - G4double PosY = *(Pos_Y_itr->second) ; - if (PosYTrackID == NTrackID) { - ms_InterCoord->SetDetectedPositionY(PosY) ; - } - Pos_Y_itr++; - } - - // Pos Z - Pos_Z_itr = PosZHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int PosZTrackID = Pos_Z_itr->first - N ; - G4double PosZ = *(Pos_Z_itr->second) ; - if (PosZTrackID == NTrackID) { - ms_InterCoord->SetDetectedPositionZ(PosZ) ; - } - Pos_Z_itr++; - } - - // Angle Theta - Ang_Theta_itr = AngThetaHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int AngThetaTrackID = Ang_Theta_itr->first - N ; - G4double AngTheta = *(Ang_Theta_itr->second) ; - if (AngThetaTrackID == NTrackID) { - ms_InterCoord->SetDetectedAngleTheta(AngTheta) ; - } - Ang_Theta_itr++; - } - - // Angle Phi - Ang_Phi_itr = AngPhiHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeX ; h++) { - G4int AngPhiTrackID = Ang_Phi_itr->first - N ; - G4double AngPhi = *(Ang_Phi_itr->second) ; - if (AngPhiTrackID == NTrackID) { - ms_InterCoord->SetDetectedAnglePhi(AngPhi) ; - } - Ang_Phi_itr++; - } - - // Second Stage - - // Third Stage - ThirdStageEnergy_itr = ThirdStageEnergyHitMap->GetMap()->begin() ; - for (G4int h = 0 ; h < ThirdStageEnergyHitMap->entries() ; h++) { - G4int ThirdStageEnergyTrackID = ThirdStageEnergy_itr->first - N; - G4double ThirdStageEnergy = *(ThirdStageEnergy_itr->second); - - if (ThirdStageEnergyTrackID == NTrackID) { - ms_Event->SetHYDTrkThirdStageEEnergy(RandGauss::shoot(ThirdStageEnergy, ResoThirdStage)); - ms_Event->SetHYDTrkThirdStageEPadNbr(1); - ms_Event->SetHYDTrkThirdStageTPadNbr(1); - ms_Event->SetHYDTrkThirdStageTTime(1); - ms_Event->SetHYDTrkThirdStageTDetectorNbr(m_index["Trapezoid"] + N); - ms_Event->SetHYDTrkThirdStageEDetectorNbr(m_index["Trapezoid"] + N); - } - - ThirdStageEnergy_itr++; - } - - DetectorNumber_itr++; - } - - // clear map for next event - DetectorNumberHitMap ->clear(); - EnergyHitMap ->clear(); - TimeHitMap ->clear(); - XHitMap ->clear(); - YHitMap ->clear(); - PosXHitMap ->clear(); - PosYHitMap ->clear(); - PosZHitMap ->clear(); - AngThetaHitMap ->clear(); - AngPhiHitMap ->clear(); - ThirdStageEnergyHitMap ->clear(); - } -} - - - -void HydeTrackerTrapezoid::InitializeScorers() -{ - // First stage Associate Scorer - m_FirstStageScorer = new G4MultiFunctionalDetector("FirstStageScorerHYDTrapezoid"); - G4VPrimitiveScorer* DetNbr = new GENERALSCORERS::PSDetectorNumber("DetectorNumber", "HYDTrapezoid", 0); - G4VPrimitiveScorer* TOF = new GENERALSCORERS::PSTOF("StripTime","HYDTrapezoid", 0); - G4VPrimitiveScorer* InteractionCoordinatesX = new GENERALSCORERS::PSInteractionCoordinatesX("InterCoordX","HYDTrapezoid", 0); - G4VPrimitiveScorer* InteractionCoordinatesY = new GENERALSCORERS::PSInteractionCoordinatesY("InterCoordY","HYDTrapezoid", 0); - G4VPrimitiveScorer* InteractionCoordinatesZ = new GENERALSCORERS::PSInteractionCoordinatesZ("InterCoordZ","HYDTrapezoid", 0); - G4VPrimitiveScorer* InteractionCoordinatesAngleTheta = new GENERALSCORERS::PSInteractionCoordinatesAngleTheta("InterCoordAngTheta","HYDTrapezoid", 0); - G4VPrimitiveScorer* InteractionCoordinatesAnglePhi = new GENERALSCORERS::PSInteractionCoordinatesAnglePhi("InterCoordAngPhi","HYDTrapezoid", 0); - G4VPrimitiveScorer* Energy = new HYDScorerFirstStageEnergy("StripEnergy", "HYDTrapezoid", 0); - G4VPrimitiveScorer* StripPositionX = new HYDScorerFirstStageFrontStripTrapezoid("StripNumberX", 0, NumberOfStripsX); - G4VPrimitiveScorer* StripPositionY = new HYDScorerFirstStageBackStripTrapezoid("StripNumberY", 0, NumberOfStripsY); - - //and register it to the multifunctionnal detector - m_FirstStageScorer->RegisterPrimitive(DetNbr); - m_FirstStageScorer->RegisterPrimitive(Energy); - m_FirstStageScorer->RegisterPrimitive(TOF); - m_FirstStageScorer->RegisterPrimitive(StripPositionX); - m_FirstStageScorer->RegisterPrimitive(StripPositionY); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesX); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesY); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesZ); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesAngleTheta); - m_FirstStageScorer->RegisterPrimitive(InteractionCoordinatesAnglePhi); - - // Second stage Associate Scorer - m_SecondStageScorer = new G4MultiFunctionalDetector("SecondStageScorerHYDTrapezoid"); - G4VPrimitiveScorer* SecondStageEnergy = new HYDScorerSecondStageEnergy("SecondStageEnergy", "HYDTrapezoid", 0); - m_SecondStageScorer->RegisterPrimitive(SecondStageEnergy); - - // Third stage Associate Scorer - m_ThirdStageScorer = new G4MultiFunctionalDetector("ThirdStageScorerHYDTrapezoid"); - G4VPrimitiveScorer* ThirdStageEnergy = new HYDScorerThirdStageEnergy("ThirdStageEnergy", "HYDTrapezoid", 0); - m_ThirdStageScorer->RegisterPrimitive(ThirdStageEnergy); - - // 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/src/MUST2Array.cc b/NPSimulation/src/MUST2Array.cc index 9e578584f..d611e88b4 100644 --- a/NPSimulation/src/MUST2Array.cc +++ b/NPSimulation/src/MUST2Array.cc @@ -579,7 +579,7 @@ void MUST2Array::ReadConfiguration(string Path) bool check_Theta = false ; bool check_Phi = false ; bool check_R = false ; - bool check_beta = false ; +// bool check_beta = false ; bool check_SI = false ; bool check_SILI = false ; @@ -728,7 +728,7 @@ void MUST2Array::ReadConfiguration(string Path) //Angle method else if (DataBuffer.compare(0, 5, "BETA=") == 0) { - check_beta = true; +// check_beta = true; ConfigFile >> DataBuffer ; beta_u = atof(DataBuffer.c_str()) ; beta_u = beta_u * deg ; @@ -836,7 +836,7 @@ void MUST2Array::ReadConfiguration(string Path) check_Theta = false ; check_Phi = false ; check_R = false ; - check_beta = false ; +// check_beta = false ; check_SI = false ; check_SILI = false ; diff --git a/NPSimulation/src/Must2Scorers.cc b/NPSimulation/src/Must2Scorers.cc index 06601b2cb..923b3c37e 100644 --- a/NPSimulation/src/Must2Scorers.cc +++ b/NPSimulation/src/Must2Scorers.cc @@ -183,10 +183,11 @@ G4bool PSPadOrCristalNumber::ProcessHits(G4Step* aStep, G4TouchableHistory*) std::string name = aStep->GetTrack()->GetVolume()->GetName(); std::string nbr ; - G4int temp1,temp2 ; +// G4int temp1; + G4int temp2 ; G4int VolumeNumber; nbr = name[name.length()-1] ; - temp1 = atoi( nbr.c_str() ) ; +// temp1 = atoi( nbr.c_str() ) ; nbr = name[name.length()-2] ; temp2 = atoi( nbr.c_str() ) ; -- GitLab