Skip to content
Snippets Groups Projects
Commit 89720111 authored by Lubynets's avatar Lubynets
Browse files

fix signum function

parent 2aa9bdc2
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
MFMap* MFMap::instance_ = new MFMap();
float signum(float x)
float MFMap::signum (float x) const
{
if(x>0.)
return 1.;
......@@ -25,13 +25,13 @@ void MFMap::GetField(const float_v xyz[], float_v B[]) const
float y = xyz[1][iv];
float z = xyz[2][iv]-40.;
// float x_l = fabs(x); // CBM
// float y_l = fabs(y);
// float z_l = fabs(z);
float x_l = fabs(x); // CBM
float y_l = fabs(y);
float z_l = fabs(z);
float x_l = xyz[0][iv];
float y_l = xyz[1][iv];
float z_l = xyz[2][iv]; // NA61/SHINE
// float x_l = xyz[0][iv];
// float y_l = xyz[1][iv];
// float z_l = xyz[2][iv]; // NA61/SHINE
B[0][iv] = 0.;
B[1][iv] = 0.;
......@@ -40,12 +40,12 @@ void MFMap::GetField(const float_v xyz[], float_v B[]) const
if(x_l<=hXlow || x_l>=hXup || y_l<=hYlow || y_l>=hYup || z_l<=hZlow || z_l>=hZup) continue; // CBM
if(x_l!=x_l || y_l!=y_l || z_l!=z_l) continue;
// B[0][iv] = 10.*(histoBx_ -> Interpolate(x_l, y_l, z_l)*signum(x)*signum(y)); // CBM
// B[1][iv] = 10.*(histoBy_ -> Interpolate(x_l, y_l, z_l));
// B[2][iv] = 10.*(histoBz_ -> Interpolate(x_l, y_l, z_l)*signum(y)*signum(z));
B[0][iv] = 10.*(histoBx_ -> Interpolate(x_l, y_l, z_l)); // NA61/SHINE
B[0][iv] = 10.*(histoBx_ -> Interpolate(x_l, y_l, z_l)*signum(x)*signum(y)); // CBM
B[1][iv] = 10.*(histoBy_ -> Interpolate(x_l, y_l, z_l));
B[2][iv] = 10.*(histoBz_ -> Interpolate(x_l, y_l, z_l));
B[2][iv] = 10.*(histoBz_ -> Interpolate(x_l, y_l, z_l)*signum(y)*signum(z));
// B[0][iv] = 10.*(histoBx_ -> Interpolate(x_l, y_l, z_l)); // NA61/SHINE
// B[1][iv] = 10.*(histoBy_ -> Interpolate(x_l, y_l, z_l));
// B[2][iv] = 10.*(histoBz_ -> Interpolate(x_l, y_l, z_l));
}
};
......@@ -18,30 +18,30 @@ public:
protected:
// MFMap() // CBM
// {
// fileMF_ = TFile::Open("/home/user/cbmdir/kfpf/kfpf_analysis_tree_converter/input/field_mapF.root", "read");
// // fileMF_ = TFile::Open("/lustre/cbm/users/lubynets/kfpf/macro/field_mapF.root", "read");
// histoBx_ = (TH3F*)fileMF_->Get("histoBx");
// histoBy_ = (TH3F*)fileMF_->Get("histoBy");
// histoBz_ = (TH3F*)fileMF_->Get("histoBz");
// };
MFMap() // NA61/SHINE
MFMap() // CBM
{
fileMF_ = TFile::Open("/home/user/cbmdir/kfpf/kfpf_analysis_tree_converter/input/na61mf.root", "read");
histoBx_ = (TH3F*)fileMF_->Get("field_x");
histoBy_ = (TH3F*)fileMF_->Get("field_y");
histoBz_ = (TH3F*)fileMF_->Get("field_z");
fileMF_ = TFile::Open("/home/user/cbmdir/kfpf/kfpf_analysis_tree_converter/input/field_mapF.root", "read");
// fileMF_ = TFile::Open("/lustre/cbm/users/lubynets/kfpf/macro/field_mapF.root", "read");
histoBx_ = (TH3F*)fileMF_->Get("histoBx");
histoBy_ = (TH3F*)fileMF_->Get("histoBy");
histoBz_ = (TH3F*)fileMF_->Get("histoBz");
};
// MFMap() // NA61/SHINE
// {
// fileMF_ = TFile::Open("/home/user/cbmdir/kfpf/kfpf_analysis_tree_converter/input/na61mf.root", "read");
// histoBx_ = (TH3F*)fileMF_->Get("field_x");
// histoBy_ = (TH3F*)fileMF_->Get("field_y");
// histoBz_ = (TH3F*)fileMF_->Get("field_z");
// };
virtual ~MFMap() = default;
private:
static MFMap* instance_;
// float signum(float x); //TODO WHY not working in singleton?
float signum(float x) const;
TFile* fileMF_;
TH3F* histoBx_;
......
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