Newer
Older
#ifndef TICPHYSICS_H
#define TICPHYSICS_H
/*****************************************************************************
* Copyright (C) 2009-2020 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: P. Morfouace contact address: pierre.morfouace@cea.fr *
* *
* Creation Date : October 2023 *
* Last update : *
*---------------------------------------------------------------------------*
* Decription: *
* This class hold IC Treated data *
* *
*---------------------------------------------------------------------------*
* Comment: *
* *
* *
*****************************************************************************/
// C++ headers
#include <vector>
#include <map>
#include <set>
#include <string>
using namespace std;
// ROOT headers
#include "TObject.h"
#include "TH1.h"
#include "TVector3.h"
#include "TSpline.h"
#include "TTimeData.h"
#include "TProfileEvaluator.h"
#include "NPCalibrationManager.h"
#include "NPVDetector.h"
#include "NPInputParser.h"
class TICPhysics : public TObject, public NPL::VDetector {
//////////////////////////////////////////////////////////////
// constructor and destructor
public:
TICPhysics();
~TICPhysics() {};
//////////////////////////////////////////////////////////////
// Inherited from TObject and overriden to avoid warnings
public:
void Clear();
void Clear(const Option_t*) {};
//////////////////////////////////////////////////////////////
// data obtained after BuildPhysicalEvent() and stored in
// output ROOT file
public:
double DE;
double Eres;
double EtotInit;
double fIC_Init[11];//!
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/// A usefull method to bundle all operation to add a detector
void AddDetector(TVector3 Pos);
void AddDetector(double R, double Theta, double Phi);
//////////////////////////////////////////////////////////////
// methods inherited from the VDetector ABC class
public:
// read stream from ConfigFile to pick-up detector parameters
void ReadConfiguration(NPL::InputParser);
// add parameters to the CalibrationManger
void AddParameterToCalibrationManager();
// method called event by event, aiming at extracting the
// physical information from detector
void BuildPhysicalEvent();
// same as BuildPhysicalEvent() method but with a simpler
// treatment
void BuildSimplePhysicalEvent();
// same as above but for online analysis
void BuildOnlinePhysicalEvent() {BuildPhysicalEvent();};
// activate raw data object and branches from input TChain
// in this method mother branches (Detector) AND daughter leaves
// (fDetector_parameter) have to be activated
void InitializeRootInputRaw();
// activate physics data object and branches from input TChain
// in this method mother branches (Detector) AND daughter leaves
// (fDetector_parameter) have to be activated
void InitializeRootInputPhysics();
// create branches of output ROOT file
void InitializeRootOutput();
// clear the raw and physical data objects event by event
void ClearEventPhysics() {Clear();}
void ClearEventData() {m_EventData->Clear();}
//////////////////////////////////////////////////////////////
// specific methods to IC array
public:
// remove bad channels, calibrate the data and apply thresholds
void PreTreat();
// clear the pre-treated object
void ClearPreTreatedData() {m_PreTreatedData->Clear();}
// read the user configuration file. If no file is found, load standard one
void ReadAnalysisConfig();
// give and external TICData object to TICPhysics.
// needed for online analysis for example
void SetRawDataPointer(TICData* rawDataPointer) {m_EventData = rawDataPointer;}
// Setter and getter for section of the FPMW.
void SetFPMWSection(int section) {m_FPMW_Section = section;}
int GetFPMWSection() {return m_FPMW_Section;}
//Setter and Getter for TTimeData used for drift time calculation and XY
void SetTTimeData(TTimeData *newTime) {m_TimeData = newTime;}
TTimeData* GetTTimeData() {return m_TimeData;}
void SetX(double PosX) {m_X = PosX;}
double GetX() {return m_X;}
void SetY(double PosY) {m_Y = PosY;}
double GetY() {return m_Y;}
bool LoadSpline(vector<TSpline3*> &iSpline, int &NSpline, string Path);

Theodore Efremov
committed
template <typename T> bool LoadVector(vector<T> &vec, const string &Path);
void ApplyXYCorrections();
// objects are not written in the TTree
private:
TICData* m_EventData; //!
TICData* m_PreTreatedData; //!
TICPhysics* m_EventPhysics; //!
// getters for raw and pre-treated data object
public:
TICData* GetRawData() const {return m_EventData;}
TICData* GetPreTreatedData() const {return m_PreTreatedData;}
// parameters used in the analysis
private:
int m_NumberOfDetectors; //!
string m_Z_SPLINE_PATH; //!

Theodore Efremov
committed
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); //!

Theodore Efremov
committed
vector<Double_t> m_Z_spline_eval ; //!
//Time temporary variable
TTimeData* m_TimeData; //!
//Correction in XY of IC
string m_Y_SPLINE_PATH; //!
string m_XY0_PROFILE_PATH; //!
string m_DE_SPLINE_PATH; //!
bool m_Y_SPLINE_CORRECTION = false; //!
bool m_DE_SPLINE_CORRECTION = false; //!
bool m_XY0_SPLINE_CORRECTION = false; //!
int m_number_Y_spline; //!
int m_number_XY0_spline; //!
int m_number_DE_spline; //!
double m_X; //!
double m_Y; //!
// Be careful this array contains only the correction from IC1 to 4
vector<TSpline3*> m_Yspline = vector<TSpline3*>(11); //!
vector<TSpline3*> m_DEspline = vector<TSpline3*>(11); //!
// The following contains correction for IC0
ProfileEvaluator m_IC0_Profile;//!
private:
double m_Data_Year; //!