Skip to content

Commit 7ad0a18

Browse files
zhux97plexoos
andauthored
Code update for Run18 embedding (#481)
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>
1 parent eba1468 commit 7ad0a18

12 files changed

Lines changed: 1075 additions & 352 deletions

File tree

StRoot/RTS/src/DAQ_TPX/tpxFCF.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,6 +1617,10 @@ void tpxFCF::dump(tpxFCF_cl *cl, int row)
16171617

16181618
}
16191619

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

16221626

StRoot/RTS/src/DAQ_TPX/tpxGain.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ void tpxGain::do_default(int sec)
828828
return ;
829829
}
830830

831-
int tpxGain::from_file(char *fname, int sec)
831+
int tpxGain::from_file(const char *fname, int sec)
832832
{
833833
FILE *f ;
834834
int s, r, p ;
@@ -999,7 +999,7 @@ int tpxGain::from_file(char *fname, int sec)
999999
}
10001000

10011001

1002-
int tpxGain::to_file(char *fname)
1002+
int tpxGain::to_file(const char *fname)
10031003
{
10041004

10051005
FILE *f ;

StRoot/RTS/src/DAQ_TPX/tpxGain.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class tpxGain
139139
return (gains[s-1] + r*TPX_MAX_PAD + (p-1)) ;
140140
}
141141

142-
int from_file(char *fname, int sector = 0) ;
142+
int from_file(const char *fname, int sector = 0) ;
143143

144144

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

194194

195195
// below used only during calculation
196-
int to_file(char *fname) ;
196+
int to_file(const char *fname) ;
197197

198198
void init(int sec=0) ; // zap's structs; assume all TPX
199199
void accum(char *evbuff, int bytes) ; // parses one RDO's worth of pulser data

StRoot/StDetectorDbMaker/StDetectorDbChairs.cxx

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,21 @@ Float_t St_TpcAvgCurrentC::AcCharge(Int_t sector, Int_t channel) {
999999
return (sector > 0 && sector <= 24 && channel > 0 && channel <= 8) ?
10001000
Struct()->AcCharge[8*(sector-1)+channel-1] : 0;
10011001
}
1002+
#include "St_itpcRDOMapC.h"
1003+
MakeChairInstance2(tpcRDOMap,St_itpcRDOMapC,Calibrations/tpc/itpcRDOMap);
1004+
//________________________________________________________________________________
1005+
Int_t St_itpcRDOMapC::rdo(Int_t padrow, Int_t pad) const {
1006+
Int_t rdo = 0;
1007+
Int_t N = nrows(0);
1008+
for (Int_t i = 0; i < N; i++) {
1009+
if (padrow != row(i)) continue;
1010+
if (pad < padMin(i) || pad > padMax(i)) continue;
1011+
rdo = rdoI(i);
1012+
1013+
break;
1014+
}
1015+
return rdo;
1016+
}
10021017
#include "St_tpcRDOMapC.h"
10031018
MakeChairInstance(tpcRDOMap,Calibrations/tpc/tpcRDOMap);
10041019
//________________________________________________________________________________
@@ -1014,6 +1029,17 @@ Int_t St_tpcRDOMapC::rdo(Int_t padrow, Int_t pad) const {
10141029
}
10151030
return rdo;
10161031
}
1032+
//________________________________________________________________________________
1033+
Int_t St_tpcRDOMapC::rdo(Int_t sector, Int_t padrow, Int_t pad) const {
1034+
if (St_tpcPadConfigC::instance()->iTpc(sector)) {
1035+
Int_t N40 = St_tpcPadConfigC::instance()->innerPadRows(sector);
1036+
if (padrow <= N40) {
1037+
return St_itpcRDOMapC::instance()->rdo(padrow,pad);
1038+
}
1039+
return St_tpcRDOMapC::instance()->rdo(padrow-N40+13,pad) + 2;
1040+
}
1041+
return rdo(padrow, pad);
1042+
}
10171043
#include "St_tpcRDOT0offsetC.h"
10181044
MakeChairInstance(tpcRDOT0offset,Calibrations/tpc/tpcRDOT0offset);
10191045
Float_t St_tpcRDOT0offsetC::T0(Int_t sector, Int_t padrow, Int_t pad) const {
@@ -1105,24 +1131,44 @@ starClockOnl_st *St_starClockOnlC::Struct(Int_t i) {
11051131
MakeChairInstance(starMagOnl,RunLog/onl/starMagOnl);
11061132
#include "St_beamInfoC.h"
11071133
MakeChairInstance(beamInfo,RunLog/onl/beamInfo);
1134+
//________________________________________________________________________________
11081135
#include "St_tpcRDOMasksC.h"
11091136
MakeChairInstance(tpcRDOMasks,RunLog/onl/tpcRDOMasks);
11101137
//________________________________________________________________________________
1111-
UInt_t St_tpcRDOMasksC::getSectorMask(UInt_t sector) {
1138+
UInt_t St_tpcRDOMasksC::getSectorMask(UInt_t sec) {
11121139
UInt_t MASK = 0x0000; // default is to mask it out
11131140
//UInt_t MASK = 0xFFFF; // change to ON by default ** THIS WAS A HACK
1114-
if(sector < 1 || sector > 24 || getNumRows() == 0){
1141+
if(sec < 1 || sec > 24 || getNumRows() == 0){
11151142
LOG_WARN << "St_tpcRDOMasksC:: getSectorMask : return default mask for "
1116-
<< "sector= " << sector << " getNumRows()=" << getNumRows() << endm;
1143+
<< "sector= " << sec << " getNumRows()=" << getNumRows() << endm;
11171144
return MASK;
11181145
}
1119-
MASK = mask(((sector + 1) / 2) - 1); // does the mapping from sector 1-24 to packed sectors
1120-
if( sector % 2 == 0){ // if its even relevent bits are 6-11
1121-
MASK = MASK >> 6;
1146+
// tpcRDOMasks_st *row = Struct();
1147+
// Take care about unsorted tpcRDOMaks table
1148+
Int_t i = -1;
1149+
UInt_t j = (sec + 1) / 2 - 1;
1150+
for (i = 0; i < 12; i++) {
1151+
if (sector(i) == 2*j + 1) {break;}
1152+
}
1153+
assert(i >= 0);
1154+
// MASK = mask(((sec + 1) / 2) - 1); // does the mapping from sector 1-24 to packed sectors
1155+
MASK = mask(i); // does the mapping from sector 1-24 to packed sectors
1156+
if (runNumber() <= 19000000 || (runNumber() < 20000000 && sec != 20)) {// no iTPC
1157+
if (sec == 16 && MASK == 0 && runNumber() > 8181000 && runNumber() < 9181000) MASK = 4095;
1158+
if( sec % 2 == 0){ // if its even relevent bits are 6-11
1159+
MASK = MASK >> 6;
1160+
}
1161+
// Otherwise want lower 6 bits
1162+
MASK &= 0x000003F; // Mask out higher order bits
1163+
} else if (runNumber() < 20000000 && sec == 20) { // Run XVIII, sector 20
1164+
MASK = 255;
1165+
} else { // Run XIX and higher
1166+
if( sec % 2 == 0){ // if its even relevent bits are 8-13
1167+
MASK = MASK >> 8;
1168+
}
1169+
// Otherwise want lower 6 bits
1170+
MASK &= 255; // Mask out higher order bits
11221171
}
1123-
// Otherwise want lower 6 bits
1124-
MASK &= 0x000003F; // Mask out higher order bits
1125-
if (sector == 16 && MASK == 0 && runNumber() > 8181000 && runNumber() < 9181000) MASK = 4095;
11261172
return MASK;
11271173
}
11281174
//________________________________________________________________________________
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef St_itpcRDOMapC_h
2+
#define St_itpcRDOMapC_h
3+
4+
#include "TChair.h"
5+
#include "tables/St_tpcRDOMap_Table.h"
6+
7+
class St_itpcRDOMapC : public TChair {
8+
public:
9+
static St_itpcRDOMapC* instance();
10+
tpcRDOMap_st *Struct(Int_t i = 0) const {return ((St_tpcRDOMap*) Table())->GetTable()+i;}
11+
UInt_t getNumRows() const {return GetNRows();}
12+
UChar_t nrows(Int_t i = 0) const {return Struct(i)->nrows;}
13+
UChar_t index(Int_t i = 0) const {return Struct(i)->idx;}
14+
UChar_t row(Int_t i = 0) const {return Struct(i)->row;}
15+
UChar_t padMin(Int_t i = 0) const {return Struct(i)->padMin;}
16+
UChar_t padMax(Int_t i = 0) const {return Struct(i)->padMax;}
17+
UChar_t rdoI(Int_t i = 0) const {return Struct(i)->rdo;}
18+
Int_t rdo(Int_t padrow, Int_t pad = 1) const;
19+
protected:
20+
St_itpcRDOMapC(St_tpcRDOMap *table=0) : TChair(table) {}
21+
virtual ~St_itpcRDOMapC() {fgInstance = 0;}
22+
private:
23+
static St_itpcRDOMapC* fgInstance;
24+
ClassDefineChair(St_itpcRDOMapC, St_tpcRDOMap, tpcRDOMap_st )
25+
ClassDef(St_itpcRDOMapC,1) //C++ TChair for itpcRDOMap table class
26+
};
27+
#endif

StRoot/StDetectorDbMaker/St_tpcRDOMapC.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class St_tpcRDOMapC : public TChair {
1515
UChar_t padMin(Int_t i = 0) const {return Struct(i)->padMin;}
1616
UChar_t padMax(Int_t i = 0) const {return Struct(i)->padMax;}
1717
UChar_t rdoI(Int_t i = 0) const {return Struct(i)->rdo;}
18-
Int_t rdo(Int_t padrow, Int_t pad = 0) const;
18+
Int_t rdo(Int_t padrow, Int_t pad = 1) const;
19+
Int_t rdo(Int_t sector, Int_t padrow, Int_t pad) const;
1920
protected:
2021
St_tpcRDOMapC(St_tpcRDOMap *table=0) : TChair(table) {}
2122
virtual ~St_tpcRDOMapC() {fgInstance = 0;}

StRoot/StDetectorDbMaker/St_tpcRDOMasksC.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "tables/St_tpcRDOMasks_Table.h"
66
#include "St_tpcPadPlanesC.h"
77
#include "St_tpcPadConfigC.h"
8+
#include "St_tpcRDOMapC.h"
89
class St_tpcRDOMasksC : public TChair {
910
public:
1011
static St_tpcRDOMasksC* instance();
@@ -14,6 +15,7 @@ class St_tpcRDOMasksC : public TChair {
1415
UInt_t sector(Int_t i = 0) {return Struct(i)->sector;}
1516
UInt_t mask(Int_t i = 0) {return Struct(i)->mask;}
1617
UInt_t getSectorMask(UInt_t sector);
18+
#if 0
1719
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.
1820
UInt_t rdo = 0;
1921
if (row > 0 && row <= 8) rdo = 1;
@@ -24,19 +26,21 @@ class St_tpcRDOMasksC : public TChair {
2426
else if (row >37 && row <= 45) rdo = 6;
2527
return rdo;
2628
}
27-
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.
28-
if (St_tpcPadConfigC::instance()->iTpc(sector)) return 8;
29-
return rdoForPadrow(row);
29+
#else
30+
static UInt_t rdoForPadrow(Int_t row) {return rdoForPadrow(1,row,1);}
31+
#endif
32+
static UInt_t rdoForPadrow(Int_t sector, Int_t row, Int_t pad=1) {
33+
//Function returns the rdo board number for a given padrow index. Range of map used is 1-72
34+
return St_tpcRDOMapC::instance()->rdo(sector, row, pad);
3035
}
3136
Bool_t isOn(Int_t sector,Int_t rdo) {
32-
if (St_tpcPadConfigC::instance()->iTpc(sector)) return 1;
33-
if(sector < 1 || sector > 24 || rdo < 1 || rdo > 6) return 0;
37+
if(sector < 1 || sector > 24 || rdo < 1 || rdo > 8) return 0;
3438
UInt_t MASK = getSectorMask(sector);
3539
MASK = MASK >> (rdo - 1);
3640
MASK &= 0x00000001;
3741
return MASK;
3842
}
39-
Bool_t isRowOn(Int_t sector, Int_t row) {return isOn(sector, rdoForPadrow(sector, row));}
43+
Bool_t isRowOn(Int_t sector, Int_t row, Int_t pad = 1) {return isOn(sector, rdoForPadrow(sector, row, pad));}
4044
protected:
4145
St_tpcRDOMasksC(St_tpcRDOMasks *table=0) : TChair(table) {}
4246
virtual ~St_tpcRDOMasksC() {fgInstance = 0;}

0 commit comments

Comments
 (0)