Skip to content

Commit

Permalink
Tfg.export.102423b (star-bnl#614)
Browse files Browse the repository at this point in the history
The commit is a result of adjustment TPC gating grid for
3p85GeV_fixedTarget_2021 (May) data
https://drupal.star.bnl.gov/STAR/system/files/TPC%20Gaiting%20Grid.pdf
There also are a few modifications for STAR dE/dx model required by
TpcRS.
  • Loading branch information
fisyak authored and dkapukchyan committed Mar 11, 2024
1 parent 6c9a630 commit c4c360d
Show file tree
Hide file tree
Showing 38 changed files with 1,176 additions and 904 deletions.
26 changes: 26 additions & 0 deletions StDb/idl/pidCorrection.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//:Description: Drift Distance depended correction
//:Synonyms::::
//:Source:
//:Update:
//:Update frequncy:
//:Reminder:
//:Recall frequency:
//:Size of Data:
//:Pointer to data: pidCorrection.time:
struct pidCorrection {
long idx; // row index > 0 if it is real
long nrows; // total no. of real rows in the table; For Db interface (where nrows = 50)
long type; // type = 0 polymonical fit, use only [min,max]
long var; // fit variable: 0 => pmomL10, 1 => bgL10,
long particle; // from StEvent/StPidParticleDefinition.h : kUndef = -1, kPidElectron = 0, Proton = 1, Kaon = 2, Pion = 3, Muon = 4, Deuteron = 5, Triton = 6,
// He3 = 7, Alpha = 8, He6 = 9, Li5 = 10, Li6,= 11, Li7 = 12, Be7 = 13, Be9 = 14, Be10 = 15, B11 = 16
long charge; // +/-1, 0 does not matter
long pull; // != 0 calculated pull correction, == 0 to value
long det; // from StdEdxY2Maker/StTrackPiD.h : kUndef = 0, kI70 = 1, kI70U = 2, kFit = 3, kFitU = 4, kdNdx = 5, kdNdxU = 6, kBTof -7 , kETof = 8, kMtd = 9, kBEmc = 10
long npar; // npar < 0, X = exp(x) paramterization; abs(npar) >= 100 cut on range [min.max]
double OffSet; // for future use
double min; // fit range
double max; //
double a[10]; // a[npar]
char comment[32];
};
3 changes: 3 additions & 0 deletions StRoot/StBichsel/StBichselLinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
#pragma link C++ function StdEdxPull::EvalPred2(Double_t, Double_t, UChar_t, Int_t);
#pragma link C++ function StdEdxPull::EvalDeV2(Double_t, Double_t, Double_t, UChar_t, Int_t);
#pragma link C++ function StdEdxPull::Eval2(Double_t, Double_t, Double_t, UChar_t, Int_t);

#pragma link C++ class St_spline3-;
#pragma link C++ class spline3_st+;
#endif
73 changes: 73 additions & 0 deletions StRoot/StBichsel/St_spline3C.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#include "Riostream.h"
#include "St_spline3C.h"
#include "TString.h"
#include "TInterpreter.h"
#include "TSystem.h"
//________________________________________________________________________________
St_spline3 *St_spline3C::Open(const Char_t *path) {
St_spline3 *table = 0;
TString PATH(path);
TString Dir(gSystem->DirName(PATH));
TString File(gSystem->BaseName(PATH));
File += ".C";
TString pathF(".:./StarDb/"); pathF += Dir + ":$STAR/StarDb/" + Dir;
Char_t *file = gSystem->Which(pathF,File,kReadPermission);
if (! file) {
std::cout << Form("Fatal::St_spline3C::Open \tFile %s has not been found in path %s",File.Data(),pathF.Data()) << std::endl;
return table;
} else {
std::cout << Form("Warning::St_spline3C::Open \tFile %s has been found as %s",File.Data(),file) << std::endl;
}
TString command(".L "); command += file; TInterpreter::EErrorCode ee;
gInterpreter->ProcessLine(command,&ee);
if (ee) { //assert(!ee);
std::cout << Form("Fatal::St_spline3C::Open has failed to read \tFile %s",file) << std::endl;
delete [] file;
return table;
}
table = (St_spline3 *) gInterpreter->Calc("CreateTable()",&ee);
if (! table) {//assert(table);
std::cout << Form("Fatal::St_spline3C::Open has failed to load \tFile %s",file) << std::endl;
delete [] file;
return table;
}
table->Print(0,1);
command.ReplaceAll(".L ",".U ");
gInterpreter->ProcessLine(command,&ee);
if (ee) { // assert(!ee);
std::cout << Form("Fatal::St_spline3C::Open has failed to unload \tFile %s",file) << std::endl;
delete [] file;
SafeDelete(table);
return table;
}
return table;
}
//________________________________________________________________________________
St_spline3C::St_spline3C(St_spline3 *table) : TChair(table), fSpline(0), fFunc(0), fValid(kTRUE) {
if (table) {
fSpline = new TSpline3("Spline3", Xknots(), Yknots(), nknots(), option(), ValBeg(), ValEnd());
fSpline->SetLineColor(2);
fXmin = Xknots()[0] - 0.1;
fXmax = Xknots()[nknots()-1] + 0.1;
fFunc = new TF1(GetName(), this, fXmin, fXmax, 0, "St_spline3C");
fFunc->SetNpx(100);
fFunc->Save(Xknots()[0], Xknots()[nknots()-1], 0., 0., 0., 0.);
} else {
fValid = kFALSE;
}
}
#define MakeChairInstance3(CLASS,PATH) \
ClassImp(CLASS); \
CLASS *CLASS::fgInstance = 0; \
CLASS *CLASS::instance() { \
if (fgInstance && ! fgInstance->IsValid()) return 0; \
if (fgInstance) return fgInstance; \
St_spline3 *table = St_spline3C::Open(# PATH); \
fgInstance = new CLASS(table); \
return fgInstance; \
}
//________________________________________________________________________________
MakeChairInstance3(Stspline3LndNdxL10,dEdxModel/spline3LndNdxL10);
MakeChairInstance3(StElectonsDEV_dEdx,dEdxModel/ElectonsDEV_dEdx);
MakeChairInstance3(StPionDEV_dEdx,dEdxModel/PionDEV_dEdx);
MakeChairInstance3(StProtonDEV_dEdx,dEdxModel/ProtonDEV_dEdx);
77 changes: 77 additions & 0 deletions StRoot/StBichsel/St_spline3C.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#ifndef St_spline3C_h
#define St_spline3C_h

#include "TChair.h"
//#include "tables/St_spline3_Table.h"
#include "St_spline3_Table.h"
#include "TSpline.h"
#include "TF1.h"
//________________________________________________________________________________
class St_spline3C : public TChair {
public:
St_spline3C(St_spline3 *table=0);
virtual ~St_spline3C() {}
spline3_st *Struct(Int_t i = 0) const {return ((St_spline3*) Table())->GetTable()+i;}
UInt_t getNumRows() const {return GetNRows();}
Int_t nknots(Int_t i = 0) const {return Struct(i)->nknots;}
Double_t* Xknots(Int_t i = 0) const {return Struct(i)->Xknots;}
Double_t* Yknots(Int_t i = 0) const {return Struct(i)->Yknots;}
Double_t ValBeg(Int_t i = 0) const {return Struct(i)->ValBeg;}
Double_t ValEnd(Int_t i = 0) const {return Struct(i)->ValEnd;}
Char_t* option(Int_t i = 0) const {return (Char_t *) Struct(i)->option;}
TSpline3* Spline() {return fSpline;}
Double_t operator() (Double_t *x, Double_t *p) const {return fSpline->Eval(x[0]);}
TF1* Func() {return fFunc;}
Bool_t IsValid() {return fValid;}
static St_spline3 *Open(const Char_t *path);
Bool_t InRange(Double_t x) {return fXmin <= x && x <= fXmax;}
private:
TSpline3* fSpline;
TF1* fFunc;
Bool_t fValid;
Double_t fXmin;
Double_t fXmax;
ClassDefChair(St_spline3, spline3_st )
ClassDef(St_spline3C,1) //C++ TChair for spline3 table class
};
//________________________________________________________________________________
class Stspline3LndNdxL10 : public St_spline3C {// Log(dN/dx) versus log10(beta*gamma)
public:
static Stspline3LndNdxL10* instance();
Stspline3LndNdxL10(St_spline3 *table=0) : St_spline3C(table) {}
virtual ~Stspline3LndNdxL10() {fgInstance = 0;}
private:
static Stspline3LndNdxL10* fgInstance;
ClassDef(Stspline3LndNdxL10,1) //C++ TChair for spline3LndNdxL10
};
//________________________________________________________________________________
class StElectonsDEV_dEdx : public St_spline3C {// Log(dN/dx) versus log10(beta*gamma)
public:
static StElectonsDEV_dEdx* instance();
StElectonsDEV_dEdx(St_spline3 *table=0) : St_spline3C(table) {}
virtual ~StElectonsDEV_dEdx() {fgInstance = 0;}
private:
static StElectonsDEV_dEdx* fgInstance;
ClassDef(StElectonsDEV_dEdx,1) //C++ TChair for ElectonsDEV_dEdx
};
//________________________________________________________________________________
class StPionDEV_dEdx : public St_spline3C {// Log(dN/dx) versus log10(beta*gamma)
public:
static StPionDEV_dEdx* instance();
StPionDEV_dEdx(St_spline3 *table=0) : St_spline3C(table) {}
virtual ~StPionDEV_dEdx() {fgInstance = 0;}
private:
static StPionDEV_dEdx* fgInstance;
ClassDef(StPionDEV_dEdx,1) //C++ TChair for PionDEV_dEdx
};
//________________________________________________________________________________
class StProtonDEV_dEdx : public St_spline3C {// Log(dN/dx) versus log10(beta*gamma)
public:
static StProtonDEV_dEdx* instance();
StProtonDEV_dEdx(St_spline3 *table=0) : St_spline3C(table) {}
virtual ~StProtonDEV_dEdx() {fgInstance = 0;}
private:
static StProtonDEV_dEdx* fgInstance;
ClassDef(StProtonDEV_dEdx,1) //C++ TChair for ProtonDEV_dEdx
};
#endif
11 changes: 11 additions & 0 deletions StRoot/StBichsel/St_spline3_Table.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#include "St_spline3_Table.h"
/////////////////////////////////////////////////////////////////////////
//
// Class St_spline3 wraps the STAF table spline3
// It has been generated "by automatic". Please don't change it "by hand"
//
/////////////////////////////////////////////////////////////////////////

#include "Stypes.h"
TableImpl(spline3)
23 changes: 23 additions & 0 deletions StRoot/StBichsel/St_spline3_Table.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

#ifndef STAF_St_spline3_Table
#define STAF_St_spline3_Table

#include "TTable.h"

#include "spline3.h"

/*!
* \class St_spline3
* \brief C++ wrapper for <spline3> StAF table
* \author Automatic Generation
* \date Fri May 26 18:56:01 2023
*
* This was generated for version '.DEV2'
*/
class St_spline3 : public TTable
{
public:
ClassDefTable(St_spline3,spline3_st)
ClassDef(St_spline3,2) //C++ wrapper for <spline3> StAF table
};
#endif
Loading

0 comments on commit c4c360d

Please sign in to comment.