Skip to content

Commit

Permalink
Backport patches for embedding (#493)
Browse files Browse the repository at this point in the history
* All codes in PR #466 are included, to fix the offline cluster finder
(PRs #417 and #429), update TpcRS parameter for Run19 (PR #463).
* Codes in PR #281 are included, to fix the gating grid simulation and
to fix the StMcEventMaker for iTPC simulation.

These patches are needed for SL21d based embedding productions (Run18
Isobar st_hf/st_upc, Run19 FXT, Run20 FXT runs).

Co-authored-by: Dmitri Smirnov <[email protected]>
  • Loading branch information
zhux97 and plexoos authored Feb 8, 2023
1 parent daa8af0 commit a6fa10c
Show file tree
Hide file tree
Showing 16 changed files with 1,059 additions and 277 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
7 changes: 3 additions & 4 deletions StRoot/StDetectorDbMaker/StDetectorDbChairs.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ void PrintTable(const Char_t *str, TTable *table) {
Bool_t iprt = kTRUE;
if (St_db_Maker::GetValidity(table,t) > 0) {
if (table->InheritsFrom("St_tpcCorrection")) {
St_tpcCorrection *t = (St_tpcCorrection *) table;
tpcCorrection_st *s = t->GetTable(); Nrows = s->nrows;}
St_tpcCorrection *tt = (St_tpcCorrection *) table;
tpcCorrection_st *s = tt->GetTable(); Nrows = s->nrows;}
if (Nrows > 10) Nrows = 10;
CHECKTABLE(tpcCorrection);
CHECKTABLE(tpcHVPlanes);
Expand Down Expand Up @@ -306,9 +306,8 @@ MakeChairInstance2(tpcCorrection,St_TpcdXdYC,Calibrations/tpc/TpcdXdY);
MakeChairInstance2(GatingGrid,St_GatingGridC,Calibrations/tpc/GatingGrid);
//________________________________________________________________________________
Double_t St_GatingGridC::CalcCorrection(Int_t i, Double_t x) {// drift time in microseconds
if (x < 0) return 0;
GatingGrid_st *cor = ((St_GatingGrid *) Table())->GetTable() + i;
Double_t value = -10;
GatingGrid_st *cor = ((St_GatingGrid *) Table())->GetTable() + i;
if (x <= cor->t0) return value;
Double_t corD = 1. - TMath::Exp(-(x-cor->t0)/(cor->settingTime/4.6));
if (corD < 1e-4) return value;
Expand Down
2 changes: 1 addition & 1 deletion StRoot/StMcEventMaker/PACKAGE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# $Id $
# package StMcEventMaker
# author:
Library:libStMcEventMaker.so:LIBS += -lgen_Tables -lsim_Tables -lStChain -l_StEEmcUtil -l_StEmcUtil -lStMcEvent
Library:libStMcEventMaker.so:LIBS += -lgen_Tables -lsim_Tables -lStChain -lStEEmcUtil -lStEmcUtil -lStMcEvent
#Library:libStMcEventMaker.so:LIBS += -lgen_Tables -lsim_Tables -lStChain -lStEEmcUtil -lStEmcUtil -lStMcEvent
23 changes: 16 additions & 7 deletions StRoot/StMcEventMaker/StMcEventMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ struct vertexFlag {
int primaryFlag; };

static const char rcsid[] = "$Id: StMcEventMaker.cxx,v 1.79 2016/08/04 01:54:33 perev Exp $";
static long NTracks = 0;

ClassImp(StMcEventMaker)
#define AddHit2Track(G2Type,DET) \
Int_t iTrkId = ( G2Type ## HitTable[ihit].track_p) - 1; \
Expand Down Expand Up @@ -524,7 +526,9 @@ Int_t StMcEventMaker::Make()
// Now we check if we have the pointer, if we do, then we can access the tables!

if (g2t_vertexTablePointer && g2t_trackTablePointer){

long NVertices = g2t_vertexTablePointer->GetNRows();
NTracks = g2t_trackTablePointer->GetNRows();
if (NVertices > 0 && NTracks > 0) {
//
// g2t_event Table
//
Expand Down Expand Up @@ -789,7 +793,6 @@ Int_t StMcEventMaker::Make()
//______________________________________________________________________
// Step 2 - Fill Vertices - we do not fill parent/daughters until Step 3

long NVertices = g2t_vertexTablePointer->GetNRows();

vector<vertexFlag> vtemp(NVertices); // Temporary array for Step 3

Expand Down Expand Up @@ -838,7 +841,6 @@ Int_t StMcEventMaker::Make()
//______________________________________________________________________
// Step 3 - Fill Tracks - we do not fill associated hits until Step 4

long NTracks = g2t_trackTablePointer->GetNRows();
size_t usedTracksG2t = 0;
long NGeneratorTracks = (particleTablePointer) ? particleTablePointer->GetNRows() : 0;
size_t usedTracksEvGen = 0;
Expand Down Expand Up @@ -1067,12 +1069,14 @@ Int_t StMcEventMaker::Make()
long nPseudoPadrow = 0;
long ihit;
for(ihit=0; ihit<NHits; ihit++) {
if (tpcHitTable[ihit].volume_id < 101 || tpcHitTable[ihit].volume_id > 2445) {
if (tpcHitTable[ihit].volume_id <= 202445 &&
tpcHitTable[ihit].volume_id > 2445) nPseudoPadrow++;
#if 1 /* keep all tpc hits => Inner TPC sector upgrade */
if (tpcHitTable[ihit].volume_id < 101 || tpcHitTable[ihit].volume_id > 2472) {
if (tpcHitTable[ihit].volume_id <= 202472 &&
tpcHitTable[ihit].volume_id > 2472) nPseudoPadrow++;
else nBadVolId++;
continue;
}
#endif
// g2t_tpc_hitTablePointer->Print(ihit,1);
th = new StMcTpcHit(&tpcHitTable[ihit]);
// cout << "McTpcHit\t" << ihit << *th << endl;
Expand Down Expand Up @@ -1295,6 +1299,7 @@ Int_t StMcEventMaker::Make()
//_______________________________________________________________
// At this point StMcEvent should be loaded.

}
}


Expand Down Expand Up @@ -1350,6 +1355,7 @@ void StMcEventMaker::fillBemc(St_g2t_emc_hit* g2t_emc_hitTablePointer)
// cout << "eta " << eta << endl;
// cout << "sub " << sub << endl;
// cout << "detector " << detector << endl;
if (emcHitTable->track_p <= 0 || emcHitTable->track_p > NTracks) continue;
tr = ttemp[emcHitTable->track_p - 1];
de = emcHitTable->de;

Expand Down Expand Up @@ -1423,6 +1429,7 @@ void StMcEventMaker::fillBsmd(St_g2t_emc_hit* g2t_smd_hitTablePointer)
long NHits = g2t_smd_hitTablePointer->GetNRows();
for(long ihit=0; ihit<NHits; ihit++,smdHitTable++) {
geomBsmd->getVolIdBsmd(smdHitTable->volume_id, module,eta,sub,detector); // Must check ??
if (smdHitTable->track_p <= 0 || smdHitTable->track_p > NTracks) continue;
tr = ttemp[smdHitTable->track_p - 1];
de = smdHitTable->de;

Expand Down Expand Up @@ -1485,7 +1492,7 @@ void StMcEventMaker::fillEemc(St_g2t_emc_hit* g2t_tile, St_g2t_emc_hit* g2t_smd)
const EEmcMCHit *h = mEemcGeant.getGeantHits(nHit);
for(Int_t i=0; i<nHit; i++,h++) {
int detId=h->detector;
assert(h->track_p>0); // tmp, to catch bugs,JB
if (h->track_p <= 0 || h->track_p > NTracks) continue;
StMcTrack *tr = ttemp[h->track_p - 1];
int Beta=0,Bsub=0,Bmodule=0; // barrel indexes
/* barrel indexes are used to lable eemc hits
Expand Down Expand Up @@ -1579,6 +1586,7 @@ void StMcEventMaker::fillFpd(St_g2t_emc_hit* g2t_fpd_hitTablePointer)
volume_id /= 1000;
int nstb = volume_id % 10;
int ew = volume_id / 10;
if (hit.track_p <= 0 || hit.track_p > NTracks) continue;
StMcTrack* track = ttemp[hit.track_p - 1];
// Store ew in module, nstb in sub, and ch in eta
StMcCalorimeterHit* fpdHit = new StMcCalorimeterHit(ew,ch,nstb,hit.de,track);
Expand Down Expand Up @@ -1612,6 +1620,7 @@ void StMcEventMaker::fillFsc(St_g2t_emc_hit* g2t_fsc_hitTablePointer)
int module = 1; // only one FSC exists at the moment :)
int eta = floor(float(volume_id) / float(80)); // X coordinate
int sub = volume_id % 80; // Y coordinate
if (hit.track_p <= 0 || hit.track_p > NTracks) continue;
StMcTrack* track = ttemp[hit.track_p - 1];
// Store ew in module, nstb in sub, and ch in eta
StMcCalorimeterHit* fscHit = new StMcCalorimeterHit(module,eta,sub,hit.de,track);
Expand Down
11 changes: 0 additions & 11 deletions StRoot/StTpcHitMaker/StTpcHitMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -442,17 +442,6 @@ Int_t StTpcHitMaker::Make() {
LOG_WARN << "TPC status indicates it is unusable for this event. Ignoring hits." << endm;
return kStOK;
}
#ifdef __GENE__ /* I have no idea what the codes after */
if ( kMode == kTpx || kMode == kTpc || kMode == kiTPC ) {
pEvent = dynamic_cast<StEvent *> (GetInputDS("StEvent"));
if (Debug()) {LOG_INFO << "StTpcHitMaker::Make : StEvent has been retrieved " <<pEvent<< endm;}
if (! pEvent) {LOG_INFO << "StTpcHitMaker::Make : StEvent has not been found " << endm; return kStWarn;}
pHitCollection = pEvent->tpcHitCollection();
} else {
pEvent = 0;
pHitCollection = 0;
}
#endif

static Int_t minSector = IAttr("minSector");
static Int_t maxSector = IAttr("maxSector");
Expand Down
Loading

0 comments on commit a6fa10c

Please sign in to comment.