diff --git a/Inputs/EventGenerator/neutron.source b/Inputs/EventGenerator/neutron.source new file mode 100644 index 0000000000000000000000000000000000000000..d861370b140a651c5a39492ad40855b5f97ec94b --- /dev/null +++ b/Inputs/EventGenerator/neutron.source @@ -0,0 +1,26 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%% An Isotropic Source to be used as EventGenerator %%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Energy are given in MeV , Position in mm % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +Isotropic + EnergyLow= 0 + EnergyHigh= 20 + %EnergyDistribution= flat + EnergyDistribution= 0.38*sqrt(x)*exp(-x/0.847212) + %EnergyDistribution= -0.00372440431*pow(x,6)+0.387617479*pow(x,5)-14.3752948*pow(x,4)+225.888082*pow(x,3)-1555.60583*pow(x,2)+7983.24902*pow(x,1)+9069.96435 + %EnergyDistribution= 0.619676*TMath::SinH(sqrt(1.07777*x))*exp(-0.847212*x) + %EnergyDistribution= 1.90903*TMath::SinH(sqrt(1.04982*x))*exp(-0.845506*x) + %EnergyDistribution= 22.8043*TMath::SinH(sqrt(0.0144658*x))*exp(-0.729612*x) + %EnergyDistribution= 13.0603*TMath::SinH(sqrt(0.0547835*x))*exp(-0.691795*x) + HalfOpenAngleMin= 0 + HalfOpenAngleMax= 0 + x0= 0 + y0= 0 + z0= -1000 mm + SigmaX= 5 mm + SigmaY= 5 mm + Multiplicity= 1 + Particle= neutron +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Supported particle type: proton, neutron, deuton, triton, He3 , alpha diff --git a/NPLib/Core/NPDetectorFactory.cxx b/NPLib/Core/NPDetectorFactory.cxx index 5c42b5f7848ff577a9472f06d3bab52fc776dd75..c6139e46875d99104c7a5ac9c41796b7e262ed8a 100644 --- a/NPLib/Core/NPDetectorFactory.cxx +++ b/NPLib/Core/NPDetectorFactory.cxx @@ -29,12 +29,21 @@ #include<iostream> #include<stdlib.h> -// NPTool -#include "NPOptionManager.h" - NPL::DetectorFactory* NPL::DetectorFactory::m_Instance = 0; //////////////////////////////////////////////////////////////////////////////// NPL::DetectorFactory::DetectorFactory(){ +#ifdef __linux__ + m_SharedLibExtension = ".so"; +#endif + +#ifdef __FreeBSD__ + m_SharedLibExtension = ".so"; +#endif + +#ifdef __APPLE__ + m_SharedLibExtension = ".dylib"; +#endif + } @@ -138,7 +147,7 @@ void NPL::DetectorFactory::AddToken(std::string Token, std::string LibName){ // Create the full name: - LibName = "libNP"+LibName + NPOptionManager::getInstance()->GetSharedLibExtension(); + LibName = "libNP"+LibName + m_SharedLibExtension; m_TokenLib[Token] = LibName; } diff --git a/NPLib/Core/NPDetectorFactory.h b/NPLib/Core/NPDetectorFactory.h index bbc7588a598fd58fa2e52656a09b5cf0cef8463f..eea84736d1080358e396e5fcfe47b088ba61f128 100644 --- a/NPLib/Core/NPDetectorFactory.h +++ b/NPLib/Core/NPDetectorFactory.h @@ -48,6 +48,7 @@ class DetectorFactory{ std::map<std::string,ClassDetectorFactoryFn> m_Construct; // Map that Match the Token with the Lib to be loaded std::map<std::string,std::string> m_TokenLib; + std::string m_SharedLibExtension; }; } #endif diff --git a/NPLib/Core/NPDetectorManager.cxx b/NPLib/Core/NPDetectorManager.cxx index 6f6bbe9e598a8052fef38f06753f6114a3416255..fe44b39eea44f77d5b815eb544d461f6fcfc646f 100644 --- a/NPLib/Core/NPDetectorManager.cxx +++ b/NPLib/Core/NPDetectorManager.cxx @@ -40,6 +40,7 @@ #include "NPCalibrationManager.h" #include "NPInputParser.h" #include "NPSystemOfUnits.h" + using namespace NPUNITS; //Root #include"TCanvas.h" diff --git a/Projects/ChiNu/PhysicsListOption.txt b/Projects/ChiNu/PhysicsListOption.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec1a9581f1eaf7645d75dab4f7a5ce99feb20aad --- /dev/null +++ b/Projects/ChiNu/PhysicsListOption.txt @@ -0,0 +1,15 @@ +EmPhysicsList Option4 +DefaultCutOff 1 +DriftElectronPhysics 0 +IonBinaryCascadePhysics 0 +NPIonInelasticPhysics 0 +EmExtraPhysics 0 +HadronElasticPhysics 0 +StoppingPhysics 0 +OpticalPhysics 0 +HadronPhysicsINCLXX 0 +HadronPhysicsQGSP_BIC_HP 0 +HadronPhysicsQGSP_BERT_HP 0 +Decay 0 +Menate_R 0 +NeutronHP 1 diff --git a/Projects/ComptonTelescope/online/CMakeLists.txt b/Projects/ComptonTelescope/online/CMakeLists.txt index 4138480665b8f1d272513e95767e25eaf217004a..6f36d687f46d9c0ee4ddf63e168bdac3ae7a94d2 100644 --- a/Projects/ComptonTelescope/online/CMakeLists.txt +++ b/Projects/ComptonTelescope/online/CMakeLists.txt @@ -4,8 +4,23 @@ set (CCAM_VERSION_MAJOR 0) set (CCAM_VERSION_MINOR 1) set(CMAKE_BUILD_TYPE Release) +# ROOT stuff +list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS}) +find_package(ROOT REQUIRED) +include_directories(${ROOT_INCLUDE_DIRS}) + +# nptool stuff +find_package(NPLib) +include(${NPLib_USE_FILE}) +message(" found: ${NPLIB}") +message(" include directory: ${NPLib_INCLUDE_DIRS}") +message(" detector list (empty if all): ${NPLib_DETECTOR_LIST}") +message(" library directory: ${NPLib_LIB_DIRS}") +link_directories(${NPLIB}/lib) + # support for c++11 set (CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}") # set directories set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) diff --git a/Projects/ComptonTelescope/online/src/CMakeLists.txt b/Projects/ComptonTelescope/online/src/CMakeLists.txt index 62beb054ade0aa4baac3c0cc7d1362e2d81c118e..a98440caaf058e514eda61c855c7ca5894387643 100644 --- a/Projects/ComptonTelescope/online/src/CMakeLists.txt +++ b/Projects/ComptonTelescope/online/src/CMakeLists.txt @@ -1,17 +1,16 @@ # ROOT stuff -list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS}) -find_package(ROOT REQUIRED) -include_directories(${ROOT_INCLUDE_DIRS}) +#list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS}) +#find_package(ROOT REQUIRED) +#include_directories(${ROOT_INCLUDE_DIRS}) # nptool stuff -#list(APPEND CMAKE_PREFIX_PATH $ENV{NPTOOL}) -find_package(NPLib) -include(${NPLib_USE_FILE}) -message(" found: ${NPLIB}") -message(" include directory: ${NPLib_INCLUDE_DIRS}") -message(" detector list (empty if all): ${NPLib_DETECTOR_LIST}") -message(" library directory: ${NPLib_LIB_DIRS}") -link_directories(${NPLIB}/lib) +#find_package(NPLib) +#include(${NPLib_USE_FILE}) +#message(" found: ${NPLIB}") +#message(" include directory: ${NPLib_INCLUDE_DIRS}") +#message(" detector list (empty if all): ${NPLib_DETECTOR_LIST}") +#message(" library directory: ${NPLib_LIB_DIRS}") +#link_directories(${NPLIB}/lib) # build DecodeR shared library add_library(DecodeR SHARED DecodeR.cpp) @@ -20,5 +19,6 @@ add_library(DecodeR SHARED DecodeR.cpp) add_executable(online online.cpp) # link library rules -#target_link_libraries(online DecodeR ${ROOT_LIBRARIES} NPCore NPPhysics NPComptonTelescope) -target_link_libraries(online ${ROOT_LIBRARIES} NPCore NPPhysics) +# !!!! Example1.detector not found when NPComptonTelescope is added !!!! +target_link_libraries(online DecodeR ${ROOT_LIBRARIES} NPCore NPPhysics NPComptonTelescope) +#target_link_libraries(online DecodeR ${ROOT_LIBRARIES} NPCore NPPhysics) diff --git a/Projects/ComptonTelescope/online/src/online.C b/Projects/ComptonTelescope/online/src/online.C index cd20a502ca46268ac4668a3b1d61fec8d0c51412..97560ed03c54c4ce62b5263c7dd7d32d14db68f4 100644 --- a/Projects/ComptonTelescope/online/src/online.C +++ b/Projects/ComptonTelescope/online/src/online.C @@ -347,7 +347,8 @@ void online() // sprintf(arg,"-D ./ComptonCAM.detector -C Calibration.txt -GH -E Example2.reaction -P %i --circular",port); // sprintf(arg,"-D ./ComptonCAM.detector -C calibrations.txt -GH -E Example2.reaction --circular"); // sprintf(arg,"-D ./ComptonCAM.detector -C calibrations.txt -GH -E ./10He.reaction --circular"); -/* string arg = "-D ./ComptonCAM.detector -C calibrations.txt -GH -E ./10He.reaction --circular"; +// string arg = "-D ./ComptonCAM.detector -C calibrations.txt -GH -E ./10He.reaction --circular"; + string arg = "-D ./Example1.detector -GH -E Example1.reaction --circular"; NPOptionManager::getInstance(arg); // ROOT output file name @@ -357,8 +358,8 @@ void online() string detectorfileName = NPOptionManager::getInstance()->GetDetectorFile(); cout << "detector file name from NPOptionManager: " << detectorfileName << "\n"; NPL::DetectorManager* m_NPDetectorManager = new NPL::DetectorManager(); - m_NPDetectorManager->ReadConfigurationFile(detectorfileName);*/ -/* m_NPDetectorManager->InitializeRootOutput();*/ + m_NPDetectorManager->ReadConfigurationFile(detectorfileName); + m_NPDetectorManager->InitializeRootOutput(); // instantiate raw ComptonCAM data pointer auto ccamData = new TComptonTelescopeData(); @@ -374,7 +375,7 @@ void online() // Load a file ifstream is; - is.open("decodeR/mfm.bin", ios::binary); + is.open("../mfm.bin", ios::binary); is.seekg (0, ios::end); int length = is.tellg(); is.seekg (0, ios::beg); diff --git a/Projects/ComptonTelescope/online/src/online.cpp b/Projects/ComptonTelescope/online/src/online.cpp index 7d02c9159752d09411eb036768c1218b95f854e7..31df7a2e380cbaad70e2ec0327d0f10c0f3e9be0 100644 --- a/Projects/ComptonTelescope/online/src/online.cpp +++ b/Projects/ComptonTelescope/online/src/online.cpp @@ -2,13 +2,13 @@ #include "NPOptionManager.h" #include "RootOutput.h" #include "NPDetectorManager.h" -//#include "TComptonTelescopeData.h" -//#include "TComptonTelescopePhysics.h" +#include "TComptonTelescopeData.h" +#include "TComptonTelescopePhysics.h" // root headers // custom headers -//#include "DecodeR.h" +#include "DecodeR.h" // C++ headers #include <iostream> @@ -22,42 +22,35 @@ int main() { /////////////////////////////////////////////////////////////////////////// // configure option manager - // NPOptionManager::getInstance()->Destroy(); + // NPOptionManager::getInstance()->Destroy(); // char arg[1000]; // sprintf(arg,"-D ./ComptonCAM.detector -C Calibration.txt -GH -E Example2.reaction -P %i --circular",port); // sprintf(arg,"-D ./ComptonCAM.detector -C calibrations.txt -GH -E Example2.reaction --circular"); // sprintf(arg,"-D ./ComptonCAM.detector -C calibrations.txt -GH -E ./10He.reaction --circular"); // string arg = "-D ./ComptonCAM.detector -C calibrations.txt -GH -E ./10He.reaction --circular"; - - string arg = "-D ./Example1.detector -GH -E Example1.reaction -T /scratch/rdc/FDC2.root RawTree"; + string arg = "-D ./Example1.detector -GH -E Example1.reaction --circular"; NPOptionManager::getInstance(arg); // ROOT output file name RootOutput::getInstance("OnlineTree.root", "OnlineTree"); + // configure detector manager string detectorfileName = NPOptionManager::getInstance()->GetDetectorFile(); cout << "detector file name from NPOptionManager: " << detectorfileName << "\n"; NPL::DetectorManager* m_NPDetectorManager = new NPL::DetectorManager(); m_NPDetectorManager->ReadConfigurationFile(detectorfileName); m_NPDetectorManager->InitializeRootOutput(); - m_NPDetectorManager->InitializeRootInput(); - // Essential! - #if __cplusplus > 199711L && NPMULTITHREADING - m_NPDetectorManager->StopThread(); - #endif - RootOutput::Destroy(); - RootInput::Destroy(); /////////////////////////////////////////////////////////////////////////// // this part is commented for debugging purposes, but it works on its own /////////////////////////////////////////////////////////////////////////// // instantiate raw ComptonCAM data pointer - /* auto ccamData = new TComptonTelescopeData(); - ccamData->Dump(); + auto ccamData = new TComptonTelescopeData(); + ccamData->Dump(); // connect raw CCAM data pointer to physics class - // auto ccamPhys = (TComptonTelescopePhysics*) m_NPDetectorManager->GetDetector("ComptonTelescope"); - // ccamPhys->SetRawDataPointer(ccamData); +// auto ccamPhys = (TComptonTelescopePhysics*) m_NPDetectorManager->GetDetector("ComptonTelescope"); +// ccamPhys->SetRawDataPointer(ccamData); // read data file/flux and fill ccamData object std::cout << "Reading data\n"; @@ -109,7 +102,7 @@ int main() } delete D; delete [] buffer; - */ + // test zone... /* ccamData->SetCTTrackerFrontETowerNbr(1); @@ -121,5 +114,12 @@ int main() ccamData->Dump(); */ std::cout << "test compil\n"; + + // Essential + #if __cplusplus > 199711L && NPMULTITHREADING + m_NPDetectorManager->StopThread(); + #endif + RootOutput::Destroy(); + return 0; }