Commit c59f3bdf authored by Adrien Matta's avatar Adrien Matta
Browse files

* Fixing timing issue in thread start

parent f24d6479
Pipeline #93989 passed with stages
in 20 minutes and 27 seconds
......@@ -393,11 +393,10 @@ void NPL::DetectorManager::InitThreadPool(){
m_ThreadPool.clear();
m_Ready.clear();
std::map<std::string,VDetector*>::iterator it;
m_Ready.resize(m_Detector.size(),false);
unsigned int i = 0;
for (it = m_Detector.begin(); it != m_Detector.end(); ++it) {
m_ThreadPool.push_back( std::thread( &NPL::DetectorManager::StartThread,this,it->second,i++) );
m_Ready.push_back(false);
}
m_stop = false;
......
......@@ -16,7 +16,7 @@ endif()
## Check for FORTRAN compiler, if so
## compile RAYTRACE code
if("${CMAKE_GENERATOR}" STREQUAL "Unix Makefiles")
#if("${CMAKE_GENERATOR}" STREQUAL "Unix Makefiles")
check_language(Fortran)
if(CMAKE_Fortran_COMPILER)
message(STATUS "Compiling libMDM with RAYTRACE support included.")
......@@ -24,15 +24,15 @@ if("${CMAKE_GENERATOR}" STREQUAL "Unix Makefiles")
enable_language(Fortran)
set (CMAKE_Fortran_FLAGS "-O3 -finit-local-zero -falign-commons -fno-automatic -w")
add_library(NPMDM SHARED TMDMSpectra.cxx TMDMData.cxx TMDMPhysics.cxx TMDMPhysicsMinimizer TMDMDataDict.cxx TMDMPhysicsDict.cxx TMDMPhysicsMinimizerDict.cxx MDMTrace.cpp RAYTKIN1.F)
else()
else()
## No fortran support, compile "fake" c-version
message(STATUS "No Fortran support, disabling RAYTRACE in libMDM")
add_library(NPMDM SHARED TMDMSpectra.cxx TMDMData.cxx TMDMPhysics.cxx TMDMPhysicsMinimizer TMDMDataDict.cxx TMDMPhysicsDict.cxx TMDMPhysicsMinimizerDict.cxx MDMTrace.cpp)
endif()
else()
message(STATUS "Fortran support only included with Unix Makefile generator, disabling RAYTRACE in libMDM.")
add_library(NPMDM SHARED TMDMSpectra.cxx TMDMData.cxx TMDMPhysics.cxx TMDMPhysicsMinimizer TMDMDataDict.cxx TMDMPhysicsDict.cxx TMDMPhysicsMinimizerDict.cxx MDMTrace.cpp)
endif()
message(STATUS "No Fortran support, disabling RAYTRACE in libMDM")
add_library(NPMDM SHARED TMDMSpectra.cxx TMDMData.cxx TMDMPhysics.cxx TMDMPhysicsMinimizer TMDMDataDict.cxx TMDMPhysicsDict.cxx TMDMPhysicsMinimizerDict.cxx MDMTrace.cpp)
endif()
#else()
# message(STATUS "Fortran support only included with Unix Makefile generator, disabling RAYTRACE in libMDM.")
# add_library(NPMDM SHARED TMDMSpectra.cxx TMDMData.cxx TMDMPhysics.cxx TMDMPhysicsMinimizer TMDMDataDict.cxx TMDMPhysicsDict.cxx TMDMPhysicsMinimizerDict.cxx MDMTrace.cpp)
#endif()
if(Minuit2_FOUND)
## Link to Minuit2 library
......
......@@ -184,14 +184,13 @@ void NPL::DCReconstructionMT::InitThreadPool(){
StopThread();
m_ThreadPool.clear();
m_Ready.clear();
m_Ready.resize(m_nbr_thread,false);
for (unsigned int i=0; i < m_nbr_thread; i++) {
//Create the minimiser (deleted by the thread)
ROOT::Math::Minimizer* mini=ROOT::Math::Factory::CreateMinimizer("Minuit2", "Migrad");
// Register minimiser for futur deletion
m_ThreadPool.push_back( std::thread(&NPL::DCReconstructionMT::StartThread,this,mini,i) );
m_Ready.push_back(false);
}
m_stop = false;
......
......@@ -97,6 +97,8 @@ G4bool Decay::ModelTrigger(const G4FastTrack& fastTrack) {
////////////////////////////////////////////////////////////////////////////////
void Decay::DoIt(const G4FastTrack& fastTrack,G4FastStep& fastStep){
cout << m_ExcitationEnergy << endl;
// Get the track info
const G4Track* PrimaryTrack = fastTrack.GetPrimaryTrack();
G4ThreeVector pdirection = PrimaryTrack->GetMomentum().unit();
......
......@@ -12,7 +12,7 @@
* Last update : *
*---------------------------------------------------------------------------*
* Decription: *
* This class describe eAGanil analysis project *
* This class describe eAGanil analysis project *
* *
*---------------------------------------------------------------------------*
* Comment: *
......@@ -45,11 +45,13 @@ void Analysis::Init(){
Inter = new TInteractionCoordinates();
RootInput:: getInstance()->GetChain()->SetBranchAddress("InteractionCoordinates",&Inter);
RootInput:: getInstance()->GetChain()->SetBranchAddress("ReactionConditions",&Initial );
RootInput:: getInstance()->GetChain()->SetBranchAddress("Run",&Run );
RootOutput::getInstance()->GetTree()->Branch("Ex",&Ex);
RootOutput::getInstance()->GetTree()->Branch("ELab",&ELab);
RootOutput::getInstance()->GetTree()->Branch("ThetaLab",&ThetaLab);
RootOutput::getInstance()->GetTree()->Branch("Detected",&Detected);
RootOutput::getInstance()->GetTree()->Branch("Resolution",&Resolution);
RootOutput::getInstance()->GetTree()->Branch("Run",&Run);
m_reaction.ReadConfigurationFile(NPOptionManager::getInstance()->GetReactionFile());
Resolution={5e-2,1e-2,5e-3,1e-3,5e-4,1e-4,5e-5,1e-5,5e-6,1e-6};
}
......@@ -63,14 +65,16 @@ void Analysis::TreatEvent(){
unsigned int sizeR = Resolution.size();
for(unsigned int i = 0 ; i < sizeR ; i++){
double E = Rand.Gaus(Energy,Energy*Resolution[i]);
//double E = Rand.Gaus(Energy,Energy*Resolution[i]);
//double E = Rand.Gaus(Energy,Energy*1e-4);
//double T = Rand.Gaus(Theta,Theta*Resolution[i]);
double ExO = m_reaction.ReconstructRelativistic(E,Theta);
//double ExO = m_reaction.ReconstructRelativistic(Energy,T);
// double T = Rand.Gaus(Theta,Theta*Resolution[i]);
//double ExO = m_reaction.ReconstructRelativistic(E,Theta);
// double ExO = m_reaction.ReconstructRelativistic(Energy,T);
double ExO = m_reaction.ReconstructRelativistic(Energy,Theta);
Ex.push_back(ExO);
ThetaLab.push_back(Theta/deg);
ELab.push_back(E);
//ELab.push_back(E);
if(Inter->GetDetectedMultiplicity())
Detected.push_back(1);
else
......
......@@ -46,6 +46,7 @@ class Analysis: public NPL::VAnalysis{
NPL::Reaction m_reaction;
vector<double> Ex,ELab,ThetaLab,Resolution;
vector<int> Detected;
int Run;
private:
TeAGanilPhysics* eAGanil;
TInteractionCoordinates* Inter;
......
......@@ -2,7 +2,7 @@
Beam
Particle= electron
Energy= 500 MeV
SigmaEnergy= 0.25 MeV
SigmaEnergy= 0.0 MeV
SigmaThetaX= 0.1 deg
SigmaPhiY= 0.1 deg
SigmaX= 0.1 mm
......
void AddNuclei(string,double);
void resolutionT();
void resolutionP();
void resolutionE();
// the main canvas
TCanvas* c;
////////////////////////////////////////////////////////////////////////////////
void resolution(){
c = new TCanvas("c","c",1500,500);
c->Divide(3,1);
resolutionP();
resolutionT();
resolutionE();
}
////////////////////////////////////////////////////////////////////////////////
void resolutionP(){
auto f = new TFile("../../Outputs/Analysis/eAGanil_P.root");
auto tree= (TTree*) f->FindObjectAny("PhysicsTree");
vector<double> Resolution={5e-2,1e-2,5e-3,1e-3,5e-4,1e-4,5e-5,1e-5,5e-6,1e-6};
unsigned int sizeR = Resolution.size();
auto cl = new TCanvas();
cl->Divide(3,2);
vector<double> R ;
for(unsigned int i = 0 ; i < sizeR ; i++){
cl->cd(i+1);
if(i<3)
tree->Draw(Form("Ex>>h%d(1000,-10,10)",i),Form("Resolution==%f",Resolution[i]),"");
else
tree->Draw(Form("Ex>>h%d(1000,-0.5,0.5)",i),Form("Resolution==%f",Resolution[i]),"");
auto h = (TH1*) gDirectory->FindObjectAny(Form("h%d",i));
h->Fit("gaus");
R.push_back(2*sqrt(2*log(2))*h->GetFunction("gaus")->GetParameter(2)*1000.);
cout << R[i] << endl;
}
auto g = new TGraph(R.size(),&Resolution[0],&R[0]);
c->cd(1);
g->Draw("apl");
gPad->SetLogx();
g->SetMarkerStyle(20);
g->GetYaxis()->SetRangeUser(-100,1400);
g->GetXaxis()->SetTitle("p/#deltaP");
g->GetYaxis()->SetTitle("FWHM (keV)");
AddNuclei("100 keV",100);
/* AddNuclei("134Sn",725.6);
AddNuclei("132Sn",64.4);
AddNuclei("133Sn",853.7);
AddNuclei("70Ni",183.11);
AddNuclei("71Ni",252.2);
AddNuclei("72Ni",455);
//AddNuclei("73Ni",239.2);
AddNuclei("74Ni",739);*/
}
auto f = new TFile("../../Outputs/Analysis/PhysicsTree.root");
////////////////////////////////////////////////////////////////////////////////
void resolutionT(){
auto f = new TFile("../../Outputs/Analysis/eAGanil_T.root");
auto tree= (TTree*) f->FindObjectAny("PhysicsTree");
vector<double> Resolution={5e-2,1e-2,5e-3,1e-3,5e-4,1e-4,5e-5,1e-5,5e-6,1e-6};
unsigned int sizeR = Resolution.size();
auto c = new TCanvas();
c->Divide(3,2);
auto cl = new TCanvas();
cl->Divide(3,2);
vector<double> R ;
for(unsigned int i = 0 ; i < sizeR ; i++){
c->cd(i+1);
cl->cd(i+1);
if(i<3)
tree->Draw(Form("Ex>>h%d(1000,-10,10)",i),Form("Resolution==%f",Resolution[i]),"");
else
......@@ -23,25 +81,70 @@ void resolution(){
}
auto g = new TGraph(R.size(),&Resolution[0],&R[0]);
new TCanvas();
g->Draw("apc");
c->cd(2);
g->Draw("apl");
gPad->SetLogx();
g->SetMarkerStyle(20);
g->GetYaxis()->SetRangeUser(-100,1400);
g->GetXaxis()->SetTitle("E/#deltaE");
g->GetXaxis()->SetTitle("#theta/#delta#theta");
g->GetYaxis()->SetTitle("FWHM (keV)");
AddNuclei("100 keV",100);
/* AddNuclei("134Sn",725.6);
AddNuclei("132Sn",64.4);
AddNuclei("133Sn",853.7);
AddNuclei("70Ni",183.11);
AddNuclei("71Ni",252.2);
AddNuclei("72Ni",455);
//AddNuclei("73Ni",239.2);
AddNuclei("74Ni",739);*/
}
////////////////////////////////////////////////////////////////////////////////
void resolutionE(){
auto f = new TFile("../../Outputs/Analysis/eAGanil_E.root");
auto tree= (TTree*) f->FindObjectAny("PhysicsTree");
vector<double> Resolution={1e-1,1e-2,1e-3,1e-4,1e-5,1e-6,0};
vector<double> Run={2,3,4,5,6,7,1};
unsigned int sizeR = Resolution.size();
auto cl = new TCanvas();
cl->Divide(3,2);
vector<double> R ;
for(unsigned int i = 0 ; i < sizeR ; i++){
cl->cd(i+1);
tree->Draw(Form("Ex>>h%d(1000,-0.5,0.5)",i),Form("Run==%f",Run[i]),"");
auto h = (TH1*) gDirectory->FindObjectAny(Form("h%d",i));
h->Fit("gaus");
R.push_back(2*sqrt(2*log(2))*h->GetFunction("gaus")->GetParameter(2)*1000.);
cout << R[i] << endl;
}
auto g = new TGraph(R.size(),&Resolution[0],&R[0]);
c->cd(3);
g->Draw("apl");
gPad->SetLogx();
g->SetMarkerStyle(20);
AddNuclei("134Sn",725.6);
g->GetXaxis()->SetRangeUser(1e-6,5e-2);
g->GetYaxis()->SetRangeUser(-100,1400);
g->GetXaxis()->SetTitle("E/#deltaE");
g->GetYaxis()->SetTitle("FWHM (keV)");
AddNuclei("100 keV",100);
/* AddNuclei("134Sn",725.6);
AddNuclei("132Sn",64.4);
AddNuclei("133Sn",853.7);
AddNuclei("70Ni",183.11);
AddNuclei("71Ni",252.2);
AddNuclei("72Ni",455);
//AddNuclei("73Ni",239.2);
AddNuclei("74Ni",739);
AddNuclei("74Ni",739);*/
}
////////////////////////////////////////////////////////////////////////////////
void AddNuclei(string name,double keV){
static bool alt = true;
static double off =1e-6;
......@@ -52,7 +155,7 @@ void AddNuclei(string name,double keV){
TLatex* t;
if(alt){
t = new TLatex(3e-6-off,keV-30,name.c_str());
alt=false;
alt=true;
}
else{
t = new TLatex(3e-6+off,keV+10,name.c_str());
......
/run/beamOn 1000
/run/beamOn 10000
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment