diff --git a/NPLib/Detectors/Helios/CMakeLists.txt b/NPLib/Detectors/Helios/CMakeLists.txt index 096c8f366f21ea82443994f437a715a2afe87e91..b97770f02e0804a9de5cd7accd547adebab75885 100644 --- a/NPLib/Detectors/Helios/CMakeLists.txt +++ b/NPLib/Detectors/Helios/CMakeLists.txt @@ -1,6 +1,6 @@ add_custom_command(OUTPUT THeliosPhysicsDict.cxx COMMAND ../../scripts/build_dict.sh THeliosPhysics.h THeliosPhysicsDict.cxx THeliosPhysics.rootmap libNPHelios.dylib DEPENDS THeliosPhysics.h) add_custom_command(OUTPUT THeliosDataDict.cxx COMMAND ../../scripts/build_dict.sh THeliosData.h THeliosDataDict.cxx THeliosData.rootmap libNPHelios.dylib DEPENDS THeliosData.h) -add_library(NPHelios SHARED Helios.cxx THeliosData.cxx THeliosPhysics.cxx THeliosDataDict.cxx THeliosPhysicsDict.cxx ) +add_library(NPHelios SHARED THeliosSpectra.cxx THeliosData.cxx THeliosPhysics.cxx THeliosDataDict.cxx THeliosPhysicsDict.cxx ) target_link_libraries(NPHelios ${ROOT_LIBRARIES} NPCore) -install(FILES THeliosData.h THeliosPhysics.h Helios.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) +install(FILES THeliosData.h THeliosPhysics.h THeliosSpectra.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) diff --git a/NPLib/Detectors/Helios/Helios.cxx b/NPLib/Detectors/Helios/Helios.cxx deleted file mode 100644 index b32c6a20a25c50f886a914df4635b0ce48aaf310..0000000000000000000000000000000000000000 --- a/NPLib/Detectors/Helios/Helios.cxx +++ /dev/null @@ -1,465 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2016 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: Marc Labiche contact address: marc.labiche@stfc.ac.uk * - * * - * Creation Date : 30/01/12 * - * Last update : 31/08/15 * - *---------------------------------------------------------------------------* - * Decription: This class is mainly an interface to the * - * THeliosPhysics class and it deals with the geometrical * - * correspondance between strip number and absolute coordinates * - * (X, Y, Z) of interaction. * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -#include "Helios.h" - -// C++ headers -#include <iostream> -#include <fstream> -#include <string> -#include <cmath> -#include <stdlib.h> - -// NPL headers -#include "RootInput.h" -#include "RootOutput.h" -#include "NPDetectorFactory.h" -#include "NPOptionManager.h" -// ROOT headers -#include "TChain.h" - -using namespace std ; - -// Default Constructor - -Helios::Helios() -{ - m_NumberOfModule = 0; - m_NominalField = 0; - m_TargThick = 0; - m_EventData = new THeliosData(); - m_EventPhysics = new THeliosPhysics(); -} - - - -Helios::~Helios() -{ - m_NumberOfModule = 0; - m_NominalField = 0; - m_TargThick = 0; - delete m_EventData; - delete m_EventPhysics; -} - - - -// Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token -void Helios::ReadConfiguration(NPL::InputParser parser){ - vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("HeliosDummyShape"); - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << "//// " << blocks.size() << " detectors found " << endl; - - // Cartesian Case - vector<string> cart = {"X1_Y1","X1_Y128","X128_Y1","X128_Y128"}; - // Spherical Case - vector<string> sphe= {"R","THETA","PHI","BETA"}; - - for(unsigned int i = 0 ; i < blocks.size() ; i++){ - if(blocks[i]->HasTokenList(cart)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Helios " << i+1 << endl; - - TVector3 A = blocks[i]->GetTVector3("X1_Y1","mm"); - TVector3 B = blocks[i]->GetTVector3("X128_Y1","mm"); - TVector3 C = blocks[i]->GetTVector3("X1_Y128","mm"); - TVector3 D = blocks[i]->GetTVector3("X128_Y128","mm"); - AddModuleDummyShape(A,B,C,D) ; - } - - else if(blocks[i]->HasTokenList(sphe)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Helios " << i+1 << endl; - - double Theta = blocks[i]->GetDouble("THETA","deg"); - double Phi= blocks[i]->GetDouble("PHI","deg"); - double R = blocks[i]->GetDouble("R","mm"); - vector<double> beta = blocks[i]->GetVectorDouble("BETA","deg"); - AddModuleDummyShape(Theta,Phi,R,beta[0],beta[1],beta[2]); - } - - else{ - cout << "ERROR: Missing token for M2Telescope blocks, check your input file" << endl; - exit(1); - } - } -} - - -// Read stream at Path and pick-up calibration parameter using Token -// If argument is "Simulation" no change calibration is loaded -void Helios::ReadCalibrationFile(string Path) -{ - Path.c_str(); - -} - - - -// 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 Helios::InitializeRootInputRaw() -{ - TChain* inputChain = RootInput::getInstance()->GetChain(); - inputChain->SetBranchStatus("HELIOS", true); - inputChain->SetBranchStatus("fHelios*", true); - inputChain->SetBranchAddress("HELIOS", &m_EventData); -} - - - -// Create associated branches and associated private member DetectorPhysics address -void Helios::InitializeRootOutput() -{ - TTree* outputTree = RootOutput::getInstance()->GetTree(); - outputTree->Branch("HELIOS", "THeliosPhysics", &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 Helios::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 Helios::BuildSimplePhysicalEvent() -{ - m_EventPhysics -> BuildSimplePhysicalEvent(m_EventData); -} - - - - - - -void Helios::AddModuleDummyShape(TVector3 C_X1_Y1, - TVector3 C_X128_Y1, - TVector3 C_X1_Y128, - TVector3 C_X128_Y128) -{ - m_NumberOfModule++; - - cout << m_NumberOfModule << endl; - - // 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 - //Commented by Adrien Matta (produce a warning) - // double Face = 50; // mm - //double NumberOfStrip = 128; - //double StripPitch = 0.98; //Face/NumberOfStrip; // mm - //double NumberOfLStrip = 22; // 1mm - //double StripLPitch = 1.; //Face/NumberOfStrip; // mm - - //double FaceL = 20.; - //double NumberOfLStrip = 10; // 2mm - double FaceL = 22.; - double NumberOfLStrip = 11; // 2mm - //double FaceL = 24.; - //double NumberOfLStrip = 12; // 2mm - - double StripLPitch = FaceL/NumberOfLStrip; // mm - //double NumberOfTStrip = 250; - //double StripTPitch = .5; //Face/NumberOfStrip; // mm - double FaceT = 125.; - double NumberOfTStrip = 128; - double StripTPitch = FaceT/NumberOfTStrip; //125./128.; //Face/NumberOfTStrip; // mm - //double NumberOfTStrip = 62; - //double StripTPitch = 2.016; //Face/NumberOfStrip; // mm - //double NumberOfTStrip =25; - //double StripTPitch = 5.; //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.); - Strip_1_1 = C_X1_Y1 + (U*(StripLPitch/2.)) + (V*(StripTPitch/2.)); // or: C_X1_Y1 + (U * (StripTPitch/2.) + (V* (StripLPitch/2.) !!! To be checked !!! - - cout << "Strip_1_1 x=" << Strip_1_1[0] << endl; - cout << "Strip_1_1 y=" << Strip_1_1[1] << endl; - cout << "Strip_1_1 z=" << Strip_1_1[2] << endl; - - /* - 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); - } - */ - for (int i = 0; i < NumberOfLStrip; i++) { - lineX.clear(); - lineY.clear(); - lineZ.clear(); - - for (int j = 0; j < NumberOfTStrip; j++) { - StripCenter = Strip_1_1 + StripLPitch*( i*U ) + StripTPitch*( j*V ); // or: Strip_1_1 + StripTPitch*( i*U ) + StripLPitch*( j*V ) !!! To be checked as above!!! - // StripCenter += -TargetPosition; - - /* - if(i<3 && j<5){ - cout << "i:" << i << " j:" << j << endl; - cout << "StripCenter x= "<< StripCenter[0] << endl; - cout << "StripCenter y= "<< StripCenter[1] << endl; - cout << "StripCenter z= "<< StripCenter[2] << endl; - } - */ - 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 Helios::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 = 1; // mm - double NumberOfStrip = 1; - //double NumberOfStrip = 500; - double StripPitch = 9.8; // 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 Helios::GetEnergyDeposit() -{ - //if (m_EventPhysics->TotalEnergy.size() > 0) - if (m_EventPhysics->GetEventMultiplicity() > 0) - return m_EventPhysics->fTotalEnergy[0]; - else - return -1000; -} - -double Helios::GetTimeDetected() -{ - if (m_EventPhysics->fTotalTime.size() > 0) - return m_EventPhysics->fTotalTime[0]; - else - return -1000; -} - - - -TVector3 Helios::GetPositionOfInteraction() -{ - /* !! not possible with helios as we don't measure Y -> use interaction coordinate Z instead !! - * - * TVector3 Position = TVector3(-1000,-1000,-1000); - - - if (m_EventPhysics->fModuleNumber.size() == 1) { - - cout << "Module=" << m_EventPhysics->fModuleNumber[0] << endl; - cout << "1ststage X" << m_EventPhysics->fFirstStage_X[0] << endl; - cout << "1ststage Y" << m_EventPhysics->fFirstStage_Y[0] << endl; - - - Position = TVector3(GetStripPositionX((m_EventPhysics->fModuleNumber[0])-1000, m_EventPhysics->fFirstStage_X[0], m_EventPhysics->fFirstStage_Y[0]), - GetStripPositionY((m_EventPhysics->fModuleNumber[0])-1000, m_EventPhysics->fFirstStage_X[0], m_EventPhysics->fFirstStage_Y[0]), - GetStripPositionZ((m_EventPhysics->fModuleNumber[0])-1000, m_EventPhysics->fFirstStage_X[0], m_EventPhysics->fFirstStage_Y[0])); - } - - return(Position); - */ -return (TVector3(0,0,0)); -} - - - -void Helios::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 ; - } - } - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// Construct Method to be pass to the DetectorFactory // -//////////////////////////////////////////////////////////////////////////////// -NPL::VDetector* Helios::Construct(){ - return (NPL::VDetector*) new Helios(); -} - -//////////////////////////////////////////////////////////////////////////////// -// Registering the construct method to the factory // -//////////////////////////////////////////////////////////////////////////////// -extern "C"{ -class proxy_helios{ - public: - proxy_helios(){ - NPL::DetectorFactory::getInstance()->AddToken("HeliosDummyShape","Helios"); - NPL::DetectorFactory::getInstance()->AddDetector("HeliosDummyShape",Helios::Construct); - } -}; - -proxy_helios p; -} diff --git a/NPLib/Detectors/Helios/Helios.h b/NPLib/Detectors/Helios/Helios.h deleted file mode 100644 index f26ed5f7931e5b87209b24a60f1b5a2cedcd146a..0000000000000000000000000000000000000000 --- a/NPLib/Detectors/Helios/Helios.h +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef HELIOS_H -#define HELIOS_H -/***************************************************************************** - * Copyright (C) 2009-2016 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: M. Labiche contact address: marc.labiche@stfc.ac.uk * - * * - * Creation Date : 30/01/12 * - * Last update : 15/08/15 * - *---------------------------------------------------------------------------* - * Decription: This class is mainly an interface to the * - * THeliosPhysics class and it deals with the geometrical * - * correspondance between strip number and absolute coordinates * - * (X, Y, Z) of interaction. * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -// NPL -#include "NPVDetector.h" -#include "THeliosData.h" -#include "THeliosPhysics.h" -#include "NPInputParser.h" -// Root -#include "TVector3.h" - -class Helios : public NPL::VDetector -{ -public: - Helios(); - virtual ~Helios(); - -public: - ///////////////////////////////////// - // Innherited from VDetector Class // - ///////////////////////////////////// - // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token - void ReadConfiguration(NPL::InputParser); - - // 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 Helios // - //////////////////////////////// - - // 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; } - - double GetTargetThickness() { return m_TargThick; } - double GetNominalMField() { return m_NominalField; } - - // Get Root input and output objects - THeliosData* GetEventData() {return m_EventData;} - THeliosPhysics* GetEventPhysics() {return m_EventPhysics;} - - // To be called after a build Physical Event - double GetEnergyDeposit(); - double GetTimeDetected(); - TVector3 GetPositionOfInteraction(); - - void Print(); - - - -private: - //////////////////////////////////////// - // Root Input and Output tree classes // - //////////////////////////////////////// - THeliosData* m_EventData; - THeliosPhysics* m_EventPhysics; - - -private: - // Spatial Position of Strip Calculated on basis of detector position - int m_NumberOfModule; - double m_NominalField; - double m_TargThick; - vector< vector < vector < double > > > m_StripPositionX; - vector< vector < vector < double > > > m_StripPositionY; - vector< vector < vector < double > > > m_StripPositionZ; - - - - public: // Static constructor to be passed to the Detector Factory - static NPL::VDetector* Construct(); - -}; - -#endif diff --git a/NPLib/Detectors/Helios/THeliosData.cxx b/NPLib/Detectors/Helios/THeliosData.cxx index b405926e1388e6ba7003cd6511cc901d0b2864ff..e6809c27c4fb7ce00367a5669265a4685dad25b4 100644 --- a/NPLib/Detectors/Helios/THeliosData.cxx +++ b/NPLib/Detectors/Helios/THeliosData.cxx @@ -6,90 +6,112 @@ *****************************************************************************/ /***************************************************************************** - * Original Author: Marc Labiche contact address: marc.labiche@stfc.ac.uk * + * Original Author: Adrien Matta contact address: matta@lpccaen.in2p3.fr * * * - * Creation Date : 30/01/12 * - * Last update : 31/08/15 * + * Creation Date : octobre 2016 * + * Last update : * *---------------------------------------------------------------------------* - * Decription: This class stores the results of the G4 simulation for the * - * tracker part of the Gaspard 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 * + * Decription: * + * This class hold Helios Raw data * + * * *---------------------------------------------------------------------------* * Comment: * - * * + * * * * *****************************************************************************/ - -#include <iostream> #include "THeliosData.h" -using namespace std; +#include <iostream> +#include <fstream> +#include <sstream> +#include <string> +using namespace std; ClassImp(THeliosData) -THeliosData::THeliosData() -{ - // Default constructor - Clear(); +////////////////////////////////////////////////////////////////////// +THeliosData::THeliosData() { } +////////////////////////////////////////////////////////////////////// +THeliosData::~THeliosData() { +} - -THeliosData::~THeliosData() -{ +////////////////////////////////////////////////////////////////////// +void THeliosData::Clear() { + fHelios_EBack_DetectorNbr.clear(); + fHelios_EBack_Energy.clear(); + fHelios_EUp_DetectorNbr.clear(); + fHelios_EUp_Energy.clear(); + fHelios_EDw_DetectorNbr.clear(); + fHelios_EDw_Energy.clear(); + + fHelios_TBack_DetectorNbr.clear(); + fHelios_TBack_Time.clear(); + fHelios_TUp_DetectorNbr.clear(); + fHelios_TUp_Time.clear(); + fHelios_TDw_DetectorNbr.clear(); + fHelios_TDw_Time.clear(); } -void THeliosData::Clear() -{ - // DSSD -/* For helisol - // (X,E) - fHelios_FirstStage_E_DetectorNbr.clear(); - //fHelios_FirstStage_E_StripNbr.clear() ; - fHelios_FirstStage_E_StripLNbr.clear() ; - fHelios_FirstStage_E_StripTNbr.clear() ; - fHelios_FirstStage_E_Energy.clear() ; - // (X,T) - fHelios_FirstStage_T_DetectorNbr.clear() ; - //fHelios_FirstStage_T_StripNbr.clear() ; - fHelios_FirstStage_T_StripLNbr.clear() ; - fHelios_FirstStage_T_StripTNbr.clear() ; - fHelios_FirstStage_T_Time.clear() ; -*/ - /* for helios */ - // (X,E) - fHelios_FirstStage_E_DetectorNbr.clear(); - fHelios_FirstStage_E_StripNbr.clear() ; - fHelios_FirstStage_E_Energy.clear() ; - // (X,T) - fHelios_FirstStage_T_DetectorNbr.clear() ; - fHelios_FirstStage_T_StripNbr.clear() ; - fHelios_FirstStage_T_Time.clear() ; - +////////////////////////////////////////////////////////////////////// +void THeliosData::Dump() const { + // This method is very useful for debuging and worth the dev. + cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event [THeliosData::Dump()] XXXXXXXXXXXXXXXXX" << endl; + + // E Back + size_t mysize = fHelios_EBack_DetectorNbr.size(); + cout << "Helios_EBack_Mult: " << mysize << endl; -} + for (size_t i = 0 ; i < mysize ; i++){ + cout << "DetNbr: " << fHelios_EBack_DetectorNbr[i] + << " Energy: " << fHelios_EBack_Energy[i]; + } + // E Up + mysize = fHelios_EUp_DetectorNbr.size(); + cout << "Helios_EUp_Mult: " << mysize << endl; + for (size_t i = 0 ; i < mysize ; i++){ + cout << "DetNbr: " << fHelios_EUp_DetectorNbr[i] + << " Energy: " << fHelios_EUp_Energy[i]; + } -void THeliosData::Dump() const -{ - cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event XXXXXXXXXXXXXXXXX" << endl; + // E Dw + mysize = fHelios_EDw_DetectorNbr.size(); + cout << "Helios_EDw_Mult: " << mysize << endl; + + for (size_t i = 0 ; i < mysize ; i++){ + cout << "DetNbr: " << fHelios_EDw_DetectorNbr[i] + << " Energy: " << fHelios_EDw_Energy[i]; + } + + // T Back + mysize = fHelios_TBack_DetectorNbr.size(); + cout << "Helios_TBack_Mult: " << mysize << endl; + + for (size_t i = 0 ; i < mysize ; i++){ + cout << "DetNbr: " << fHelios_TBack_DetectorNbr[i] + << " Time: " << fHelios_TBack_Time[i]; + } + + // T Up + mysize = fHelios_TUp_DetectorNbr.size(); + cout << "Helios_TUp_Mult: " << mysize << endl; + + for (size_t i = 0 ; i < mysize ; i++){ + cout << "DetNbr: " << fHelios_TUp_DetectorNbr[i] + << " Time: " << fHelios_TUp_Time[i]; + } + + // T Dw + mysize = fHelios_TDw_DetectorNbr.size(); + cout << "Helios_TDw_Mult: " << mysize << endl; + + for (size_t i = 0 ; i < mysize ; i++){ + cout << "DetNbr: " << fHelios_TDw_DetectorNbr[i] + << " Time: " << fHelios_TDw_Time[i]; + } - // DSSD - // (X,E) - cout << "Helios_FirstStage_FrontE_Mult = " << fHelios_FirstStage_E_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fHelios_FirstStage_E_DetectorNbr.size(); i++) - cout << "DetNbr: " << fHelios_FirstStage_E_DetectorNbr[i] << " Strip: " << fHelios_FirstStage_E_StripNbr[i] << " Energy: " << fHelios_FirstStage_E_Energy[i] << endl; - //cout << "DetNbr: " << fHelios_FirstStage_E_DetectorNbr[i] << " StripL: " << fHelios_FirstStage_E_StripLNbr[i] << " StripT: " << fHelios_FirstStage_E_StripTNbr[i]<< " Energy: " << fHelios_FirstStage_E_Energy[i] << endl; - // (X,T) - cout << "Helios_FirstStage_FrontT_Mult = " << fHelios_FirstStage_T_DetectorNbr.size() << endl; - for (UShort_t i = 0; i < fHelios_FirstStage_T_DetectorNbr.size(); i++) - cout << "DetNbr: " << fHelios_FirstStage_T_DetectorNbr[i] << " Strip: " << fHelios_FirstStage_T_StripNbr[i] << " Time: " << fHelios_FirstStage_T_Time[i] << endl; - // cout << "DetNbr: " << fHelios_FirstStage_T_DetectorNbr[i] << " StripL: " << fHelios_FirstStage_T_StripLNbr[i] << " StripT: " << fHelios_FirstStage_T_StripTNbr[i] << " Time: " << fHelios_FirstStage_T_Time[i] << endl; - } diff --git a/NPLib/Detectors/Helios/THeliosData.h b/NPLib/Detectors/Helios/THeliosData.h index 29b94484628415026f4c1d68542812165198f069..f634bd63c4e930dc1826a45b665591d352c2360a 100644 --- a/NPLib/Detectors/Helios/THeliosData.h +++ b/NPLib/Detectors/Helios/THeliosData.h @@ -1,5 +1,5 @@ -#ifndef __HELIOSDATA__ -#define __HELIOSDATA__ +#ifndef __HeliosDATA__ +#define __HeliosDATA__ /***************************************************************************** * Copyright (C) 2009-2016 this file is part of the NPTool Project * * * @@ -8,204 +8,194 @@ *****************************************************************************/ /***************************************************************************** - * Original Author: Marc Labiche contact address: marc.labiche@stfc.ac.uk * + * Original Author: Adrien Matta contact address: matta@lpccaen.in2p3.fr * * * - * Creation Date : 30/01/12 * - * Last update : 31/08/15 * + * Creation Date : octobre 2016 * + * Last update : * *---------------------------------------------------------------------------* - * Decription: This class stores the results of the G4 simulation for the * - * tracker part of the Gaspard 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 * + * Decription: * + * This class hold Helios Raw data * + * * *---------------------------------------------------------------------------* * Comment: * - * * + * * * * *****************************************************************************/ +// STL #include <vector> +using namespace std; + +// ROOT #include "TObject.h" -using namespace std ; - -class THeliosData : public TObject -{ -protected: - // First Stage -/* for helisol - // Energy - vector<UShort_t> fHelios_FirstStage_E_DetectorNbr; - //vector<UShort_t> fHelios_FirstStage_E_StripNbr; - vector<UShort_t> fHelios_FirstStage_E_StripLNbr; - vector<UShort_t> fHelios_FirstStage_E_StripTNbr; - vector<Double_t> fHelios_FirstStage_E_Energy; - // Time - vector<UShort_t> fHelios_FirstStage_T_DetectorNbr; - //vector<UShort_t> fHelios_FirstStage_T_StripNbr; - vector<UShort_t> fHelios_FirstStage_T_StripLNbr; - vector<UShort_t> fHelios_FirstStage_T_StripTNbr; - vector<Double_t> fHelios_FirstStage_T_Time; -*/ - - -/* for helios */ - // Energy - vector<UShort_t> fHelios_FirstStage_E_DetectorNbr; - vector<UShort_t> fHelios_FirstStage_E_StripNbr; - vector<Double_t> fHelios_FirstStage_E_Energy; - // Time - vector<UShort_t> fHelios_FirstStage_T_DetectorNbr; - vector<UShort_t> fHelios_FirstStage_T_StripNbr; - vector<Double_t> fHelios_FirstStage_T_Time; - - - -public: - THeliosData(); - virtual ~THeliosData(); - - void Clear(); - void Clear(const Option_t*) {}; - void Dump() const; - - ///////////////////// SETTERS //////////////////////// - // RSD - -/* for helisol - - // (E) - void SetHeliosFirstStageEDetectorNbr(UShort_t DetNbr) { - fHelios_FirstStage_E_DetectorNbr.push_back(DetNbr); - } - //void SetHeliosFirstStageEStripNbr(UShort_t StripNbr) { - // fHelios_FirstStage_E_StripNbr.push_back(StripNbr); - //} - void SetHeliosFirstStageEStripLNbr(Double_t PosInStrip) { - fHelios_FirstStage_E_StripLNbr.push_back(PosInStrip); - } - void SetHeliosFirstStageEStripTNbr(Double_t PosInStrip) { - fHelios_FirstStage_E_StripTNbr.push_back(PosInStrip); - } - void SetHeliosFirstStageEEnergy(Double_t Energy) { - fHelios_FirstStage_E_Energy.push_back(Energy); - } - // (T) - void SetHeliosFirstStageTDetectorNbr(UShort_t DetNbr) { - fHelios_FirstStage_T_DetectorNbr.push_back(DetNbr); - } - //void SetHeliosFirstStageTStripNbr(UShort_t StripNbr) { - // fHelios_FirstStage_T_StripNbr.push_back(StripNbr); - //} - void SetHeliosFirstStageTStripLNbr(Double_t PosInStrip) { - fHelios_FirstStage_T_StripLNbr.push_back(PosInStrip); - } - void SetHeliosFirstStageTStripTNbr(Double_t PosInStrip) { - fHelios_FirstStage_T_StripTNbr.push_back(PosInStrip); - } - void SetHeliosFirstStageTTime(Double_t Time) { - fHelios_FirstStage_T_Time.push_back(Time); - } -*/ - - /* for helios */ - void SetHeliosFirstStageEDetectorNbr(UShort_t DetNbr) { - fHelios_FirstStage_E_DetectorNbr.push_back(DetNbr); - } - void SetHeliosFirstStageEStripNbr(UShort_t StripNbr) { - fHelios_FirstStage_E_StripNbr.push_back(StripNbr); - } - void SetHeliosFirstStageEEnergy(Double_t Energy) { - fHelios_FirstStage_E_Energy.push_back(Energy); - } - // (T) - void SetHeliosFirstStageTDetectorNbr(UShort_t DetNbr) { - fHelios_FirstStage_T_DetectorNbr.push_back(DetNbr); - } - void SetHeliosFirstStageTStripNbr(UShort_t StripNbr) { - fHelios_FirstStage_T_StripNbr.push_back(StripNbr); - } - void SetHeliosFirstStageTTime(Double_t Time) { - fHelios_FirstStage_T_Time.push_back(Time); - } - - - ///////////////////// GETTERS //////////////////////// - // RSD - - /* for helisol - // (E) - int GetHeliosFirstStageEMult() { - return fHelios_FirstStage_E_DetectorNbr.size(); - } - UShort_t GetHeliosFirstStageEDetectorNbr(Int_t i) { - return fHelios_FirstStage_E_DetectorNbr.at(i); - } - //UShort_t GetHeliosFirstStageEStripNbr(Int_t i) { - // return fHelios_FirstStage_E_StripNbr.at(i); - //} - UShort_t GetHeliosFirstStageEStripLNbr(Int_t i) { - return fHelios_FirstStage_E_StripLNbr.at(i); - } - UShort_t GetHeliosFirstStageEStripTNbr(Int_t i) { - return fHelios_FirstStage_E_StripTNbr.at(i); - } - Double_t GetHeliosFirstStageEEnergy(Int_t i) { - return fHelios_FirstStage_E_Energy.at(i); - } - // (T) - UShort_t GetHeliosFirstStageTMult() { - return fHelios_FirstStage_T_DetectorNbr.size(); - } - UShort_t GetHeliosFirstStageTDetectorNbr(Int_t i) { - return fHelios_FirstStage_T_DetectorNbr.at(i); - } - //UShort_t GetHeliosFirstStageTStripNbr(Int_t i) { - // return fHelios_FirstStage_T_StripNbr.at(i); - //} - UShort_t GetHeliosFirstStageTStripLNbr(Int_t i) { - return fHelios_FirstStage_T_StripLNbr.at(i); - } - UShort_t GetHeliosFirstStageTStripTNbr(Int_t i) { - return fHelios_FirstStage_T_StripTNbr.at(i); - } - Double_t GetHeliosFirstStageTTime(Int_t i) { - return fHelios_FirstStage_T_Time.at(i); - } -*/ - - /* for helios */ - UShort_t GetHeliosFirstStageEMult() { - return fHelios_FirstStage_E_DetectorNbr.size(); - } - UShort_t GetHeliosFirstStageEDetectorNbr(Int_t i) { - return fHelios_FirstStage_E_DetectorNbr.at(i); - } - UShort_t GetHeliosFirstStageEStripNbr(Int_t i) { - return fHelios_FirstStage_E_StripNbr.at(i); - } - Double_t GetHeliosFirstStageEEnergy(Int_t i) { - return fHelios_FirstStage_E_Energy.at(i); - } - // (T) - UShort_t GetHeliosFirstStageTMult() { - return fHelios_FirstStage_T_DetectorNbr.size(); - } - UShort_t GetHeliosFirstStageTDetectorNbr(Int_t i) { - return fHelios_FirstStage_T_DetectorNbr.at(i); - } - UShort_t GetHeliosFirstStageTStripNbr(Int_t i) { - return fHelios_FirstStage_T_StripNbr.at(i); - } - Double_t GetHeliosFirstStageTTime(Int_t i) { - return fHelios_FirstStage_T_Time.at(i); - } - - - - ClassDef(THeliosData, 1) // HeliosData structure +class THeliosData : public TObject { + ////////////////////////////////////////////////////////////// + // data members are hold into vectors in order + // to allow multiplicity treatment + private: + // Energy + vector<UShort_t> fHelios_EBack_DetectorNbr; + vector<Double_t> fHelios_EBack_Energy; + vector<UShort_t> fHelios_EUp_DetectorNbr; + vector<Double_t> fHelios_EUp_Energy; + vector<UShort_t> fHelios_EDw_DetectorNbr; + vector<Double_t> fHelios_EDw_Energy; + + + // Time + vector<UShort_t> fHelios_TBack_DetectorNbr; + vector<Double_t> fHelios_TBack_Time; + vector<UShort_t> fHelios_TUp_DetectorNbr; + vector<Double_t> fHelios_TUp_Time; + vector<UShort_t> fHelios_TDw_DetectorNbr; + vector<Double_t> fHelios_TDw_Time; + + + + ////////////////////////////////////////////////////////////// + // Constructor and destructor + public: + THeliosData(); + virtual ~THeliosData(); + + + ////////////////////////////////////////////////////////////// + // Inherited from TObject and overriden to avoid warnings + public: + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; + + + ////////////////////////////////////////////////////////////// + // Getters and Setters + // Prefer inline declaration to avoid unnecessary called of + // frequently used methods + // add //! to avoid ROOT creating dictionnary for the methods + public: + ////////////////////// SETTERS //////////////////////// + // E Back + inline void SetEBack_DetectorNbr(const UShort_t& DetNbr) + {fHelios_EBack_DetectorNbr.push_back(DetNbr);} //! + inline void SetEBack_Energy(const Double_t& Energy) + {fHelios_EBack_Energy.push_back(Energy);}//! + // Prefer global setter so that all vectors have the same size + inline void SetEBack(const UShort_t& DetNbr,const Double_t& Energy) { + SetEBack_DetectorNbr(DetNbr); + SetEBack_Energy(Energy); + };//! + + // E Up + inline void SetEUp_DetectorNbr(const UShort_t& DetNbr) + {fHelios_EUp_DetectorNbr.push_back(DetNbr);} //! + inline void SetEUp_Energy(const Double_t& Energy) + {fHelios_EUp_Energy.push_back(Energy);}//! + // Prefer global setter so that all vectors have the same size + inline void SetEUp(const UShort_t& DetNbr,const Double_t& Energy) { + SetEUp_DetectorNbr(DetNbr); + SetEUp_Energy(Energy); + };//! + + // E Dw + inline void SetEDw_DetectorNbr(const UShort_t& DetNbr) + {fHelios_EDw_DetectorNbr.push_back(DetNbr);} //! + inline void SetEDw_Energy(const Double_t& Energy) + {fHelios_EDw_Energy.push_back(Energy);}//! + // Prefer global setter so that all vectors have the same size + inline void SetEDw(const UShort_t& DetNbr,const Double_t& Energy) { + SetEDw_DetectorNbr(DetNbr); + SetEDw_Energy(Energy); + };//! + + + // T Back + inline void SetTBack_DetectorNbr(const UShort_t& DetNbr) + {fHelios_TBack_DetectorNbr.push_back(DetNbr);} //! + inline void SetTBack_Time(const Double_t& Time) + {fHelios_TBack_Time.push_back(Time);}//! + // Prefer global setter so that all vectors have the same size + inline void SetTBack(const UShort_t& DetNbr,const Double_t& Time) { + SetTBack_DetectorNbr(DetNbr); + SetTBack_Time(Time); + };//! + + + // T Up + inline void SetTUp_DetectorNbr(const UShort_t& DetNbr) + {fHelios_TUp_DetectorNbr.push_back(DetNbr);} //! + inline void SetTUp_Time(const Double_t& Time) + {fHelios_TUp_Time.push_back(Time);}//! + // Prefer global setter so that all vectors have the same size + inline void SetTUp(const UShort_t& DetNbr,const Double_t& Time) { + SetTUp_DetectorNbr(DetNbr); + SetTUp_Time(Time); + };//! + + // T Dw + inline void SetTDw_DetectorNbr(const UShort_t& DetNbr) + {fHelios_TDw_DetectorNbr.push_back(DetNbr);} //! + inline void SetTDw_Time(const Double_t& Time) + {fHelios_TDw_Time.push_back(Time);}//! + // Prefer global setter so that all vectors have the same size + inline void SetTDw(const UShort_t& DetNbr,const Double_t& Time) { + SetTDw_DetectorNbr(DetNbr); + SetTDw_Time(Time); + };//! + + + ////////////////////// GETTERS //////////////////////// + // E Back + inline UShort_t GetMultEBack() const + {return fHelios_EBack_DetectorNbr.size();} + inline UShort_t GetEBack_DetectorNbr(const unsigned int &i) const + {return fHelios_EBack_DetectorNbr[i];}//! + inline Double_t GetEBack_Energy(const unsigned int &i) const + {return fHelios_EBack_Energy[i];}//! + + // E Up + inline UShort_t GetMultEUp() const + {return fHelios_EUp_DetectorNbr.size();} + inline UShort_t GetEUp_DetectorNbr(const unsigned int &i) const + {return fHelios_EUp_DetectorNbr[i];}//! + inline Double_t GetEUp_Energy(const unsigned int &i) const + {return fHelios_EUp_Energy[i];}//! + + // E Dw + inline UShort_t GetMultEDw() const + {return fHelios_EDw_DetectorNbr.size();} + inline UShort_t GetEDw_DetectorNbr(const unsigned int &i) const + {return fHelios_EDw_DetectorNbr[i];}//! + inline Double_t GetEDw_Energy(const unsigned int &i) const + {return fHelios_EDw_Energy[i];}//! + + // T Back + inline UShort_t GetMultTBack() const + {return fHelios_TBack_DetectorNbr.size();} + inline UShort_t GetTBack_DetectorNbr(const unsigned int &i) const + {return fHelios_TBack_DetectorNbr[i];}//! + inline Double_t GetTBack_Time(const unsigned int &i) const + {return fHelios_TBack_Time[i];}//! + + // T Up + inline UShort_t GetMultTUp() const + {return fHelios_TUp_DetectorNbr.size();} + inline UShort_t GetTUp_DetectorNbr(const unsigned int &i) const + {return fHelios_TUp_DetectorNbr[i];}//! + inline Double_t GetTUp_Time(const unsigned int &i) const + {return fHelios_TUp_Time[i];}//! + + // T Dw + inline UShort_t GetMultTDw() const + {return fHelios_TDw_DetectorNbr.size();} + inline UShort_t GetTDw_DetectorNbr(const unsigned int &i) const + {return fHelios_TDw_DetectorNbr[i];}//! + inline Double_t GetTDw_Time(const unsigned int &i) const + {return fHelios_TDw_Time[i];}//! + + ////////////////////////////////////////////////////////////// + // Required for ROOT dictionnary + ClassDef(THeliosData,1) // HeliosData structure }; #endif diff --git a/NPLib/Detectors/Helios/THeliosPhysics.cxx b/NPLib/Detectors/Helios/THeliosPhysics.cxx index cf75c9c75dbaeee3e0e8b8eb87754d875635fec1..52a980e91e587a037d9f488e70972fa4ba6c9102 100644 --- a/NPLib/Detectors/Helios/THeliosPhysics.cxx +++ b/NPLib/Detectors/Helios/THeliosPhysics.cxx @@ -6,179 +6,429 @@ *****************************************************************************/ /***************************************************************************** - * Original Author: Marc Labiche contact address: marc.labiche@stfc.ac.uk * + * Original Author: Adrien Matta contact address: matta@lpccaen.in2p3.fr * * * - * Creation Date : 30/01/12 * - * Last update : 31/08/15 * + * Creation Date : octobre 2016 * + * Last update : * *---------------------------------------------------------------------------* - * Decription: This class stores the physical results after NPAnalysis is run* - * for the tracker part of the Gaspard detector. * - * This class derives from TObject (ROOT) and its aim is to be * - * stored in the output TTree of NPAnalysis. * + * Decription: * + * This class hold Helios Treated data * + * * *---------------------------------------------------------------------------* * Comment: * - * * + * * * * *****************************************************************************/ #include "THeliosPhysics.h" -//#include "NPDetectorFactory.h" + +// STL +#include <sstream> #include <iostream> -#include <cstdlib> +#include <cmath> +#include <stdlib.h> +#include <limits> +using namespace std; +// NPL +#include "RootInput.h" +#include "RootOutput.h" +#include "NPDetectorFactory.h" +#include "NPPhysicalConstants.h" +#include "NPOptionManager.h" +// ROOT +#include "TChain.h" ClassImp(THeliosPhysics) -THeliosPhysics::THeliosPhysics() -{ - //fEventMultiplicity = 0; +/////////////////////////////////////////////////////////////////////////// +THeliosPhysics::THeliosPhysics() + : m_EventData(new THeliosData), + m_PreTreatedData(new THeliosData), + m_EventPhysics(this), + m_Spectra(0), + m_E_RAW_Threshold(0), // adc channels + m_E_Threshold(0), // MeV + m_NumberOfDetectors(0) { } -THeliosPhysics::~THeliosPhysics() -{ - Clear(); +/////////////////////////////////////////////////////////////////////////// +void THeliosPhysics::BuildSimplePhysicalEvent() { + BuildPhysicalEvent(); } -void THeliosPhysics::BuildSimplePhysicalEvent(THeliosData* Data) -{ - BuildPhysicalEvent(Data); +/////////////////////////////////////////////////////////////////////////// +void THeliosPhysics::BuildPhysicalEvent() { + // apply thresholds and calibration + PreTreat(); + + // Look for Eup and EDw on the same detector + unsigned int mysizeEBack = m_PreTreatedData->GetMultEBack(); + unsigned int mysizeEUp = m_PreTreatedData->GetMultEUp(); + unsigned int mysizeEDw = m_PreTreatedData->GetMultEDw(); + unsigned int mysizeTUp = m_PreTreatedData->GetMultTUp(); + unsigned int DetNbr = 0; + for(unsigned int u = 0 ; u < mysizeEUp ; u++){ + DetNbr = m_PreTreatedData->GetEUp_DetectorNbr(u); + for(unsigned int d = 0 ; d < mysizeEDw ; d++){ + if( DetNbr == m_PreTreatedData->GetEDw_DetectorNbr(d)){ + + DetectorNumber.push_back(DetNbr); + // Total Energy deposit is taken from the back + double E = -1000; + for(unsigned int b = 0 ; b < mysizeEBack ; b++){ + if(DetNbr == m_PreTreatedData->GetEBack_DetectorNbr(b)) + E = m_PreTreatedData->GetEBack_Energy(b); + } + Energy.push_back(E); + + // Position along the detector lenght between -1 and 1 + double P = m_PreTreatedData->GetEUp_Energy(d)-m_PreTreatedData->GetEDw_Energy(u); + P = P / E; + Position.push_back(P); + // Compute Z based on the Position and detector position + double Detector_length = 56; + Z.push_back(P*0.5 * Detector_length + m_Z[m_PreTreatedData->GetEUp_DetectorNbr(u)-1]); + + // Look for associated time + double T = -1000; + for(unsigned int t = 0 ; t < mysizeTUp ; t++){ + if(DetNbr == m_PreTreatedData->GetTUp_DetectorNbr(t)){ + T = m_PreTreatedData->GetTUp_Time(t); + } + Time.push_back(T); + }// for T Up + } + }// for E Dw + }// for E Up } +/////////////////////////////////////////////////////////////////////////// +void THeliosPhysics::PreTreat() { + // This method typically applies thresholds and calibrations + // Might test for disabled channels for more complex detector + // clear pre-treated object + ClearPreTreatedData(); -void THeliosPhysics::BuildPhysicalEvent(THeliosData* 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}; + // instantiate CalibrationManager + static CalibrationManager* Cal = CalibrationManager::getInstance(); - // Check - bool Check_FirstStage = false; if (Check_FirstStage) {}; + // EBack + unsigned int mysize = m_EventData->GetMultEBack(); + for (UShort_t i = 0; i < mysize; ++i) { + if (m_EventData->GetEBack_Energy(i) > m_E_RAW_Threshold) { + Double_t Energy = Cal->ApplyCalibration("Helios/EBACK" + +NPL::itoa(m_EventData->GetEBack_DetectorNbr(i)),m_EventData->GetEBack_Energy(i)); + if (Energy > m_E_Threshold) { + m_PreTreatedData->SetEBack(m_EventData->GetEBack_DetectorNbr(i), Energy); + } + } + } + // EUp + mysize = m_EventData->GetMultEUp(); + for (UShort_t i = 0; i < mysize; ++i) { + if (m_EventData->GetEUp_Energy(i) > m_E_RAW_Threshold) { + Double_t Energy = Cal->ApplyCalibration("Helios/EUP" + +NPL::itoa(m_EventData->GetEUp_DetectorNbr(i)),m_EventData->GetEUp_Energy(i)); + if (Energy > m_E_Threshold) { + m_PreTreatedData->SetEUp(m_EventData->GetEUp_DetectorNbr(i), Energy); + } + } + } + + // EDw + mysize = m_EventData->GetMultEDw(); + for (UShort_t i = 0; i < mysize ; ++i) { + if (m_EventData->GetEDw_Energy(i) > m_E_RAW_Threshold) { + Double_t Energy = Cal->ApplyCalibration("Helios/EDW" + +NPL::itoa(m_EventData->GetEDw_DetectorNbr(i)),m_EventData->GetEDw_Energy(i)); + if (Energy > m_E_Threshold) { + m_PreTreatedData->SetEDw(m_EventData->GetEDw_DetectorNbr(i), Energy); + } + } + } - // 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->GetHeliosFirstStageEMult(); - int multXT = Data->GetHeliosFirstStageTMult(); + // TBack + mysize = m_EventData->GetMultTBack(); + for (UShort_t i = 0; i < mysize; ++i) { + Double_t Time= Cal->ApplyCalibration("Helios/TBACK"+NPL::itoa(m_EventData->GetTBack_DetectorNbr(i)),m_EventData->GetTBack_Time(i)); + m_PreTreatedData->SetTBack(m_EventData->GetTBack_DetectorNbr(i), Time); + } + // TUp + mysize = m_EventData->GetMultTUp(); + for (UShort_t i = 0; i < mysize; ++i) { + Double_t Time= Cal->ApplyCalibration("Helios/TUP"+NPL::itoa(m_EventData->GetTUp_DetectorNbr(i)),m_EventData->GetTUp_Time(i)); + m_PreTreatedData->SetTUp(m_EventData->GetTUp_DetectorNbr(i), Time); + } + // TDw + mysize = m_EventData->GetMultTDw(); + for (UShort_t i = 0; i < mysize; ++i) { + Double_t Time= Cal->ApplyCalibration("Helios/TDW"+NPL::itoa(m_EventData->GetTDw_DetectorNbr(i)),m_EventData->GetTDw_Time(i)); + m_PreTreatedData->SetTDw(m_EventData->GetTDw_DetectorNbr(i), Time); + } + +} - //cout << "############"<< endl; - //cout << "multXE=" << Data->GetHeliosFirstStageEMult() << " multXT=" <<multXT << endl; +/////////////////////////////////////////////////////////////////////////// +double THeliosPhysics::ThetaLab(unsigned int i, double m, double B, double q){ + // If default value of B, use the private membes Field variable + // This allow the user to vary B in its analysis to adjust field to data + if(B == -1000){ + B = m_B; + } + + else + B *=NPUNITS::tesla; + + // If q is not provided, use the measured time + double T = 0 ; + if(q == -1000){ + T = Time[i]; + } - // Deal with multiplicity 1 for the first layer - if (multXE==1 && multXT==1) { - // calculate detector number - int det_ref = Data->GetHeliosFirstStageEDetectorNbr(0); - int detecXE = Data->GetHeliosFirstStageEDetectorNbr(0) / det_ref; - int detecXT = Data->GetHeliosFirstStageTDetectorNbr(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; - } + // else use the calculated time + else{ + T = (NPUNITS::twopi*m*NPUNITS::MeV/(NPUNITS::c_squared)) / (q*B); + } + + double v_par = Z[i]/T; + double v = sqrt(2*(Energy[i]*NPUNITS::MeV) + /(m*NPUNITS::MeV/(NPUNITS::c_squared))); + double result = acos(v_par/v); + + // in case ThetaLab is not a number (nan) + // return -1000; + if(result!=result){ + result= -1000; + } + return result; +} + +/////////////////////////////////////////////////////////////////////////// +void THeliosPhysics::ReadAnalysisConfig() { + bool ReadingStatus = false; + + // path to file + string FileName = "./configs/ConfigHelios.dat"; + + // open analysis config file + ifstream AnalysisConfigFile; + AnalysisConfigFile.open(FileName.c_str()); + + if (!AnalysisConfigFile.is_open()) { + cout << " No ConfigHelios.dat found: Default parameter loaded for Analayis " << FileName << endl; + return; + } + cout << " Loading user parameter for Analysis from ConfigHelios.dat " << endl; + + // Save it in a TAsciiFile + TAsciiFile* asciiConfig = RootOutput::getInstance()->GetAsciiFileAnalysisConfig(); + asciiConfig->AppendLine("%%% ConfigHelios.dat %%%"); + asciiConfig->Append(FileName.c_str()); + asciiConfig->AppendLine(""); + // read analysis config file + string LineBuffer,DataBuffer,whatToDo; + while (!AnalysisConfigFile.eof()) { + // Pick-up next line + getline(AnalysisConfigFile, LineBuffer); + + // search for "header" + string name = "ConfigHelios"; + if (LineBuffer.compare(0, name.length(), name) == 0) + ReadingStatus = true; + + // loop on tokens and data + while (ReadingStatus ) { + whatToDo=""; + AnalysisConfigFile >> whatToDo; + + // Search for comment symbol (%) + if (whatToDo.compare(0, 1, "%") == 0) { + AnalysisConfigFile.ignore(numeric_limits<streamsize>::max(), '\n' ); } - det_ref -= index[good_index]; -*/ - - // case of same detector - if (detecXE*detecXT == 1) { - // store module number - fModuleNumber.push_back(det_ref); - // calculate strip number -/* for helios */ - int stripXE = Data->GetHeliosFirstStageEStripNbr(0); - int stripXT = Data->GetHeliosFirstStageTStripNbr(0); -/* for helisol - int stripXE = Data->GetHeliosFirstStageEStripLNbr(0); // X <=> longitudinal (ie: // to z) - int stripXT = Data->GetHeliosFirstStageTStripLNbr(0); // X <=> longitudinal (ie: // to z) - int stripYE = Data->GetHeliosFirstStageEStripTNbr(0); // Y <=> transversal (ie: _|_ to z) - int stripYT = Data->GetHeliosFirstStageTStripTNbr(0); // Y <=> transversal (ie: _|_ to z) -*/ - // case of same strips on X and Y - if (stripXE == stripXT ) { // here we have a good strip event for helios - //if (stripXE == stripXT && stripYE == stripYT) { // here we have a good strip event for helisol - // various - Check_FirstStage = true; - EventMultiplicity = 1; - // store strip ID - fFirstStage_X.push_back(stripXE); - //fFirstStage_Y.push_back(stripYE); // for helisol added for back side of DSSSD - // get energy from strips and store it - double EnergyStrip = Data->GetHeliosFirstStageEEnergy(0); - fFirstStage_Energy.push_back(EnergyStrip); - double EnergyTot = EnergyStrip; - //cout << "XXXXXXXXXXXXXXXXXXXXXXX" << endl; - // cout << "EnergyTot=" << EnergyTot << endl; - - - // get time from strips and store it - double TimeStrip = Data->GetHeliosFirstStageTTime(0); - fFirstStage_Time.push_back(TimeStrip); - double TimeTot = TimeStrip; - // cout << "TimeTot=" << TimeTot << endl; - - // Fill total energy - fTotalEnergy.push_back(EnergyTot); - // Fill time detection - fTotalTime.push_back(TimeTot); - } - else { - cout << "Not same strips" << endl; - } + + else if (whatToDo=="E_RAW_THRESHOLD") { + AnalysisConfigFile >> DataBuffer; + m_E_RAW_Threshold = atof(DataBuffer.c_str()); + cout << whatToDo << " " << m_E_RAW_Threshold << endl; + } + + else if (whatToDo=="E_THRESHOLD") { + AnalysisConfigFile >> DataBuffer; + m_E_Threshold = atof(DataBuffer.c_str()); + cout << whatToDo << " " << m_E_Threshold << endl; } + else { - cout << "Not same detector" << endl; + ReadingStatus = false; } - } - 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 THeliosPhysics::Clear() { + DetectorNumber.clear(); + Energy.clear(); + Time.clear(); + Z.clear(); + Position.clear(); +} + + + +/////////////////////////////////////////////////////////////////////////// +void THeliosPhysics::ReadConfiguration(NPL::InputParser parser){ + vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("Helios"); + if(NPOptionManager::getInstance()->GetVerboseLevel()) + cout << "//// " << blocks.size() << " detectors found " << endl; + + vector<string> token = {"Z","Face"}; + + for(unsigned int i = 0 ; i < blocks.size() ; i++){ + if(blocks[i]->HasToken("MagneticField")) + m_B=blocks[i]->GetDouble("MagneticField","T"); + + if(blocks[i]->HasTokenList(token)){ + if(NPOptionManager::getInstance()->GetVerboseLevel()) + cout << endl << "//// Helios " << i+1 << endl; + double Z = blocks[i]->GetDouble("Z","mm"); + string Face = blocks[i]->GetString("Face"); + + m_Z.push_back(Z); + m_Face.push_back(Face); + } + + else{ + cout << "ERROR: check your input file formatting " << endl; + exit(1); + } + } + + ReadAnalysisConfig(); } -void THeliosPhysics::Clear() -{ - //fEventMultiplicity= 0; - fModuleNumber.clear(); - fEventType.clear(); - fTotalEnergy.clear(); - fTotalTime.clear(); +/////////////////////////////////////////////////////////////////////////// +void THeliosPhysics::InitSpectra() { + m_Spectra = new THeliosSpectra(m_NumberOfDetectors); +} + + + +/////////////////////////////////////////////////////////////////////////// +void THeliosPhysics::FillSpectra() { + m_Spectra -> FillRawSpectra(m_EventData); + m_Spectra -> FillPreTreatedSpectra(m_PreTreatedData); + m_Spectra -> FillPhysicsSpectra(m_EventPhysics); +} + + + +/////////////////////////////////////////////////////////////////////////// +void THeliosPhysics::CheckSpectra() { + m_Spectra->CheckSpectra(); +} + + + +/////////////////////////////////////////////////////////////////////////// +void THeliosPhysics::ClearSpectra() { + // To be done +} + + + +/////////////////////////////////////////////////////////////////////////// +map< string , TH1*> THeliosPhysics::GetSpectra() { + if(m_Spectra) + return m_Spectra->GetMapHisto(); + else{ + map< string , TH1*> empty; + return empty; + } +} + +/////////////////////////////////////////////////////////////////////////// +void THeliosPhysics::WriteSpectra() { + m_Spectra->WriteSpectra(); +} + + - // Si X - fFirstStage_Energy.clear(); - fFirstStage_Time.clear(); - fFirstStage_X.clear(); - fFirstStage_Y.clear(); +/////////////////////////////////////////////////////////////////////////// +void THeliosPhysics::AddParameterToCalibrationManager() { + CalibrationManager* Cal = CalibrationManager::getInstance(); + for (int i = 0; i < m_NumberOfDetectors; ++i) { + Cal->AddParameter("Helios", "D"+ NPL::itoa(i+1)+"_EBACK","Helios_D"+ NPL::itoa(i+1)+"_EBACK"); + Cal->AddParameter("Helios", "D"+ NPL::itoa(i+1)+"_TBACK","Helios_D"+ NPL::itoa(i+1)+"_TBACK"); + Cal->AddParameter("Helios", "D"+ NPL::itoa(i+1)+"_EUP","Helios_D"+ NPL::itoa(i+1)+"_EUP"); + Cal->AddParameter("Helios", "D"+ NPL::itoa(i+1)+"_TUP","Helios_D"+ NPL::itoa(i+1)+"_TUP"); + Cal->AddParameter("Helios", "D"+ NPL::itoa(i+1)+"_EDW","Helios_D"+ NPL::itoa(i+1)+"_EDW"); + Cal->AddParameter("Helios", "D"+ NPL::itoa(i+1)+"_TDW","Helios_D"+ NPL::itoa(i+1)+"_TDW"); + } } + +/////////////////////////////////////////////////////////////////////////// +void THeliosPhysics::InitializeRootInputRaw() { + TChain* inputChain = RootInput::getInstance()->GetChain(); + inputChain->SetBranchStatus("Helios", true ); + inputChain->SetBranchAddress("Helios", &m_EventData ); +} + + + +/////////////////////////////////////////////////////////////////////////// +void THeliosPhysics::InitializeRootInputPhysics() { + TChain* inputChain = RootInput::getInstance()->GetChain(); + inputChain->SetBranchAddress("Helios", &m_EventPhysics); +} + + + +/////////////////////////////////////////////////////////////////////////// +void THeliosPhysics::InitializeRootOutput() { + TTree* outputTree = RootOutput::getInstance()->GetTree(); + outputTree->Branch("Helios", "THeliosPhysics", &m_EventPhysics); +} + + + +//////////////////////////////////////////////////////////////////////////////// +// Construct Method to be pass to the DetectorFactory // +//////////////////////////////////////////////////////////////////////////////// +NPL::VDetector* THeliosPhysics::Construct() { + return (NPL::VDetector*) new THeliosPhysics(); +} + + + +//////////////////////////////////////////////////////////////////////////////// +// Registering the construct method to the factory // +//////////////////////////////////////////////////////////////////////////////// +extern "C"{ +class proxy_Helios{ + public: + proxy_Helios(){ + NPL::DetectorFactory::getInstance()->AddToken("Helios","Helios"); + NPL::DetectorFactory::getInstance()->AddDetector("Helios",THeliosPhysics::Construct); + } +}; + +proxy_Helios p_Helios; +} + diff --git a/NPLib/Detectors/Helios/THeliosPhysics.h b/NPLib/Detectors/Helios/THeliosPhysics.h index ba5b8c860b53eab3ba52ccbe4ca9f86ff5cc077f..8f27f39a0031a537ae51e56a6d480caf37cd29e7 100644 --- a/NPLib/Detectors/Helios/THeliosPhysics.h +++ b/NPLib/Detectors/Helios/THeliosPhysics.h @@ -1,5 +1,5 @@ -#ifndef THELIOSPHYSICS_H -#define THELIOSPHYSICS_H +#ifndef THeliosPHYSICS_H +#define THeliosPHYSICS_H /***************************************************************************** * Copyright (C) 2009-2016 this file is part of the NPTool Project * * * @@ -8,108 +8,178 @@ *****************************************************************************/ /***************************************************************************** - * Original Author: Marc Labiche contact address: marc.labiche@stfc.ac.uk * + * Original Author: Adrien Matta contact address: matta@lpccaen.in2p3.fr * * * - * Creation Date : 30/01/12 * - * Last update : 31/08/15 * + * Creation Date : octobre 2016 * + * Last update : * *---------------------------------------------------------------------------* - * Decription: This class stores the physical results after NPAnalysis is run* - * for the tracker part of the Gaspard detector. * - * This class derives from TObject (ROOT) and its aim is to be * - * stored in the output TTree of NPAnalysis. * + * Decription: * + * This class hold Helios Treated data * + * * *---------------------------------------------------------------------------* * Comment: * - * * + * * * * *****************************************************************************/ +// C++ headers +#include <vector> +#include <map> +#include <string> +using namespace std; + +// ROOT headers +#include "TObject.h" +#include "TH1.h" +#include "TCanvas.h" + +// NPTool headers #include "THeliosData.h" +#include "THeliosSpectra.h" +#include "NPCalibrationManager.h" #include "NPVDetector.h" +#include "NPInputParser.h" +// forward declaration +class THeliosSpectra; -// c++ -#include <cstdlib> -#include <vector> -//ROOT -#include "TObject.h" +class THeliosPhysics : public TObject, public NPL::VDetector { + ////////////////////////////////////////////////////////////// + // constructor and destructor + public: + THeliosPhysics(); + ~THeliosPhysics() {}; + + + ////////////////////////////////////////////////////////////// + // Inherited from TObject and overriden to avoid warnings + public: + void Clear(); + void Clear(const Option_t*) {}; + + + ////////////////////////////////////////////////////////////// + // data obtained after BuildPhysicalEvent() and stored in + // output ROOT file + public: + vector<int> DetectorNumber; + vector<double> Energy; + vector<double> Position; + vector<double> Time; + vector<double> Z; + + private: + vector<string> m_Face;//! + vector<double> m_Z;//! + double m_B;//! + + + ////////////////////////////////////////////////////////////// + // methods inherited from the VDetector ABC class + public: + // read stream from ConfigFile to pick-up detector parameters + void ReadConfiguration(NPL::InputParser); + + // add parameters to the CalibrationManger + void AddParameterToCalibrationManager(); + + // method called event by event, aiming at extracting the + // physical information from detector + void BuildPhysicalEvent(); + + // same as BuildPhysicalEvent() method but with a simpler + // treatment + void BuildSimplePhysicalEvent(); + + // same as above but for online analysis + void BuildOnlinePhysicalEvent() {BuildPhysicalEvent();}; + + // activate raw data object and branches from input TChain + // in this method mother branches (Detector) AND daughter leaves + // (fDetector_parameter) have to be activated + void InitializeRootInputRaw(); + + // activate physics data object and branches from input TChain + // in this method mother branches (Detector) AND daughter leaves + // (fDetector_parameter) have to be activated + void InitializeRootInputPhysics(); + + // create branches of output ROOT file + void InitializeRootOutput(); + + // clear the raw and physical data objects event by event + void ClearEventPhysics() {Clear();} + void ClearEventData() {m_EventData->Clear();} + + // methods related to the THeliosSpectra class + // instantiate the THeliosSpectra class and + // declare list of histograms + void InitSpectra(); + + // fill the spectra + void FillSpectra(); + + // used for Online mainly, sanity check for histograms and + // change their color if issues are found, for example + void CheckSpectra(); + + // used for Online only, clear all the spectra + void ClearSpectra(); + + // write spectra to ROOT output file + void WriteSpectra(); + + + ////////////////////////////////////////////////////////////// + // specific methods to Helios array + public: + // remove bad channels, calibrate the data and apply thresholds + void PreTreat(); + + // clear the pre-treated object + void ClearPreTreatedData() {m_PreTreatedData->Clear();} + + // read the user configuration file. If no file is found, load standard one + void ReadAnalysisConfig(); + + // give and external THeliosData object to THeliosPhysics. + // needed for online analysis for example + void SetRawDataPointer(THeliosData* rawDataPointer) {m_EventData = rawDataPointer;} + + // Return Theta Lab (in rad) based on E and B and z: + double ThetaLab(unsigned int i, double m, double B=-1000,double q=-1000); + + // objects are not written in the TTree + private: + THeliosData* m_EventData; //! + THeliosData* m_PreTreatedData; //! + THeliosPhysics* m_EventPhysics; //! + + // getters for raw and pre-treated data object + public: + THeliosData* GetRawData() const {return m_EventData;}//! + THeliosData* GetPreTreatedData() const {return m_PreTreatedData;}//! + + // parameters used in the analysis + private: + // thresholds + double m_E_RAW_Threshold; //! + double m_E_Threshold; //! + + // number of detectors + private: + int m_NumberOfDetectors; //! + + // spectra class + private: + THeliosSpectra* m_Spectra; // ! + + // spectra getter + public: + map<string, TH1*> GetSpectra(); + + // Static constructor to be passed to the Detector Factory + public: + static NPL::VDetector* Construct(); -using namespace std ; - -class THeliosPhysics : public TObject{ -public: - THeliosPhysics(); - ~THeliosPhysics(); - -public: - void Clear(); - void Clear(const Option_t*) {}; - - void BuildPhysicalEvent(THeliosData* Data); - void BuildSimplePhysicalEvent(THeliosData* Data); - -public: - // Provide Physical Multiplicity - Int_t EventMultiplicity; - - // Provide a Classification of Event - vector<Int_t> fEventType; - - // Telescope - vector<Int_t> fModuleNumber; - - // FirstStage - // First stage - vector<Double_t> fFirstStage_Energy; - vector<Double_t> fFirstStage_Time; - vector<Int_t> fFirstStage_X; - vector<Int_t> fFirstStage_Y; - -/* - vector<double> FirstStage_E; - vector<double> FirstStage_T; - vector<int> FirstStage_X; - vector<int> FirstStage_Y; -*/ - - // Physical Value - vector<Double_t> fTotalEnergy; - vector<Double_t> fTotalTime; - - - - public: - ///////////////////////////////////// - // SETTERS // - ///////////////////////////////////// - // General - void SetEventType(Int_t evtType) {fEventType.push_back(evtType);} - void SetModuleNumber(Int_t moduleNbr) {fModuleNumber.push_back(moduleNbr);} - void SetTotalEnergy(Double_t ener) {fTotalEnergy.push_back(ener);} - - // First stage - void SetFirstStageEnergy(Double_t ener) {fFirstStage_Energy.push_back(ener);} - void SetFirstStageTime(Double_t time) {fFirstStage_Time.push_back(time);} - void SetFirstStageXPosition(Int_t x) {fFirstStage_X.push_back(x);} - void SetFirstStageYPosition(Int_t y) {fFirstStage_Y.push_back(y);} - - ///////////////////////////////////// - // GETTERS // - ///////////////////////////////////// - // General - Int_t GetEventMultiplicity() {return fTotalEnergy.size();} - Int_t GetEventType(Int_t i) {return fEventType.at(i);} - Int_t GetModuleNumber(Int_t i) {return fModuleNumber.at(i);} - Double_t GetTotalEnergy(Int_t i) {return fTotalEnergy.at(i);} - - // First stage - Double_t GetFirstStageEnergy(Int_t i) {return fFirstStage_Energy.at(i);} - Double_t GetFirstStageTime(Int_t i) {return fFirstStage_Time.at(i);} - Int_t GetFirstStageXPosition(Int_t i) {return fFirstStage_X.at(i);} - Int_t GetFirstStageYPosition(Int_t i) {return fFirstStage_Y.at(i);} - - - - - ClassDef(THeliosPhysics,1) // HeliosPHysics structure }; - #endif diff --git a/NPLib/Detectors/Helios2/THelios2Spectra.cxx b/NPLib/Detectors/Helios/THeliosSpectra.cxx similarity index 78% rename from NPLib/Detectors/Helios2/THelios2Spectra.cxx rename to NPLib/Detectors/Helios/THeliosSpectra.cxx index 5b2efb885e1b313178e2bbd589fc59e6cad612bc..4a50099614942b4042f4a35ebdf6fb3ae44b78f5 100644 --- a/NPLib/Detectors/Helios2/THelios2Spectra.cxx +++ b/NPLib/Detectors/Helios/THeliosSpectra.cxx @@ -1,18 +1,18 @@ /***************************************************************************** - * Copyright (C) 2009-2016 this file is part of the NPTool Project * + * Copyright (C) 2009-2016 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: Adrien Matta contact address: matta@lpccaen.in2p3.fr * + * Original Author: Adrien Matta contact address: matta@lpccaen.in2p3.fr * * * - * Creation Date : octobre 2016 * + * Creation Date : octobre 2016 * * Last update : * *---------------------------------------------------------------------------* * Decription: * - * This class hold Helios2 Spectra * + * This class hold Helios Spectra * * * *---------------------------------------------------------------------------* * Comment: * @@ -21,7 +21,7 @@ *****************************************************************************/ // class header -#include "THelios2Spectra.h" +#include "THeliosSpectra.h" // STL #include <iostream> @@ -34,21 +34,21 @@ using namespace std; //////////////////////////////////////////////////////////////////////////////// -THelios2Spectra::THelios2Spectra() +THeliosSpectra::THeliosSpectra() : fNumberOfDetectors(0) { - SetName("Helios2"); + SetName("Helios"); } //////////////////////////////////////////////////////////////////////////////// -THelios2Spectra::THelios2Spectra(unsigned int NumberOfDetectors) { +THeliosSpectra::THeliosSpectra(unsigned int NumberOfDetectors) { if(NPOptionManager::getInstance()->GetVerboseLevel()>0) cout << "************************************************" << endl - << "THelios2Spectra : Initalizing control spectra for " + << "THeliosSpectra : Initalizing control spectra for " << NumberOfDetectors << " Detectors" << endl << "************************************************" << endl ; - SetName("Helios2"); + SetName("Helios"); fNumberOfDetectors = NumberOfDetectors; InitRawSpectra(); @@ -59,41 +59,41 @@ THelios2Spectra::THelios2Spectra(unsigned int NumberOfDetectors) { //////////////////////////////////////////////////////////////////////////////// -THelios2Spectra::~THelios2Spectra() { +THeliosSpectra::~THeliosSpectra() { } //////////////////////////////////////////////////////////////////////////////// -void THelios2Spectra::InitRawSpectra() { +void THeliosSpectra::InitRawSpectra() { } //////////////////////////////////////////////////////////////////////////////// -void THelios2Spectra::InitPreTreatedSpectra() { +void THeliosSpectra::InitPreTreatedSpectra() { } //////////////////////////////////////////////////////////////////////////////// -void THelios2Spectra::InitPhysicsSpectra() { +void THeliosSpectra::InitPhysicsSpectra() { } //////////////////////////////////////////////////////////////////////////////// -void THelios2Spectra::FillRawSpectra(THelios2Data* RawData) { +void THeliosSpectra::FillRawSpectra(THeliosData* RawData) { } //////////////////////////////////////////////////////////////////////////////// -void THelios2Spectra::FillPreTreatedSpectra(THelios2Data* PreTreatedData) { +void THeliosSpectra::FillPreTreatedSpectra(THeliosData* PreTreatedData) { } //////////////////////////////////////////////////////////////////////////////// -void THelios2Spectra::FillPhysicsSpectra(THelios2Physics* Physics) { +void THeliosSpectra::FillPhysicsSpectra(THeliosPhysics* Physics) { } diff --git a/NPLib/Detectors/Helios2/THelios2Spectra.h b/NPLib/Detectors/Helios/THeliosSpectra.h similarity index 79% rename from NPLib/Detectors/Helios2/THelios2Spectra.h rename to NPLib/Detectors/Helios/THeliosSpectra.h index 43b4eb957b5b79eb673c1ef325314f172fc45780..1284959a3cbc4353b2fd33b88b71b428419fdb62 100644 --- a/NPLib/Detectors/Helios2/THelios2Spectra.h +++ b/NPLib/Detectors/Helios/THeliosSpectra.h @@ -1,20 +1,20 @@ -#ifndef THelios2SPECTRA_H -#define THelios2SPECTRA_H +#ifndef THeliosSPECTRA_H +#define THeliosSPECTRA_H /***************************************************************************** - * Copyright (C) 2009-2016 this file is part of the NPTool Project * + * Copyright (C) 2009-2016 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: Adrien Matta contact address: matta@lpccaen.in2p3.fr * + * Original Author: Adrien Matta contact address: matta@lpccaen.in2p3.fr * * * - * Creation Date : octobre 2016 * + * Creation Date : octobre 2016 * * Last update : * *---------------------------------------------------------------------------* * Decription: * - * This class hold Helios2 Spectra * + * This class hold Helios Spectra * * * *---------------------------------------------------------------------------* * Comment: * @@ -24,20 +24,20 @@ // NPLib headers #include "NPVSpectra.h" -#include "THelios2Data.h" -#include "THelios2Physics.h" +#include "THeliosData.h" +#include "THeliosPhysics.h" // Forward Declaration -class THelios2Physics; +class THeliosPhysics; -class THelios2Spectra : public VSpectra { +class THeliosSpectra : public VSpectra { ////////////////////////////////////////////////////////////// // constructor and destructor public: - THelios2Spectra(); - THelios2Spectra(unsigned int NumberOfDetectors); - ~THelios2Spectra(); + THeliosSpectra(); + THeliosSpectra(unsigned int NumberOfDetectors); + ~THeliosSpectra(); ////////////////////////////////////////////////////////////// // Initialization methods @@ -49,9 +49,9 @@ class THelios2Spectra : public VSpectra { ////////////////////////////////////////////////////////////// // Filling methods public: - void FillRawSpectra(THelios2Data*); - void FillPreTreatedSpectra(THelios2Data*); - void FillPhysicsSpectra(THelios2Physics*); + void FillRawSpectra(THeliosData*); + void FillPreTreatedSpectra(THeliosData*); + void FillPhysicsSpectra(THeliosPhysics*); ////////////////////////////////////////////////////////////// // Detector parameters diff --git a/NPLib/Detectors/Helios2/CMakeLists.txt b/NPLib/Detectors/Helios2/CMakeLists.txt deleted file mode 100644 index 2fdd760cc5c304987a28b6a25b57165fe2c97fc0..0000000000000000000000000000000000000000 --- a/NPLib/Detectors/Helios2/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -add_custom_command(OUTPUT THelios2PhysicsDict.cxx COMMAND ../../scripts/build_dict.sh THelios2Physics.h THelios2PhysicsDict.cxx THelios2Physics.rootmap libNPHelios2.dylib DEPENDS THelios2Physics.h) -add_custom_command(OUTPUT THelios2DataDict.cxx COMMAND ../../scripts/build_dict.sh THelios2Data.h THelios2DataDict.cxx THelios2Data.rootmap libNPHelios2.dylib DEPENDS THelios2Data.h) -add_library(NPHelios2 SHARED THelios2Spectra.cxx THelios2Data.cxx THelios2Physics.cxx THelios2DataDict.cxx THelios2PhysicsDict.cxx ) -target_link_libraries(NPHelios2 ${ROOT_LIBRARIES} NPCore) -install(FILES THelios2Data.h THelios2Physics.h THelios2Spectra.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) - diff --git a/NPLib/Detectors/Helios2/THelios2Data.cxx b/NPLib/Detectors/Helios2/THelios2Data.cxx deleted file mode 100644 index 2bfb34f2984450bfe1ca1726dd1fdb7fa8473362..0000000000000000000000000000000000000000 --- a/NPLib/Detectors/Helios2/THelios2Data.cxx +++ /dev/null @@ -1,117 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2016 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: Adrien Matta contact address: matta@lpccaen.in2p3.fr * - * * - * Creation Date : octobre 2016 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class hold Helios2 Raw data * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ -#include "THelios2Data.h" - -#include <iostream> -#include <fstream> -#include <sstream> -#include <string> -using namespace std; - -ClassImp(THelios2Data) - - -////////////////////////////////////////////////////////////////////// -THelios2Data::THelios2Data() { -} - -////////////////////////////////////////////////////////////////////// -THelios2Data::~THelios2Data() { -} - -////////////////////////////////////////////////////////////////////// -void THelios2Data::Clear() { - fHelios2_EBack_DetectorNbr.clear(); - fHelios2_EBack_Energy.clear(); - fHelios2_EUp_DetectorNbr.clear(); - fHelios2_EUp_Energy.clear(); - fHelios2_EDw_DetectorNbr.clear(); - fHelios2_EDw_Energy.clear(); - - fHelios2_TBack_DetectorNbr.clear(); - fHelios2_TBack_Time.clear(); - fHelios2_TUp_DetectorNbr.clear(); - fHelios2_TUp_Time.clear(); - fHelios2_TDw_DetectorNbr.clear(); - fHelios2_TDw_Time.clear(); -} - -////////////////////////////////////////////////////////////////////// -void THelios2Data::Dump() const { - // This method is very useful for debuging and worth the dev. - cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event [THelios2Data::Dump()] XXXXXXXXXXXXXXXXX" << endl; - - // E Back - size_t mysize = fHelios2_EBack_DetectorNbr.size(); - cout << "Helios2_EBack_Mult: " << mysize << endl; - - for (size_t i = 0 ; i < mysize ; i++){ - cout << "DetNbr: " << fHelios2_EBack_DetectorNbr[i] - << " Energy: " << fHelios2_EBack_Energy[i]; - } - - // E Up - mysize = fHelios2_EUp_DetectorNbr.size(); - cout << "Helios2_EUp_Mult: " << mysize << endl; - - for (size_t i = 0 ; i < mysize ; i++){ - cout << "DetNbr: " << fHelios2_EUp_DetectorNbr[i] - << " Energy: " << fHelios2_EUp_Energy[i]; - } - - // E Dw - mysize = fHelios2_EDw_DetectorNbr.size(); - cout << "Helios2_EDw_Mult: " << mysize << endl; - - for (size_t i = 0 ; i < mysize ; i++){ - cout << "DetNbr: " << fHelios2_EDw_DetectorNbr[i] - << " Energy: " << fHelios2_EDw_Energy[i]; - } - - // T Back - mysize = fHelios2_TBack_DetectorNbr.size(); - cout << "Helios2_TBack_Mult: " << mysize << endl; - - for (size_t i = 0 ; i < mysize ; i++){ - cout << "DetNbr: " << fHelios2_TBack_DetectorNbr[i] - << " Time: " << fHelios2_TBack_Time[i]; - } - - // T Up - mysize = fHelios2_TUp_DetectorNbr.size(); - cout << "Helios2_TUp_Mult: " << mysize << endl; - - for (size_t i = 0 ; i < mysize ; i++){ - cout << "DetNbr: " << fHelios2_TUp_DetectorNbr[i] - << " Time: " << fHelios2_TUp_Time[i]; - } - - // T Dw - mysize = fHelios2_TDw_DetectorNbr.size(); - cout << "Helios2_TDw_Mult: " << mysize << endl; - - for (size_t i = 0 ; i < mysize ; i++){ - cout << "DetNbr: " << fHelios2_TDw_DetectorNbr[i] - << " Time: " << fHelios2_TDw_Time[i]; - } - -} diff --git a/NPLib/Detectors/Helios2/THelios2Data.h b/NPLib/Detectors/Helios2/THelios2Data.h deleted file mode 100644 index 559ec56a7793088c95b806c18cc4499793d166c9..0000000000000000000000000000000000000000 --- a/NPLib/Detectors/Helios2/THelios2Data.h +++ /dev/null @@ -1,201 +0,0 @@ -#ifndef __Helios2DATA__ -#define __Helios2DATA__ -/***************************************************************************** - * Copyright (C) 2009-2016 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: Adrien Matta contact address: matta@lpccaen.in2p3.fr * - * * - * Creation Date : octobre 2016 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class hold Helios2 Raw data * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -// STL -#include <vector> -using namespace std; - -// ROOT -#include "TObject.h" - -class THelios2Data : public TObject { - ////////////////////////////////////////////////////////////// - // data members are hold into vectors in order - // to allow multiplicity treatment - private: - // Energy - vector<UShort_t> fHelios2_EBack_DetectorNbr; - vector<Double_t> fHelios2_EBack_Energy; - vector<UShort_t> fHelios2_EUp_DetectorNbr; - vector<Double_t> fHelios2_EUp_Energy; - vector<UShort_t> fHelios2_EDw_DetectorNbr; - vector<Double_t> fHelios2_EDw_Energy; - - - // Time - vector<UShort_t> fHelios2_TBack_DetectorNbr; - vector<Double_t> fHelios2_TBack_Time; - vector<UShort_t> fHelios2_TUp_DetectorNbr; - vector<Double_t> fHelios2_TUp_Time; - vector<UShort_t> fHelios2_TDw_DetectorNbr; - vector<Double_t> fHelios2_TDw_Time; - - - - ////////////////////////////////////////////////////////////// - // Constructor and destructor - public: - THelios2Data(); - virtual ~THelios2Data(); - - - ////////////////////////////////////////////////////////////// - // Inherited from TObject and overriden to avoid warnings - public: - void Clear(); - void Clear(const Option_t*) {}; - void Dump() const; - - - ////////////////////////////////////////////////////////////// - // Getters and Setters - // Prefer inline declaration to avoid unnecessary called of - // frequently used methods - // add //! to avoid ROOT creating dictionnary for the methods - public: - ////////////////////// SETTERS //////////////////////// - // E Back - inline void SetEBack_DetectorNbr(const UShort_t& DetNbr) - {fHelios2_EBack_DetectorNbr.push_back(DetNbr);} //! - inline void SetEBack_Energy(const Double_t& Energy) - {fHelios2_EBack_Energy.push_back(Energy);}//! - // Prefer global setter so that all vectors have the same size - inline void SetEBack(const UShort_t& DetNbr,const Double_t& Energy) { - SetEBack_DetectorNbr(DetNbr); - SetEBack_Energy(Energy); - };//! - - // E Up - inline void SetEUp_DetectorNbr(const UShort_t& DetNbr) - {fHelios2_EUp_DetectorNbr.push_back(DetNbr);} //! - inline void SetEUp_Energy(const Double_t& Energy) - {fHelios2_EUp_Energy.push_back(Energy);}//! - // Prefer global setter so that all vectors have the same size - inline void SetEUp(const UShort_t& DetNbr,const Double_t& Energy) { - SetEUp_DetectorNbr(DetNbr); - SetEUp_Energy(Energy); - };//! - - // E Dw - inline void SetEDw_DetectorNbr(const UShort_t& DetNbr) - {fHelios2_EDw_DetectorNbr.push_back(DetNbr);} //! - inline void SetEDw_Energy(const Double_t& Energy) - {fHelios2_EDw_Energy.push_back(Energy);}//! - // Prefer global setter so that all vectors have the same size - inline void SetEDw(const UShort_t& DetNbr,const Double_t& Energy) { - SetEDw_DetectorNbr(DetNbr); - SetEDw_Energy(Energy); - };//! - - - // T Back - inline void SetTBack_DetectorNbr(const UShort_t& DetNbr) - {fHelios2_TBack_DetectorNbr.push_back(DetNbr);} //! - inline void SetTBack_Time(const Double_t& Time) - {fHelios2_TBack_Time.push_back(Time);}//! - // Prefer global setter so that all vectors have the same size - inline void SetTBack(const UShort_t& DetNbr,const Double_t& Time) { - SetTBack_DetectorNbr(DetNbr); - SetTBack_Time(Time); - };//! - - - // T Up - inline void SetTUp_DetectorNbr(const UShort_t& DetNbr) - {fHelios2_TUp_DetectorNbr.push_back(DetNbr);} //! - inline void SetTUp_Time(const Double_t& Time) - {fHelios2_TUp_Time.push_back(Time);}//! - // Prefer global setter so that all vectors have the same size - inline void SetTUp(const UShort_t& DetNbr,const Double_t& Time) { - SetTUp_DetectorNbr(DetNbr); - SetTUp_Time(Time); - };//! - - // T Dw - inline void SetTDw_DetectorNbr(const UShort_t& DetNbr) - {fHelios2_TDw_DetectorNbr.push_back(DetNbr);} //! - inline void SetTDw_Time(const Double_t& Time) - {fHelios2_TDw_Time.push_back(Time);}//! - // Prefer global setter so that all vectors have the same size - inline void SetTDw(const UShort_t& DetNbr,const Double_t& Time) { - SetTDw_DetectorNbr(DetNbr); - SetTDw_Time(Time); - };//! - - - ////////////////////// GETTERS //////////////////////// - // E Back - inline UShort_t GetMultEBack() const - {return fHelios2_EBack_DetectorNbr.size();} - inline UShort_t GetEBack_DetectorNbr(const unsigned int &i) const - {return fHelios2_EBack_DetectorNbr[i];}//! - inline Double_t GetEBack_Energy(const unsigned int &i) const - {return fHelios2_EBack_Energy[i];}//! - - // E Up - inline UShort_t GetMultEUp() const - {return fHelios2_EUp_DetectorNbr.size();} - inline UShort_t GetEUp_DetectorNbr(const unsigned int &i) const - {return fHelios2_EUp_DetectorNbr[i];}//! - inline Double_t GetEUp_Energy(const unsigned int &i) const - {return fHelios2_EUp_Energy[i];}//! - - // E Dw - inline UShort_t GetMultEDw() const - {return fHelios2_EDw_DetectorNbr.size();} - inline UShort_t GetEDw_DetectorNbr(const unsigned int &i) const - {return fHelios2_EDw_DetectorNbr[i];}//! - inline Double_t GetEDw_Energy(const unsigned int &i) const - {return fHelios2_EDw_Energy[i];}//! - - // T Back - inline UShort_t GetMultTBack() const - {return fHelios2_TBack_DetectorNbr.size();} - inline UShort_t GetTBack_DetectorNbr(const unsigned int &i) const - {return fHelios2_TBack_DetectorNbr[i];}//! - inline Double_t GetTBack_Time(const unsigned int &i) const - {return fHelios2_TBack_Time[i];}//! - - // T Up - inline UShort_t GetMultTUp() const - {return fHelios2_TUp_DetectorNbr.size();} - inline UShort_t GetTUp_DetectorNbr(const unsigned int &i) const - {return fHelios2_TUp_DetectorNbr[i];}//! - inline Double_t GetTUp_Time(const unsigned int &i) const - {return fHelios2_TUp_Time[i];}//! - - // T Dw - inline UShort_t GetMultTDw() const - {return fHelios2_TDw_DetectorNbr.size();} - inline UShort_t GetTDw_DetectorNbr(const unsigned int &i) const - {return fHelios2_TDw_DetectorNbr[i];}//! - inline Double_t GetTDw_Time(const unsigned int &i) const - {return fHelios2_TDw_Time[i];}//! - - ////////////////////////////////////////////////////////////// - // Required for ROOT dictionnary - ClassDef(THelios2Data,1) // Helios2Data structure -}; - -#endif diff --git a/NPLib/Detectors/Helios2/THelios2Physics.cxx b/NPLib/Detectors/Helios2/THelios2Physics.cxx deleted file mode 100644 index e160ee278cd1424d3d22fb263eb2bfe84f0ce49a..0000000000000000000000000000000000000000 --- a/NPLib/Detectors/Helios2/THelios2Physics.cxx +++ /dev/null @@ -1,434 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2016 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: Adrien Matta contact address: matta@lpccaen.in2p3.fr * - * * - * Creation Date : octobre 2016 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class hold Helios2 Treated data * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -#include "THelios2Physics.h" - -// STL -#include <sstream> -#include <iostream> -#include <cmath> -#include <stdlib.h> -#include <limits> -using namespace std; - -// NPL -#include "RootInput.h" -#include "RootOutput.h" -#include "NPDetectorFactory.h" -#include "NPPhysicalConstants.h" -#include "NPOptionManager.h" -// ROOT -#include "TChain.h" - -ClassImp(THelios2Physics) - - -/////////////////////////////////////////////////////////////////////////// -THelios2Physics::THelios2Physics() - : m_EventData(new THelios2Data), - m_PreTreatedData(new THelios2Data), - m_EventPhysics(this), - m_Spectra(0), - m_E_RAW_Threshold(0), // adc channels - m_E_Threshold(0), // MeV - m_NumberOfDetectors(0) { -} - - - -/////////////////////////////////////////////////////////////////////////// -void THelios2Physics::BuildSimplePhysicalEvent() { - BuildPhysicalEvent(); -} - - - -/////////////////////////////////////////////////////////////////////////// -void THelios2Physics::BuildPhysicalEvent() { - // apply thresholds and calibration - PreTreat(); - - // Look for Eup and EDw on the same detector - unsigned int mysizeEBack = m_PreTreatedData->GetMultEBack(); - unsigned int mysizeEUp = m_PreTreatedData->GetMultEUp(); - unsigned int mysizeEDw = m_PreTreatedData->GetMultEDw(); - unsigned int mysizeTUp = m_PreTreatedData->GetMultTUp(); - unsigned int DetNbr = 0; - for(unsigned int u = 0 ; u < mysizeEUp ; u++){ - DetNbr = m_PreTreatedData->GetEUp_DetectorNbr(u); - for(unsigned int d = 0 ; d < mysizeEDw ; d++){ - if( DetNbr == m_PreTreatedData->GetEDw_DetectorNbr(d)){ - - DetectorNumber.push_back(DetNbr); - // Total Energy deposit is taken from the back - double E = -1000; - for(unsigned int b = 0 ; b < mysizeEBack ; b++){ - if(DetNbr == m_PreTreatedData->GetEBack_DetectorNbr(b)) - E = m_PreTreatedData->GetEBack_Energy(b); - } - Energy.push_back(E); - - // Position along the detector lenght between -1 and 1 - double P = m_PreTreatedData->GetEDw_Energy(d)-m_PreTreatedData->GetEUp_Energy(u); - P = P / E; - Position.push_back(P); - // Compute Z based on the Position and detector position - double Detector_length = 56; - Z.push_back(P*0.5 * Detector_length + m_Z[m_PreTreatedData->GetEUp_DetectorNbr(u)-1]); - - // Look for associated time - double T = -1000; - for(unsigned int t = 0 ; t < mysizeTUp ; t++){ - if(DetNbr == m_PreTreatedData->GetTUp_DetectorNbr(t)){ - T = m_PreTreatedData->GetTUp_Time(t); - } - Time.push_back(T); - }// for T Up - } - }// for E Dw - }// for E Up -} - -/////////////////////////////////////////////////////////////////////////// -void THelios2Physics::PreTreat() { - // This method typically applies thresholds and calibrations - // Might test for disabled channels for more complex detector - - // clear pre-treated object - ClearPreTreatedData(); - - // instantiate CalibrationManager - static CalibrationManager* Cal = CalibrationManager::getInstance(); - - // EBack - unsigned int mysize = m_EventData->GetMultEBack(); - for (UShort_t i = 0; i < mysize; ++i) { - if (m_EventData->GetEBack_Energy(i) > m_E_RAW_Threshold) { - Double_t Energy = Cal->ApplyCalibration("Helios2/EBACK" - +NPL::itoa(m_EventData->GetEBack_DetectorNbr(i)),m_EventData->GetEBack_Energy(i)); - if (Energy > m_E_Threshold) { - m_PreTreatedData->SetEBack(m_EventData->GetEBack_DetectorNbr(i), Energy); - } - } - } - - // EUp - mysize = m_EventData->GetMultEUp(); - for (UShort_t i = 0; i < mysize; ++i) { - if (m_EventData->GetEUp_Energy(i) > m_E_RAW_Threshold) { - Double_t Energy = Cal->ApplyCalibration("Helios2/EUP" - +NPL::itoa(m_EventData->GetEUp_DetectorNbr(i)),m_EventData->GetEUp_Energy(i)); - if (Energy > m_E_Threshold) { - m_PreTreatedData->SetEUp(m_EventData->GetEUp_DetectorNbr(i), Energy); - } - } - } - - // EDw - mysize = m_EventData->GetMultEDw(); - for (UShort_t i = 0; i < mysize ; ++i) { - if (m_EventData->GetEDw_Energy(i) > m_E_RAW_Threshold) { - Double_t Energy = Cal->ApplyCalibration("Helios2/EDW" - +NPL::itoa(m_EventData->GetEDw_DetectorNbr(i)),m_EventData->GetEDw_Energy(i)); - if (Energy > m_E_Threshold) { - m_PreTreatedData->SetEDw(m_EventData->GetEDw_DetectorNbr(i), Energy); - } - } - } - - // TBack - mysize = m_EventData->GetMultTBack(); - for (UShort_t i = 0; i < mysize; ++i) { - Double_t Time= Cal->ApplyCalibration("Helios2/TBACK"+NPL::itoa(m_EventData->GetTBack_DetectorNbr(i)),m_EventData->GetTBack_Time(i)); - m_PreTreatedData->SetTBack(m_EventData->GetTBack_DetectorNbr(i), Time); - } - - // TUp - mysize = m_EventData->GetMultTUp(); - for (UShort_t i = 0; i < mysize; ++i) { - Double_t Time= Cal->ApplyCalibration("Helios2/TUP"+NPL::itoa(m_EventData->GetTUp_DetectorNbr(i)),m_EventData->GetTUp_Time(i)); - m_PreTreatedData->SetTUp(m_EventData->GetTUp_DetectorNbr(i), Time); - } - // TDw - mysize = m_EventData->GetMultTDw(); - for (UShort_t i = 0; i < mysize; ++i) { - Double_t Time= Cal->ApplyCalibration("Helios2/TDW"+NPL::itoa(m_EventData->GetTDw_DetectorNbr(i)),m_EventData->GetTDw_Time(i)); - m_PreTreatedData->SetTDw(m_EventData->GetTDw_DetectorNbr(i), Time); - } - -} - -/////////////////////////////////////////////////////////////////////////// -double THelios2Physics::ThetaLab(unsigned int i, double m, double B, double q){ - // If default value of B, use the private membes Field variable - // This allow the user to vary B in its analysis to adjust field to data - if(B == -1000){ - B = m_B; - } - - else - B *=NPUNITS::tesla; - - // If q is not provided, use the measured time - double T = 0 ; - if(q == -1000){ - T = Time[i]; - } - - // else use the calculated time - else{ - T = (NPUNITS::twopi*m*NPUNITS::MeV/(NPUNITS::c_squared)) / (q*B); - } - - double v_par = Z[i]/T; - double v = sqrt(2*(Energy[i]*NPUNITS::MeV) - /(m*NPUNITS::MeV/(NPUNITS::c_squared))); - double result = acos(v_par/v); - - // in case ThetaLab is not a number (nan) - // return -1000; - if(result!=result){ - result= -1000; - } - return result; -} - -/////////////////////////////////////////////////////////////////////////// -void THelios2Physics::ReadAnalysisConfig() { - bool ReadingStatus = false; - - // path to file - string FileName = "./configs/ConfigHelios2.dat"; - - // open analysis config file - ifstream AnalysisConfigFile; - AnalysisConfigFile.open(FileName.c_str()); - - if (!AnalysisConfigFile.is_open()) { - cout << " No ConfigHelios2.dat found: Default parameter loaded for Analayis " << FileName << endl; - return; - } - cout << " Loading user parameter for Analysis from ConfigHelios2.dat " << endl; - - // Save it in a TAsciiFile - TAsciiFile* asciiConfig = RootOutput::getInstance()->GetAsciiFileAnalysisConfig(); - asciiConfig->AppendLine("%%% ConfigHelios2.dat %%%"); - asciiConfig->Append(FileName.c_str()); - asciiConfig->AppendLine(""); - // read analysis config file - string LineBuffer,DataBuffer,whatToDo; - while (!AnalysisConfigFile.eof()) { - // Pick-up next line - getline(AnalysisConfigFile, LineBuffer); - - // search for "header" - string name = "ConfigHelios2"; - if (LineBuffer.compare(0, name.length(), name) == 0) - ReadingStatus = true; - - // loop on tokens and data - while (ReadingStatus ) { - whatToDo=""; - AnalysisConfigFile >> whatToDo; - - // Search for comment symbol (%) - if (whatToDo.compare(0, 1, "%") == 0) { - AnalysisConfigFile.ignore(numeric_limits<streamsize>::max(), '\n' ); - } - - else if (whatToDo=="E_RAW_THRESHOLD") { - AnalysisConfigFile >> DataBuffer; - m_E_RAW_Threshold = atof(DataBuffer.c_str()); - cout << whatToDo << " " << m_E_RAW_Threshold << endl; - } - - else if (whatToDo=="E_THRESHOLD") { - AnalysisConfigFile >> DataBuffer; - m_E_Threshold = atof(DataBuffer.c_str()); - cout << whatToDo << " " << m_E_Threshold << endl; - } - - else { - ReadingStatus = false; - } - } - } -} - - - -/////////////////////////////////////////////////////////////////////////// -void THelios2Physics::Clear() { - DetectorNumber.clear(); - Energy.clear(); - Time.clear(); - Z.clear(); - Position.clear(); -} - - - -/////////////////////////////////////////////////////////////////////////// -void THelios2Physics::ReadConfiguration(NPL::InputParser parser){ - vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("Helios2"); - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << "//// " << blocks.size() << " detectors found " << endl; - - vector<string> token = {"Z","Face"}; - - for(unsigned int i = 0 ; i < blocks.size() ; i++){ - if(blocks[i]->HasToken("MagneticField")) - m_B=blocks[i]->GetDouble("MagneticField","T"); - - if(blocks[i]->HasTokenList(token)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Helios2 " << i+1 << endl; - double Z = blocks[i]->GetDouble("Z","mm"); - string Face = blocks[i]->GetString("Face"); - - m_Z.push_back(Z); - m_Face.push_back(Face); - } - - else{ - cout << "ERROR: check your input file formatting " << endl; - exit(1); - } - } - - ReadAnalysisConfig(); -} - - - -/////////////////////////////////////////////////////////////////////////// -void THelios2Physics::InitSpectra() { - m_Spectra = new THelios2Spectra(m_NumberOfDetectors); -} - - - -/////////////////////////////////////////////////////////////////////////// -void THelios2Physics::FillSpectra() { - m_Spectra -> FillRawSpectra(m_EventData); - m_Spectra -> FillPreTreatedSpectra(m_PreTreatedData); - m_Spectra -> FillPhysicsSpectra(m_EventPhysics); -} - - - -/////////////////////////////////////////////////////////////////////////// -void THelios2Physics::CheckSpectra() { - m_Spectra->CheckSpectra(); -} - - - -/////////////////////////////////////////////////////////////////////////// -void THelios2Physics::ClearSpectra() { - // To be done -} - - - -/////////////////////////////////////////////////////////////////////////// -map< string , TH1*> THelios2Physics::GetSpectra() { - if(m_Spectra) - return m_Spectra->GetMapHisto(); - else{ - map< string , TH1*> empty; - return empty; - } -} - -/////////////////////////////////////////////////////////////////////////// -void THelios2Physics::WriteSpectra() { - m_Spectra->WriteSpectra(); -} - - - -/////////////////////////////////////////////////////////////////////////// -void THelios2Physics::AddParameterToCalibrationManager() { - CalibrationManager* Cal = CalibrationManager::getInstance(); - for (int i = 0; i < m_NumberOfDetectors; ++i) { - Cal->AddParameter("Helios2", "D"+ NPL::itoa(i+1)+"_EBACK","Helios2_D"+ NPL::itoa(i+1)+"_EBACK"); - Cal->AddParameter("Helios2", "D"+ NPL::itoa(i+1)+"_TBACK","Helios2_D"+ NPL::itoa(i+1)+"_TBACK"); - Cal->AddParameter("Helios2", "D"+ NPL::itoa(i+1)+"_EUP","Helios2_D"+ NPL::itoa(i+1)+"_EUP"); - Cal->AddParameter("Helios2", "D"+ NPL::itoa(i+1)+"_TUP","Helios2_D"+ NPL::itoa(i+1)+"_TUP"); - Cal->AddParameter("Helios2", "D"+ NPL::itoa(i+1)+"_EDW","Helios2_D"+ NPL::itoa(i+1)+"_EDW"); - Cal->AddParameter("Helios2", "D"+ NPL::itoa(i+1)+"_TDW","Helios2_D"+ NPL::itoa(i+1)+"_TDW"); - - } -} - - - -/////////////////////////////////////////////////////////////////////////// -void THelios2Physics::InitializeRootInputRaw() { - TChain* inputChain = RootInput::getInstance()->GetChain(); - inputChain->SetBranchStatus("Helios2", true ); - inputChain->SetBranchAddress("Helios2", &m_EventData ); -} - - - -/////////////////////////////////////////////////////////////////////////// -void THelios2Physics::InitializeRootInputPhysics() { - TChain* inputChain = RootInput::getInstance()->GetChain(); - inputChain->SetBranchAddress("Helios2", &m_EventPhysics); -} - - - -/////////////////////////////////////////////////////////////////////////// -void THelios2Physics::InitializeRootOutput() { - TTree* outputTree = RootOutput::getInstance()->GetTree(); - outputTree->Branch("Helios2", "THelios2Physics", &m_EventPhysics); -} - - - -//////////////////////////////////////////////////////////////////////////////// -// Construct Method to be pass to the DetectorFactory // -//////////////////////////////////////////////////////////////////////////////// -NPL::VDetector* THelios2Physics::Construct() { - return (NPL::VDetector*) new THelios2Physics(); -} - - - -//////////////////////////////////////////////////////////////////////////////// -// Registering the construct method to the factory // -//////////////////////////////////////////////////////////////////////////////// -extern "C"{ -class proxy_Helios2{ - public: - proxy_Helios2(){ - NPL::DetectorFactory::getInstance()->AddToken("Helios2","Helios2"); - NPL::DetectorFactory::getInstance()->AddDetector("Helios2",THelios2Physics::Construct); - } -}; - -proxy_Helios2 p_Helios2; -} - diff --git a/NPLib/Detectors/Helios2/THelios2Physics.h b/NPLib/Detectors/Helios2/THelios2Physics.h deleted file mode 100644 index b7ef3391cd8307fbba2f91f47c0775da455ca617..0000000000000000000000000000000000000000 --- a/NPLib/Detectors/Helios2/THelios2Physics.h +++ /dev/null @@ -1,186 +0,0 @@ -#ifndef THelios2PHYSICS_H -#define THelios2PHYSICS_H -/***************************************************************************** - * Copyright (C) 2009-2016 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: Adrien Matta contact address: matta@lpccaen.in2p3.fr * - * * - * Creation Date : octobre 2016 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class hold Helios2 Treated data * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -// C++ headers -#include <vector> -#include <map> -#include <string> -using namespace std; - -// ROOT headers -#include "TObject.h" -#include "TH1.h" -#include "TCanvas.h" - -// NPTool headers -#include "THelios2Data.h" -#include "THelios2Spectra.h" -#include "NPCalibrationManager.h" -#include "NPVDetector.h" -#include "NPInputParser.h" -// forward declaration -class THelios2Spectra; - -class THelios2Physics : public TObject, public NPL::VDetector { - ////////////////////////////////////////////////////////////// - // constructor and destructor - public: - THelios2Physics(); - ~THelios2Physics() {}; - - - ////////////////////////////////////////////////////////////// - // Inherited from TObject and overriden to avoid warnings - public: - void Clear(); - void Clear(const Option_t*) {}; - - - ////////////////////////////////////////////////////////////// - // data obtained after BuildPhysicalEvent() and stored in - // output ROOT file - public: - vector<int> DetectorNumber; - vector<double> Energy; - vector<double> Position; - vector<double> Time; - vector<double> Z; - - private: - vector<string> m_Face;//! - vector<double> m_Z;//! - double m_B;//! - - - ////////////////////////////////////////////////////////////// - // methods inherited from the VDetector ABC class - public: - // read stream from ConfigFile to pick-up detector parameters - void ReadConfiguration(NPL::InputParser); - - // add parameters to the CalibrationManger - void AddParameterToCalibrationManager(); - - // method called event by event, aiming at extracting the - // physical information from detector - void BuildPhysicalEvent(); - - // same as BuildPhysicalEvent() method but with a simpler - // treatment - void BuildSimplePhysicalEvent(); - - // same as above but for online analysis - void BuildOnlinePhysicalEvent() {BuildPhysicalEvent();}; - - // activate raw data object and branches from input TChain - // in this method mother branches (Detector) AND daughter leaves - // (fDetector_parameter) have to be activated - void InitializeRootInputRaw(); - - // activate physics data object and branches from input TChain - // in this method mother branches (Detector) AND daughter leaves - // (fDetector_parameter) have to be activated - void InitializeRootInputPhysics(); - - // create branches of output ROOT file - void InitializeRootOutput(); - - // clear the raw and physical data objects event by event - void ClearEventPhysics() {Clear();} - void ClearEventData() {m_EventData->Clear();} - - // methods related to the THelios2Spectra class - // instantiate the THelios2Spectra class and - // declare list of histograms - void InitSpectra(); - - // fill the spectra - void FillSpectra(); - - // used for Online mainly, sanity check for histograms and - // change their color if issues are found, for example - void CheckSpectra(); - - // used for Online only, clear all the spectra - void ClearSpectra(); - - // write spectra to ROOT output file - void WriteSpectra(); - - - ////////////////////////////////////////////////////////////// - // specific methods to Helios2 array - public: - // remove bad channels, calibrate the data and apply thresholds - void PreTreat(); - - // clear the pre-treated object - void ClearPreTreatedData() {m_PreTreatedData->Clear();} - - // read the user configuration file. If no file is found, load standard one - void ReadAnalysisConfig(); - - // give and external THelios2Data object to THelios2Physics. - // needed for online analysis for example - void SetRawDataPointer(THelios2Data* rawDataPointer) {m_EventData = rawDataPointer;} - - // Return Theta Lab (in rad) based on E and B and z: - double ThetaLab(unsigned int i, double m, double B=-1000,double q=-1000); - - // objects are not written in the TTree - private: - THelios2Data* m_EventData; //! - THelios2Data* m_PreTreatedData; //! - THelios2Physics* m_EventPhysics; //! - - // getters for raw and pre-treated data object - public: - THelios2Data* GetRawData() const {return m_EventData;}//! - THelios2Data* GetPreTreatedData() const {return m_PreTreatedData;}//! - - // parameters used in the analysis - private: - // thresholds - double m_E_RAW_Threshold; //! - double m_E_Threshold; //! - - // number of detectors - private: - int m_NumberOfDetectors; //! - - // spectra class - private: - THelios2Spectra* m_Spectra; // ! - - // spectra getter - public: - map<string, TH1*> GetSpectra(); - - // Static constructor to be passed to the Detector Factory - public: - static NPL::VDetector* Construct(); - - ClassDef(THelios2Physics,1) // Helios2Physics structure -}; -#endif diff --git a/NPSimulation/Core/NPSDetectorFactory.cc b/NPSimulation/Core/NPSDetectorFactory.cc index 630ee50224f7c5fc26c7c73e5492f6afaab9931d..96c545b82cc67648752bd49d10582322e7536f09 100644 --- a/NPSimulation/Core/NPSDetectorFactory.cc +++ b/NPSimulation/Core/NPSDetectorFactory.cc @@ -99,7 +99,7 @@ NPS::VDetector* DetectorFactory::Construct(std::string Token){ } else{ - std::cout << "Warning: Detector with Token " << Token << " has no Constructor or no Library" << endl << " error is: \n"; + std::cout << "Warning: Detector with Token " << Token << ", error while loading lib:" << endl; if(LibError) { std::cout << LibError; } else { std::cout << "NULL"; } std::cout << std::endl; return NULL; } diff --git a/NPSimulation/Core/Target.cc b/NPSimulation/Core/Target.cc index 1338e87326613bf1e263332cccecc29f09640389..72ad14f78a3f97754ff7bbe2642f9905c2689104 100644 --- a/NPSimulation/Core/Target.cc +++ b/NPSimulation/Core/Target.cc @@ -64,6 +64,8 @@ using namespace CLHEP ; using namespace std; + +Target* Target::TargetInstance=0; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... // Specific Method of this class Target::Target(){ @@ -96,10 +98,7 @@ Target::Target(){ m_ShieldFrontRadius = 0 ; m_ShieldBackRadius = 0 ; m_ShieldMaterial = 0 ; - - - - + TargetInstance = this; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... Target::~Target(){ diff --git a/NPSimulation/Detectors/Helios/CMakeLists.txt b/NPSimulation/Detectors/Helios/CMakeLists.txt deleted file mode 100644 index 487bf390a43c46dfcc5cbbed28fac2ce8a00c15b..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Helios/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_library(NPSHelios SHARED Helios.cc HeliosDetDummyShape.cc HeliosModule.cc HeliosScorers.cc) -target_link_libraries(NPSHelios NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} NPHelios) diff --git a/NPSimulation/Detectors/Helios/Helios.cc b/NPSimulation/Detectors/Helios/Helios.cc deleted file mode 100644 index dcc60478ae26ade0d7c22447bbbe2d2e7be5efe2..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Helios/Helios.cc +++ /dev/null @@ -1,141 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2016 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: Marc Labiche contact address: marc.labiche@stfc.ac.uk * - * * - * Creation Date : 31/01/12 * - * Last update : 31/08/15 * - *---------------------------------------------------------------------------* - * Decription: This class manages different shapes of module for the Helios * - * It allows to have Helios geometries with an * - * heterogeneous set of modules * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -// C++ headers -#include <fstream> -#include <sstream> -#include <string> -#include <cmath> - -// NPTool headers -#include "Helios.hh" -#include "HeliosDetDummyShape.hh" -#include "NPSDetectorFactory.hh" -#include "NPOptionManager.h" -using namespace std; - - -Helios::Helios() -{ -} - - - -Helios::~Helios() -{ -} - - - -// Read stream at Configfile to pick-up parameters of detector (Position,...) -// Called in DetecorConstruction::ReadDetextorConfiguration Method -void Helios::ReadConfiguration(NPL::InputParser parser){ - vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("HeliosDummyShape"); - if(blocks.size()>1){ - cout << "wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww " << endl; - // instantiate a new "detector" corresponding to the Shape elements - // The HeliosSquare class should be replaced by the - // HeliosShape class you need to define - HeliosModule* myDetector = new HeliosDetDummyShape(); - - // read part of the configuration file corresponding to shape elements - myDetector->ReadConfiguration(parser); - - // ms_InterCoord comes from NPS::VDetector - myDetector->SetInterCoordPointer(ms_InterCoord); - - // store HeliosShape "detector" - m_Modules.push_back(myDetector); - } -} - -// Construct detector and initialize sensitive part. -// Called After DetecorConstruction::AddDetector Method -void Helios::ConstructDetector(G4LogicalVolume* world) -{ - // loop on sub-detectors belonging to Helios - int nbDetectors = m_Modules.size(); - for (int i = 0; i < nbDetectors; i++) m_Modules[i]->ConstructDetector(world); -} - - - -// Connect the GaspardTrackingData class to the output TTree -// of the simulation -void Helios::InitializeRootOutput() -{ - // loop on sub-detectors belonging to Helios - int nbDetectors = m_Modules.size(); - for (int i = 0; i < nbDetectors; i++) m_Modules[i]->InitializeRootOutput(); -} - - - -// Initialize all scorers necessary for each detector -void Helios::InitializeScorers() -{ - // loop on sub-detectors belonging to Helios - 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 Helios::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 Helios - int nbDetectors = m_Modules.size(); - for (int i = 0; i < nbDetectors; i++) m_Modules[i]->ReadSensitive(event); -} - //////////////////////////////////////////////////////////////////////////////// - // Construct Method to be pass to the DetectorFactory // - //////////////////////////////////////////////////////////////////////////////// - NPS::VDetector* Helios::Construct(){ - return (NPS::VDetector*) new Helios(); - } - - //////////////////////////////////////////////////////////////////////////////// - // Registering the construct method to the factory // - //////////////////////////////////////////////////////////////////////////////// - extern"C" { - class proxy{ - public: - proxy(){ - NPS::DetectorFactory::getInstance()->AddToken("HeliosDummyShape","Helios"); - NPS::DetectorFactory::getInstance()->AddDetector("HeliosDummyShape",Helios::Construct); - } -}; - - proxy p; - } diff --git a/NPSimulation/Detectors/Helios/Helios.hh b/NPSimulation/Detectors/Helios/Helios.hh deleted file mode 100644 index 8bc12698d9ffda8a75c236e621908a53cccda416..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Helios/Helios.hh +++ /dev/null @@ -1,76 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2016 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: Marc Labiche contact address: marc.labiche@stfc.ac.uk * - * * - * Creation Date : 31/01/12 * - * Last update : 31/08/15 * - *---------------------------------------------------------------------------* - * Decription: This class manages different shapes of module for the Helios * - * detector. It allows to have Helios geometries with an * - * heterogeneous set of modules * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -#ifndef Helios_h -#define Helios_h 1 - -// C++ headers -#include <vector> - -// NPTool header -#include "NPSVDetector.hh" -#include "HeliosModule.hh" -#include "NPInputParser.h" -using namespace std; -using namespace CLHEP; - - - -class Helios : public NPS::VDetector -{ - //////////////////////////////////////////////////// - /////// Default Constructor and Destructor ///////// - //////////////////////////////////////////////////// -public: - Helios(); - virtual ~Helios(); - - //////////////////////////////////////////////////// - ///////// Inherite from NPS::VDetector class /////////// - //////////////////////////////////////////////////// -public: - // Read stream at Configfile to pick-up parameters of detector (Position,...) - // Called in DetecorConstruction::ReadDetextorConfiguration Method - void ReadConfiguration(NPL::InputParser); - - // 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<HeliosModule*> m_Modules; -public: - static NPS::VDetector* Construct(); -}; -#endif diff --git a/NPSimulation/Detectors/Helios/HeliosDetDummyShape.cc b/NPSimulation/Detectors/Helios/HeliosDetDummyShape.cc deleted file mode 100644 index 981360f29d1fd9def47d2190d0029d802f335044..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Helios/HeliosDetDummyShape.cc +++ /dev/null @@ -1,863 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2016 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: Marc Labiche contact address: marc.labiche@stfc.ac.uk * - * * - * Creation Date : 31/01/12 * - * Last update : 31/08/15 * - *---------------------------------------------------------------------------* - * Decription: Define a dummy module for the Helios detector * - * The goal of this class is to be a starting point to create a * - * new shape to be added to the Helios detector. * - * * - *---------------------------------------------------------------------------* - * Comment: * - * For Helios, the shape is a rectangular box (w~1cm, l~5cm, d~700um) * - * For Helisol, the shape is a rectangular box (w~2.2cm, l~12.5cm, d~1000um) * - * * - * * - *****************************************************************************/ - -// C++ headers -#include <sstream> -#include <string> -#include <cmath> - -// G4 Geometry headers -#include "G4Trd.hh" -#include "G4Box.hh" -#include "G4Tubs.hh" -#include "G4Trap.hh" -#include "G4Polyhedra.hh" -#include "G4SubtractionSolid.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" - -// For the magnetic field -#include "MyMagneticField.hh" -#include "G4FieldManager.hh" -#include "G4TransportationManager.hh" -#include "G4ChordFinder.hh" -#include "G4MagIntegratorStepper.hh" - -// G4 sensitive -#include "G4SDManager.hh" -#include "G4MultiFunctionalDetector.hh" -#include "NPSVDetector.hh" - -// NPTool headers -#include "HeliosDetDummyShape.hh" -#include "ObsoleteGeneralScorers.hh" -#include "HeliosScorers.hh" -#include "RootOutput.h" -#include "NPOptionManager.h" -#include "NPSDetectorFactory.hh" -// CLHEP -#include "CLHEP/Random/RandGauss.h" - -using namespace std; -using namespace CLHEP; -using namespace HELIOSDUMMYSHAPE; - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -HeliosDetDummyShape::HeliosDetDummyShape() -{ - ms_InterCoord = 0; -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -HeliosDetDummyShape::~HeliosDetDummyShape() -{ -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void HeliosDetDummyShape::AddModule(G4ThreeVector X1_Y1 , - G4ThreeVector X128_Y1 , - G4ThreeVector X1_Y128 , - G4ThreeVector X128_Y128 , - bool wFirstStage ) -{ - 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_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_wNumberStrip.push_back(wNumberStrip); -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void HeliosDetDummyShape::AddModule(G4double R , - G4double Theta , - G4double Phi , - G4double beta_u , - G4double beta_v , - G4double beta_w , - bool wFirstStage ) -{ - 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) ; -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void HeliosDetDummyShape::VolumeMaker(G4int TelescopeNumber, - G4ThreeVector MMpos, - G4RotationMatrix* MMrot, - bool wFirstStage, - 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); - - // Al - a = 26.98 * g / mole; - density = 2.7 * g / cm3; - G4Material* Aluminium = new G4Material("Al", z = 13., a, density); - - // Copper - a = 63.546 * g / mole; - density = 8.96 * g / cm3; -// G4Material* Copper; -// Copper = new G4Material("Cu", z = 29., 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); - - // PCB - G4Element* Si = new G4Element("Silicon" , symbol = "Si" , z = 14 , a = 28.0855 * g / mole); - G4Element* C = new G4Element("Carbon" , symbol = "C" , z = 6 , a = 12.011 * g / mole); - G4Element* H = new G4Element("Hydrogen" , symbol = "H" , z = 1 , a = 1.0079 * g / mole); - G4Element* Br = new G4Element("Bromine" , symbol = "Br" , z = 35 , a = 79.904 * g / mole); - - density = 1.7 * g / cm3; - G4Material* PCB = new G4Material("PCB", density, ncomponents = 5); - PCB->AddElement(Si, .181); - PCB->AddElement(O, .406); - PCB->AddElement(C, .278); - PCB->AddElement(H, .068); - PCB->AddElement(Br, .067); - - - //////////////////////////////////////////////////////////////// - ////////////// Starting Volume Definition ////////////////////// - //////////////////////////////////////////////////////////////// - - // - // Detector support structure (rods) - // - // Add the Aluminium rod - - /* For helios: */ - G4double Al_rod_x = 1. * cm; // half width - G4double Al_rod_y = 1. * cm; // half height - G4double Al_rod_z = 20.0 * cm; // half length - G4Box* Al_rod_box - = new G4Box("Al_rod_box", Al_rod_x, Al_rod_y, Al_rod_z); - G4Tubs* Al_rod_tub - = new G4Tubs("Al_rod_tub", 0, 0.5*cm, Al_rod_z+1.*mm, 0.*deg, 360*deg); - G4SubtractionSolid* Al_rod=new G4SubtractionSolid("Rod",Al_rod_box, Al_rod_tub, 0, G4ThreeVector(0.,0.,0.)); - - G4LogicalVolume* Al_rod_log = new G4LogicalVolume(Al_rod, Aluminium, "Al_rod", 0, 0, 0); - - //new G4PVPlacement(0, G4ThreeVector(0.,0., Al_rod_z+1.*mm + 12.5*cm), Al_rod_log, "Al_rod", world, false, 0); // 150 - //new G4PVPlacement(0, G4ThreeVector(0.,0., -(Al_rod_z+1.*mm + 12.5*cm)), Al_rod_log, "Al_rod", world, false, 1); // -150 - //new G4PVPlacement(0, G4ThreeVector(0.,0., Al_rod_z+1.*mm + 8.5*cm), Al_rod_log, "Al_rod", world, false, 0); // 100 - new G4PVPlacement(0, G4ThreeVector(0.,0., -(Al_rod_z+1.*mm + 8.5*cm)), Al_rod_log, "Al_rod", world, false, 1); // -100 - - - - /* For helisol: */ /* - const G4double Zplan[2]={140*mm, 670*mm}; // if first silicons are at 150mm to target (helisol.detector) - //const G4double Zplan[2]={90*mm, 620*mm}; // if first silicon at 100mm to target (helisol_2.detector) - //const G4double Zplan[2]={40*mm, 570*mm}; // if first silicon at 50mm to target (helisol_3.detector) - const G4double Rinner[2]={15*mm, 15*mm}; - const G4double Router[2]={24*mm, 24*mm}; - G4Polyhedra* Al_rod= new G4Polyhedra("Al_rod", 0., 360*deg, 6, 2, Zplan, Rinner, Router); - - G4LogicalVolume* Al_rod_log = new G4LogicalVolume(Al_rod, Aluminium, "Al_rod", 0, 0, 0); - - G4RotationMatrix* RotZ30Y180 = new G4RotationMatrix(); - RotZ30Y180->rotateY(180*deg); - RotZ30Y180->rotateZ(30*deg); - G4RotationMatrix* RotZ30 = new G4RotationMatrix(); - RotZ30->rotateZ(30*deg); - - new G4PVPlacement(RotZ30, G4ThreeVector(0.,0., 0.), Al_rod_log, "Al_rod", world, false, 0); - new G4PVPlacement(RotZ30Y180, G4ThreeVector(0.,0., 0.), Al_rod_log, "Al_rod", world, false, 1); - */ - - // - // Add the Aluminium chamber - // - G4double Al_chamber_rmin = 50. * cm; - G4double Al_chamber_rmax = 50.5 * cm; - G4double Al_chamber_z = 100.0 * cm; - - //G4Tubs* Al_chamber_tub - // = new G4Tubs("Al_chamber_tub", Al_chamber_rmin, Al_chamber_rmax, Al_chamber_z, 0.*deg, 180*deg); - G4Tubs* Al_chamber_tub - = new G4Tubs("Al_chamber_tub", Al_chamber_rmin, Al_chamber_rmax, Al_chamber_z, 0.*deg, 360*deg); - - G4LogicalVolume* Al_chamber_log = new G4LogicalVolume(Al_chamber_tub, Aluminium, "Al_chamber", 0, 0, 0); - - G4RotationMatrix* RotZ = new G4RotationMatrix(); - RotZ->rotateZ(-90*deg); - - new G4PVPlacement(RotZ, G4ThreeVector(0.,0.,0.), Al_chamber_log, "Al_chamber", world, false, 0); - - - //G4VisAttributes* VisAtt1 = new G4VisAttributes(G4Colour(0.2, 0.5, 0.8)); - //Al_rod_log->SetVisAttributes(VisAtt1); - //G4VisAttributes* VisAtt2 = new G4VisAttributes(G4Colour(0., 0.5, 0.3)); - //Al_chamber_log->SetVisAttributes(VisAtt2); - - // - // Silicon mother volume (vacuum) - // - G4String Name = "HeliosDummyShape" + DetectorNumber ; - - G4Box* solidHeliosDummyShape = new G4Box(Name, 0.5*FaceFrontWidth, 0.5*FaceFrontLength, 0.5*Thickness); - G4LogicalVolume* logicHeliosDummyShape = new G4LogicalVolume(solidHeliosDummyShape, Vacuum, Name, 0, 0, 0); - - new G4PVPlacement(G4Transform3D(*MMrot, MMpos) , - logicHeliosDummyShape , - Name , - world , - false , - 0); - - logicHeliosDummyShape->SetVisAttributes(G4VisAttributes::Invisible); - //logicHeliosDummyShape->SetVisAttributes(G4VisAttributes(G4Colour(1, 0., 0.0))); // red - //if (m_non_sensitive_part_visiualisation) logicHeliosDummyShape->SetVisAttributes(G4VisAttributes(G4Colour(0.90, 0.90, 0.90))); - - - // Adding front Al layer for helisol - /* - G4Box* solidAlLayer = new G4Box("AlLayer", 0.5*FaceFrontWidth, 0.5*FaceFrontLength, 0.5*AlThickness); - G4LogicalVolume* logicAlLayer = new G4LogicalVolume(solidAlLayer, Aluminium, "AlLayer", 0, 0, 0); - - new G4PVPlacement(0, - G4ThreeVector(0.,0., +0.5*FirstStageThickness+0.5*AlThickness), - logicAlLayer, - "AlLayer", - logicHeliosDummyShape, - false, - 0); - - logicAlLayer->SetVisAttributes(G4VisAttributes(G4Colour(0, 200, 200))); // green - */ - - //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*FirstStageFaceWidth, 0.5*FirstStageFaceLength, 0.5*FirstStageThickness); - G4LogicalVolume* logicFirstStage = new G4LogicalVolume(solidFirstStage, Silicon, "logicFirstStage", 0, 0, 0); - - new G4PVPlacement(0, - positionFirstStage, - logicFirstStage, -// "G" + DetectorNumber + "FirstStage", - Name + "_FirstStage", - logicHeliosDummyShape, - false, - 0); - - // Set First Stage sensible - logicFirstStage->SetSensitiveDetector(m_FirstStageScorer); - - ///Visualisation of FirstStage Strip - G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(1., 0., 0.)); // red - logicFirstStage->SetVisAttributes(FirstStageVisAtt); - - - /* - G4Box* solidFirstStageframeIn = new G4Box("solidFirstStageframeIn", 0.5*FaceFront, 0.5*FaceFront, 0.5*1*mm); - G4Box* solidFirstStageframeOut = new G4Box("solidFirstStageframeOut", 0.5*FirstStageFace, 0.5*FirstStageFace, 0.5*1.1*mm); - G4SubtractionSolid* solidFirstStagePCB = new G4SubtractionSolid("solidFirstStagePCB",solidFirstStageframeIn, solidFirstStageframeOut, 0, G4ThreeVector(0.,0.,0.)); - G4LogicalVolume* logicFirstStagePCB = new G4LogicalVolume(solidFirstStagePCB, PCB, "logicFirstStagePCB", 0, 0, 0); - - G4ThreeVector positionFirstStagePCB(0.,0.,-0.5*Length+0.5*1*mm); - PVPBuffer = new G4PVPlacement(0, - positionFirstStagePCB, - logicFirstStagePCB, -// "G" + DetectorNumber + "FirstStage", - Name + "_FirstStagePCB", - logicHeliosDummyShape, - false, - 0); - - - ///Visualisation of FirstStage Strip - G4VisAttributes* FirstStagePCBVisAtt = new G4VisAttributes(G4Colour(0., 0.8, 0.5)); // green - logicFirstStagePCB->SetVisAttributes(FirstStagePCBVisAtt); - */ - - } - - - -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Virtual Method of NPS::VDetector class - -// Read stream at Configfile to pick-up parameters of detector (Position,...) -// Called in DetecorConstruction::ReadDetextorConfiguration Method -void HeliosDetDummyShape::ReadConfiguration(NPL::InputParser parser){ - vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("HeliosDummyShape"); - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << "//// " << blocks.size() << " detectors found " << endl; - - // Cartesian Case - vector<string> cart = {"X1_Y1","X1_Y128","X128_Y1","X128_Y128"}; - // Spherical Case - vector<string> sphe= {"R","THETA","PHI","BETA"}; - - for(unsigned int i = 0 ; i < blocks.size() ; i++){ - - if(blocks[i]->HasToken("MField")){ - double Bz = blocks[i]->GetDouble("MField","T"); - MyMagneticField* myField = new MyMagneticField(G4ThreeVector(0.,0.,Bz)); - - G4FieldManager* fieldMgr - = G4TransportationManager::GetTransportationManager() - ->GetFieldManager(); - fieldMgr->SetDetectorField(myField); - fieldMgr->CreateChordFinder(myField); - } - if(blocks[i]->HasTokenList(cart)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Helios " << i+1 << endl; - - G4ThreeVector A = NPS::ConvertVector(blocks[i]->GetTVector3("X1_Y1","mm")); - G4ThreeVector B = NPS::ConvertVector(blocks[i]->GetTVector3("X128_Y1","mm")); - G4ThreeVector C = NPS::ConvertVector(blocks[i]->GetTVector3("X1_Y128","mm")); - G4ThreeVector D = NPS::ConvertVector(blocks[i]->GetTVector3("X128_Y128","mm")); - AddModule(A,B,C,D,true) ; - } - - else if(blocks[i]->HasTokenList(sphe)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Helios " << i+1 << endl; - - double Theta = blocks[i]->GetDouble("THETA","deg"); - double Phi= blocks[i]->GetDouble("PHI","deg"); - double R = blocks[i]->GetDouble("R","mm"); - vector<double> beta = blocks[i]->GetVectorDouble("BETA","deg"); - AddModule(Theta,Phi,R,beta[0],beta[1],beta[2],true); - } - - else{ - cout << "ERROR: Missing token for M2Telescope blocks, check your input file" << endl; - exit(1); - } - } -} - -// Construct detector and inialise sensitive part. -// Called After DetecorConstruction::AddDetector Method -void HeliosDetDummyShape::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 ; - - 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(); - - // G4double MMscal = MMu.dot(MMv); - - MMw = MMu.cross(MMv); -// if (MMw.z() > 0) MMw = MMv.cross(MMu) ; - MMw = MMw.unit(); - - MMCenter = (m_X1_Y1[i] + m_X1_Y128[i] + m_X128_Y1[i] + m_X128_Y128[i]) / 4; - - // Passage Matrix from Lab Referential to Telescope Referential - // MUST2 - MMrot = new G4RotationMatrix(MMu, MMv, MMw); - // translation to place Telescope - MMpos = MMw * Thickness * 0.5 + MMCenter; - - - //cout << "MMposX= " << MMpos.getX() << " MMposY= " << MMpos.getY() << " MMposZ= " << MMpos.getZ() << endl; - //cout << "MMposX= " << MMpos.getX() << " MMposY= " << MMpos.getY() << " MMposZ= " << MMpos.getZ() << endl; - - - - } - - // 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 * Thickness * 0.5 + CT ; - } - - FirstStage = m_wFirstStage[i] ; - - VolumeMaker(i + 1, MMpos, MMrot, FirstStage, world); - } - - delete MMrot ; -} - - - -// Connect the GaspardTrackingData class to the output TTree -// of the simulation -void HeliosDetDummyShape::InitializeRootOutput() -{ -} - - - -// Set the TinteractionCoordinates object from NPS::VDetector to the present class -void HeliosDetDummyShape::SetInterCoordPointer(TInteractionCoordinates* interCoord) -{ - ms_InterCoord = interCoord; -} - - - -// Read sensitive part and fill the Root tree. -// Called at in the EventAction::EndOfEventAvtion -void HeliosDetDummyShape::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; - - NPS::HitsMap<G4int>* DetectorNumberHitMap; - NPS::HitsMap<G4double>* EnergyHitMap; - NPS::HitsMap<G4double>* TimeHitMap; - NPS::HitsMap<G4double>* XHitMap; // X strip id - NPS::HitsMap<G4double>* YHitMap; // Y strip id - NPS::HitsMap<G4double>* PosXHitMap; - NPS::HitsMap<G4double>* PosYHitMap; - NPS::HitsMap<G4double>* PosZHitMap; - NPS::HitsMap<G4double>* AngThetaHitMap; - NPS::HitsMap<G4double>* AngPhiHitMap; - - - // Read the Scorer associate to the Silicon Strip - //Detector Number - G4int StripDetCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHeliosDummyShape/DetectorNumber") ; - DetectorNumberHitMap = (NPS::HitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripDetCollectionID)) ; - DetectorNumber_itr = DetectorNumberHitMap->GetMap()->begin() ; - - //Energy - G4int StripEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHeliosDummyShape/StripEnergy") ; - EnergyHitMap = (NPS::HitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripEnergyCollectionID)) ; - Energy_itr = EnergyHitMap->GetMap()->begin() ; - - //Time of Flight - G4int StripTimeCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHeliosDummyShape/StripTime") ; - TimeHitMap = (NPS::HitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripTimeCollectionID)) ; - Time_itr = TimeHitMap->GetMap()->begin() ; - - //Strip Number X - G4int StripXCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHeliosDummyShape/StripIDFront") ; - XHitMap = (NPS::HitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripXCollectionID)) ; - X_itr = XHitMap->GetMap()->begin() ; - - //Strip Number Y - G4int StripYCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHeliosDummyShape/StripIDBack"); - YHitMap = (NPS::HitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripYCollectionID)) ; - Y_itr = YHitMap->GetMap()->begin() ; - - //Interaction Coordinate X - G4int InterCoordXCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHeliosDummyShape/InterCoordX") ; - PosXHitMap = (NPS::HitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordXCollectionID)) ; - Pos_X_itr = PosXHitMap->GetMap()->begin() ; - - //Interaction Coordinate Y - G4int InterCoordYCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHeliosDummyShape/InterCoordY") ; - PosYHitMap = (NPS::HitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordYCollectionID)) ; - Pos_Y_itr = PosYHitMap->GetMap()->begin() ; - - //Interaction Coordinate Z - G4int InterCoordZCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHeliosDummyShape/InterCoordZ") ; - PosZHitMap = (NPS::HitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordZCollectionID)) ; - Pos_Z_itr = PosXHitMap->GetMap()->begin() ; - - //Interaction Coordinate Angle Theta - G4int InterCoordAngThetaCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHeliosDummyShape/InterCoordAngTheta") ; - AngThetaHitMap = (NPS::HitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordAngThetaCollectionID)) ; - Ang_Theta_itr = AngThetaHitMap->GetMap()->begin() ; - - //Interaction Coordinate Angle Phi - G4int InterCoordAngPhiCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("FirstStageScorerHeliosDummyShape/InterCoordAngPhi") ; - AngPhiHitMap = (NPS::HitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordAngPhiCollectionID)) ; - Ang_Phi_itr = AngPhiHitMap->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(); - - - //G4cout << "sizeN:" << sizeN << G4endl; - - - if (sizeE != sizeT || sizeT != sizeX || sizeX != sizeY) { - //G4cout << "sizeE:" << sizeE << G4endl; - //G4cout << "sizeT:" << sizeT << G4endl; - //G4cout << "sizeX:" << sizeX << G4endl; - //G4cout << "sizeY:" << sizeY << G4endl; - //G4cout << "No match size Si Event Map: sE:" - // << sizeE << " sT:" << sizeT << " sX:" << sizeX << " sY:" << sizeY << G4endl ; - return; - } - - // Loop on FirstStage number - for (G4int l = 0; l < sizeN; l++) { - G4int N = *(DetectorNumber_itr->second); - G4int NTrackID = DetectorNumber_itr->first - N; - - //G4cout <<"N:" <<N << G4endl; - //G4cout <<"DetectorNumber_itr->first:" << DetectorNumber_itr->first << G4endl; - //G4cout <<"NTrackID:" <<NTrackID << G4endl; - - - if (N > 0) { - // Fill detector number - ms_Event->SetHeliosFirstStageEDetectorNbr(m_index["DummyShape"] + N); - ms_Event->SetHeliosFirstStageTDetectorNbr(m_index["DummyShape"] + N); - - // Energy - Energy_itr = EnergyHitMap->GetMap()->begin(); - for (G4int ll = 0 ; ll < sizeE ; ll++) { - G4int ETrackID = Energy_itr->first - N; - G4double E = *(Energy_itr->second); - - if (ETrackID == NTrackID) { - ms_Event->SetHeliosFirstStageEEnergy(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->SetHeliosFirstStageTTime(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->SetHeliosFirstStageEStripNbr(int(X)); - ms_Event->SetHeliosFirstStageTStripNbr(int(X)); - //ms_Event->SetHeliosFirstStageEStripTNbr(X); - //ms_Event->SetHeliosFirstStageTStripTNbr(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->SetHeliosFirstStageEStripNbr(int(X)); - //ms_Event->SetHeliosFirstStageTStripNbr(int(X)); - ms_Event->SetHeliosFirstStageEStripLNbr(Y); - ms_Event->SetHeliosFirstStageTStripLNbr(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(RandGauss::shoot(PosZ, ResoFirstStage)) ; // for helios !!!! - } - 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++; - } - - } - 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(); - -} - - - -void HeliosDetDummyShape::InitializeScorers() -{ - bool already_exist = false; - // First stage Associate Scorer - m_FirstStageScorer = NPS::VDetector::CheckScorer("FirstStageScorerHeliosDummyShape",already_exist); - if(already_exist) return; - - - G4VPrimitiveScorer* DetNbr = new OBSOLETEGENERALSCORERS::PSDetectorNumber("DetectorNumber", "HeliosDummyShape", 0); - G4VPrimitiveScorer* TOF = new OBSOLETEGENERALSCORERS::PSTOF("StripTime","HeliosDummyShape", 0); - G4VPrimitiveScorer* InteractionCoordinatesX = new OBSOLETEGENERALSCORERS::PSInteractionCoordinatesX("InterCoordX","HeliosDummyShape", 0); - G4VPrimitiveScorer* InteractionCoordinatesY = new OBSOLETEGENERALSCORERS::PSInteractionCoordinatesY("InterCoordY","HeliosDummyShape", 0); - G4VPrimitiveScorer* InteractionCoordinatesZ = new OBSOLETEGENERALSCORERS::PSInteractionCoordinatesZ("InterCoordZ","HeliosDummyShape", 0); - G4VPrimitiveScorer* InteractionCoordinatesAngleTheta = new OBSOLETEGENERALSCORERS::PSInteractionCoordinatesAngleTheta("InterCoordAngTheta","HeliosDummyShape", 0); - G4VPrimitiveScorer* InteractionCoordinatesAnglePhi = new OBSOLETEGENERALSCORERS::PSInteractionCoordinatesAnglePhi("InterCoordAngPhi","HeliosDummyShape", 0); - G4VPrimitiveScorer* Energy = new HeliosScorerFirstStageEnergy("StripEnergy", "HeliosDummyShape", 0); -// G4VPrimitiveScorer* StripPositionX = new HeliosScorerFirstStageFrontStripDummyShape("StripIDFront", 0, NumberOfTStrips); // X <=> transversal (ie: _|_ to z) -// G4VPrimitiveScorer* StripPositionY = new HeliosScorerFirstStageBackStripDummyShape("StripIDBack", 0, NumberOfLStrips); // Y <=> longitudinal (ie: // to z) - G4VPrimitiveScorer* StripPositionX = new HeliosScorerFirstStageFrontStripDummyShape("StripIDFront", 0, NumberOfStrips); - G4VPrimitiveScorer* StripPositionY = new HeliosScorerFirstStageBackStripDummyShape("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); - - - - - // Add All Scorer to the Global Scorer Manager - G4SDManager::GetSDMpointer()->AddNewDetector(m_FirstStageScorer); -} diff --git a/NPSimulation/Detectors/Helios/HeliosDetDummyShape.hh b/NPSimulation/Detectors/Helios/HeliosDetDummyShape.hh deleted file mode 100644 index 531411866114c3bb65a2a7827495a69f07ad20c0..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Helios/HeliosDetDummyShape.hh +++ /dev/null @@ -1,219 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2016 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: Marc Labiche contact address: marc.labiche@stfc.ac.uk * - * * - * Creation Date : 31/01/12 * - * Last update : 31/08/15 * - *---------------------------------------------------------------------------* - * Decription: Define a dummy module for the Helios detector * - * The goal of this class is to be a starting point to create a * - * new shape to be added to the Helios detector. * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -#ifndef HeliosDetDummyShape_h -#define HeliosDetDummyShape_h 1 - -// C++ headers -#include <vector> - -// NPTool header -#include "HeliosModule.hh" -#include "TInteractionCoordinates.h" -#include "NPInputParser.h" -using namespace std; -using namespace CLHEP; - - - -class HeliosDetDummyShape : public HeliosModule -{ - //////////////////////////////////////////////////// - /////// Default Constructor and Destructor ///////// - //////////////////////////////////////////////////// -public: - HeliosDetDummyShape(); - virtual ~HeliosDetDummyShape(); - - //////////////////////////////////////////////////// - //////// Specific Function of this Class /////////// - //////////////////////////////////////////////////// -public: - // By Position Method - void AddModule(G4ThreeVector TL , - G4ThreeVector BL , - G4ThreeVector BR , - G4ThreeVector CT , - bool wFirstStage ); - - // By Angle Method - void AddModule(G4double R , - G4double Theta , - G4double Phi , - G4double beta_u , - G4double beta_v , - G4double beta_w , - bool wFirstStage ); - - // 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 , - G4LogicalVolume* world); - - - //////////////////////////////////////////////////// - //// Inherite from HeliosModule class ///// - //////////////////////////////////////////////////// -public: - // Read stream at Configfile to pick-up parameters of detector (Position,...) - // Called in DetecorConstruction::ReadDetextorConfiguration Method - void ReadConfiguration(NPL::InputParser); - - // 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 NPS::VDetector to the classes - // deriving from HeliosModule - // This is mandatory since the Helios*** does not derive from NPS::VDetector - void SetInterCoordPointer(TInteractionCoordinates* interCoord); - TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; - - - //////////////////////////////////////////////////// - ///////////////Private intern Data////////////////// - //////////////////////////////////////////////////// -private: - // Interaction Coordinates coming from NPS::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 HELIOSDUMMYSHAPE -{ - // Resolution - - const G4double ResoFirstStage = 0.0170; // = 40 keV of Resolution <=> Helios range is 25 to 55 keV resolution // Unit is MeV/2.35 -// const G4double ResoFirstStage = 0.0085; // = 20 keV of Resolution // Unit is MeV/2.35 - const G4double ResoTimeGpd = 0.4255; // = 1ns // 0.212765957;// = 500ps // Unit is ns/2.35 - //const G4double ResoFirstStage = 0.; // = detector energy resolution is taken care in the analysis code !!!! - //const G4double ResoTimeGpd = 0.; // = 1ns // 0.212765957;// = 500ps // Unit is ns/2.35 - //const G4double ResoPosZ = 0.; // = detector energy resolution is taken care in the analysis code !!!! - const G4double ResoPosZ = 0.4255;// = 1mm for Helios // Unit is mm/2.35 - - // Geometry for the mother volume containing the different layers of your dummy shape module - // Note : dimension has to be the same as the sensitive volume otherwise there are issues with the NPAnalysis/Helios - - /* For Helisol : - //const G4double FaceFrontWidth = 22.*mm; // for helisol - const G4double FaceFrontWidth = 24.*mm; // for helisol - const G4double FaceFrontLength = 125*mm; // for helisol - //const G4double FaceBackWidth = 22.*mm; // for helisol - const G4double FaceBackWidth = 24.*mm; // for helisol - const G4double FaceBackLength = 125*mm; // for helisol - const G4double Thickness = 1.002*mm; // ie: thickness 1 mm + 2um - const G4double InterStageDistance = 2.5*mm; // for helisol - - //const G4double AlThickness = 0.001*mm; // ie: thickness 1um - const G4double AlThickness = 0.00055*mm; // ie: thickness 0.55um - //const G4double AlThickness = 0.00015*mm; // ie: thickness 0.15um - */ - - /* For helios: */ - const G4double FaceFrontWidth = 1.2*cm; // for helios - const G4double FaceFrontLength = 5.6*cm; // for helios - const G4double FaceBackWidth = 1.2*cm; // for helios - const G4double FaceBackLength = 5.6*cm; // for helios - const G4double Thickness = 1.*mm; // for helios - const G4double InterStageDistance = 5*mm; // for helios - - - // for testing the excitation energy reconstruction -// const G4double Length = 4*cm; -// const G4double InterStageDistance = 15*mm; - - // First stage - - /* For Helisol : - //const G4double FirstStageFaceWidth = 20*mm; // for helisol50.6 - //const G4int NumberOfLStrips = 10; // 2 mm strip pitch for strips parallel to beam axis - const G4double FirstStageFaceWidth = 22*mm; // for helisol54 - const G4int NumberOfLStrips = 11; // if 2 mm strip pitch for strips parallel to beam axis - //const G4int NumberOfLStrips = 22; // if 1 mm strip pitch for strips parallel to beam axis - //const G4double FirstStageFaceWidth = 24*mm; // for helisol57.5 - //const G4int NumberOfLStrips = 12; // 2 mm strip pitch for strips parallel to beam axis - - const G4double FirstStageFaceLength = 125*mm; // for helisol - const G4double FirstStageThickness = 1000*micrometer; // for helisol - */ - /* For helios: */ - const G4double FirstStageFaceWidth = 0.9*cm; // for helios - const G4double FirstStageFaceLength = 5.05*cm; // for helios - //const G4double FirstStageThickness = 1000*micrometer; // for helios - const G4double FirstStageThickness = 700*micrometer; -// const G4double FirstStageThickness = 2*mm; -// for testing the excitation energy reconstruction -// const G4double FirstStageThickness = 1.3*cm; - - const G4int NumberOfStrips = 1; // PSD resistive strip - -// const G4int NumberOfStrips = 250; // PSD resistive strip -// const G4int NumberOfLStrips = 22; // 1 mm strip pitch for strips parallel to beam axis -// const G4int NumberOfTStrips = 250; // .5 mm strip pitch for strips perpendicular to beam axis -// const G4int NumberOfLStrips = 22; // 1 mm strip pitch for strips parallel to beam axis -// const G4int NumberOfLStrips = 11; // 2 mm strip pitch for strips parallel to beam axis -// const G4int NumberOfTStrips = 128; // ~1. mm strip pitch for strips perpendicular to beam axis -// const G4int NumberOfTStrips = 25; // 1. mm strip pitch for strips perpendicular to beam axis -// const G4int NumberOfTStrips = 62; // 2. mm strip pitch for strips perpendicular to beam axis - - - // Starting at the front of the first stage and going to the third stage - //const G4double FirstStage_PosZ = Thickness* -0.5 + 0.5*FirstStageThickness; - const G4double FirstStage_PosZ = 0.; -} - -#endif diff --git a/NPSimulation/Detectors/Helios/HeliosModule.cc b/NPSimulation/Detectors/Helios/HeliosModule.cc deleted file mode 100644 index 7a58ac6991e252de04023a04d000c775525cff34..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Helios/HeliosModule.cc +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2016 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: Marc Labiche contact address: marc.labiche@stfc.ac.uk * - * * - * Creation Date : 31/01/12 * - * Last update : 31/08/15 * - *---------------------------------------------------------------------------* - * Decription: This class is an Abstract Base Class (ABC) from which should * - * derive all different modules from the Helios detector. * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -#include "HeliosModule.hh" -#include "RootOutput.h" - - -THeliosData *HeliosModule::ms_Event = 0; - - - -HeliosModule::HeliosModule() -{ - if (ms_Event == 0) ms_Event = new THeliosData(); - - InitializeRootOutput(); - InitializeIndex(); -} - - - -HeliosModule::~HeliosModule() -{ -} - - - -void HeliosModule::InitializeRootOutput() -{ - RootOutput *pAnalysis = RootOutput::getInstance(); - TTree *pTree = pAnalysis->GetTree(); - // if the branch does not exist yet, create it - if (!pTree->FindBranch("HELIOS")) - pTree->Branch("HELIOS", "THeliosData", &ms_Event); - - pTree->SetBranchAddress("HELIOS", &ms_Event); - -} - - - -void HeliosModule::InitializeIndex() -{ - // m_index["Square"] = 0; - // m_index["Trapezoid"] = 100; - // m_index["Annular"] = 200; - m_index["DummyShape"] = 1000; -} diff --git a/NPSimulation/Detectors/Helios/HeliosModule.hh b/NPSimulation/Detectors/Helios/HeliosModule.hh deleted file mode 100644 index e3d805e851d85262df72cddb7c09da64cc115ab1..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Helios/HeliosModule.hh +++ /dev/null @@ -1,96 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2016 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: Marc Labiche contact address: marc.labiche@stfc.ac.uk * - * * - * Creation Date : 31/01/12 * - * Last update : 31/08/15 * - *---------------------------------------------------------------------------* - * Decription: This class is an Abstract Base Class (ABC) from which should * - * derive all different modules from the Helios detector. * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -#ifndef HeliosModule_h -#define HeliosModule_h 1 - -// C++ headers -#include <string> -#include <vector> - -// G4 headers -#include "G4LogicalVolume.hh" -#include "G4Event.hh" -#include "G4MultiFunctionalDetector.hh" - -// NPTool - ROOT headers -#include "TInteractionCoordinates.h" -#include "THeliosData.h" -#include "NPInputParser.h" -using namespace std; -using namespace CLHEP; - - - -class HeliosModule -{ -public: - HeliosModule(); - virtual ~HeliosModule(); - -public: - // Read stream at Configfile to pick-up parameters of detector (Position,...) - virtual void ReadConfiguration(NPL::InputParser) = 0; - - // Construct detector and inialise sensitive part. - virtual void ConstructDetector(G4LogicalVolume* world) = 0; - - // Read sensitive part of a the HeliosModule 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 NPS::VDetector to the classes - // deriving from HeliosModule - // This is mandatory since the Helios*** does not derive from NPS::VDetector - virtual void SetInterCoordPointer(TInteractionCoordinates* interCoord) = 0; - virtual TInteractionCoordinates* GetInterCoordPointer() = 0; - - // Initialize the Index map for the different modules of Gaspard - void InitializeIndex(); - -public: - THeliosData* GetEventPointer() {return ms_Event;}; - -protected: - // Class to store the result of simulation - static THeliosData* ms_Event; - - // Set to true if you want this stage on you telescope - vector<bool> m_wFirstStage; - - // 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; - - -protected: - map<string, int> m_index; -}; - -#endif diff --git a/NPSimulation/Detectors/Helios/HeliosScorers.cc b/NPSimulation/Detectors/Helios/HeliosScorers.cc deleted file mode 100644 index 169488b69190c44e7dcd13e05d5a736fae733d3c..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Helios/HeliosScorers.cc +++ /dev/null @@ -1,240 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2016 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: Marc Labiche contact address: marc.labiche@stfc.ac.uk * - * * - * Creation Date : 31/01/12 * - * Last update : 31/08/15 * - *---------------------------------------------------------------------------* - * Decription: This class holds all the scorers needed by the * - * Helios*** objects. * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -// G4 headers -#include "G4UnitsTable.hh" - -// NPTool headers -#include "ObsoleteGeneralScorers.hh" -#include "HeliosScorers.hh" - -#include "HeliosDetDummyShape.hh" - -using namespace HELIOSDUMMYSHAPE; - -//....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) -HeliosScorerFirstStageEnergy::HeliosScorerFirstStageEnergy(G4String name, G4String volumeName, G4int depth) - : G4VPrimitiveScorer(name, depth), HCID(-1) -{ - m_VolumeName = volumeName; -} - -HeliosScorerFirstStageEnergy::~HeliosScorerFirstStageEnergy() -{ -} - -G4bool HeliosScorerFirstStageEnergy::ProcessHits(G4Step* aStep, G4TouchableHistory*) -{ - // get detector number - int DetNbr = OBSOLETEGENERALSCORERS::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 < 100*keV) return FALSE; - if (edep < 100*eV) return FALSE; // modified by mMarc - G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->add(DetNbr + index, edep); - return TRUE; -} - -void HeliosScorerFirstStageEnergy::Initialize(G4HCofThisEvent* HCE) -{ - EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName()); - if (HCID < 0) { - HCID = GetCollectionID(0); - } - HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); -} - -void HeliosScorerFirstStageEnergy::EndOfEvent(G4HCofThisEvent*) -{ -} - -void HeliosScorerFirstStageEnergy::Clear() -{ - EvtMap->clear(); -} - -void HeliosScorerFirstStageEnergy::DrawAll() -{ -} - -void HeliosScorerFirstStageEnergy::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 -HeliosScorerFirstStageFrontStripDummyShape::HeliosScorerFirstStageFrontStripDummyShape(G4String name, G4int depth, G4int NumberOfStrip) - : G4VPrimitiveScorer(name, depth), HCID(-1) -{ - m_NumberOfStrip = NumberOfStrip ; -} - -HeliosScorerFirstStageFrontStripDummyShape::~HeliosScorerFirstStageFrontStripDummyShape() -{ -} - -G4bool HeliosScorerFirstStageFrontStripDummyShape::ProcessHits(G4Step* aStep, G4TouchableHistory*) -{ - // get detector number - int DetNbr = OBSOLETEGENERALSCORERS::PickUpDetectorNumber(aStep, "HeliosDummyShape"); - - // get front strip number - G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); - POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); - - G4double StripPitch = HELIOSDUMMYSHAPE::FirstStageFaceLength / m_NumberOfStrip; // transversal strip - - G4double temp = (POS(1) + HELIOSDUMMYSHAPE::FirstStageFaceLength / 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 < 100*keV) return FALSE; - if (edep < 100*eV) return FALSE; // modified by mMarc - G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->set(DetNbr + index, X); - return TRUE; -} - -void HeliosScorerFirstStageFrontStripDummyShape::Initialize(G4HCofThisEvent* HCE) -{ - EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName()); - if (HCID < 0) { - HCID = GetCollectionID(0); - } - HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); -} - -void HeliosScorerFirstStageFrontStripDummyShape::EndOfEvent(G4HCofThisEvent*) -{ -} - -void HeliosScorerFirstStageFrontStripDummyShape::Clear() -{ - EvtMap->clear(); -} - -void HeliosScorerFirstStageFrontStripDummyShape::DrawAll() -{ -} - -void HeliosScorerFirstStageFrontStripDummyShape::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 -HeliosScorerFirstStageBackStripDummyShape::HeliosScorerFirstStageBackStripDummyShape(G4String name, G4int depth, G4int NumberOfStrip) - : G4VPrimitiveScorer(name, depth), HCID(-1) -{ - m_NumberOfStrip = NumberOfStrip ; -} - -HeliosScorerFirstStageBackStripDummyShape::~HeliosScorerFirstStageBackStripDummyShape() -{ -} - -G4bool HeliosScorerFirstStageBackStripDummyShape::ProcessHits(G4Step* aStep, G4TouchableHistory*) -{ - // get detector number - int DetNbr = OBSOLETEGENERALSCORERS::PickUpDetectorNumber(aStep, "HeliosDummyShape"); - - // get back strip number - G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); - POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); - - G4double StripPitch = HELIOSDUMMYSHAPE::FirstStageFaceWidth / m_NumberOfStrip; // longitudinal strip - - G4double temp = (POS(0) + HELIOSDUMMYSHAPE::FirstStageFaceWidth / 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 < 100*keV) return FALSE; - if (edep < 100*eV) return FALSE; // modified by mMarc - G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->set(DetNbr + index, X); - return TRUE; -} - -void HeliosScorerFirstStageBackStripDummyShape::Initialize(G4HCofThisEvent* HCE) -{ - EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName()); - if (HCID < 0) { - HCID = GetCollectionID(0); - } - HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); -} - -void HeliosScorerFirstStageBackStripDummyShape::EndOfEvent(G4HCofThisEvent*) -{ -} - -void HeliosScorerFirstStageBackStripDummyShape::Clear() - -{ - EvtMap->clear(); -} - -void HeliosScorerFirstStageBackStripDummyShape::DrawAll() -{ -} - -void HeliosScorerFirstStageBackStripDummyShape::PrintAll() -{ - G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl ; - G4cout << " PrimitiveScorer " << GetName() << G4endl ; - G4cout << " Number of entries " << EvtMap->entries() << G4endl ; -} - - - diff --git a/NPSimulation/Detectors/Helios/HeliosScorers.hh b/NPSimulation/Detectors/Helios/HeliosScorers.hh deleted file mode 100644 index 188d421f808fdd0eab2269aa316bbf2b40c0f2ba..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Helios/HeliosScorers.hh +++ /dev/null @@ -1,112 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2016 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: Marc Labiche contact address: marc.labiche@stfc.ac.uk * - * * - * Creation Date : 31/01/12 * - * Last update : 31/08/15 * - *---------------------------------------------------------------------------* - * Decription: This class holds all the scorers needed by the * - * Helios*** objects. * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ - -#ifndef HELIOSScorer_h -#define HELIOSScorer_h 1 - -#include "G4VPrimitiveScorer.hh" -#include "G4THitsMap.hh" - -namespace HELIOSSCORERS -{ - -class HeliosScorerFirstStageEnergy : public G4VPrimitiveScorer -{ -public: // with description - HeliosScorerFirstStageEnergy(G4String name, G4String volumeName, G4int depth = 0); - virtual ~HeliosScorerFirstStageEnergy(); - -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 HeliosScorerFirstStageFrontStripDummyShape : public G4VPrimitiveScorer -{ -public: // with description - //HeliosScorerFirstStageFrontStripDummyShape(G4String name, G4int depth = 0, G4int NumberOfStrip = 128); - //HeliosScorerFirstStageFrontStripDummyShape(G4String name, G4int depth = 0, G4int NumberOfStrip = 250); // 0.5mm - HeliosScorerFirstStageFrontStripDummyShape(G4String name, G4int depth = 0, G4int NumberOfStrip = 128); // 1mm - //HeliosScorerFirstStageFrontStripDummyShape(G4String name, G4int depth = 0, G4int NumberOfStrip = 62); // 2mm - //HeliosScorerFirstStageFrontStripDummyShape(G4String name, G4int depth = 0, G4int NumberOfStrip = 25); // 5mm - virtual ~HeliosScorerFirstStageFrontStripDummyShape(); - -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 HeliosScorerFirstStageBackStripDummyShape : public G4VPrimitiveScorer -{ -public: // with description - //HeliosScorerFirstStageBackStripDummyShape(G4String name, G4int depth = 0, G4int NumberOfStrip = 128); - //HeliosScorerFirstStageBackStripDummyShape(G4String name, G4int depth = 0, G4int NumberOfStrip = 22); // 22x1mm - //HeliosScorerFirstStageBackStripDummyShape(G4String name, G4int depth = 0, G4int NumberOfStrip = 10); // 11x2mm for helisol50.6 - HeliosScorerFirstStageBackStripDummyShape(G4String name, G4int depth = 0, G4int NumberOfStrip = 11); // 11x2mm for helisol54 - //HeliosScorerFirstStageBackStripDummyShape(G4String name, G4int depth = 0, G4int NumberOfStrip = 12); // 12x2mm for helisol57.5 - virtual ~HeliosScorerFirstStageBackStripDummyShape(); - -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; -}; - - -} - -using namespace HELIOSSCORERS; -#endif diff --git a/NPSimulation/Detectors/Helios2/CMakeLists.txt b/NPSimulation/Detectors/Helios2/CMakeLists.txt deleted file mode 100644 index be643a240000abbfa578521714afe94b5a4442ec..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Helios2/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_library(NPSHelios2 SHARED Helios2.cc) -target_link_libraries(NPSHelios2 NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} NPHelios2) diff --git a/NPSimulation/Detectors/Helios2/Helios2.cc b/NPSimulation/Detectors/Helios2/Helios2.cc deleted file mode 100644 index aa2558c62d355add0ce918604f1ec05448417cc1..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Helios2/Helios2.cc +++ /dev/null @@ -1,404 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2016 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: Adrien Matta contact address: matta@lpccaen.in2p3.fr * - * * - * Creation Date : octobre 2016 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class describe Helios2 simulation * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - *****************************************************************************/ - -// C++ headers -#include <sstream> -#include <cmath> -#include <limits> -//G4 Geometry object -#include "G4Tubs.hh" -#include "G4Box.hh" -#include "G4SubtractionSolid.hh" - -//G4 sensitive -#include "G4SDManager.hh" -#include "G4MultiFunctionalDetector.hh" - -//G4 various object -#include "G4Material.hh" -#include "G4Transform3D.hh" -#include "G4PVPlacement.hh" -#include "G4VisAttributes.hh" -#include "G4Colour.hh" - -// G4 Field -#include "G4FieldManager.hh" -#include "G4MagneticField.hh" -#include "G4UniformMagField.hh" -#include "G4TransportationManager.hh" - -// NPTool header -#include "Helios2.hh" -#include "DSSDScorers.hh" -#include "InteractionScorers.hh" -#include "RootOutput.h" -#include "MaterialManager.hh" -#include "NPSDetectorFactory.hh" -#include "Target.hh" -#include "NPOptionManager.h" -// CLHEP header -#include "CLHEP/Random/RandGauss.h" - -using namespace std; -using namespace CLHEP; - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -namespace Helios2_NS{ - // Energy and time Resolution - const double EnergyThreshold = 100*keV; - const double ResoTime = 1*ns ; - const double ResoEnergyFront = 50*keV ; - const double ResoEnergyBack = 24*keV; - const double MagnetInnerRadius = 46*cm; - const double MagnetOutterRadius = 1*m; - const double MagnetLength = 2.35*m; - - const double SquareTubeSide = 16*mm; - const double SquareTubeExcess = 2.4*mm;// Wafer to Wafer distance - const double SquareTubeRadius = 5*mm; - const double WaferWidth = 12*mm ; - const double WaferLength = 56 *mm ; - const double ActiveWaferWidth = 9*mm ; - const double ActiveWaferLength = 50.5 *mm ; - const double AluThicness = 0.3*micrometer; - const double WaferThickness = 700* micrometer; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Helios2 Specific Method -Helios2::Helios2(){ - m_Event = new THelios2Data() ; - m_Helios2Scorer = 0; - m_SquareTube = 0; - m_SiliconWafer = 0; - m_ActiveWafer = 0; - m_Magnet = 0; - m_B=0; - - // RGB Color + Transparency - m_VisSquareTube = new G4VisAttributes(G4Colour(0.8, 0.8, 0.8, 0.5)); - m_VisPassiveSilicon = new G4VisAttributes(G4Colour(0.1, 0.1, 0.1, 1)); - m_VisSilicon = new G4VisAttributes(G4Colour(0.3, 0.3, 0.3, 1)); - m_VisMagnet = new G4VisAttributes(G4Colour(0, 0.5, 1, 0.3)); -} - -Helios2::~Helios2(){ -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void Helios2::AddHelios2(double Z, string Face){ - m_Z.push_back(Z); - m_Face.push_back(Face); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -G4LogicalVolume* Helios2::BuildSquareTube(){ - if(!m_SquareTube){ - G4Box* box = new G4Box("Helios2_Box",Helios2_NS::SquareTubeSide*0.5, - Helios2_NS::SquareTubeSide*0.5,0.5*(Helios2_NS::SquareTubeExcess+Helios2_NS::WaferLength)); - - G4Tubs* tubs = new G4Tubs("Helios2_Box",0,Helios2_NS::SquareTubeRadius, - (Helios2_NS::SquareTubeExcess+Helios2_NS::WaferLength),0,360*deg); - - - G4RotationMatrix* R = new G4RotationMatrix(); - G4ThreeVector P(0,0,0); - G4SubtractionSolid* sub = new G4SubtractionSolid("Helios2_Sub",box,tubs,R,P); - - G4Material* Al= MaterialManager::getInstance()->GetMaterialFromLibrary("Al"); - m_SquareTube= new G4LogicalVolume(sub,Al,"logic_Helios2_Box",0,0,0); - m_SquareTube->SetVisAttributes(m_VisSquareTube); - } - return m_SquareTube; -} -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -G4LogicalVolume* Helios2::BuildSiliconWafer(){ - if(!m_SiliconWafer){ - G4Box* box1 = new G4Box("Helios2_Box1",Helios2_NS::WaferWidth*0.5, - Helios2_NS::WaferThickness*0.5+Helios2_NS::AluThicness,Helios2_NS::WaferLength*0.5); - - G4Box* box2 = new G4Box("Helios2_Box2",Helios2_NS::ActiveWaferWidth*0.5, - Helios2_NS::WaferThickness*0.5,Helios2_NS::ActiveWaferLength*0.5); - - - G4Material* Si= MaterialManager::getInstance()->GetMaterialFromLibrary("Si"); - G4Material* Al= MaterialManager::getInstance()->GetMaterialFromLibrary("Al"); - - m_SiliconWafer= new G4LogicalVolume(box1,Al,"logic_Helios2_Wafer",0,0,0); - m_ActiveWafer= new G4LogicalVolume(box2,Si,"logic_Helios2_ActiveWafer",0,0,0); - - G4ThreeVector AWPos(0,0,0); - G4RotationMatrix* AWRot = new G4RotationMatrix(); - new G4PVPlacement(G4Transform3D(*AWRot,AWPos),m_ActiveWafer, - "Helios2_ActiveWafer",m_SiliconWafer, true, 0); - m_ActiveWafer->SetSensitiveDetector(m_Helios2Scorer); - - m_SiliconWafer->SetVisAttributes(m_VisPassiveSilicon); - m_ActiveWafer->SetVisAttributes(m_VisSilicon); - - } - - - return m_SiliconWafer; -} -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -G4LogicalVolume* Helios2::BuildMagnet(){ - if(!m_Magnet){ - G4Tubs* tubs1 = new G4Tubs("Helios2_MainFull",0, - Helios2_NS::MagnetOutterRadius,Helios2_NS::MagnetLength*0.5,0,360*deg); - - // Inner part of the Soleinoid minus the Target it self (placed in the world) - G4SubtractionSolid* tubs = new G4SubtractionSolid("Helios_Main", - tubs1, Target::GetTarget()->GetTargetSolid(), new G4RotationMatrix() ,Target::GetTarget()->GetTargetPosition()); - - G4Tubs* tubs2 = new G4Tubs("Helios2_Mag",Helios2_NS::MagnetInnerRadius, - Helios2_NS::MagnetOutterRadius,Helios2_NS::MagnetLength*0.5,0,360*deg); - - G4Material* Fe= MaterialManager::getInstance()->GetMaterialFromLibrary("Fe"); - G4Material* Vc= MaterialManager::getInstance()->GetMaterialFromLibrary("Vacuum"); - - m_Magnet= new G4LogicalVolume(tubs,Vc,"logic_Helios2_Main",0,0,0); - G4LogicalVolume* Mag = new G4LogicalVolume(tubs2,Fe,"logic_Helios2_Magnet",0,0,0); - - Mag->SetVisAttributes(m_VisMagnet); - m_Magnet->SetVisAttributes(G4VisAttributes::Invisible); - // Place the Solenoid - G4ThreeVector MagPos(0,0,0); - G4RotationMatrix* MagRot = new G4RotationMatrix(); - - new G4PVPlacement(G4Transform3D(*MagRot,MagPos), - Mag, - "Helios2_Magnet",m_Magnet,false,0); - - } - return m_Magnet; -} - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Virtual Method of NPS::VDetector class - -// Read stream at Configfile to pick-up parameters of detector (Position,...) -// Called in DetecorConstruction::ReadDetextorConfiguration Method -void Helios2::ReadConfiguration(NPL::InputParser parser ){ - vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("Helios2"); - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << "//// " << blocks.size() << " detectors found " << endl; - - vector<string> token = {"Z","Face"}; - - for(unsigned int i = 0 ; i < blocks.size() ; i++){ - if(blocks[i]->HasToken("MagneticField")) - m_B=blocks[i]->GetDouble("MagneticField","T"); - - if(blocks[i]->HasTokenList(token)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Helios2 " << i+1 << endl; - double Z = blocks[i]->GetDouble("Z","mm"); - string Face = blocks[i]->GetString("Face"); - AddHelios2(Z,Face); - } - - else{ - cout << "ERROR: check your input file formatting " << endl; - exit(1); - } - } -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -// Construct detector and inialise sensitive part. -// Called After DetecorConstruction::AddDetector Method -void Helios2::ConstructDetector(G4LogicalVolume* world){ - // Place the Solenoid - G4ThreeVector MagPos(0,0,0); - G4RotationMatrix* MagRot = new G4RotationMatrix(); - - new G4PVPlacement(G4Transform3D(*MagRot,MagPos), - BuildMagnet(), - "Helios2",world,false,0); - - // Add the Magnetic field - static G4FieldManager* fieldMgr = new G4FieldManager(); - G4MagneticField* magField = new G4UniformMagField(G4ThreeVector(0.,0.,m_B)); - fieldMgr->SetDetectorField(magField); - if(!fieldMgr->GetChordFinder()) - fieldMgr->CreateChordFinder(magField); - BuildMagnet()->SetFieldManager(fieldMgr,true); - - fieldMgr->SetMinimumEpsilonStep( 1*mm); - fieldMgr->SetMaximumEpsilonStep( 10*m ); - fieldMgr->SetDeltaOneStep( 1 * mm ); - - // Place detectors and support inside it - for (unsigned short i = 0 ; i < m_Z.size() ; i++) { - G4ThreeVector DetPos; - G4RotationMatrix* DetRot = NULL; - - if(m_Face[i]=="Up"){ - DetPos = G4ThreeVector(0,Helios2_NS::SquareTubeSide*0.5+1*mm,m_Z[i]); - DetRot = new G4RotationMatrix(); - } - else if(m_Face[i]=="Right"){ - DetPos = G4ThreeVector(Helios2_NS::SquareTubeSide*0.5+1*mm,0,m_Z[i]); - DetRot = new G4RotationMatrix(); - DetRot->rotateZ(90*deg); - } - else if(m_Face[i]=="Down"){ - DetPos = G4ThreeVector(0,-Helios2_NS::SquareTubeSide*0.5-1*mm,m_Z[i]); - DetRot = new G4RotationMatrix(); - DetRot->rotateZ(180*deg); - } - else if(m_Face[i]=="Left"){ - DetPos = G4ThreeVector(-Helios2_NS::SquareTubeSide*0.5-1*mm,0,m_Z[i]); - DetRot = new G4RotationMatrix(); - DetRot->rotateZ(270*deg); - } - else{ - cout << "Face orientation for Helios 2 detector "<< m_Face[i] << " Not Valid!" << endl; - exit(1); - } - - // Place the Silicon Wafer - new G4PVPlacement(G4Transform3D(*DetRot,DetPos), - BuildSiliconWafer(), - "Helios2_SiliconWafer",BuildMagnet(),false,i+1); - - // Place the Square Tub - if(m_UsedZ.find(m_Z[i])==m_UsedZ.end()){ - G4ThreeVector TubePos(0,0,m_Z[i]); - G4RotationMatrix* TubeRot = new G4RotationMatrix(); - new G4PVPlacement(G4Transform3D(*TubeRot,TubePos), - BuildSquareTube(), - "Helios2_SquareTube",BuildMagnet(),false,i+1); - m_UsedZ.insert(m_Z[i]); - } - } - -} -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Add Detector branch to the EventTree. -// Called After DetecorConstruction::AddDetector Method -void Helios2::InitializeRootOutput(){ - RootOutput *pAnalysis = RootOutput::getInstance(); - TTree *pTree = pAnalysis->GetTree(); - if(!pTree->FindBranch("Helios2")){ - pTree->Branch("Helios2", "THelios2Data", &m_Event) ; - } - - pTree->SetBranchAddress("Helios2", &m_Event) ; - -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Read sensitive part and fill the Root tree. -// Called at in the EventAction::EndOfEventAvtion -void Helios2::ReadSensitive(const G4Event* ){ - m_Event->Clear(); - - /////////// - // Resistiverimeter scorer - DSSDScorers::PS_Resistive* Scorer= (DSSDScorers::PS_Resistive*) m_Helios2Scorer->GetPrimitive(0); - - // Loop on the Back - unsigned int sizeBack = Scorer->GetBackMult(); - for(unsigned int i = 0 ; i < sizeBack ; i++){ - double EBack = RandGauss::shoot(Scorer->GetEnergyBack(i),Helios2_NS::ResoEnergyBack); - double TBack = RandGauss::shoot(Scorer->GetTimeBack(i),Helios2_NS::ResoTime); - if(EBack>Helios2_NS::EnergyThreshold){ - m_Event->SetEBack(Scorer->GetDetectorBack(i),EBack); - m_Event->SetTBack(Scorer->GetDetectorBack(i),TBack); - } - } - // Loop on the Up - unsigned int sizeUp = Scorer->GetUpMult(); - for(unsigned int i = 0 ; i < sizeUp ; i++){ - double EUp = RandGauss::shoot(Scorer->GetEnergyUp(i),Helios2_NS::ResoEnergyFront); - double TUp = RandGauss::shoot(Scorer->GetTimeUp(i),Helios2_NS::ResoTime); - if(EUp>Helios2_NS::EnergyThreshold){ - m_Event->SetEUp(Scorer->GetDetectorUp(i),EUp); - m_Event->SetTUp(Scorer->GetDetectorUp(i),TUp); - } - } - - // Loop on the Down - unsigned int sizeDown = Scorer->GetDownMult(); - for(unsigned int i = 0 ; i < sizeDown ; i++){ - double EDw = RandGauss::shoot(Scorer->GetEnergyDown(i),Helios2_NS::ResoEnergyFront); - double TDw = RandGauss::shoot(Scorer->GetTimeDown(i),Helios2_NS::ResoTime); - if(EDw>Helios2_NS::EnergyThreshold){ - m_Event->SetEDw(Scorer->GetDetectorDown(i),EDw); - m_Event->SetTDw(Scorer->GetDetectorDown(i),TDw); - } - } -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////// -void Helios2::InitializeScorers() { - // This check is necessary in case the geometry is reloaded - bool already_exist = false; - m_Helios2Scorer = CheckScorer("Helios2Scorer",already_exist) ; - - if(already_exist) - return ; - - // Otherwise the scorer is initialised - G4VPrimitiveScorer* Resistive= new DSSDScorers::PS_Resistive("Resistive",1,Helios2_NS::WaferLength,Helios2_NS::WaferWidth,1) ; - //and register it to the multifunctionnal detector - m_Helios2Scorer->RegisterPrimitive(Resistive); - G4VPrimitiveScorer* Inter = new InteractionScorers::PS_Interactions("Resistive",ms_InterCoord,1) ; - m_Helios2Scorer->RegisterPrimitive(Inter); - - G4SDManager::GetSDMpointer()->AddNewDetector(m_Helios2Scorer) ; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////////////////////// -// Construct Method to be pass to the DetectorFactory // -//////////////////////////////////////////////////////////////////////////////// -NPS::VDetector* Helios2::Construct(){ - return (NPS::VDetector*) new Helios2(); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////////////////////// -// Registering the construct method to the factory // -//////////////////////////////////////////////////////////////////////////////// -extern"C" { - class proxy_nps_Helios2{ - public: - proxy_nps_Helios2(){ - NPS::DetectorFactory::getInstance()->AddToken("Helios2","Helios2"); - NPS::DetectorFactory::getInstance()->AddDetector("Helios2",Helios2::Construct); - } - }; - - proxy_nps_Helios2 p_nps_Helios2; -} diff --git a/NPSimulation/Detectors/Helios2/Helios2.hh b/NPSimulation/Detectors/Helios2/Helios2.hh deleted file mode 100644 index 9abb3b49b061989edd34df753f7eb2c1839b3e67..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Helios2/Helios2.hh +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef Helios2_h -#define Helios2_h 1 -/***************************************************************************** - * Copyright (C) 2009-2016 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: Adrien Matta contact address: matta@lpccaen.in2p3.fr * - * * - * Creation Date : octobre 2016 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class describe Helios2 simulation * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - *****************************************************************************/ - -// C++ header -#include <string> -#include <vector> -#include <set> -using namespace std; - -// G4 headers -#include "G4ThreeVector.hh" -#include "G4RotationMatrix.hh" -#include "G4LogicalVolume.hh" -#include "G4MultiFunctionalDetector.hh" - -// NPTool header -#include "NPSVDetector.hh" -#include "THelios2Data.h" -#include "NPInputParser.h" - -class Helios2 : public NPS::VDetector{ - //////////////////////////////////////////////////// - /////// Default Constructor and Destructor ///////// - //////////////////////////////////////////////////// - public: - Helios2() ; - virtual ~Helios2() ; - - //////////////////////////////////////////////////// - /////// Specific Function of this Class /////////// - //////////////////////////////////////////////////// - public: - // adding Helios silicon and support tube - void AddHelios2(double Z,string Face); - - G4LogicalVolume* BuildSquareTube(); - G4LogicalVolume* BuildSiliconWafer(); - G4LogicalVolume* BuildMagnet(); - - private: - G4LogicalVolume* m_SquareTube; - G4LogicalVolume* m_SiliconWafer; - G4LogicalVolume* m_ActiveWafer; - G4LogicalVolume* m_Magnet; - - //////////////////////////////////////////////////// - ////// Inherite from NPS::VDetector class ///////// - //////////////////////////////////////////////////// - public: - // Read stream at Configfile to pick-up parameters of detector (Position,...) - // Called in DetecorConstruction::ReadDetextorConfiguration Method - void ReadConfiguration(NPL::InputParser) ; - - // 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: // Scorer - // Initialize all Scorer used by the MUST2Array - void InitializeScorers() ; - - // Associated Scorer - G4MultiFunctionalDetector* m_Helios2Scorer ; - //////////////////////////////////////////////////// - ///////////Event class to store Data//////////////// - //////////////////////////////////////////////////// - private: - THelios2Data* m_Event ; - - //////////////////////////////////////////////////// - ///////////////Private intern Data////////////////// - //////////////////////////////////////////////////// - private: // Geometry - // Detector Coordinate - vector<double> m_Z; - vector<string> m_Face; - - // keep track of the Z used to put the tube only once - set<double> m_UsedZ; - - // Magnetic field - double m_B ; - - // Visualisation Attribute - G4VisAttributes* m_VisSquareTube; - G4VisAttributes* m_VisPassiveSilicon; - - G4VisAttributes* m_VisSilicon; - G4VisAttributes* m_VisMagnet; - - // Needed for dynamic loading of the library - public: - static NPS::VDetector* Construct(); -}; -#endif diff --git a/NPSimulation/Detectors/MUST2/MUST2Array.cc b/NPSimulation/Detectors/MUST2/MUST2Array.cc index 94860cbe3740461838caa8a64bf95949e7ea3039..620d794ac62f13d3b672aa281750c679c3d3247e 100644 --- a/NPSimulation/Detectors/MUST2/MUST2Array.cc +++ b/NPSimulation/Detectors/MUST2/MUST2Array.cc @@ -75,6 +75,8 @@ MUST2Array::MUST2Array() { MUST2Array::~MUST2Array() {} + + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void MUST2Array::AddTelescope(G4ThreeVector X1_Y1, G4ThreeVector X128_Y1, G4ThreeVector X1_Y128, G4ThreeVector X128_Y128, diff --git a/NPSimulation/Scorers/DSSDScorers.cc b/NPSimulation/Scorers/DSSDScorers.cc index ecaffbfc06d0017703a710b70d7926808b2d2223..0e085c023b39ee000e03f0fc431f86af6546b403 100644 --- a/NPSimulation/Scorers/DSSDScorers.cc +++ b/NPSimulation/Scorers/DSSDScorers.cc @@ -373,21 +373,21 @@ G4bool PS_Resistive::ProcessHits(G4Step* aStep, G4TouchableHistory*){ if(it!=m_HitUp.end()) it->Add(t_EnergyUp); else - m_HitUp.Set(t_EnergyUp,t_Time,t_DetectorNumber,t_StripWidthNumber); + m_HitUp.Set(t_EnergyUp,t_Time,t_StripWidthNumber,t_DetectorNumber); // Down it = m_HitDown.find(DSSDData::CalculateIndex(t_DetectorNumber,t_StripWidthNumber)); if(it!=m_HitDown.end()) it->Add(t_EnergyDown); else - m_HitDown.Set(t_EnergyDown,t_Time,t_DetectorNumber,t_StripWidthNumber); + m_HitDown.Set(t_EnergyDown,t_Time,t_StripWidthNumber,t_DetectorNumber); // Back it = m_HitBack.find(DSSDData::CalculateIndex(t_DetectorNumber,t_StripWidthNumber)); if(it!=m_HitBack.end()) it->Add(t_Energy); else - m_HitBack.Set(t_Energy,t_Time,t_DetectorNumber,1); + m_HitBack.Set(t_Energy,t_Time,1,t_DetectorNumber); diff --git a/Projects/Helios/Analysis.cxx b/Projects/Helios/Analysis.cxx deleted file mode 100644 index e91710ff41a20f04a25dadf1a4cbff371477f8e1..0000000000000000000000000000000000000000 --- a/Projects/Helios/Analysis.cxx +++ /dev/null @@ -1,226 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2014 this file is part of the NPTool Project * - * * - * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * - * For the list of contributors see $NPTOOL/Licence/Contributors * - *****************************************************************************/ - -/***************************************************************************** - * Original Author: Adrien MATTA contact address: a.matta@surrey.ac.uk * - * * - * Creation Date : march 2025 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * Class describing the property of an Analysis object * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ -#include<iostream> -using namespace std; -#include"Analysis.h" -#include"NPAnalysisFactory.h" -#include"NPDetectorManager.h" -#include"NPOptionManager.h" - -#include"NPPhysicalConstants.h" - - -//////////////////////////////////////////////////////////////////////////////// -Analysis::Analysis(){ -} -//////////////////////////////////////////////////////////////////////////////// -Analysis::~Analysis(){ -} - -//////////////////////////////////////////////////////////////////////////////// -void Analysis::Init(){ - - myInit= new TInitialConditions(); - myIntCoord= new TInteractionCoordinates(); - - Hel = (Helios*) m_DetectorManager -> GetDetector("Helios"); - - Bfield=Hel->GetNominalMField(); - cout << "Nominal Magnetic field= " << Bfield << " Tesla" << endl; - - LightCD2 = EnergyLoss("proton_CD2.G4table","G4Table",100 ); - //LightAl = EnergyLoss("proton_Al.G4table","G4Table",100); - //LightSi = EnergyLoss("proton_Si.G4table","G4Table",100); - //BeamCD2 = EnergyLoss("Sn132_CD2.G4table","G4Table",100); - //BeamCD2 = EnergyLoss("Mg30_CD2.G4table","G4Table",100); - BeamCD2 = EnergyLoss("Mg28_CD2.G4table","G4Table",100); - //BeamCD2 = EnergyLoss("Hg206_CD2.G4table","G4Table",100); - - myReaction = new NPL::Reaction(); - myReaction->ReadConfigurationFile(NPOptionManager::getInstance()->GetReactionFile()); - - //TargetThickness = 0.189*micrometer; - TargetThickness = m_DetectorManager->GetTargetThickness(); // * by micrometer to convert in mm - cout << "Target Thickness = " << TargetThickness << " mm" << endl; - - - OriginalBeamEnergy = myReaction->GetBeamEnergy(); - cout << "Beam Energy before target= " << OriginalBeamEnergy << " MeV" << endl; - - - pCharge= myReaction->GetNucleus3().GetZ(); -// pCharge=1; - - //double pAtomWeight= myReaction->GetNucleus3()->GetA(); - //double pMassExcess= myReaction->GetNucleus3()->GetMassExcess(); - //pMass= (pAtomWeight*amu_c2 + pMassExcess/1000)/amu_c2; - //cout << "Mass of light particle= " << pMass << endl; - pMass= (myReaction->GetNucleus3().Mass())/amu_c2; -// pMass=1.00782503207; // MeV/c2 - for 132Sn(d,p) -// pMass=2.0141017778; // MeV/c2 - for 224Ra(d,d) -// pMass=12*931.49; // MeV/c2 - for 224Ra(C,C) - - - cout << "Charge of light particle= " << pCharge << endl; - cout << "Mass of light particle= " << pMass << " amu" << endl; - cout << "Reaction QValue= " << myReaction->GetQValue() << " MeV" <<endl; - - - Rand = new TRandom3(); - DetectorNumber = 0 ; - ThetaNormalTarget = 0 ; - - ThetaHelSurface = 0; - X_Hel = 0 ; - Y_Hel = 0 ; - Z_Hel = 0 ; - Si_E_Hel = 0 ; - E_Hel = 0; - Si_X_Hel = 0; - Si_Y_Hel = 0; - - InitOutputBranch(); - InitInputBranch(); - - -} - -//////////////////////////////////////////////////////////////////////////////// -void Analysis::TreatEvent(){ - // Reinitiate calculated variable - ReInitValue(); - double XTarget = -1001; - double YTarget = -1001; - - TVector3 BeamDirection = TVector3(0,0,1); - - double BeamEnergy = BeamCD2.Slow(OriginalBeamEnergy,TargetThickness/2,0); - myReaction->SetBeamEnergy(BeamEnergy); // set the new beam energy taking into account the beam energy loss in target befor reaction - - double Theta_extrap=0. ; - double ThetaDet =0. ; - //double ExcitationE=0. ; double ExcitationE_extrap=0. ; - - - //TVector3 Pos; // for helisol but not for helios - - - XTarget=myInit->GetIncidentPositionX(); - YTarget=myInit->GetIncidentPositionY(); - - - //////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////// - //////////////////////////// LOOP on Helios ////////////////// - if( Hel->GetEnergyDeposit() >0){ - - /************************************************/ - // Part 1 : Interaction position in detector - - if(XTarget>-1000 && YTarget>-1000){ // XTarget and YTarget can be known experimentaly only if there are beam tracker detectors !!! - - //Pos = Hel -> GetPositionOfInteraction(); // Lab Position of the light particle interaction in the Si Detector for helisol but not for helios - Z_Hel = myIntCoord->GetDetectedPositionZ(0); - - } - - else{ - BeamDirection = TVector3(-1000,-1000,-1000); - } - - /************************************************/ - - /************************************************/ - // Part 2 : Impact Energy - Energy = EDep = 0; - Energy = Hel->GetEnergyDeposit(); - - // Detector intrinsic energy resolution - EDep = Energy; // resolution already taken into account in simulation output for helios !! - // EDep = Rand->Gaus(Energy, 0.01/2.35); // 10 keV sigma resolution for helisol !! - - /************************************************/ - - /************************************************/ - // Part 3 : Excitation energy calculation - - //Ex= EDep - 0.0138322*ZPos -11.5701; // for 136Xe(d,p) - Ex= -(EDep - 0.0116048*Z_Hel -7.21402); // for 30Mg(d,p)31Mg-gs at 7.5 MeV/u and 2 Tesla - //Ex= -(EDep - 0.014929*Z_Hel -7.29597); // for 30Mg(d,p)31Mg-gs at 7.5 MeV/u and 2.5 Tesla - //Ex= -(EDep - 0.014464*Z_Hel -8.4199); // for 28Mg(d,p)29Mg-gs at 7.5 MeV/u and 2.5 Tesla - //Ex= -(EDep - 0.0176351*Z_Hel -11.0221); // for 206Hg(d,p) at 10 MeV/u and 2.5 Tesla - - - - }//end loop Helios - -} - -//////////////////////////////////////////////////////////////////////////////// -void Analysis::End(){ - -} -//////////////////////////////////////////////////////////////////////////////// -void Analysis::InitOutputBranch() { - RootOutput::getInstance()->GetTree()->Branch("EDep",&EDep,"EDep/D"); - RootOutput::getInstance()->GetTree()->Branch("Z_Hel",&Z_Hel,"Z_Hel/D"); - RootOutput::getInstance()->GetTree()->Branch("Ex",&Ex,"Ex/D"); - -} - -//////////////////////////////////////////////////////////////////////////////// -void Analysis::InitInputBranch(){ - RootInput:: getInstance()->GetChain()->SetBranchAddress("InitialConditions",&myInit ); - RootInput:: getInstance()->GetChain()->SetBranchAddress("InteractionCoordinates",&myIntCoord ); -} -//////////////////////////////////////////////////////////////////////////////// -void Analysis::ReInitValue(){ - ELab = -1000; - EDep = -1000; - Z_Hel= -1000; - Ex= -1000; - -} - - - -//////////////////////////////////////////////////////////////////////////////// -// Construct Method to be pass to the AnalysisFactory // -//////////////////////////////////////////////////////////////////////////////// -NPL::VAnalysis* Analysis::Construct(){ - return (NPL::VAnalysis*) new Analysis(); -} - -//////////////////////////////////////////////////////////////////////////////// -// Registering the construct method to the factory // -//////////////////////////////////////////////////////////////////////////////// -extern "C"{ -class proxy{ - public: - proxy(){ - NPL::AnalysisFactory::getInstance()->SetConstructor(Analysis::Construct); - } -}; - -proxy p; -} - diff --git a/Projects/Helios/Analysis.h b/Projects/Helios/Analysis.h deleted file mode 100644 index 88190337c210bce2643ca450d2cfe0aabc78ad86..0000000000000000000000000000000000000000 --- a/Projects/Helios/Analysis.h +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef Analysis_h -#define Analysis_h -/***************************************************************************** - * Copyright (C) 2009-2014 this file is part of the NPTool Project * - * * - * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * - * For the list of contributors see $NPTOOL/Licence/Contributors * - *****************************************************************************/ - -/***************************************************************************** - * Original Author: Adrien MATTA contact address: a.matta@surrey.ac.uk * - * * - * Creation Date : march 2025 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * Class describing the property of an Analysis object * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - * * - *****************************************************************************/ -#include"NPVAnalysis.h" -#include"NPEnergyLoss.h" -#include"NPReaction.h" -#include"RootOutput.h" -#include"RootInput.h" -#include "Helios.h" -#include "TInitialConditions.h" -#include "TInteractionCoordinates.h" -#include <TRandom3.h> -#include <TVector3.h> -#include <TMath.h> - - -class Analysis: public NPL::VAnalysis{ - public: - Analysis(); - ~Analysis(); - - public: - void Init(); - void TreatEvent(); - void End(); - - void InitOutputBranch(); - void InitInputBranch(); - void ReInitValue(); - static NPL::VAnalysis* Construct(); - - void ZonBeamAxis (TVector3 A, double E, int q, double M, double B, double*, double*, double*) ; - - - private: - double Ex, QValue, Z_extrap; - double ELab, EDep; - double ThetaLab; - double ThetaCM; - NPL::Reaction* myReaction; - - TInitialConditions* myInit ; - TInteractionCoordinates* myIntCoord ; - - // Energy loss table: the G4Table are generated by the simulation - EnergyLoss LightCD2; - //EnergyLoss LightAl; - //EnergyLoss LightSi; - EnergyLoss BeamCD2; - TVector3 BeamImpact; - - double TargetThickness ; - // Beam Energy - double OriginalBeamEnergy ; // AMEV - // Light ejectile Charge and Mass - int pCharge; - double pMass; - // Nominal magnetic field - double Bfield; - // intermediate variable - TRandom3 *Rand ; - int DetectorNumber ; - double ThetaNormalTarget; - - - double Energy ; - - double ThetaHelSurface ; - double X_Hel ; - double Y_Hel ; - double Z_Hel ; - double Si_E_Hel ; - double E_Hel ; - double Si_X_Hel ; - double Si_Y_Hel ; - - Helios* Hel; - -}; -#endif diff --git a/Projects/Helios/CMakeLists.txt b/Projects/Helios/CMakeLists.txt deleted file mode 100644 index 22c74affdfc45019bdda2594f8439c52d4ab97ec..0000000000000000000000000000000000000000 --- a/Projects/Helios/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -cmake_minimum_required (VERSION 2.8) -# Setting the policy to match Cmake version -cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) -# include the default NPAnalysis cmake file -include("../../NPLib/ressources/CMake/NPAnalysis.cmake") diff --git a/Projects/Helios/DetectorConfiguration/helios.detector b/Projects/Helios/DetectorConfiguration/helios.detector deleted file mode 100644 index 66e71f5fdc70f78aa41004c8e4a4d96e16ffa1fe..0000000000000000000000000000000000000000 --- a/Projects/Helios/DetectorConfiguration/helios.detector +++ /dev/null @@ -1,426 +0,0 @@ -%%%%%%%%%Target%%%%%%%%%%%%%%%%%%%%%% -%% -%% Thickness in micrometer -%% Radius in mm -%% Position in mm -%% Magnetic field in tesla -%% -%%%%%%%%%%Detector%%%%%%%%%%%%%%%%%%% -%% -%% Position and distance given in mm -%% Angle given in degree -%% using the data from the experimental mesurement -%% special care is given for the X Y direction -%% NOTATTION USED IN THE FOLLOWING: -%% -%% X1_Y1 --> X:1 Y:1 -%% X128_Y1 --> X:128 Y:1 -%% X1_Y128 --> X:1 Y:128 -%% X128_Y128 --> X:128 Y:128 -%%Option: 0,1 for Si SiLi and CSI -%%Option: all or sensible for VISualisation -% 1.2 12.371134021 -% 2 20.618556701 -% 30 309.278350515 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 -GeneralTarget -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 -Target - THICKNESS= 1. -% THICKNESS= 0.28 - RADIUS= 7.5 - MATERIAL= CD2 -% MATERIAL= Ti-t - X= 0 - Y= 0 - Z= 0 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -Helios - MField= 2. -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 -HeliosDummyShape - X1_Y1= 11.5 11.5 150. - X128_Y1= 11.5 -11.5 150. - X1_Y128= 11.5 11.5 206. - X128_Y128= 11.5 -11.5 206. - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2 -HeliosDummyShape - X1_Y1= -11.5 11.5 150. - X128_Y1= 11.5 11.5 150. - X1_Y128= -11.5 11.5 206. - X128_Y128= 11.5 11.5 206. - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%3 -HeliosDummyShape - X1_Y1= -11.5 -11.5 150. - X128_Y1= -11.5 11.5 150. - X1_Y128= -11.5 -11.5 206. - X128_Y128= -11.5 11.5 206. - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%4 -HeliosDummyShape - X1_Y1= 11.5 -11.5 150. - X128_Y1= -11.5 -11.5 150. - X1_Y128= 11.5 -11.5 206. - X128_Y128= -11.5 -11.5 206. - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 -HeliosDummyShape - X1_Y1= 11.5 11.5 208.4 - X128_Y1= 11.5 -11.5 208.4 - X1_Y128= 11.5 11.5 264.4 - X128_Y128= 11.5 -11.5 264.4 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%6 -HeliosDummyShape - X1_Y1= -11.5 11.5 208.4 - X128_Y1= 11.5 11.5 208.4 - X1_Y128= -11.5 11.5 264.4 - X128_Y128= 11.5 11.5 264.4 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%7 -HeliosDummyShape - X1_Y1= -11.5 -11.5 208.4 - X128_Y1= -11.5 11.5 208.4 - X1_Y128= -11.5 -11.5 264.4 - X128_Y128= -11.5 11.5 264.4 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%8 -HeliosDummyShape - X1_Y1= 11.5 -11.5 208.4 - X128_Y1= -11.5 -11.5 208.4 - X1_Y128= 11.5 -11.5 264.4 - X128_Y128= -11.5 -11.5 264.4 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%9 -HeliosDummyShape - X1_Y1= 11.5 11.5 266.8 - X128_Y1= 11.5 -11.5 266.8 - X1_Y128= 11.5 11.5 322.8 - X128_Y128= 11.5 -11.5 322.8 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%10 -HeliosDummyShape - X1_Y1= -11.5 11.5 266.8 - X128_Y1= 11.5 11.5 266.8 - X1_Y128= -11.5 11.5 322.8 - X128_Y128= 11.5 11.5 322.8 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%11 -HeliosDummyShape - X1_Y1= -11.5 -11.5 266.8 - X128_Y1= -11.5 11.5 266.8 - X1_Y128= -11.5 -11.5 322.8 - X128_Y128= -11.5 11.5 322.8 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%12 -HeliosDummyShape - X1_Y1= 11.5 -11.5 266.8 - X128_Y1= -11.5 -11.5 266.8 - X1_Y128= 11.5 -11.5 322.8 - X128_Y128= -11.5 -11.5 322.8 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%13 -HeliosDummyShape - X1_Y1= 11.5 11.5 325.2 - X128_Y1= 11.5 -11.5 325.2 - X1_Y128= 11.5 11.5 381.2 - X128_Y128= 11.5 -11.5 381.2 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%14 -HeliosDummyShape - X1_Y1= -11.5 11.5 325.2 - X128_Y1= 11.5 11.5 325.2 - X1_Y128= -11.5 11.5 381.2 - X128_Y128= 11.5 11.5 381.2 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%15 -HeliosDummyShape - X1_Y1= -11.5 -11.5 325.2 - X128_Y1= -11.5 11.5 325.2 - X1_Y128= -11.5 -11.5 381.2 - X128_Y128= -11.5 11.5 381.2 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%16 -HeliosDummyShape - X1_Y1= 11.5 -11.5 325.2 - X128_Y1= -11.5 -11.5 325.2 - X1_Y128= 11.5 -11.5 381.2 - X128_Y128= -11.5 -11.5 381.2 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%17 -HeliosDummyShape - X1_Y1= 11.5 11.5 383.6 - X128_Y1= 11.5 -11.5 383.6 - X1_Y128= 11.5 11.5 439.6 - X128_Y128= 11.5 -11.5 439.6 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%18 -HeliosDummyShape - X1_Y1= -11.5 11.5 383.6 - X128_Y1= 11.5 11.5 383.6 - X1_Y128= -11.5 11.5 439.6 - X128_Y128= 11.5 11.5 439.6 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%19 -HeliosDummyShape - X1_Y1= -11.5 -11.5 383.6 - X128_Y1= -11.5 11.5 383.6 - X1_Y128= -11.5 -11.5 439.6 - X128_Y128= -11.5 11.5 439.6 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%20 -HeliosDummyShape - X1_Y1= 11.5 -11.5 383.6 - X128_Y1= -11.5 -11.5 383.6 - X1_Y128= 11.5 -11.5 439.6 - X128_Y128= -11.5 -11.5 439.6 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%21 -HeliosDummyShape - X1_Y1= 11.5 11.5 442. - X128_Y1= 11.5 -11.5 442. - X1_Y128= 11.5 11.5 498. - X128_Y128= 11.5 -11.5 498. - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%22 -HeliosDummyShape - X1_Y1= -11.5 11.5 442. - X128_Y1= 11.5 11.5 442. - X1_Y128= -11.5 11.5 498. - X128_Y128= 11.5 11.5 498. - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%23 -HeliosDummyShape - X1_Y1= -11.5 -11.5 442. - X128_Y1= -11.5 11.5 442. - X1_Y128= -11.5 -11.5 498. - X128_Y128= -11.5 11.5 498. - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%24 -HeliosDummyShape - X1_Y1= 11.5 -11.5 442. - X128_Y1= -11.5 -11.5 442. - X1_Y128= 11.5 -11.5 498 - X128_Y128= -11.5 -11.5 498. - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%25 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% AT backward angles: -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%25 -HeliosDummyShape - X1_Y1= 11.5 11.5 -150. - X128_Y1= 11.5 -11.5 -150. - X1_Y128= 11.5 11.5 -206. - X128_Y128= 11.5 -11.5 -206. - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%26 -HeliosDummyShape - X1_Y1= -11.5 11.5 -150. - X128_Y1= 11.5 11.5 -150. - X1_Y128= -11.5 11.5 -206. - X128_Y128= 11.5 11.5 -206. - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%27 -HeliosDummyShape - X1_Y1= -11.5 -11.5 -150. - X128_Y1= -11.5 11.5 -150. - X1_Y128= -11.5 -11.5 -206. - X128_Y128= -11.5 11.5 -206. - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%28 -HeliosDummyShape - X1_Y1= 11.5 -11.5 -150. - X128_Y1= -11.5 -11.5 -150. - X1_Y128= 11.5 -11.5 -206. - X128_Y128= -11.5 -11.5 -206. - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%29 -HeliosDummyShape - X1_Y1= 11.5 11.5 -208.4 - X128_Y1= 11.5 -11.5 -208.4 - X1_Y128= 11.5 11.5 -264.4 - X128_Y128= 11.5 -11.5 -264.4 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%30 -HeliosDummyShape - X1_Y1= -11.5 11.5 -208.4 - X128_Y1= 11.5 11.5 -208.4 - X1_Y128= -11.5 11.5 -264.4 - X128_Y128= 11.5 11.5 -264.4 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%31 -HeliosDummyShape - X1_Y1= -11.5 -11.5 -208.4 - X128_Y1= -11.5 11.5 -208.4 - X1_Y128= -11.5 -11.5 -264.4 - X128_Y128= -11.5 11.5 -264.4 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%32 -HeliosDummyShape - X1_Y1= 11.5 -11.5 -208.4 - X128_Y1= -11.5 -11.5 -208.4 - X1_Y128= 11.5 -11.5 -264.4 - X128_Y128= -11.5 -11.5 -264.4 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%33 -HeliosDummyShape - X1_Y1= 11.5 11.5 -266.8 - X128_Y1= 11.5 -11.5 -266.8 - X1_Y128= 11.5 11.5 -322.8 - X128_Y128= 11.5 -11.5 -322.8 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%34 -HeliosDummyShape - X1_Y1= -11.5 11.5 -266.8 - X128_Y1= 11.5 11.5 -266.8 - X1_Y128= -11.5 11.5 -322.8 - X128_Y128= 11.5 11.5 -322.8 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%35 -HeliosDummyShape - X1_Y1= -11.5 -11.5 -266.8 - X128_Y1= -11.5 11.5 -266.8 - X1_Y128= -11.5 -11.5 -322.8 - X128_Y128= -11.5 11.5 -322.8 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%36 -HeliosDummyShape - X1_Y1= 11.5 -11.5 -266.8 - X128_Y1= -11.5 -11.5 -266.8 - X1_Y128= 11.5 -11.5 -322.8 - X128_Y128= -11.5 -11.5 -322.8 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%37 -HeliosDummyShape - X1_Y1= 11.5 11.5 -325.2 - X128_Y1= 11.5 -11.5 -325.2 - X1_Y128= 11.5 11.5 -381.2 - X128_Y128= 11.5 -11.5 -381.2 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%38 -HeliosDummyShape - X1_Y1= -11.5 11.5 -325.2 - X128_Y1= 11.5 11.5 -325.2 - X1_Y128= -11.5 11.5 -381.2 - X128_Y128= 11.5 11.5 -381.2 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%39 -HeliosDummyShape - X1_Y1= -11.5 -11.5 -325.2 - X128_Y1= -11.5 11.5 -325.2 - X1_Y128= -11.5 -11.5 -381.2 - X128_Y128= -11.5 11.5 -381.2 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%40 -HeliosDummyShape - X1_Y1= 11.5 -11.5 -325.2 - X128_Y1= -11.5 -11.5 -325.2 - X1_Y128= 11.5 -11.5 -381.2 - X128_Y128= -11.5 -11.5 -381.2 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%41 -HeliosDummyShape - X1_Y1= 11.5 11.5 -383.6 - X128_Y1= 11.5 -11.5 -383.6 - X1_Y128= 11.5 11.5 -439.6 - X128_Y128= 11.5 -11.5 -439.6 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%42 -HeliosDummyShape - X1_Y1= -11.5 11.5 -383.6 - X128_Y1= 11.5 11.5 -383.6 - X1_Y128= -11.5 11.5 -439.6 - X128_Y128= 11.5 11.5 -439.6 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%43 -HeliosDummyShape - X1_Y1= -11.5 -11.5 -383.6 - X128_Y1= -11.5 11.5 -383.6 - X1_Y128= -11.5 -11.5 -439.6 - X128_Y128= -11.5 11.5 -439.6 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%44 -HeliosDummyShape - X1_Y1= 11.5 -11.5 -383.6 - X128_Y1= -11.5 -11.5 -383.6 - X1_Y128= 11.5 -11.5 -439.6 - X128_Y128= -11.5 -11.5 -439.6 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%45 -HeliosDummyShape - X1_Y1= 11.5 11.5 -442. - X128_Y1= 11.5 -11.5 -442. - X1_Y128= 11.5 11.5 -498. - X128_Y128= 11.5 -11.5 -498. - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%46 -HeliosDummyShape - X1_Y1= -11.5 11.5 -442. - X128_Y1= 11.5 11.5 -442. - X1_Y128= -11.5 11.5 -498. - X128_Y128= 11.5 11.5 -498. - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%47 -HeliosDummyShape - X1_Y1= -11.5 -11.5 -442. - X128_Y1= -11.5 11.5 -442. - X1_Y128= -11.5 -11.5 -498. - X128_Y128= -11.5 11.5 -498. - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%48 -HeliosDummyShape - X1_Y1= 11.5 -11.5 -442. - X128_Y1= -11.5 -11.5 -442. - X1_Y128= 11.5 -11.5 -498 - X128_Y128= -11.5 -11.5 -498. - FIRSTSTAGE= 1 - VIS= all diff --git a/Projects/Helios/DetectorConfiguration/helios100.detector b/Projects/Helios/DetectorConfiguration/helios100.detector deleted file mode 100644 index 25c45f735d18feef70650a1e62441d3e362de872..0000000000000000000000000000000000000000 --- a/Projects/Helios/DetectorConfiguration/helios100.detector +++ /dev/null @@ -1,257 +0,0 @@ -%%%%%%%%%Target%%%%%%%%%%%%%%%%%%%%%% -%% -%% Thickness in micrometer -%% Radius in mm -%% Position in mm -%% Magnetic field in tesla -%% -%%%%%%%%%%Detector%%%%%%%%%%%%%%%%%%% -%% -%% Position and distance given in mm -%% Angle given in degree -%% using the data from the experimental mesurement -%% special care is given for the X Y direction -%% NOTATTION USED IN THE FOLLOWING: -%% -%% X1_Y1 --> X:1 Y:1 -%% X128_Y1 --> X:128 Y:1 -%% X1_Y128 --> X:1 Y:128 -%% X128_Y128 --> X:128 Y:128 -%%Option: 0,1 for Si SiLi and CSI -%%Option: all or sensible for VISualisation -% 1.2 12.371134021 -% 2 20.618556701 -% 30 309.278350515 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 -Target - THICKNESS= 0.945 - ANGLE= 0. - RADIUS= 7.5 - MATERIAL= CD2 - X= 0 - Y= 0 - Z= 0 -%%%%%%%%% Det 1 %%%%%%%% 1st quadran -QQQ - THETA= 0 - PHI= 0 - R= 900 - BETA= 0 0 -0 - SIDE= right -%%%%%%%%% Det 2 %%%%%%%% 2nd quadran -QQQ - THETA= 0 - PHI= 90 - R= 900 - BETA= 0 0 -0 - SIDE= right -%%%%%%%%% Det 1 %%%%%%%% -QQQ - THETA= 0 - PHI= 180 - R= 900 - BETA= 0 0 -0 - SIDE= right -%%%%%%%%% Det 1 %%%%%%%% -QQQ - THETA= 0 - PHI= 270 - R= 900 - BETA= 0 0 -0 - SIDE= right -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% AT backward -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%25 -HeliosDummyShape - MField= 2 - X1_Y1= 11.5 11.5 -100 - X128_Y1= 11.5 -11.5 -100 - X1_Y128= 11.5 11.5 -156 - X128_Y128= 11.5 -11.5 -156 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%26 -HeliosDummyShape - X1_Y1= -11.5 11.5 -100 - X128_Y1= 11.5 11.5 -100 - X1_Y128= -11.5 11.5 -156 - X128_Y128= 11.5 11.5 -156 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%27 -HeliosDummyShape - X1_Y1= -11.5 -11.5 -100 - X128_Y1= -11.5 11.5 -100 - X1_Y128= -11.5 -11.5 -156 - X128_Y128= -11.5 11.5 -156 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%28 -HeliosDummyShape - X1_Y1= 11.5 -11.5 -100 - X128_Y1= -11.5 -11.5 -100 - X1_Y128= 11.5 -11.5 -156 - X128_Y128= -11.5 -11.5 -156 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%29 -HeliosDummyShape - X1_Y1= 11.5 11.5 -158.4 - X128_Y1= 11.5 -11.5 -158.4 - X1_Y128= 11.5 11.5 -214.4 - X128_Y128= 11.5 -11.5 -214.4 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%30 -HeliosDummyShape - X1_Y1= -11.5 11.5 -158.4 - X128_Y1= 11.5 11.5 -158.4 - X1_Y128= -11.5 11.5 -214.4 - X128_Y128= 11.5 11.5 -214.4 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%31 -HeliosDummyShape - X1_Y1= -11.5 -11.5 -158.4 - X128_Y1= -11.5 11.5 -158.4 - X1_Y128= -11.5 -11.5 -214.4 - X128_Y128= -11.5 11.5 -214.4 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%32 -HeliosDummyShape - X1_Y1= 11.5 -11.5 -158.4 - X128_Y1= -11.5 -11.5 -158.4 - X1_Y128= 11.5 -11.5 -214.4 - X128_Y128= -11.5 -11.5 -214.4 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%33 -HeliosDummyShape - X1_Y1= 11.5 11.5 -216.8 - X128_Y1= 11.5 -11.5 -216.8 - X1_Y128= 11.5 11.5 -272.8 - X128_Y128= 11.5 -11.5 -272.8 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%34 -HeliosDummyShape - X1_Y1= -11.5 11.5 -216.8 - X128_Y1= 11.5 11.5 -216.8 - X1_Y128= -11.5 11.5 -272.8 - X128_Y128= 11.5 11.5 -272.8 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%35 -HeliosDummyShape - X1_Y1= -11.5 -11.5 -216.8 - X128_Y1= -11.5 11.5 -216.8 - X1_Y128= -11.5 -11.5 -272.8 - X128_Y128= -11.5 11.5 -272.8 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%36 -HeliosDummyShape - X1_Y1= 11.5 -11.5 -216.8 - X128_Y1= -11.5 -11.5 -216.8 - X1_Y128= 11.5 -11.5 -272.8 - X128_Y128= -11.5 -11.5 -272.8 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%37 -HeliosDummyShape - X1_Y1= 11.5 11.5 -275.2 - X128_Y1= 11.5 -11.5 -275.2 - X1_Y128= 11.5 11.5 -331.2 - X128_Y128= 11.5 -11.5 -331.2 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%38 -HeliosDummyShape - X1_Y1= -11.5 11.5 -275.2 - X128_Y1= 11.5 11.5 -275.2 - X1_Y128= -11.5 11.5 -331.2 - X128_Y128= 11.5 11.5 -331.2 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%39 -HeliosDummyShape - X1_Y1= -11.5 -11.5 -275.2 - X128_Y1= -11.5 11.5 -275.2 - X1_Y128= -11.5 -11.5 -331.2 - X128_Y128= -11.5 11.5 -331.2 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%40 -HeliosDummyShape - X1_Y1= 11.5 -11.5 -275.2 - X128_Y1= -11.5 -11.5 -275.2 - X1_Y128= 11.5 -11.5 -331.2 - X128_Y128= -11.5 -11.5 -331.2 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%41 -HeliosDummyShape - X1_Y1= 11.5 11.5 -333.6 - X128_Y1= 11.5 -11.5 -333.6 - X1_Y128= 11.5 11.5 -389.6 - X128_Y128= 11.5 -11.5 -389.6 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%42 -HeliosDummyShape - X1_Y1= -11.5 11.5 -333.6 - X128_Y1= 11.5 11.5 -333.6 - X1_Y128= -11.5 11.5 -389.6 - X128_Y128= 11.5 11.5 -389.6 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%43 -HeliosDummyShape - X1_Y1= -11.5 -11.5 -333.6 - X128_Y1= -11.5 11.5 -333.6 - X1_Y128= -11.5 -11.5 -389.6 - X128_Y128= -11.5 11.5 -389.6 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%44 -HeliosDummyShape - X1_Y1= 11.5 -11.5 -333.6 - X128_Y1= -11.5 -11.5 -333.6 - X1_Y128= 11.5 -11.5 -389.6 - X128_Y128= -11.5 -11.5 -389.6 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%45 -HeliosDummyShape - X1_Y1= 11.5 11.5 -392 - X128_Y1= 11.5 -11.5 -392 - X1_Y128= 11.5 11.5 -448 - X128_Y128= 11.5 -11.5 -448 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%46 -HeliosDummyShape - X1_Y1= -11.5 11.5 -392 - X128_Y1= 11.5 11.5 -392 - X1_Y128= -11.5 11.5 -448 - X128_Y128= 11.5 11.5 -448 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%47 -HeliosDummyShape - X1_Y1= -11.5 -11.5 -392 - X128_Y1= -11.5 11.5 -392 - X1_Y128= -11.5 -11.5 -448 - X128_Y128= -11.5 11.5 -448 - FIRSTSTAGE= 1 - VIS= all -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%48 -HeliosDummyShape - X1_Y1= 11.5 -11.5 -392 - X128_Y1= -11.5 -11.5 -392 - X1_Y128= 11.5 -11.5 -448 - X128_Y128= -11.5 -11.5 -448 - FIRSTSTAGE= 1 - VIS= all diff --git a/Projects/Helios/RunToTreat.txt b/Projects/Helios/RunToTreat.txt deleted file mode 100644 index e9e25937b5bc55fcae0c5444cc967452ad7a0438..0000000000000000000000000000000000000000 --- a/Projects/Helios/RunToTreat.txt +++ /dev/null @@ -1,4 +0,0 @@ -TTreeName - SimulatedTree -RootFileName -../../Outputs/Simulation/myResult.root