diff --git a/Projects/ComptonTelescope/ComptonCAM.detector b/Projects/ComptonTelescope/ComptonCAM.detector deleted file mode 100644 index d91488de93685e6ea07102e05d3aa6225f16dc77..0000000000000000000000000000000000000000 --- a/Projects/ComptonTelescope/ComptonCAM.detector +++ /dev/null @@ -1,16 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -ComptonTelescope - R= 150 mm - THETA= 0 deg - PHI= 0 deg - BETA= 0 0 0 deg - SIZE_DSSSD= 64 mm - NUMBER_DSSSD= 1 - DISTANCE_INTER_DSSSD= 10 mm - THICKNESS_DSSSD= 1.5 mm - NUMBER_STRIPS= 32 - DISTANCE_TRACKER_CALORIMETER= 20 mm - THICKNESS_CALORIMETER= 10 mm - TRACKER= 1 - CALORIMETER= 1 - VIS= 1 diff --git a/Projects/ComptonTelescope/online/CMakeLists.txt b/Projects/ComptonTelescope/online/CMakeLists.txt index 6f36d687f46d9c0ee4ddf63e168bdac3ae7a94d2..61ba46d1aa7199a74bc01d8f254d2dd81158d3c8 100644 --- a/Projects/ComptonTelescope/online/CMakeLists.txt +++ b/Projects/ComptonTelescope/online/CMakeLists.txt @@ -20,6 +20,8 @@ link_directories(${NPLIB}/lib) # support for c++11 set (CMAKE_CXX_STANDARD 11) + +# add ROOT cxx flags set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}") # set directories diff --git a/Projects/ComptonTelescope/online/calibrations.txt b/Projects/ComptonTelescope/online/calibrations.txt new file mode 100644 index 0000000000000000000000000000000000000000..97821d5d8bd7db027203aba58148e1dd5239c5e7 --- /dev/null +++ b/Projects/ComptonTelescope/online/calibrations.txt @@ -0,0 +1,5 @@ +CalibrationFilePath + ./calibrations/COCOTE_PACI_Front.txt + ./calibrations/COCOTE_PACI_Back.txt + ./calibrations/CeBr3_PED.txt + ./calibrations/CeBr3_E.txt diff --git a/Projects/ComptonTelescope/online/calibrations/COCOTE_PACI_Back.txt b/Projects/ComptonTelescope/online/calibrations/COCOTE_PACI_Back.txt new file mode 100644 index 0000000000000000000000000000000000000000..39b26671fcf3c1a76e7c5af932977654dfd15f7f --- /dev/null +++ b/Projects/ComptonTelescope/online/calibrations/COCOTE_PACI_Back.txt @@ -0,0 +1,32 @@ +COMPTONTELESCOPE_D1_STRIP_BACK0_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK1_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK2_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK3_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK4_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK5_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK6_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK7_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK8_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK9_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK10_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK11_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK12_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK13_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK14_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK15_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK16_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK17_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK18_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK19_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK20_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK21_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK22_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK23_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK24_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK25_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK26_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK27_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK28_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK29_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK30_E -37.1 0.2106 +COMPTONTELESCOPE_D1_STRIP_BACK31_E -37.1 0.2106 diff --git a/Projects/ComptonTelescope/online/calibrations/COCOTE_PACI_Front.txt b/Projects/ComptonTelescope/online/calibrations/COCOTE_PACI_Front.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ecdf01d3078b513e3bedf0f8cef56941d0489ac --- /dev/null +++ b/Projects/ComptonTelescope/online/calibrations/COCOTE_PACI_Front.txt @@ -0,0 +1,32 @@ +COMPTONTELESCOPE_D1_STRIP_FRONT0_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT1_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT2_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT3_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT4_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT5_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT6_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT7_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT8_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT9_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT10_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT11_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT12_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT13_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT14_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT15_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT16_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT17_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT18_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT19_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT20_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT21_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT22_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT23_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT24_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT25_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT26_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT27_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT28_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT29_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT30_E -34.4 0.22729 +COMPTONTELESCOPE_D1_STRIP_FRONT31_E -34.4 0.22729 diff --git a/Projects/ComptonTelescope/online/src/CMakeLists.txt b/Projects/ComptonTelescope/online/src/CMakeLists.txt index a98440caaf058e514eda61c855c7ca5894387643..78c0f6dd08c64266ec21b00063c742003babc232 100644 --- a/Projects/ComptonTelescope/online/src/CMakeLists.txt +++ b/Projects/ComptonTelescope/online/src/CMakeLists.txt @@ -1,17 +1,3 @@ -# 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) - # build DecodeR shared library add_library(DecodeR SHARED DecodeR.cpp) @@ -19,6 +5,4 @@ add_library(DecodeR SHARED DecodeR.cpp) add_executable(online online.cpp) # link library rules -# !!!! 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.cpp b/Projects/ComptonTelescope/online/src/online.cpp index 31df7a2e380cbaad70e2ec0327d0f10c0f3e9be0..a40a5c6c0a15283d37c5ba6d1c6daf985c1af5e3 100644 --- a/Projects/ComptonTelescope/online/src/online.cpp +++ b/Projects/ComptonTelescope/online/src/online.cpp @@ -12,9 +12,8 @@ // C++ headers #include <iostream> -#include <string> #include <fstream> -#include <vector> +#include <string> using namespace std; @@ -22,35 +21,29 @@ int main() { /////////////////////////////////////////////////////////////////////////// // configure option manager - // 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 --circular"; +// NPOptionManager::getInstance()->Destroy(); + +// string arg = "-D ./ComptonCAM.detector -C Calibration.txt -GH -E Example2.reaction -P %i --circular",port); + string arg = "-D ./ComptonCAM.detector -C calibrations.txt -GH -E ./10He.reaction --circular"; NPOptionManager::getInstance(arg); - // ROOT output file name + // open ROOT output file RootOutput::getInstance("OnlineTree.root", "OnlineTree"); + // get tree pointer + auto m_OutputTree = RootOutput::getInstance()->GetTree(); // 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(); - /////////////////////////////////////////////////////////////////////////// - // this part is commented for debugging purposes, but it works on its own - /////////////////////////////////////////////////////////////////////////// // instantiate raw ComptonCAM data pointer 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"; @@ -60,7 +53,7 @@ int main() // Load a file std::ifstream is; - is.open("../mfm.bin", std::ios::binary); + is.open("./mfm.bin", std::ios::binary); is.seekg (0, std::ios::end); int length = is.tellg(); is.seekg (0, ios::beg); @@ -75,18 +68,20 @@ int main() D -> decodeRawMFM(); D -> Dump(); - int c = 0; - // int i = 0; - - while (D -> getCursor() < length) + const int pixelNumber = 64; + while (D -> getCursor() < length) { + // Clear raw data and physics objects + m_NPDetectorManager->ClearEventPhysics(); + m_NPDetectorManager->ClearEventData(); + // Read the actual data D -> decodeRawMFM(); //D -> Dump();//Optionnal print // Set ccamData (a better way is envisionned) - for (int i=0; i<64; i++) { + for (int i = 0; i < pixelNumber; ++i) { ccamData -> SetCTCalorimeterTTowerNbr( 1 ); ccamData -> SetCTCalorimeterTDetectorNbr( 1 );//Triggered ASIC number ccamData -> SetCTCalorimeterTChannelNbr( D -> getPixelNumber() );//ASIC's channel number @@ -96,25 +91,21 @@ int main() ccamData -> SetCTCalorimeterEChannelNbr( i );//PMTÂ pixel number ccamData -> SetCTCalorimeterEEnergy( D -> getData()[i] ); } - ccamData -> Dump(); - ccamData -> Clear(); +// ccamData -> Dump(); + + // Fill object in output ROOT file + m_OutputTree->Fill(); + c++; } delete D; delete [] buffer; - // test zone... - /* - ccamData->SetCTTrackerFrontETowerNbr(1); - ccamData->SetCTTrackerFrontEDetectorNbr(1); - ccamData->SetCTTrackerFrontEStripNbr(12); - ccamData->SetCTTrackerFrontEEnergy(480); - ccamData->Dump(); - ccamData->Clear(); - ccamData->Dump(); - */ std::cout << "test compil\n"; + // Fill spectra + m_NPDetectorManager->WriteSpectra(); + // Essential #if __cplusplus > 199711L && NPMULTITHREADING m_NPDetectorManager->StopThread();