Skip to content

Commit

Permalink
Reset modified tables in StDetectorDbMaker::InitRun, intialize rows =… (
Browse files Browse the repository at this point in the history
#560)

Reset modified tables in StDetectorDbMaker::InitRun, intialize rows = 0
in St_tpcRDOMasksC::instance
  • Loading branch information
fisyak authored Jul 21, 2023
1 parent 3f3c47a commit 7fd7f97
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 6 deletions.
60 changes: 58 additions & 2 deletions StRoot/StDetectorDbMaker/StDetectorDbChairs.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ St_tpcRDOMasksC *St_tpcRDOMasksC::instance() {
}
if (needReorder) {
LOG_WARN << "St_tpcRDOMasksC::instance RunLog/onl/tpcRDOMasks has to be reordered" << endm;
tpcRDOMasks_st rows[12];
tpcRDOMasks_st rows[12] = {0};
Int_t OldRun = -1;
for (UInt_t i = 0; i < N; i++) {
if ((row+i)->sector == 2*i + 1) {
Expand Down Expand Up @@ -1404,6 +1404,10 @@ St_tpcRDOMasksC *St_tpcRDOMasksC::instance() {
table->Print(0,12);
}
fgInstance = new St_tpcRDOMasksC(table);
if (StDetectorDbMaker::instance()) {
fgInstance->SetName("tpcRDOMasksC");
StDetectorDbMaker::instance()->AddConst(fgInstance);
}
return fgInstance;
}
//________________________________________________________________________________
Expand Down Expand Up @@ -1500,6 +1504,10 @@ St_tpcPadGainT0C *St_tpcPadGainT0C::instance() {
assert(table);
}
fgInstance = new St_tpcPadGainT0C(table);
if (StDetectorDbMaker::instance()) {
fgInstance->SetName("tpcPadGainT0C");
StDetectorDbMaker::instance()->AddConst(fgInstance);
}
// Apply additional correction for gain tables
Int_t run = StMaker::GetChain()->GetRunNumber();
St_tpcExtraGainCorrectionC *extra = St_tpcExtraGainCorrectionC::instance();
Expand Down Expand Up @@ -1817,6 +1825,10 @@ St_itpcPadGainT0C *St_itpcPadGainT0C::instance() {
assert(table);
}
fgInstance = new St_itpcPadGainT0C(table);
if (StDetectorDbMaker::instance()) {
fgInstance->SetName("itpcPadGainT0C");
StDetectorDbMaker::instance()->AddConst(fgInstance);
}
// Apply additional correction for gain tables
Int_t run = StMaker::GetChain()->GetRunNumber();
St_tpcExtraGainCorrectionC *extra = St_tpcExtraGainCorrectionC::instance();
Expand Down Expand Up @@ -2999,7 +3011,51 @@ MakeChairInstance(tofTrgWindow,Calibrations/tof/tofTrgWindow);
#include "St_tofTzeroC.h"
MakeChairInstance(tofTzero,Calibrations/tof/tofTzero);
#include "St_tofSimResParamsC.h"
MakeChairInstance(tofSimResParams,Calibrations/tof/tofSimResParams);
//MakeChairInstance(tofSimResParams,Calibrations/tof/tofSimResParams);
St_tofSimResParamsC *St_tofSimResParamsC::fgInstance = 0;
Double_t St_tofSimResParamsC::params[120][192] = {0};
Double_t St_tofSimResParamsC::mAverageTimeResTof = 0;

St_tofSimResParamsC *St_tofSimResParamsC::instance() {
if (fgInstance) return fgInstance;
St_tofSimResParams *table = (St_tofSimResParams *) StMaker::GetChain()->GetDataBase("Calibrations/tof/tofSimResParams");
if (! table) {
LOG_WARN << "St_tofSimResParamsC::instance Calibrations/tof/tofSimResParams was not found" << endm;
assert(table);
}
DEBUGTABLE(tofSimResParams);
fgInstance = new St_tofSimResParamsC(table);
mAverageTimeResTof=0;
for ( int i = 0; i < 120; i++ ){ // nTrays
for ( int j = 0; j < 192; j++ ){
size_t index = i * 120 + j;
params[i][j] = St_tofSimResParamsC::instance()->resolution()[index];
mAverageTimeResTof+=params[i][j];
LOG_DEBUG << "tray:" << i << ", mod cell:" << j << " = " << St_tofSimResParamsC::instance()->resolution()[index] << " == " << params[i][j] << endm;
}
}
mAverageTimeResTof=mAverageTimeResTof/(120*192);
LOG_INFO << "Loaded tofSimResParams. Average = " << mAverageTimeResTof << endm;

if (StDetectorDbMaker::instance()) {
fgInstance->SetName("tofSimResParamsC");
StDetectorDbMaker::instance()->AddConst(fgInstance);
}
return fgInstance;
}
//________________________________________________________________________________
Double_t St_tofSimResParamsC::timeres_tof(UInt_t itray, UInt_t imodule, UInt_t icell) {
/*
* Calculates the average resolution across all 38 tubes (discounts inactive tubes)
* then returns a single vertex resolution (in ps) for use in embedding w/ vpdStart
*/
Double_t result = 8.5e-11;
if ( itray > 120 || imodule > 32 || icell > 6 )
return result;

return params[ itray ][ imodule * 6 + icell ];

}
#include "St_vpdDelayC.h"
MakeChairInstance(vpdDelay,Calibrations/tof/vpdDelay);
#include "St_vpdTotCorrC.h"
Expand Down
7 changes: 7 additions & 0 deletions StRoot/StDetectorDbMaker/StDetectorDbMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@
#endif
St_trigDetSums* St_trigDetSumsC::fgTableCopy = 0;
Int_t StDetectorDbMaker::_debug = 0;
StDetectorDbMaker *StDetectorDbMaker::fgStDetectorDbMaker = 0;
ClassImp(StDetectorDbMaker)
//_____________________________________________________________________________
//_____________________________________________________________________________
Int_t StDetectorDbMaker::InitRun (Int_t runumber) {
if (m_ConstSet) m_ConstSet->Delete(); // Clear Chair Instances
return 0;
}
//_____________________________________________________________________________
Int_t StDetectorDbMaker::Make(){
#if 0 /* Move to St_trigDetSumsC to unify reading daq and StEvent files */
// Also need to update instances for classes done in InitRun.
Expand Down
9 changes: 6 additions & 3 deletions StRoot/StDetectorDbMaker/StDetectorDbMaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@

class StDetectorDbMaker : public StMaker {
public:
StDetectorDbMaker(const char *name="DetectorDb") : StMaker(name) {}
virtual ~StDetectorDbMaker() {}
StDetectorDbMaker(const char *name="DetectorDb") : StMaker(name) {fgStDetectorDbMaker = this; }
virtual ~StDetectorDbMaker() {fgStDetectorDbMaker = 0;}
virtual Int_t InitRun(Int_t runumber);
virtual Int_t Make();
static StDetectorDbMaker *instance() {return fgStDetectorDbMaker;}
private:
static Int_t _debug;
virtual const char *GetCVS() const
{static const char cvs[]="Tag $Name: $ $Id: StDetectorDbMaker.h,v 1.5 2015/12/23 23:34:09 fisyak Exp $ built " __DATE__ " " __TIME__ ; return cvs;}

static StDetectorDbMaker *fgStDetectorDbMaker;
ClassDef(StDetectorDbMaker,0) //StAF chain virtual base class for Makers
};

Expand Down
3 changes: 2 additions & 1 deletion StRoot/StDetectorDbMaker/St_itpcPadGainT0C.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "TChair.h"
#include "tables/St_itpcPadGainT0_Table.h"

class TBrowser;
struct rowpadFEEmap_t {// FEE & RDO map for iTPC
Int_t row, padMin, padMax, fee, rdo;
};
Expand All @@ -26,6 +26,7 @@ class St_itpcPadGainT0C : public TChair {
for (Int_t pad=1; pad<=120; pad++) if (Gain(sector,row,pad)>0) return kTRUE;
return kFALSE;
}
void Browse(TBrowser *b) {}
static rowpadFEEmap_t rowpadFEE[];
static Int_t NCrowpadFEE;
protected:
Expand Down
6 changes: 6 additions & 0 deletions StRoot/StDetectorDbMaker/St_tofSimResParamsC.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "TChair.h"
#include "tables/St_tofSimResParams_Table.h"
class TBrowser;

class St_tofSimResParamsC : public TChair {
public:
Expand All @@ -11,7 +12,12 @@ class St_tofSimResParamsC : public TChair {
UInt_t getNumRows() const {return GetNRows();}
UShort_t * resolution(Int_t i = 0) const {return Struct(i)->resolution;}
UChar_t* algoFlag(Int_t i = 0) const {return Struct(i)->algoFlag;}
static Double_t average_timeres_tof(){return mAverageTimeResTof;}
static Double_t timeres_tof(UInt_t itray, UInt_t imodule, UInt_t icell);
void Browse(TBrowser *b) {}
protected:
static Double_t params[120][192];
static Double_t mAverageTimeResTof;
St_tofSimResParamsC(St_tofSimResParams *table=0) : TChair(table) {}
virtual ~St_tofSimResParamsC() {fgInstance = 0;}
private:
Expand Down
2 changes: 2 additions & 0 deletions StRoot/StDetectorDbMaker/St_tpcMaxHitsC.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
#define St_tpcMaxHitsC_h
#include "TChair.h"
#include "tables/St_tpcMaxHits_Table.h"
class TBrowser;
class St_tpcMaxHitsC : public TChair {
public:
static St_tpcMaxHitsC* instance();
tpcMaxHits_st *Struct(Int_t i = 0) {return ((St_tpcMaxHits*) Table())->GetTable()+i;}
Int_t maxSectorHits() {return Struct()->maxSectorHits;}
Int_t maxBinZeroHits() {return Struct()->maxBinZeroHits;}
void Browse(TBrowser *b) {}
protected:
St_tpcMaxHitsC(St_tpcMaxHits *table=0) : TChair(table) {}
virtual ~St_tpcMaxHitsC() {fgInstance = 0;}
Expand Down
2 changes: 2 additions & 0 deletions StRoot/StDetectorDbMaker/St_tpcPadGainT0C.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "TChair.h"
#include "tables/St_tpcPadGainT0_Table.h"
#include "St_tpcPadConfigC.h"
class TBrowser;
class St_tpcPadGainT0C : public TChair {
public:
static St_tpcPadGainT0C* instance();
Expand All @@ -28,6 +29,7 @@ class St_tpcPadGainT0C : public TChair {
for (Int_t pad=1; pad<=182; pad++) if (Gain(sector,row,pad)>0) return kTRUE;
return kFALSE;
}
void Browse(TBrowser *b) {}
protected:
St_tpcPadGainT0C(St_tpcPadGainT0 *table=0) : TChair(table) {}
virtual ~St_tpcPadGainT0C() {fgInstance = 0;}
Expand Down

0 comments on commit 7fd7f97

Please sign in to comment.