Skip to content

Commit 3f9857f

Browse files
zhux97plexoosgenevbnigmatkulov
authored
Backport patches for embedding (SL20c) (#498)
Patches needed for Run18 Isobar (st_physics) embedding are assembled. The patched codes are extracted from PR #466, PR #481. --------- Co-authored-by: Dmitri Smirnov <[email protected]> Co-authored-by: Gene Van Buren <[email protected]> Co-authored-by: Grigory Nigmatkulov <[email protected]>
1 parent b401ce6 commit 3f9857f

File tree

11 files changed

+1020
-335
lines changed

11 files changed

+1020
-335
lines changed

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: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,21 @@ Float_t St_TpcAvgCurrentC::AcCharge(Int_t sector, Int_t channel) {
10231023
return (sector > 0 && sector <= 24 && channel > 0 && channel <= 8) ?
10241024
Struct()->AcCharge[8*(sector-1)+channel-1] : 0;
10251025
}
1026+
#include "St_itpcRDOMapC.h"
1027+
MakeChairInstance2(tpcRDOMap,St_itpcRDOMapC,Calibrations/tpc/itpcRDOMap);
1028+
//________________________________________________________________________________
1029+
Int_t St_itpcRDOMapC::rdo(Int_t padrow, Int_t pad) const {
1030+
Int_t rdo = 0;
1031+
Int_t N = nrows(0);
1032+
for (Int_t i = 0; i < N; i++) {
1033+
if (padrow != row(i)) continue;
1034+
if (pad < padMin(i) || pad > padMax(i)) continue;
1035+
rdo = rdoI(i);
1036+
1037+
break;
1038+
}
1039+
return rdo;
1040+
}
10261041
#include "St_tpcRDOMapC.h"
10271042
MakeChairInstance(tpcRDOMap,Calibrations/tpc/tpcRDOMap);
10281043
//________________________________________________________________________________
@@ -1038,6 +1053,17 @@ Int_t St_tpcRDOMapC::rdo(Int_t padrow, Int_t pad) const {
10381053
}
10391054
return rdo;
10401055
}
1056+
//________________________________________________________________________________
1057+
Int_t St_tpcRDOMapC::rdo(Int_t sector, Int_t padrow, Int_t pad) const {
1058+
if (St_tpcPadConfigC::instance()->iTpc(sector)) {
1059+
Int_t N40 = St_tpcPadConfigC::instance()->innerPadRows(sector);
1060+
if (padrow <= N40) {
1061+
return St_itpcRDOMapC::instance()->rdo(padrow,pad);
1062+
}
1063+
return St_tpcRDOMapC::instance()->rdo(padrow-N40+13,pad) + 2;
1064+
}
1065+
return rdo(padrow, pad);
1066+
}
10411067
#include "St_tpcRDOT0offsetC.h"
10421068
MakeChairInstance(tpcRDOT0offset,Calibrations/tpc/tpcRDOT0offset);
10431069
Float_t St_tpcRDOT0offsetC::T0(Int_t sector, Int_t padrow, Int_t pad) const {
@@ -1145,21 +1171,40 @@ Bool_t St_beamInfoC::IsFixedTarget() {
11451171
#include "St_tpcRDOMasksC.h"
11461172
MakeChairInstance(tpcRDOMasks,RunLog/onl/tpcRDOMasks);
11471173
//________________________________________________________________________________
1148-
UInt_t St_tpcRDOMasksC::getSectorMask(UInt_t sector) {
1174+
UInt_t St_tpcRDOMasksC::getSectorMask(UInt_t sec) {
11491175
UInt_t MASK = 0x0000; // default is to mask it out
11501176
//UInt_t MASK = 0xFFFF; // change to ON by default ** THIS WAS A HACK
1151-
if(sector < 1 || sector > 24 || getNumRows() == 0){
1177+
if(sec < 1 || sec > 24 || getNumRows() == 0){
11521178
LOG_WARN << "St_tpcRDOMasksC:: getSectorMask : return default mask for "
1153-
<< "sector= " << sector << " getNumRows()=" << getNumRows() << endm;
1179+
<< "sector= " << sec << " getNumRows()=" << getNumRows() << endm;
11541180
return MASK;
11551181
}
1156-
MASK = mask(((sector + 1) / 2) - 1); // does the mapping from sector 1-24 to packed sectors
1157-
if( sector % 2 == 0){ // if its even relevent bits are 6-11
1158-
MASK = MASK >> 6;
1182+
// tpcRDOMasks_st *row = Struct();
1183+
// Take care about unsorted tpcRDOMaks table
1184+
Int_t i = -1;
1185+
UInt_t j = (sec + 1) / 2 - 1;
1186+
for (i = 0; i < 12; i++) {
1187+
if (sector(i) == 2*j + 1) {break;}
1188+
}
1189+
assert(i >= 0);
1190+
// MASK = mask(((sec + 1) / 2) - 1); // does the mapping from sector 1-24 to packed sectors
1191+
MASK = mask(i); // does the mapping from sector 1-24 to packed sectors
1192+
if (runNumber() <= 19000000 || (runNumber() < 20000000 && sec != 20)) {// no iTPC
1193+
if (sec == 16 && MASK == 0 && runNumber() > 8181000 && runNumber() < 9181000) MASK = 4095;
1194+
if( sec % 2 == 0){ // if its even relevent bits are 6-11
1195+
MASK = MASK >> 6;
1196+
}
1197+
// Otherwise want lower 6 bits
1198+
MASK &= 0x000003F; // Mask out higher order bits
1199+
} else if (runNumber() < 20000000 && sec == 20) { // Run XVIII, sector 20
1200+
MASK = 255;
1201+
} else { // Run XIX and higher
1202+
if( sec % 2 == 0){ // if its even relevent bits are 8-13
1203+
MASK = MASK >> 8;
1204+
}
1205+
// Otherwise want lower 6 bits
1206+
MASK &= 255; // Mask out higher order bits
11591207
}
1160-
// Otherwise want lower 6 bits
1161-
MASK &= 0x000003F; // Mask out higher order bits
1162-
if (sector == 16 && MASK == 0 && runNumber() > 8181000 && runNumber() < 9181000) MASK = 4095;
11631208
return MASK;
11641209
}
11651210
//________________________________________________________________________________
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)