Skip to content

Commit

Permalink
Fix misconfigured alignment correction in #358, change default start …
Browse files Browse the repository at this point in the history
…time in eTOF (#372)

- Changing default start time modus in StEtofMatchMaker to use bTOF only start time instead of eTOF hybrid start time. 
- Added error hand-down from eTOF geometry to matchmaker if no alignment database table is found.

Additional notes:

This patch (PR #372) fixes a bug missed while introducing misalignment parameters for ETOF counters in PR #156
The code was reading a wrong number of entries from the database thus disabling the correction effect for all channels

Co-authored-by: Dmitri Smirnov <dmixsmi@gmail.com>
  • Loading branch information
PhilippWeidenkaff and plexoos committed Jul 8, 2022
1 parent 330b977 commit 04c5cd3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
11 changes: 8 additions & 3 deletions StRoot/StETofMatchMaker/StETofMatchMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ StETofMatchMaker::StETofMatchMaker( const char* name )
mIsMuDstIn( false ),
mOuterTrackGeometry( true ),
mUseHelixSwimmer( false ),
mUseOnlyBTofHeaderStartTime( false ),
mUseOnlyBTofHeaderStartTime( true ),
mIsSim( false ),
mDoQA( false ),
mDebug( false ),
Expand Down Expand Up @@ -306,14 +306,19 @@ StETofMatchMaker::InitRun( Int_t runnumber )

if( !gGeoManager ) {
LOG_ERROR << "Cannot get GeoManager" << endm;
return kStErr;
return kStFatal;
}

LOG_DEBUG << " gGeoManager: " << gGeoManager << endm;

mETofGeom->init( gGeoManager, etofProjection::safetyMargins, mUseHelixSwimmer ); //provide backline to initiating maker to load DB tables
}

if ( mETofGeom && !mETofGeom->isInitDone() ) { //if initialization attempt above failed.
LOG_ERROR << "Initialization of StEtofGeometry failed" << endm;
return kStFatal;
}

if( mDoQA ) {
// for geometry debugging
for( unsigned int i=0; i<mETofGeom->nValidModules(); i++ ) {
Expand Down Expand Up @@ -3034,4 +3039,4 @@ ETofTrack::ETofTrack( const StMuTrack* mutrack )

if ( phi < 0. ) phi += 2. * M_PI;
}
}
}
30 changes: 18 additions & 12 deletions StRoot/StETofUtil/StETofGeometry.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,11 @@ StETofGeometry::init( TGeoManager* geoManager, const double* safetyMargins = ini
readAlignmentDatabase();
}

if( mAlignmentParameters.size() != eTofConst::nCounters * eTofConst::nModules ){
LOG_ERROR << "StETofGeometry::Init(...) - Wrong size of counter alignment vector. Either incomplete alignment file or non-existant database table." << endm;
return;
}

int iCounterAlignment = 0;
// loop over sectors
for( int sector = eTofConst::sectorStart; sector <= eTofConst::sectorStop; sector++ ) {
Expand Down Expand Up @@ -635,13 +640,8 @@ StETofGeometry::init( TGeoManager* geoManager, const double* safetyMargins = ini
LOG_DEBUG << activeVolume->GetDX() << " " << activeVolume->GetDY() << " " << activeVolume->GetDZ() << endm;

int counterId = counter - eTofConst::counterStart;
if( mAlignmentParameters.size() == 108 ){ //alignment parameters for all counters available
mETofModule[ mNValidModules-1 ]->addCounter( *gpNode, dx, dy, moduleId, counterId, safetyMargins, mAlignmentParameters.at(iCounterAlignment) );
iCounterAlignment++;
} else {
mETofModule[ mNValidModules-1 ]->addCounter( *gpNode, dx, dy, moduleId, counterId, safetyMargins );
}

mETofModule[ mNValidModules-1 ]->addCounter( *gpNode, dx, dy, moduleId, counterId, safetyMargins, mAlignmentParameters.at(iCounterAlignment) );
iCounterAlignment++;
} // end of loop over counters

} // end of loop over planes
Expand Down Expand Up @@ -683,6 +683,7 @@ StETofGeometry::reset()
LOG_INFO << "StETofGeometry cleared up ...." << endm;

mNValidModules = 0;
mAlignmentParameters.clear();
mInitFlag = false;

mStarBField = nullptr;
Expand Down Expand Up @@ -1526,6 +1527,10 @@ StETofGeometry::readAlignmentDatabase(){
//add check for no alignment set here.

TDataSet* dbDataSet = StMaker::GetChain()->GetDataBase("Geometry/etof/etofAlign");
if( !dbDataSet ) {
LOG_ERROR << "unable to get the dataset from the database" << endm;
return;
}

St_etofAlign* etofAlign = static_cast< St_etofAlign * > ( dbDataSet->Find( "etofAlign" ) );
if( !etofAlign ) {
Expand All @@ -1539,11 +1544,12 @@ StETofGeometry::readAlignmentDatabase(){
float tempY;
float tempZ;

for( int iCounter = 0; iCounter < eTofConst::nCounters; iCounter++){
tempX = table[iCounter].detectorAlignX[0];
tempY = table[iCounter].detectorAlignY[0];
tempZ = table[iCounter].detectorAlignZ[0];
for( int iCounter = 0; iCounter < eTofConst::nCounters * eTofConst::nModules; iCounter++){
tempX = table->detectorAlignX[iCounter];
tempY = table->detectorAlignY[iCounter];
tempZ = table->detectorAlignZ[iCounter];
StThreeVectorD counterAlignmentParameter = StThreeVectorD( tempX, tempY, tempZ );
mAlignmentParameters.push_back( counterAlignmentParameter );
//LOG_INFO <<" Setting alignment parameters for counter "<< iCounter << " X: "<< tempX << " Y: "<< tempY <<" Z: "<< tempZ << endm;
}
}
}

0 comments on commit 04c5cd3

Please sign in to comment.