Skip to content

Commit f323209

Browse files
author
Xin Dong
committed
Hit occupancy protection update: logic simplification and fix
1 parent 07b7f67 commit f323209

1 file changed

Lines changed: 12 additions & 18 deletions

File tree

StRoot/StTpcHitMaker/StTpcRTSHitMaker.cxx

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ Int_t StTpcRTSHitMaker::InitRun(Int_t runnumber) {
284284
#ifdef __TFG__VERSION__
285285
}
286286
#endif /* __TFG__VERSION__ */
287+
PrintAttr();
287288

288289
//////////////////////////////////////
289290
// XD: restore hit occupancy protection code to avoid long-hung of production jobs
@@ -292,6 +293,7 @@ Int_t StTpcRTSHitMaker::InitRun(Int_t runnumber) {
292293
// No hit maxima if these DB params are 0
293294
Int_t maxHitsPerSector = St_tpcMaxHitsC::instance()->maxSectorHits();
294295
Int_t maxBinZeroHits = St_tpcMaxHitsC::instance()->maxBinZeroHits();
296+
if ( !(maxHitsPerSector > 0 || maxBinZeroHits > 0) ) return kStOK;
295297
Int_t livePads = 0;
296298
Int_t totalPads = 0;
297299
Float_t liveFrac = 1;
@@ -304,42 +306,35 @@ Int_t StTpcRTSHitMaker::InitRun(Int_t runnumber) {
304306
if (St_tpcPadConfigC::instance()->iTPC(sector)) rowMin = 14;
305307
for(Int_t row = rowMin; row <= 45; row++) {
306308
Int_t Npads = St_tpcPadPlanesC::instance()->padsPerRow(row);
307-
if (maxHitsPerSector > 0 || maxBinZeroHits > 0) {
308-
totalSecPads += Npads;
309-
if (StDetectorDbTpcRDOMasks::instance()->isRowOn(sector,row) &&
310-
St_tpcAnodeHVavgC::instance()->livePadrow(sector,row))
311-
liveSecPads += Npads;
312-
}
309+
totalSecPads += Npads;
310+
if (StDetectorDbTpcRDOMasks::instance()->isRowOn(sector,row) &&
311+
St_tpcAnodeHVavgC::instance()->livePadrow(sector,row))
312+
liveSecPads += Npads;
313313
}
314314

315315
//iTPC
316-
if (! St_tpcPadConfigC::instance()->iTPC(sector)) continue;
317-
for(Int_t row = 1; row <= 40; row++) {
318-
Int_t Npads = St_itpcPadPlanesC::instance()->padsPerRow(row);
319-
if (maxHitsPerSector > 0 || maxBinZeroHits > 0) {
316+
if (St_tpcPadConfigC::instance()->iTPC(sector)) {
317+
for(Int_t row = 1; row <= 40; row++) {
318+
Int_t Npads = St_itpcPadPlanesC::instance()->padsPerRow(row);
320319
totalSecPads += Npads;
321320
if (StDetectorDbTpcRDOMasks::instance()->isRowOn(sector,row) &&
322321
St_tpcAnodeHVavgC::instance()->livePadrow(sector,row))
323322
liveSecPads += Npads;
324323
}
325324
}
326325

327-
328326
livePads += liveSecPads;
329327
totalPads += totalSecPads;
330328
if (maxHitsPerSector > 0) {
331-
liveFrac = TMath::Max(0.1f,
332-
((Float_t) liveSecPads) / (1e-15f + (Float_t) totalSecPads));
329+
liveFrac = TMath::Max(0.1f, ((Float_t) liveSecPads) / (1e-15f + (Float_t) totalSecPads));
333330
maxHits[sector-1] = (Int_t) (liveFrac * maxHitsPerSector);
334-
if (Debug()) {LOG_INFO << "maxHits in sector " << sector
335-
<< " = " << maxHits[sector-1] << endm;}
331+
if (Debug()) {LOG_INFO << "maxHits in sector " << sector << " = " << maxHits[sector-1] << endm;}
336332
} else {
337333
maxHits[sector-1] = 0;
338334
if (Debug()) {LOG_INFO << "No maxHits in sector " << sector << endm;}
339335
}
340336
if (maxBinZeroHits > 0) {
341-
liveFrac = TMath::Max(0.1f,
342-
((Float_t) livePads) / (1e-15f + (Float_t) totalPads));
337+
liveFrac = TMath::Max(0.1f, ((Float_t) livePads) / (1e-15f + (Float_t) totalPads));
343338
maxBin0Hits = (Int_t) (liveFrac * maxBinZeroHits);
344339
if (Debug()) {LOG_INFO << "maxBinZeroHits " << maxBin0Hits << endm;}
345340
} else {
@@ -350,7 +345,6 @@ Int_t StTpcRTSHitMaker::InitRun(Int_t runnumber) {
350345
/////////
351346
/////////
352347

353-
PrintAttr();
354348
return kStOK;
355349
}
356350
//________________________________________________________________________________

0 commit comments

Comments
 (0)