Skip to content

Commit

Permalink
Code update for Run18 embedding (#481)
Browse files Browse the repository at this point in the history
Patches needed for Run18 embedding are assembled in this PR. These
patches are:
* RDO map is updated and iTPC RDO is added for sector 20 in Run18.
* TpcRS parameters for the second half of Run18 27 GeV dataset is added.
* Offline cluster finder (RTS and StTpcRTSHitMaker) is updated with the
correct gain interface.
* A newer StTpcRSMaker is included to correct the 1st pad row.

Co-authored-by: Dmitri Smirnov <dmixsmi@gmail.com>
  • Loading branch information
zhux97 and plexoos authored Feb 2, 2023
1 parent eba1468 commit 7ad0a18
Show file tree
Hide file tree
Showing 12 changed files with 1,075 additions and 352 deletions.
4 changes: 4 additions & 0 deletions StRoot/RTS/src/DAQ_TPX/tpxFCF.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,10 @@ void tpxFCF::dump(tpxFCF_cl *cl, int row)

}

if(do_cuts==1 && run_compatibility >= 22) { // ADDED in FY22, pp500
// kill ONEDPAD unless they fall before the trigger
if((cl->t_max > 20) && (fla & FCF_ONEPAD)) return ;
}
}


Expand Down
4 changes: 2 additions & 2 deletions StRoot/RTS/src/DAQ_TPX/tpxGain.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ void tpxGain::do_default(int sec)
return ;
}

int tpxGain::from_file(char *fname, int sec)
int tpxGain::from_file(const char *fname, int sec)
{
FILE *f ;
int s, r, p ;
Expand Down Expand Up @@ -999,7 +999,7 @@ int tpxGain::from_file(char *fname, int sec)
}


int tpxGain::to_file(char *fname)
int tpxGain::to_file(const char *fname)
{

FILE *f ;
Expand Down
4 changes: 2 additions & 2 deletions StRoot/RTS/src/DAQ_TPX/tpxGain.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class tpxGain
return (gains[s-1] + r*TPX_MAX_PAD + (p-1)) ;
}

int from_file(char *fname, int sector = 0) ;
int from_file(const char *fname, int sector = 0) ;


// [sector 1-24][RDO 1-6][fee-index 0-35]
Expand Down Expand Up @@ -193,7 +193,7 @@ class tpxGain


// below used only during calculation
int to_file(char *fname) ;
int to_file(const char *fname) ;

void init(int sec=0) ; // zap's structs; assume all TPX
void accum(char *evbuff, int bytes) ; // parses one RDO's worth of pulser data
Expand Down
64 changes: 55 additions & 9 deletions StRoot/StDetectorDbMaker/StDetectorDbChairs.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,21 @@ Float_t St_TpcAvgCurrentC::AcCharge(Int_t sector, Int_t channel) {
return (sector > 0 && sector <= 24 && channel > 0 && channel <= 8) ?
Struct()->AcCharge[8*(sector-1)+channel-1] : 0;
}
#include "St_itpcRDOMapC.h"
MakeChairInstance2(tpcRDOMap,St_itpcRDOMapC,Calibrations/tpc/itpcRDOMap);
//________________________________________________________________________________
Int_t St_itpcRDOMapC::rdo(Int_t padrow, Int_t pad) const {
Int_t rdo = 0;
Int_t N = nrows(0);
for (Int_t i = 0; i < N; i++) {
if (padrow != row(i)) continue;
if (pad < padMin(i) || pad > padMax(i)) continue;
rdo = rdoI(i);

break;
}
return rdo;
}
#include "St_tpcRDOMapC.h"
MakeChairInstance(tpcRDOMap,Calibrations/tpc/tpcRDOMap);
//________________________________________________________________________________
Expand All @@ -1014,6 +1029,17 @@ Int_t St_tpcRDOMapC::rdo(Int_t padrow, Int_t pad) const {
}
return rdo;
}
//________________________________________________________________________________
Int_t St_tpcRDOMapC::rdo(Int_t sector, Int_t padrow, Int_t pad) const {
if (St_tpcPadConfigC::instance()->iTpc(sector)) {
Int_t N40 = St_tpcPadConfigC::instance()->innerPadRows(sector);
if (padrow <= N40) {
return St_itpcRDOMapC::instance()->rdo(padrow,pad);
}
return St_tpcRDOMapC::instance()->rdo(padrow-N40+13,pad) + 2;
}
return rdo(padrow, pad);
}
#include "St_tpcRDOT0offsetC.h"
MakeChairInstance(tpcRDOT0offset,Calibrations/tpc/tpcRDOT0offset);
Float_t St_tpcRDOT0offsetC::T0(Int_t sector, Int_t padrow, Int_t pad) const {
Expand Down Expand Up @@ -1105,24 +1131,44 @@ starClockOnl_st *St_starClockOnlC::Struct(Int_t i) {
MakeChairInstance(starMagOnl,RunLog/onl/starMagOnl);
#include "St_beamInfoC.h"
MakeChairInstance(beamInfo,RunLog/onl/beamInfo);
//________________________________________________________________________________
#include "St_tpcRDOMasksC.h"
MakeChairInstance(tpcRDOMasks,RunLog/onl/tpcRDOMasks);
//________________________________________________________________________________
UInt_t St_tpcRDOMasksC::getSectorMask(UInt_t sector) {
UInt_t St_tpcRDOMasksC::getSectorMask(UInt_t sec) {
UInt_t MASK = 0x0000; // default is to mask it out
//UInt_t MASK = 0xFFFF; // change to ON by default ** THIS WAS A HACK
if(sector < 1 || sector > 24 || getNumRows() == 0){
if(sec < 1 || sec > 24 || getNumRows() == 0){
LOG_WARN << "St_tpcRDOMasksC:: getSectorMask : return default mask for "
<< "sector= " << sector << " getNumRows()=" << getNumRows() << endm;
<< "sector= " << sec << " getNumRows()=" << getNumRows() << endm;
return MASK;
}
MASK = mask(((sector + 1) / 2) - 1); // does the mapping from sector 1-24 to packed sectors
if( sector % 2 == 0){ // if its even relevent bits are 6-11
MASK = MASK >> 6;
// tpcRDOMasks_st *row = Struct();
// Take care about unsorted tpcRDOMaks table
Int_t i = -1;
UInt_t j = (sec + 1) / 2 - 1;
for (i = 0; i < 12; i++) {
if (sector(i) == 2*j + 1) {break;}
}
assert(i >= 0);
// MASK = mask(((sec + 1) / 2) - 1); // does the mapping from sector 1-24 to packed sectors
MASK = mask(i); // does the mapping from sector 1-24 to packed sectors
if (runNumber() <= 19000000 || (runNumber() < 20000000 && sec != 20)) {// no iTPC
if (sec == 16 && MASK == 0 && runNumber() > 8181000 && runNumber() < 9181000) MASK = 4095;
if( sec % 2 == 0){ // if its even relevent bits are 6-11
MASK = MASK >> 6;
}
// Otherwise want lower 6 bits
MASK &= 0x000003F; // Mask out higher order bits
} else if (runNumber() < 20000000 && sec == 20) { // Run XVIII, sector 20
MASK = 255;
} else { // Run XIX and higher
if( sec % 2 == 0){ // if its even relevent bits are 8-13
MASK = MASK >> 8;
}
// Otherwise want lower 6 bits
MASK &= 255; // Mask out higher order bits
}
// Otherwise want lower 6 bits
MASK &= 0x000003F; // Mask out higher order bits
if (sector == 16 && MASK == 0 && runNumber() > 8181000 && runNumber() < 9181000) MASK = 4095;
return MASK;
}
//________________________________________________________________________________
Expand Down
27 changes: 27 additions & 0 deletions StRoot/StDetectorDbMaker/St_itpcRDOMapC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef St_itpcRDOMapC_h
#define St_itpcRDOMapC_h

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

class St_itpcRDOMapC : public TChair {
public:
static St_itpcRDOMapC* instance();
tpcRDOMap_st *Struct(Int_t i = 0) const {return ((St_tpcRDOMap*) Table())->GetTable()+i;}
UInt_t getNumRows() const {return GetNRows();}
UChar_t nrows(Int_t i = 0) const {return Struct(i)->nrows;}
UChar_t index(Int_t i = 0) const {return Struct(i)->idx;}
UChar_t row(Int_t i = 0) const {return Struct(i)->row;}
UChar_t padMin(Int_t i = 0) const {return Struct(i)->padMin;}
UChar_t padMax(Int_t i = 0) const {return Struct(i)->padMax;}
UChar_t rdoI(Int_t i = 0) const {return Struct(i)->rdo;}
Int_t rdo(Int_t padrow, Int_t pad = 1) const;
protected:
St_itpcRDOMapC(St_tpcRDOMap *table=0) : TChair(table) {}
virtual ~St_itpcRDOMapC() {fgInstance = 0;}
private:
static St_itpcRDOMapC* fgInstance;
ClassDefineChair(St_itpcRDOMapC, St_tpcRDOMap, tpcRDOMap_st )
ClassDef(St_itpcRDOMapC,1) //C++ TChair for itpcRDOMap table class
};
#endif
3 changes: 2 additions & 1 deletion StRoot/StDetectorDbMaker/St_tpcRDOMapC.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class St_tpcRDOMapC : public TChair {
UChar_t padMin(Int_t i = 0) const {return Struct(i)->padMin;}
UChar_t padMax(Int_t i = 0) const {return Struct(i)->padMax;}
UChar_t rdoI(Int_t i = 0) const {return Struct(i)->rdo;}
Int_t rdo(Int_t padrow, Int_t pad = 0) const;
Int_t rdo(Int_t padrow, Int_t pad = 1) const;
Int_t rdo(Int_t sector, Int_t padrow, Int_t pad) const;
protected:
St_tpcRDOMapC(St_tpcRDOMap *table=0) : TChair(table) {}
virtual ~St_tpcRDOMapC() {fgInstance = 0;}
Expand Down
16 changes: 10 additions & 6 deletions StRoot/StDetectorDbMaker/St_tpcRDOMasksC.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "tables/St_tpcRDOMasks_Table.h"
#include "St_tpcPadPlanesC.h"
#include "St_tpcPadConfigC.h"
#include "St_tpcRDOMapC.h"
class St_tpcRDOMasksC : public TChair {
public:
static St_tpcRDOMasksC* instance();
Expand All @@ -14,6 +15,7 @@ class St_tpcRDOMasksC : public TChair {
UInt_t sector(Int_t i = 0) {return Struct(i)->sector;}
UInt_t mask(Int_t i = 0) {return Struct(i)->mask;}
UInt_t getSectorMask(UInt_t sector);
#if 0
static UInt_t rdoForPadrow(Int_t row) { //Function returns the rdo board number for a given padrow index. Range of map used is 1-45.
UInt_t rdo = 0;
if (row > 0 && row <= 8) rdo = 1;
Expand All @@ -24,19 +26,21 @@ class St_tpcRDOMasksC : public TChair {
else if (row >37 && row <= 45) rdo = 6;
return rdo;
}
static UInt_t rdoForPadrow(Int_t sector, Int_t row) { //Function returns the rdo board number for a given padrow index. Range of map used is 1-45.
if (St_tpcPadConfigC::instance()->iTpc(sector)) return 8;
return rdoForPadrow(row);
#else
static UInt_t rdoForPadrow(Int_t row) {return rdoForPadrow(1,row,1);}
#endif
static UInt_t rdoForPadrow(Int_t sector, Int_t row, Int_t pad=1) {
//Function returns the rdo board number for a given padrow index. Range of map used is 1-72
return St_tpcRDOMapC::instance()->rdo(sector, row, pad);
}
Bool_t isOn(Int_t sector,Int_t rdo) {
if (St_tpcPadConfigC::instance()->iTpc(sector)) return 1;
if(sector < 1 || sector > 24 || rdo < 1 || rdo > 6) return 0;
if(sector < 1 || sector > 24 || rdo < 1 || rdo > 8) return 0;
UInt_t MASK = getSectorMask(sector);
MASK = MASK >> (rdo - 1);
MASK &= 0x00000001;
return MASK;
}
Bool_t isRowOn(Int_t sector, Int_t row) {return isOn(sector, rdoForPadrow(sector, row));}
Bool_t isRowOn(Int_t sector, Int_t row, Int_t pad = 1) {return isOn(sector, rdoForPadrow(sector, row, pad));}
protected:
St_tpcRDOMasksC(St_tpcRDOMasks *table=0) : TChair(table) {}
virtual ~St_tpcRDOMasksC() {fgInstance = 0;}
Expand Down
Loading

0 comments on commit 7ad0a18

Please sign in to comment.