diff --git a/Examples/Example3/Analysis.cxx b/Examples/Example3/Analysis.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d96df0b21d0be5399f2653fe34edb2c4ce3b37eb --- /dev/null +++ b/Examples/Example3/Analysis.cxx @@ -0,0 +1,174 @@ +/***************************************************************************** + * 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: Marc Labiche contact address: marc.labiche@stfc.ac.uk * + * * + * Creation Date : nov 2016 * + * 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(); + + Fat = (TFatimaPhysics*) m_DetectorManager -> GetDetector("Fatima"); + + + + myBeam = new NPL::Beam(); + myBeam->ReadConfigurationFile(NPOptionManager::getInstance()->GetReactionFile()); + + // myDetector= new NPL::DetectorManager(); + // myDetector->ReadConfigurationFile(NPOptionManager::getInstance()->GetDetectorFile()); + + ANucleus = myBeam->GetA(); + cout << "Beam nucleus A= " << ANucleus <<endl; + + OriginalBeamEnergy = myBeam->GetEnergy(); + cout << "Beam Energy before target= " << OriginalBeamEnergy << " MeV" << endl; + + beta= sqrt(pow(OriginalBeamEnergy,2)+2*OriginalBeamEnergy*25*931.5)/(OriginalBeamEnergy+25*931.5); + // To do: calculate beta form middle of the target. + cout << "beta beam= " << beta << endl; + + Mult_Fatima= 0; + E_Fatima = 0 ; + + // Output histo + HistoFile=new TFile("../../Outputs/Analysis/HistoList.root","RECREATE"); + E_DopplerCor = new TH1D("EDop","Gamma Doppler corrected energy",4000,0,4); + E_Recorded = new TH1D("ERec","Raw Gamma energy",4000,0,4); + + // Output tree: + InitOutputBranch(); + // Input tree + InitInputBranch(); + +} + +//////////////////////////////////////////////////////////////////////////////// +void Analysis::TreatEvent(){ + // Reinitiate calculated variable + ReInitValue(); + // 32 module - symetrical configuration -> 16 polar angles + const double ThetaDet[]= {19.02390167, 37.70329404, 57.52298638, 77.29968198, + 25.83989928, 46.55103678, 67.02589098, 107.1442293, + 26.85689097, 41.56673389, 59.43554149, 77.97363101, + 115.2395483, 46.94600569, 72.54645084, 103.1039385 }; + + + Mult_Fatima=Fat->GetEventData()->GetFatimaLaBr3EMult(); + + //cout << "Multiplicity in Fatima= " << Mult_Fatima << endl; + + //////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////// + //////////////////////////// Fatima evt ////////////////// + + if( Mult_Fatima==1){ + + Det_Fatima= Fat->GetEventData()->GetFatimaLaBr3EDetectorNbr(0); + //cout << "Multiplicity in Fatima= " << Mult_Fatima << endl; + //cout << "Fatima Det id = " << Det_Fatima << endl; + + if(Det_Fatima<17) + { + //cout << "Theta detector = " << ThetaDet[Det_Fatima-1] << endl; + ThetaDop=ThetaDet[Det_Fatima-1]; + }else + { + //cout << "Theta detector = " << ThetaDet[Det_Fatima-17] << endl; + ThetaDop=ThetaDet[Det_Fatima-17]; + } + + Energy = Fat->GetEventData()->GetFatimaLaBr3EEnergy(0); + //cout << "Fatima Energy = " << Energy << endl; + + // Detector intrinsic energy resolution + EDepCor = Energy*(1-beta*cos((ThetaDop)*3.14159/180.))/sqrt(1-beta*beta);; // To do: doppler correction + + //Fill hitogram + E_Recorded->Fill(Energy); + E_DopplerCor->Fill(EDepCor); + + }//end Fatima evt + +} + +//////////////////////////////////////////////////////////////////////////////// +void Analysis::End(){ + + HistoFile->Write(); + HistoFile->Close(); + +} +//////////////////////////////////////////////////////////////////////////////// +void Analysis::InitOutputBranch() { + RootOutput::getInstance()->GetTree()->Branch("EDepCor",&EDepCor,"EDepCor/D"); + RootOutput::getInstance()->GetTree()->Branch("Det_Fatima",&Det_Fatima,"Det_Fatima/I"); + +} + +//////////////////////////////////////////////////////////////////////////////// +void Analysis::InitInputBranch(){ + // RootInput:: getInstance()->GetChain()->SetBranchAddress("InitialConditions",&myInit ); +} +//////////////////////////////////////////////////////////////////////////////// +void Analysis::ReInitValue(){ + EDepCor = -10; + Det_Fatima= -10; + +} + +//////////////////////////////////////////////////////////////////////////////// +// 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/Examples/Example3/Analysis.h b/Examples/Example3/Analysis.h new file mode 100644 index 0000000000000000000000000000000000000000..cd08a5b67e6719e615f1f376fd430287dd4b2d99 --- /dev/null +++ b/Examples/Example3/Analysis.h @@ -0,0 +1,77 @@ +#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"NPBeam.h" +#include"RootOutput.h" +#include"RootInput.h" +#include "TFatimaPhysics.h" +#include "TInitialConditions.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(); + + private: + double ELab, EDepCor; + double ThetaDop, beta; + int Det_Fatima; + int ANucleus; + const static double ThetaDet[]; + + NPL::Beam* myBeam; + //NPL::DetectorManager* myDetector; + + TInitialConditions* myInit ; + //TInteractionCoordinates* myIntCoord ; + + double OriginalBeamEnergy ; // MEV + double Energy ; + double E_Fatima ; + int Mult_Fatima; + + TFatimaPhysics* Fat; + + TFile* HistoFile; + TH1D* E_DopplerCor; + TH1D* E_Recorded; + + + +}; +#endif diff --git a/Examples/Example3/CMakeLists.txt b/Examples/Example3/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..22c74affdfc45019bdda2594f8439c52d4ab97ec --- /dev/null +++ b/Examples/Example3/CMakeLists.txt @@ -0,0 +1,5 @@ +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/Examples/Example3/RunToTreat.txt b/Examples/Example3/RunToTreat.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9e25937b5bc55fcae0c5444cc967452ad7a0438 --- /dev/null +++ b/Examples/Example3/RunToTreat.txt @@ -0,0 +1,4 @@ +TTreeName + SimulatedTree +RootFileName +../../Outputs/Simulation/myResult.root diff --git a/Examples/Example3/defaultRunToTreat.txt b/Examples/Example3/defaultRunToTreat.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9e25937b5bc55fcae0c5444cc967452ad7a0438 --- /dev/null +++ b/Examples/Example3/defaultRunToTreat.txt @@ -0,0 +1,4 @@ +TTreeName + SimulatedTree +RootFileName +../../Outputs/Simulation/myResult.root diff --git a/Inputs/DetectorConfiguration/Fatima.detector b/Inputs/DetectorConfiguration/Fatima.detector index fa85842a1e40ae6c345be075574a03eec2aba255..6a1289586fbe638b33a500950f53f1acf57660c2 100644 --- a/Inputs/DetectorConfiguration/Fatima.detector +++ b/Inputs/DetectorConfiguration/Fatima.detector @@ -12,12 +12,10 @@ Target THICKNESS= 10.3 ANGLE= 0 RADIUS= 12 -% MATERIAL= CD2l MATERIAL= CD2 - NBLAYERS= 50 X= 0 Y= 0 - Z= 0 + Z= 0 %Target % THICKNESS= 0.01 % ANGLE= 0 @@ -27,7 +25,6 @@ Target % X= 0 % Y= 0 % Z= 0 - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %GeneralChamber %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -35,23 +32,18 @@ Target %GREATChamber %GREAT-Karl % Heightmin= 178. -% Heightmax= 181. +% Heightmax= 181. % Widthmin= 228. % Widthmax= 231. -% Depthmin= 200. +% Depthmin= 200. % Depthmax= 205. % MATERIAL= Alu - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - - % % ################################################# % ############ At the back of DSSSDs: ############# % ################################################# % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Fatima %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1 diff --git a/NPLib/Detectors/Fatima/TFatimaPhysics.cxx b/NPLib/Detectors/Fatima/TFatimaPhysics.cxx index 37bd59d1d216531ae4258884c6054579737048f0..707bea73edbe76acce424a450473ba7a563083ff 100644 --- a/NPLib/Detectors/Fatima/TFatimaPhysics.cxx +++ b/NPLib/Detectors/Fatima/TFatimaPhysics.cxx @@ -350,16 +350,16 @@ void TFatimaPhysics::ReadCalibrationFile(string Path){ //////////////////////////////////////////////////////////////////////////////// void TFatimaPhysics::InitializeRootInputRaw(){ TChain* inputChain = RootInput::getInstance()->GetChain(); - inputChain->SetBranchStatus("FATIMA", true); + inputChain->SetBranchStatus("Fatima", true); inputChain->SetBranchStatus("fFATIMA*", true); - inputChain->SetBranchAddress("FATIMA", &m_EventData); + inputChain->SetBranchAddress("Fatima", &m_EventData); } //////////////////////////////////////////////////////////////////////////////// void TFatimaPhysics::InitializeRootOutput(){ TTree* outputTree = RootOutput::getInstance()->GetTree(); - outputTree->Branch("FATIMA", "TFatimaPhysics", &m_EventPhysics); + outputTree->Branch("Fatima", "TFatimaPhysics", &m_EventPhysics); } void TFatimaPhysics::AddDetector(TVector3 A, TVector3 B,