Commit 35c4f725 authored by Morfouace's avatar Morfouace
Browse files

* Updating Sofia detectors

parent 980dc392
Pipeline #123552 passed with stages
in 6 minutes and 6 seconds
......@@ -43,15 +43,15 @@ TSofBeamID::~TSofBeamID() {
//////////////////////////////////////////////////////////////////////
void TSofBeamID::Clear() {
Zbeam = -1;
Qmax = -1;
AoQ = -1;
Abeam = -1;
Beta = -1;
Gamma = -1;
Brho = -1;
XS2 = -1000;
XCC = -1000;
fBeam_Z = -1;
fBeam_Qmax = -1;
fBeam_AoQ = -1;
fBeam_A = -1;
fBeam_Beta = -1;
fBeam_Gamma = -1;
fBeam_Brho = -1;
fBeam_XS2 = -1000;
fBeam_XCC = -1000;
}
......@@ -62,13 +62,13 @@ void TSofBeamID::Dump() const {
// This method is very useful for debuging and worth the dev.
cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event [TSofBeamID::Dump()] XXXXXXXXXXXXXXXXX" << endl;
cout << "Zbeam: " << Zbeam << endl;
cout << "AoQ: " << AoQ << endl;
cout << "Abeam: " << Abeam << endl;
cout << "Beta: " << Beta << endl;
cout << "Gamma: " << Gamma << endl;
cout << "Brho: " << Brho << endl;
cout << "XS2: " << XS2 << endl;
cout << "XCC: " << XCC << endl;
cout << "fBeam_Z: " << fBeam_Z << endl;
cout << "fBeam_AoQ: " << fBeam_AoQ << endl;
cout << "fBeam_A: " << fBeam_A << endl;
cout << "fBeam_Beta: " << fBeam_Beta << endl;
cout << "fBeam_Gamma: " << fBeam_Gamma << endl;
cout << "fBeam_Brho: " << fBeam_Brho << endl;
cout << "fBeam_XS2: " << fBeam_XS2 << endl;
cout << "fBeam_XCC: " << fBeam_XCC << endl;
}
......@@ -34,15 +34,15 @@ class TSofBeamID : public TObject {
// data members are hold into vectors in order
// to allow multiplicity treatment
private:
double Zbeam;
double Qmax;
double AoQ;
double Abeam;
double Beta;
double Gamma;
double Brho;
double XS2;
double XCC;
double fBeam_Z;
double fBeam_Qmax;
double fBeam_AoQ;
double fBeam_A;
double fBeam_Beta;
double fBeam_Gamma;
double fBeam_Brho;
double fBeam_XS2;
double fBeam_XCC;
//////////////////////////////////////////////////////////////
// Constructor and destructor
......@@ -66,26 +66,26 @@ class TSofBeamID : public TObject {
// add //! to avoid ROOT creating dictionnary for the methods
public:
////////////////////// SETTERS ////////////////////////
inline void SetZbeam(double val){Zbeam = val;};//!
inline void SetQmax(double val){Qmax = val;};//!
inline void SetAoQ(double val){AoQ = val;};//!
inline void SetAbeam(double val){Abeam = val;};//!
inline void SetBeta(double val){Beta = val;};//!
inline void SetGamma(double val){Gamma = val;};//!
inline void SetBrho(double val){Brho = val;};//!
inline void SetXS2(double val){XS2 = val;};//!
inline void SetXCC(double val){XCC = val;};//!
inline void SetZbeam(double val){fBeam_Z = val;};//!
inline void SetQmax(double val){fBeam_Qmax = val;};//!
inline void SetAoQ(double val){fBeam_AoQ = val;};//!
inline void SetAbeam(double val){fBeam_A = val;};//!
inline void SetBeta(double val){fBeam_Beta = val;};//!
inline void SetGamma(double val){fBeam_Gamma = val;};//!
inline void SetBrho(double val){fBeam_Brho = val;};//!
inline void SetXS2(double val){fBeam_XS2 = val;};//!
inline void SetXCC(double val){fBeam_XCC = val;};//!
////////////////////// GETTERS ////////////////////////
inline double GetZbeam() const {return Zbeam;}//!
inline double GetQmax() const {return Qmax;}//!
inline double GetAoQ() const {return AoQ;}//!
inline double GetAbeam() const {return Abeam;}//!
inline double GetBeta() const {return Beta;}//!
inline double GetGamma() const {return Gamma;}//!
inline double GetBrho() const {return Brho;}//!
inline double GetXS2() const {return XS2;}//!
inline double GetXCC() const {return XCC;}//!
inline double GetZbeam() const {return fBeam_Z;}//!
inline double GetQmax() const {return fBeam_Qmax;}//!
inline double GetAoQ() const {return fBeam_AoQ;}//!
inline double GetAbeam() const {return fBeam_A;}//!
inline double GetBeta() const {return fBeam_Beta;}//!
inline double GetGamma() const {return fBeam_Gamma;}//!
inline double GetBrho() const {return fBeam_Brho;}//!
inline double GetXS2() const {return fBeam_XS2;}//!
inline double GetXCC() const {return fBeam_XCC;}//!
//////////////////////////////////////////////////////////////
// Required for ROOT dictionnary
......
......@@ -48,7 +48,7 @@ TSofTrimPhysics::TSofTrimPhysics()
m_PreTreatedData(new TSofTrimData),
m_EventPhysics(this),
m_NumberOfDetectors(0),
m_Beta(0.838),
m_Beta(-1),
m_BetaNorm(0.838),
m_NumberOfSections(3),
m_NumberOfAnodesPaired(3),
......@@ -74,22 +74,32 @@ void TSofTrimPhysics::AddDetector(double R, double Theta, double Phi){
///////////////////////////////////////////////////////////////////////////
void TSofTrimPhysics::BuildSimplePhysicalEvent() {
BuildPhysicalEvent();
if(m_Beta>0)
BuildPhysicalEvent();
}
///////////////////////////////////////////////////////////////////////////
void TSofTrimPhysics::BuildPhysicalEvent() {
if(m_Beta<0)
return;
// apply thresholds and calibration
PreTreat();
if(m_PreTreatedData->GetMultiplicity() != 18)
if(m_PreTreatedData->GetMultiplicity() != 18){
m_Beta = -1;
return;
}
double Ep1[3], DTp1[3];
double Ep2[3], DTp2[3];
double Ep3[3], DTp3[3];
double Esec[3];
int mult_p1[3];
int mult_p2[3];
int mult_p3[3];
for(int i=0; i<m_NumberOfSections; i++){
Ep1[i] = 0;
Ep2[i] = 0;
......@@ -98,6 +108,9 @@ void TSofTrimPhysics::BuildPhysicalEvent() {
DTp2[i] = 0;
DTp3[i] = 0;
Esec[i] = 0;
mult_p1[i] = 0;
mult_p2[i] = 0;
mult_p3[i] = 0;
}
unsigned int mysizeE = m_PreTreatedData->GetMultiplicity();
......@@ -107,42 +120,64 @@ void TSofTrimPhysics::BuildPhysicalEvent() {
double Energy = m_PreTreatedData->GetEnergy(e);
double DT = m_PreTreatedData->GetDriftTime(e);
//cout << SectionNbr << " " << AnodeNbr << " " << Energy << " " << m_Beta << endl;
if(AnodeNbr==1 || AnodeNbr==2){
Ep1[SectionNbr-1] += Energy;
DTp1[SectionNbr-1] += DT;
mult_p1[SectionNbr-1]++;
}
if(AnodeNbr==3 || AnodeNbr==4){
Ep2[SectionNbr-1] += Energy;
DTp2[SectionNbr-1] += DT;
mult_p2[SectionNbr-1]++;
}
if(AnodeNbr==5 || AnodeNbr==6){
Ep3[SectionNbr-1] += Energy;
DTp3[SectionNbr-1] += DT;
mult_p3[SectionNbr-1]++;
}
}
static CalibrationManager* Cal = CalibrationManager::getInstance();
for(int i=0; i<m_NumberOfSections; i++){
DTp1[i] = 0.5*DTp1[i];
DTp2[i] = 0.5*DTp2[i];
DTp3[i] = 0.5*DTp3[i];
if(mult_p1[i] == 2){
Ep1[i] = 0.5*Ep1[i];
DTp1[i] = 0.5*DTp1[i];
}
else{
Ep1[i] = -1;
DTp1[i] = -1e5;
}
if(mult_p2[i] == 2){
Ep2[i] = 0.5*Ep2[i];
DTp2[i] = 0.5*DTp2[i];
}
else{
Ep2[i] = -1;
DTp2[i] = -1e5;
}
if(mult_p3[i] == 2){
Ep3[i] = 0.5*Ep3[i];
DTp3[i] = 0.5*DTp3[i];
}
else{
Ep3[i] = -1;
DTp3[i] = -1e5;
}
Ep1[i] = 0.5*Ep1[i];
Ep2[i] = 0.5*Ep2[i];
Ep3[i] = 0.5*Ep3[i];
}
static CalibrationManager* Cal = CalibrationManager::getInstance();
double Ddt = DTp2[2] - DTp2[0];
double p0_1[3], p0_2[3], p0_3[3];
double p1_1[3], p1_2[3], p1_3[3];
for(int i=0; i<m_NumberOfSections; i++){
// Energy Alignement of pairs per section
Ep1[i] = Cal->ApplyCalibration("SofTrim/SEC"+NPL::itoa(i+1)+"_ANODE1_ALIGN",Ep1[i]);
Ep2[i] = Cal->ApplyCalibration("SofTrim/SEC"+NPL::itoa(i+1)+"_ANODE2_ALIGN",Ep2[i]);
Ep3[i] = Cal->ApplyCalibration("SofTrim/SEC"+NPL::itoa(i+1)+"_ANODE3_ALIGN",Ep3[i]);
// Beta correction per pair: DE = [0] + [1]*pow(Beta, -5./3);
p0_1[i] = Cal->GetValue("SofTrim/SEC"+NPL::itoa(i+1)+"_ANODE1_BETA",0);
p0_2[i] = Cal->GetValue("SofTrim/SEC"+NPL::itoa(i+1)+"_ANODE2_BETA",0);
......@@ -150,7 +185,7 @@ void TSofTrimPhysics::BuildPhysicalEvent() {
p1_1[i] = Cal->GetValue("SofTrim/SEC"+NPL::itoa(i+1)+"_ANODE1_BETA",1);
p1_2[i] = Cal->GetValue("SofTrim/SEC"+NPL::itoa(i+1)+"_ANODE2_BETA",1);
p1_3[i] = Cal->GetValue("SofTrim/SEC"+NPL::itoa(i+1)+"_ANODE3_BETA",1);
double norm1 = p0_1[i] + p1_1[i]*TMath::Power(m_BetaNorm, -5./3.);
double norm2 = p0_2[i] + p1_2[i]*TMath::Power(m_BetaNorm, -5./3.);
double norm3 = p0_3[i] + p1_3[i]*TMath::Power(m_BetaNorm, -5./3.);
......@@ -167,9 +202,8 @@ void TSofTrimPhysics::BuildPhysicalEvent() {
Ep1[i] = Ep1[i] / fcorr_EvsDT[i][0]->Eval(DTp1[i]) * fcorr_EvsDT[i][0]->Eval(3000);
Ep2[i] = Ep2[i] / fcorr_EvsDT[i][1]->Eval(DTp2[i]) * fcorr_EvsDT[i][1]->Eval(3000);
Ep3[i] = Ep3[i] / fcorr_EvsDT[i][2]->Eval(DTp3[i]) * fcorr_EvsDT[i][2]->Eval(3000);
}
for(int i=0; i<m_NumberOfSections; i++){
// Summing up Anode Energy per section
Esec[i] = (Ep1[i] + Ep2[i] + Ep3[i])/3;
// 2nd DT correction per section: spline
......@@ -177,12 +211,8 @@ void TSofTrimPhysics::BuildPhysicalEvent() {
// Section ALignement
Esec[i] = Cal->ApplyCalibration("SofTrim/SEC"+NPL::itoa(i+1)+"_ALIGN",Esec[i]);
}
// Filling output Tree //
for(int i=0; i<m_NumberOfSections; i++){
// Filling Output Tree //
if(DTp2[i]!=0){
SectionNbr.push_back(i+1);
EnergyPair1.push_back(Ep1[i]);
......@@ -195,7 +225,7 @@ void TSofTrimPhysics::BuildPhysicalEvent() {
Theta.push_back(DTp2[2]-DTp2[0]);
}
}
m_Beta = -1;
}
///////////////////////////////////////////////////////////////////////////
......@@ -211,9 +241,9 @@ void TSofTrimPhysics::PreTreat() {
unsigned int mysize = m_EventData->GetMultiplicity();
for (unsigned int i = 0; i < mysize ; ++i) {
Double_t Energy = Cal->ApplyCalibration("SofTrim/SEC"+NPL::itoa(m_EventData->GetSectionNbr(i))+"_ANODE"+NPL::itoa(m_EventData->GetAnodeNbr(i))+"_ENERGY",m_EventData->GetEnergy(i));
Double_t DT = Cal->ApplyCalibration("SofTrim/SEC"+NPL::itoa(m_EventData->GetSectionNbr(i))+"_ANODE"+NPL::itoa(m_EventData->GetAnodeNbr(i))+"_TIME",m_EventData->GetDriftTime(i));
double Energy = Cal->ApplyCalibration("SofTrim/SEC"+NPL::itoa(m_EventData->GetSectionNbr(i))+"_ANODE"+NPL::itoa(m_EventData->GetAnodeNbr(i))+"_ENERGY",m_EventData->GetEnergy(i));
double DT = Cal->ApplyCalibration("SofTrim/SEC"+NPL::itoa(m_EventData->GetSectionNbr(i))+"_ANODE"+NPL::itoa(m_EventData->GetAnodeNbr(i))+"_TIME",m_EventData->GetDriftTime(i));
m_PreTreatedData->SetSectionNbr(m_EventData->GetSectionNbr(i));
m_PreTreatedData->SetAnodeNbr(m_EventData->GetAnodeNbr(i));
m_PreTreatedData->SetEnergy(Energy);
......@@ -439,7 +469,7 @@ void TSofTrimPhysics::AddParameterToCalibrationManager() {
}
for(int sec = 0; sec < m_NumberOfSections; sec++){
Cal->AddParameter("SofTrim","SEC"+NPL::itoa(sec+1)+"_ALIGN","SofTrim_SEC"+NPL::itoa(sec+1)+"_ALIGN");
for(int anode = 0; anode < m_NumberOfAnodesPaired; anode++){
Cal->AddParameter("SofTrim","SEC"+NPL::itoa(sec+1)+"_ANODE"+NPL::itoa(anode+1)+"_ALIGN","SofTrim_SEC"+NPL::itoa(sec+1)+"_ANODE"+NPL::itoa(anode+1)+"_ALIGN");
Cal->AddParameter("SofTrim","SEC"+NPL::itoa(sec+1)+"_ANODE"+NPL::itoa(anode+1)+"_BETA","SofTrim_SEC"+NPL::itoa(sec+1)+"_ANODE"+NPL::itoa(anode+1)+"_BETA");
......
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