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

* progress on FDC2

parent 8e24293a
Pipeline #95203 passed with stages
in 12 minutes and 52 seconds
......@@ -36,12 +36,14 @@ class SamuraiDCIndex{
m_norme=Norme();
};
unsigned int m_det;
unsigned int m_layer;
unsigned int m_wire;
unsigned int m_norme;
private:
unsigned int m_det;
unsigned int m_layer;
unsigned int m_wire;
unsigned int m_norme;
inline int Norme() const {return (m_det*1000000000+m_layer*1000000+m_wire);} ;
bool operator<(const SamuraiDCIndex i2){
return this->Norme()<i2.Norme();
}
......
......@@ -2,6 +2,7 @@
#define TSamuraiFDC0Data_H
#include "TObject.h"
#include <vector>
class TSamuraiFDC0Data: public TObject{
public:
TSamuraiFDC0Data();
......
......@@ -26,6 +26,7 @@
#include <cmath>
#include <stdlib.h>
#include <limits>
using namespace std;
// NPL
#include "RootInput.h"
......@@ -50,14 +51,6 @@ ClassImp(TSamuraiFDC0Physics)
DriftLowThreshold=0.1 ;
DriftUpThreshold=2.4;
PowerThreshold=5;
#if __cplusplus > 199711L && NPMULTITHREADING
// one thread for each plan X,Y = 2
// ! more than that this will not help !
m_reconstruction.SetNumberOfThread(2);
m_reconstruction.InitThreadPool();
#endif
}
///////////////////////////////////////////////////////////////////////////
......@@ -350,6 +343,15 @@ void TSamuraiFDC0Physics::ReadConfiguration(NPL::InputParser parser){
xml.LoadFile(xmlpath);
AddDC("SAMURAIFDC0",xml);
}
#if __cplusplus > 199711L && NPMULTITHREADING
if(blocks.size()){ // if a detector is found, init the thread pool
// one thread for each plan X,Y = 2
// ! more than that this will not help !
m_reconstruction.SetNumberOfThread(2);
m_reconstruction.InitThreadPool();
#endif
}
}
///////////////////////////////////////////////////////////////////////////
......
......@@ -25,6 +25,7 @@
// STL
#include <vector>
#include <map>
#include <string>
// NPL
#include "TSamuraiFDC0Data.h"
......@@ -48,7 +49,6 @@
//class TSamuraiFDC0Spectra;
using namespace std ;
class TSamuraiFDC0Physics : public TObject, public NPL::VDetector{
public:
......@@ -61,16 +61,16 @@ class TSamuraiFDC0Physics : public TObject, public NPL::VDetector{
public:
// Provide Physical Multiplicity
vector<double> DriftLength;
vector<int> Detector;
vector<int> Layer;
vector<int> Wire;
vector<double> Time;
vector<double> ToT;
vector<bool> Matched;
std::vector<double> DriftLength;
std::vector<int> Detector;
std::vector<int> Layer;
std::vector<int> Wire;
std::vector<double> Time;
std::vector<double> ToT;
std::vector<bool> Matched;
// Computed variable
vector<TVector3> ParticleDirection;
vector<TVector3> MiddlePosition;
std::vector<TVector3> ParticleDirection;
std::vector<TVector3> MiddlePosition;
double PosX;
double PosY;
......@@ -87,10 +87,10 @@ class TSamuraiFDC0Physics : public TObject, public NPL::VDetector{
TVector3 ProjectedPosition(double Z);
private: // Charateristic of the DC
void AddDC(string name, NPL::XmlParser&);//! take the XML file and fill in Wire_X and Layer_Angle
map<SamuraiDCIndex,double> Wire_X;//! X position of the wires
map<SamuraiDCIndex,double> Wire_Z;//! Z position of the wires
map<SamuraiDCIndex,double> Wire_Angle;//! Wire Angle (0 for X, 90 for Y, U and V are typically at +/-30)
void AddDC(std::string name, NPL::XmlParser&);//! take the XML file and fill in Wire_X and Layer_Angle
std::map<SamuraiDCIndex,double> Wire_X;//! X position of the wires
std::map<SamuraiDCIndex,double> Wire_Z;//! Z position of the wires
std::map<SamuraiDCIndex,double> Wire_Angle;//! Wire Angle (0 for X, 90 for Y, U and V are typically at +/-30)
private: // Analysis
double ToTThreshold_H;//! a ToT Low threshold to remove noise
......@@ -186,7 +186,7 @@ class TSamuraiFDC0Physics : public TObject, public NPL::VDetector{
// TSamuraiFDC0Spectra* m_Spectra; // !
public: // Spectra Getter
map< string , TH1*> GetSpectra();
std::map< std::string , TH1*> GetSpectra();
public: // Static constructor to be passed to the Detector Factory
static NPL::VDetector* Construct();
......
......@@ -2,6 +2,7 @@
#define TSamuraiFDC2Data_H
#include "TObject.h"
#include <vector>
class TSamuraiFDC2Data: public TObject{
public:
TSamuraiFDC2Data();
......
......@@ -26,11 +26,11 @@
#include <cmath>
#include <stdlib.h>
#include <limits>
using namespace std;
// NPL
#include "RootInput.h"
#include "RootOutput.h"
#include "TAsciiFile.h"
#include "NPOptionManager.h"
#include "NPDetectorFactory.h"
#include "NPSystemOfUnits.h"
......@@ -50,13 +50,6 @@ ClassImp(TSamuraiFDC2Physics)
DriftLowThreshold=0.4 ;
DriftUpThreshold=9.3;
PowerThreshold=5;
#if __cplusplus > 199711L && NPMULTITHREADING
// one thread for each plan X,U,V = 3
// ! more than this will not help !
m_reconstruction.SetNumberOfThread(3);
m_reconstruction.InitThreadPool();
#endif
}
///////////////////////////////////////////////////////////////////////////
......@@ -349,6 +342,17 @@ void TSamuraiFDC2Physics::ReadConfiguration(NPL::InputParser parser){
xml.LoadFile(xmlpath);
AddDC("SAMURAIFDC2",xml);
}
#if __cplusplus > 199711L && NPMULTITHREADING
if(blocks.size()){
// one thread for each plan X,U,V = 3
// ! more than this will not help !
m_reconstruction.SetNumberOfThread(3);
m_reconstruction.InitThreadPool();
}
#endif
}
///////////////////////////////////////////////////////////////////////////
......
......@@ -48,7 +48,6 @@
using namespace std ;
class TSamuraiFDC2Physics : public TObject, public NPL::VDetector{
public:
TSamuraiFDC2Physics();
......@@ -60,16 +59,16 @@ class TSamuraiFDC2Physics : public TObject, public NPL::VDetector{
public:
// Provide Physical Multiplicity
vector<double> DriftLength;
vector<int> Detector;
vector<int> Layer;
vector<int> Wire;
vector<double> Time;
vector<double> ToT;
vector<bool> Matched;
std::vector<double> DriftLength;
std::vector<int> Detector;
std::vector<int> Layer;
std::vector<int> Wire;
std::vector<double> Time;
std::vector<double> ToT;
std::vector<bool> Matched;
// Computed variable
vector<TVector3> ParticleDirection;
vector<TVector3> MiddlePosition;
std::vector<TVector3> ParticleDirection;
std::vector<TVector3> MiddlePosition;
double PosX;
double PosY;
......@@ -86,10 +85,10 @@ class TSamuraiFDC2Physics : public TObject, public NPL::VDetector{
TVector3 ProjectedPosition(double Z);
private: // Charateristic of the DC
void AddDC(string name, NPL::XmlParser&);//! take the XML file and fill in Wire_X and Layer_Angle
map<SamuraiDCIndex,double> Wire_X;//! X position of the wires
map<SamuraiDCIndex,double> Wire_Z;//! Z position of the wires
map<SamuraiDCIndex,double> Wire_Angle;//! Wire Angle (0 for X, 90 for Y, U and V are typically at +/-30)
void AddDC(std::string name, NPL::XmlParser&);//! take the XML file and fill in Wire_X and Layer_Angle
std::map<SamuraiDCIndex,double> Wire_X;//! X position of the wires
std::map<SamuraiDCIndex,double> Wire_Z;//! Z position of the wires
std::map<SamuraiDCIndex,double> Wire_Angle;//! Wire Angle (0 for X, 90 for Y, U and V are typically at +/-30)
private: // Analysis
double ToTThreshold_H;//! a ToT Low threshold to remove noise
......@@ -98,7 +97,7 @@ class TSamuraiFDC2Physics : public TObject, public NPL::VDetector{
double DriftLowThreshold;//! Minimum Drift length to keep the hit
double DriftUpThreshold;//! Maximum Drift length to keep the hit
double PowerThreshold;//! Maximum P2 minimisation value to keep the track
void RemoveNoise();
void RemoveNoise();//!
// Construct the 2D track and ref position at Z=0 and Z=100 based on X,Z and Radius provided
// Object use to perform the DC reconstruction
......@@ -163,7 +162,7 @@ class TSamuraiFDC2Physics : public TObject, public NPL::VDetector{
void ClearPreTreatedData() {m_PreTreatedData->Clear();}
// Remove bad channel, calibrate the data and apply threshold
void PreTreat();
void PreTreat();//!
// Retrieve raw and pre-treated data
TSamuraiFDC2Data* GetRawData() const {return m_EventData;}
......@@ -186,7 +185,7 @@ class TSamuraiFDC2Physics : public TObject, public NPL::VDetector{
// TSamuraiFDC2Spectra* m_Spectra; // !
public: // Spectra Getter
map< string , TH1*> GetSpectra();
std::map< std::string , TH1*> GetSpectra();
public: // Static constructor to be passed to the Detector Factory
static NPL::VDetector* Construct();
......
......@@ -188,11 +188,9 @@ void NPL::DCReconstructionMT::InitThreadPool(){
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_stop = false;
for(auto& th: m_ThreadPool){
th.detach();
......
......@@ -70,13 +70,11 @@ namespace NPL{
// Function used by the minimizer in BuildTrack2D
double SumD(const double* parameter );
// For debugging/optimisation
// Scan Sumd versus parameter a or b (tovary =0 for a, 1 for b)
// return a TGraph for display
TGraph* Scan(double a, double b, int tovary, double minV, double maxV);
private: // private member used by SumD
// data to minize index by thread ID
std::map<unsigned int,unsigned int> sizeX;
......@@ -98,12 +96,12 @@ namespace NPL{
bool m_stop;
public: // Init the Thread Pool
void StopThread();
void StartThread(ROOT::Math::Minimizer*,unsigned int);
void InitThreadPool();
void StartThread(ROOT::Math::Minimizer*,unsigned int);
void StopThread();
bool IsDone();
// used by SumD
// used by resolve plane
long double av,bv,au,bu;
......
......@@ -23,6 +23,7 @@
#include "BeamReaction.hh"
#include "G4Electron.hh"
#include "G4IonTable.hh"
#include "G4Gamma.hh"
#include "G4SystemOfUnits.hh"
#include "G4EmCalculator.hh"
......
......@@ -8,19 +8,6 @@ Target
X= 0 mm
Y= 0 mm
Z= 0 mm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AnnularS1
Z= -100
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GaspardTracker Trapezoid
R= -90 mm
THETA= 90 deg
PHI= 90 deg
BETA= 0 0 0 deg
FIRSTSTAGE= 1
SECONDSTAGE= 0
THIRDSTAGE= 0
VIS= all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GaspardTracker Trapezoid
......
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