Skip to content
Snippets Groups Projects
Commit 75567f75 authored by Theodore Efremov's avatar Theodore Efremov :hibiscus:
Browse files

[AlPhaPha] Added loading of generic vector feature and loading of the eval of the zspline

parent 0d108535
No related branches found
No related tags found
No related merge requests found
Pipeline #385651 canceled
......@@ -300,6 +300,14 @@ void TICPhysics::ReadAnalysisConfig() {
cout << "*** Loading Z spline ***" << endl;
m_Z_SPLINE_CORRECTION = LoadSpline(m_Zspline,m_number_zspline,m_Z_SPLINE_PATH);
}
else if (whatToDo=="LOAD_Z_SPLINE_EVAL"){
AnalysisConfigFile >> DataBuffer;
m_Z_SPLINE_EVAL_PATH = DataBuffer;
cout << "*** Loading Z spline eval position***" << endl;
m_Z_SPLINE_EVAL = LoadVector(m_Z_spline_eval,m_Z_SPLINE_EVAL_PATH);
}
else {
ReadingStatus = false;
}
......@@ -342,14 +350,57 @@ bool TICPhysics::LoadSpline(vector<TSpline3*> &iSpline, int &NSpline , string Pa
}
}
///////////////////////////////////////////////////////////////////////////
template <typename T> bool TICPhysics::LoadVector(vector<T> &vec, const string &Path){
std::ifstream file(Path);
if (!file.is_open()) {
return false; // File couldn't be opened
}
T value;
vec.clear();
std::string line;
while (std::getline(file, line)) {
std::istringstream iss(line);
while (iss >> value) {
vec.push_back(value);
}
}
file.close();
return !vec.empty();
}
///////////////////////////////////////////////////////////////////////////
double TICPhysics::ApplyZSpline(){
double DEcorr;
double FF_DEcorr0[m_number_zspline];
for(int i=0; i<m_number_zspline; i++){
FF_DEcorr0[i] = m_Zspline[i]->Eval(8500);
}
if (m_Z_SPLINE_EVAL == true){
for(int i=0; i<m_number_zspline; i++){
cout << m_Z_spline_eval[i] << endl;
if (i < m_Z_spline_eval.size()){
FF_DEcorr0[i] = m_Zspline[i]->Eval(m_Z_spline_eval[i]);
}
else if( m_Data_Year == 2024 ){
FF_DEcorr0[i] = m_Zspline[i]->Eval(12000);
}
else if( m_Data_Year == 2023 ){
FF_DEcorr0[i] = m_Zspline[i]->Eval(8500);
}
} // end loop spline
} // end cond spline eval
else if (m_Data_Year == 2023){
for(int i=0; i<m_number_zspline; i++){
FF_DEcorr0[i] = m_Zspline[i]->Eval(8500);
}
}
else if (m_Data_Year == 2024){
for(int i=0; i<m_number_zspline; i++){
FF_DEcorr0[i] = m_Zspline[i]->Eval(12000);
}
}
double DEspline0;
double Eval_DEspline;
int index=0;
......
......@@ -150,6 +150,7 @@ class TICPhysics : public TObject, public NPL::VDetector {
double GetY() {return m_Y;}
bool LoadSpline(vector<TSpline3*> &iSpline, int &NSpline, string Path);
template <typename T> bool LoadVector(vector<T> &vec, const string &Path);
double ApplyZSpline();
void ApplyXYCorrections();
......@@ -170,8 +171,11 @@ class TICPhysics : public TObject, public NPL::VDetector {
int m_FPMW_Section; //!
int m_number_zspline; //!
string m_Z_SPLINE_PATH; //!
bool m_Z_SPLINE_CORRECTION; //!
string m_Z_SPLINE_EVAL_PATH; //!
bool m_Z_SPLINE_CORRECTION = false; //!
bool m_Z_SPLINE_EVAL = false; //!
vector<TSpline3*> m_Zspline = vector<TSpline3*>(50); //!
vector<Double_t> m_Z_spline_eval ; //!
double m_Eres_Threshold; //!
//Time temporary variable
......
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