Skip to content
Snippets Groups Projects
Commit d0c7079c authored by Damien Thisse's avatar Damien Thisse
Browse files

Added in ACTAR the methods to process simulated scattering data

parent 1719af04
No related branches found
No related tags found
1 merge request!27Draft: [Epic] Preparation of the environement for the new GaseousDetectorScorers...
...@@ -51,6 +51,8 @@ void TActarData::Clear() { ...@@ -51,6 +51,8 @@ void TActarData::Clear() {
fActar_PadZ.clear(); fActar_PadZ.clear();
fActar_PadCharge.clear(); fActar_PadCharge.clear();
fActar_RebinningMap.clear();
fSilicon_Energy.clear(); fSilicon_Energy.clear();
fSilicon_Time.clear(); fSilicon_Time.clear();
fSilicon_DetectorNumber.clear(); fSilicon_DetectorNumber.clear();
...@@ -79,3 +81,33 @@ void TActarData::Dump() const { ...@@ -79,3 +81,33 @@ void TActarData::Dump() const {
} }
} }
//////////////////////////////////////////////////////////////////////
void TActarData::RebinData(){
fActar_PadNumber.clear();
fActar_PadX.clear();
fActar_PadY.clear();
fActar_PadZ.clear();
fActar_PadCharge.clear();
fZ_trigger = 0;
int min_offset = 0;
for(auto it = fActar_RebinningMap.begin(); it != fActar_RebinningMap.end(); ++it)
{
int x, y, z;
int rest_z;
z = it->first/1000000;
rest_z = it->first-z*1000000;
y = rest_z/1000;
x = rest_z-y*1000;
if((x > 1 && x < 126 && y == 39) || (x>1 && x < 126 && y == 68)) //58Ni experiment
{
int this_offset = fabs(z-256);
if(this_offset < min_offset){
fZ_trigger = z;
min_offset = this_offset;
}
}
//cout << "ID : " << it->first << " x = " << x << " y = " << y << " z = " << z << " q = " << it->second << endl;
//if(it->second > 100)
fActar_PadNumber.push_back(x*128+y); fActar_PadX.push_back(x); fActar_PadY.push_back(y); fActar_PadZ.push_back(z); fActar_PadCharge.push_back(it->second);
}
}
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
// STL // STL
#include <vector> #include <vector>
#include <map>
using namespace std; using namespace std;
// ROOT // ROOT
...@@ -49,6 +50,9 @@ class TActarData : public TObject { ...@@ -49,6 +50,9 @@ class TActarData : public TObject {
vector<double> fCsI_Energy; vector<double> fCsI_Energy;
vector<int> fCsI_CrystalNumber; vector<int> fCsI_CrystalNumber;
map<int, double> fActar_RebinningMap; //!
int fZ_trigger; //!
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Constructor and destructor // Constructor and destructor
...@@ -64,6 +68,11 @@ class TActarData : public TObject { ...@@ -64,6 +68,11 @@ class TActarData : public TObject {
void Clear(const Option_t*) {}; void Clear(const Option_t*) {};
void Dump() const; void Dump() const;
//////////////////////////////////////////////////////////////
// Methods to "rebin" the data in case of simulations
public:
void RebinData(); //!
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Getters and Setters // Getters and Setters
...@@ -89,10 +98,15 @@ class TActarData : public TObject { ...@@ -89,10 +98,15 @@ class TActarData : public TObject {
fActar_PadX.push_back(ColumnNbr); fActar_PadX.push_back(ColumnNbr);
} }
// Time Z // Time Z
inline void SetPadZ(const Double_t& Time) { inline void SetPadZ(const int& Time) {
fActar_PadZ.push_back(Time); fActar_PadZ.push_back(Time);
};//! };//!
// Rebinning (for simulation purpose)
inline void AddInRebinningMap(const int & ID, const double & charge){
fActar_RebinningMap[ID] += charge;
}
//Silicon //Silicon
inline void SetSiliconEnergy(const Double_t& Energy){ inline void SetSiliconEnergy(const Double_t& Energy){
fSilicon_Energy.push_back(Energy); fSilicon_Energy.push_back(Energy);
...@@ -122,11 +136,13 @@ class TActarData : public TObject { ...@@ -122,11 +136,13 @@ class TActarData : public TObject {
inline UShort_t GetPadX(const unsigned int &i) const inline UShort_t GetPadX(const unsigned int &i) const
{return fActar_PadX[i];}//! {return fActar_PadX[i];}//!
inline UShort_t GetPadY(const unsigned int &i) const inline UShort_t GetPadY(const unsigned int &i) const
{return fActar_PadY[i];}//! {return fActar_PadY[i];}//!
inline Double_t GetPadZ(const unsigned int &i) const inline int GetPadZ(const unsigned int &i) const
{return fActar_PadZ[i];}//! {return fActar_PadZ[i];}//!
inline Double_t GetPadCharge(const unsigned int &i) const inline Double_t GetPadCharge(const unsigned int &i) const
{return fActar_PadCharge[i];}//! {return fActar_PadCharge[i];}//!
inline UShort_t GetZTrigger() const
{return fZ_trigger;}//!
......
...@@ -78,8 +78,10 @@ TActarPhysics::TActarPhysics() ...@@ -78,8 +78,10 @@ TActarPhysics::TActarPhysics()
m_NumberOfPadSilicon(20), m_NumberOfPadSilicon(20),
m_NumberOfDetectors(0), m_NumberOfDetectors(0),
fIsGoodEvent(true), fIsGoodEvent(true),
fScattering(false) fScattering(false),
fIsSimulation(false)
{ {
m_randgen = new TRandom3(time(0));
//InitSpectra(); //InitSpectra();
} }
...@@ -257,34 +259,47 @@ void TActarPhysics::PreTreat() { ...@@ -257,34 +259,47 @@ void TActarPhysics::PreTreat() {
int where=co*NumberOfASAD*NumberOfAGET*NumberOfChannel + as*NumberOfAGET*NumberOfChannel + ag*NumberOfChannel + ch; int where=co*NumberOfASAD*NumberOfAGET*NumberOfChannel + as*NumberOfAGET*NumberOfChannel + ag*NumberOfChannel + ch;
if(co<16){ if(co<16){
unsigned int vector_size = m_EventReduced->CoboAsad[it].peakheight.size(); unsigned int vector_size = m_EventReduced->CoboAsad[it].peakheight.size();
//cout << vector_size << endl;
for(unsigned int hh=0; hh<vector_size; hh++){ if(fIsSimulation){
m_EventData->SetCharge(m_EventReduced->CoboAsad[it].peakheight[hh]); m_EventData->Clear();
m_EventData->SetPadNumber(TABLE[4][where]*128+TABLE[5][where]);
m_EventData->SetPadX(TABLE[4][where]); for(unsigned int hh=0; hh<vector_size; hh++){
m_EventData->SetPadY(TABLE[5][where]); int xx = TABLE[4][where], yy = TABLE[5][where], zz = static_cast<int>(m_EventReduced->CoboAsad[it].peaktime[hh]/fTimeSampling);
m_EventData->SetPadZ(m_EventReduced->CoboAsad[it].peaktime[hh]); m_EventData->AddInRebinningMap(1000000*zz+1000*yy+xx, m_EventReduced->CoboAsad[it].peakheight[hh]); //In order to have 512 bin of 80ns in Z
}
static string name_pixel; m_EventData->RebinData();
name_pixel = "Actar/X" ; for(unsigned int i = 0; i < m_EventData->GetPadMult(); i++){
name_pixel+= NPL::itoa(TABLE[4][where]); int xx = m_EventData->GetPadX(i), yy = m_EventData->GetPadY(i), zz = m_EventData->GetPadZ(i);
name_pixel+= "_Y" ; static string name_pixel;
name_pixel+= NPL::itoa(TABLE[5][where]); name_pixel = "Actar/X" ;
name_pixel+= "_Q"; name_pixel+= NPL::itoa(xx);
double CalCharge = CalibrationManager::getInstance()->ApplyCalibration(name_pixel, m_EventReduced->CoboAsad[it].peakheight[hh]); name_pixel+= "_Y" ;
if(CalCharge>fQ_Threshold && m_EventReduced->CoboAsad[it].peaktime[hh]>fT_Threshold){ name_pixel+= NPL::itoa(yy);
name_pixel+= "_Q";
// m_PreTreatedData->SetCharge(CalCharge); double CalCharge = CalibrationManager::getInstance()->ApplyCalibration(name_pixel, m_EventData->GetPadCharge(i));
// m_PreTreatedData->SetPadNumber(TABLE[4][where]*128+TABLE[5][where]); if(CalCharge>fQ_Threshold){
// m_PreTreatedData->SetPadX(TABLE[4][where]); double new_zz = (256+zz-m_EventData->GetZTrigger()); //To shift the z according to the trigger time (as in experimental data)
// m_PreTreatedData->SetPadY(TABLE[5][where]); PadCharge.push_back(CalCharge);
// m_PreTreatedData->SetPadZ(int(m_EventReduced->CoboAsad[it].peaktime[hh]*fTimeSampling*fDriftVelocity)); PadX.push_back((double)xx*fPadSizeX);
PadY.push_back((double)yy*fPadSizeY);
if(fRecoRansac){ PadZ.push_back((double)new_zz*fTimeSampling*fDriftVelocity);
}
}
}
else{
for(unsigned int hh=0; hh<vector_size; hh++){
static string name_pixel;
name_pixel = "Actar/X" ;
name_pixel+= NPL::itoa(TABLE[4][where]);
name_pixel+= "_Y" ;
name_pixel+= NPL::itoa(TABLE[5][where]);
name_pixel+= "_Q";
double CalCharge = CalibrationManager::getInstance()->ApplyCalibration(name_pixel, m_EventReduced->CoboAsad[it].peakheight[hh]);
if(CalCharge>fQ_Threshold && m_EventReduced->CoboAsad[it].peaktime[hh]>fT_Threshold){
PadCharge.push_back(CalCharge); PadCharge.push_back(CalCharge);
PadX.push_back((double)TABLE[4][where]*fPadSizeX); PadX.push_back((double)TABLE[4][where]*fPadSizeX);
PadY.push_back((double)TABLE[5][where]*fPadSizeY); PadY.push_back((double)TABLE[5][where]*fPadSizeY);
PadZ.push_back(int(m_EventReduced->CoboAsad[it].peaktime[hh]*fTimeSampling*fDriftVelocity)); PadZ.push_back((double)(m_EventReduced->CoboAsad[it].peaktime[hh]*fTimeSampling*fDriftVelocity));
} }
} }
} }
...@@ -610,6 +625,14 @@ void TActarPhysics::ReadAnalysisConfig() { ...@@ -610,6 +625,14 @@ void TActarPhysics::ReadAnalysisConfig() {
} }
} }
else if(whatToDo.compare(0,11,"Simulation=")==0){
AnalysisConfigFile >> DataBuffer;
if(atoi(DataBuffer.c_str()) == 1) {
fIsSimulation = true;
cout << "/// Assuming analysis of simulated data ///" << endl;
}
}
else { else {
ReadingStatus = false; ReadingStatus = false;
} }
......
...@@ -64,6 +64,7 @@ class TActarPhysics : public TObject, public NPL::VDetector, public TActarPhysic ...@@ -64,6 +64,7 @@ class TActarPhysics : public TObject, public NPL::VDetector, public TActarPhysic
public: public:
TActarPhysics(); TActarPhysics();
~TActarPhysics() { ~TActarPhysics() {
delete m_randgen;
}; };
...@@ -78,10 +79,10 @@ public: ...@@ -78,10 +79,10 @@ public:
// data obtained after BuildPhysicalEvent() and stored in // data obtained after BuildPhysicalEvent() and stored in
// output ROOT file // output ROOT file
public: public:
vector<double> PadX; //! vector<double> PadX;
vector<double> PadY; //! vector<double> PadY;
vector<double> PadZ; //! vector<double> PadZ;
vector<double> PadCharge; //! vector<double> PadCharge;
vector<int> BeamPadX; //! vector<int> BeamPadX; //!
vector<int> BeamPadY; //! vector<int> BeamPadY; //!
vector<double> BeamPadZ; //! vector<double> BeamPadZ; //!
...@@ -200,6 +201,7 @@ private: ...@@ -200,6 +201,7 @@ private:
vector<LinearCluster3D> m_Track; //! vector<LinearCluster3D> m_Track; //!
vector<LinearCluster3D> m_BeamTrack; //! vector<LinearCluster3D> m_BeamTrack; //!
vector<LinearCluster3D> m_ScatteredTrack; //! vector<LinearCluster3D> m_ScatteredTrack; //!
TRandom3* m_randgen; //!
// getters for raw and pre-treated data object // getters for raw and pre-treated data object
public: public:
...@@ -245,7 +247,7 @@ private: ...@@ -245,7 +247,7 @@ private:
double fShortTrackMaxRange; //! double fShortTrackMaxRange; //!
bool fIsGoodEvent; //! bool fIsGoodEvent; //!
bool fIsSimulation; //!
bool fScattering; //! bool fScattering; //!
int TABLE[6][NumberOfCobo*NumberOfASAD*NumberOfAGET*NumberOfChannel]; //! int TABLE[6][NumberOfCobo*NumberOfASAD*NumberOfAGET*NumberOfChannel]; //!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment