Skip to content
Snippets Groups Projects

PrStoreUTHit - Adapt to UTDet changes, warn when a null sector ptr is received

All threads resolved!
@@ -30,33 +30,31 @@ namespace LHCb::Pr {
KeyValue{"UTHitsLocation", UT::Info::HitLocation} ) {}
StatusCode StoreUTHit::initialize() {
auto sc = Transformer::initialize();
if ( sc.isFailure() ) return sc; // error printed already by GaudiAlgorithm
if ( sc.isFailure() ) return sc;
// TODO : alignment need the updateSvc for detector ( UT experts needed )
m_utDet = getDet<DeUTDetector>( DeUTDetLocation::UT );
// TODO: rebuild cache on geometry changes
for ( int srcId = 0; srcId < NBoards; srcId++ ) {
UTTell1Board* aBoard = m_readoutTool->findByBoardID( UTTell1ID( srcId ) );
const UTTell1ID tel1ID( srcId );
auto aBoard = m_readoutTool->findByBoardID( tel1ID );
if ( aBoard ) {
int i = 0;
std::size_t i = 0;
for ( auto& sector : aBoard->sectorIDs() ) {
// printf("src=%d sec=%d station=%d layer=%d region=%d sector=%d ori=%d\n", srcId, i, sector.station(),
// sector.layer(), sector.detRegion(), sector.sector(), aBoard->orientation()[i]);
const int idx =
( ( ( sector.station() - 1 ) * 2 + ( sector.layer() - 1 ) ) * 3 + ( sector.detRegion() - 1 ) ) * 98 +
( sector.sector() - 1 );
auto aSector = m_utDet->getSectorDirect( idx );
auto aSector = m_utDet->getSector( sector );
if ( !aSector ) { warning() << tel1ID << " " << sector << " gave NULL UT sector" << endmsg; }
const int geomIdx = srcId * NSectorPerBoard + i;
const std::size_t geomIdx = srcId * NSectorPerBoard + i++;
assert( geomIdx < m_sectors_cache.size() );
assert( geomIdx < m_fullchan_cache.size() );
m_sectors_cache[geomIdx] = aSector;
m_fullchan_cache[geomIdx] = {sector.station(), sector.layer(), sector.detRegion(),
sector.sector(), sector.uniqueSector(), (unsigned int)sector};
i++;
}
}
}
@@ -80,7 +78,7 @@ namespace LHCb::Pr {
for ( unsigned int iBoard = 0u; iBoard < m_readoutTool->nBoard(); ++iBoard ) {
int testID = m_readoutTool->findByOrder( iBoard )->boardID().id();
auto iterBank =
std::find_if( banks.begin(), banks.end(), [&]( const RawBank* b ) { return b->sourceID() == testID; } );
std::find_if( banks.begin(), banks.end(), [&]( const auto b ) { return b->sourceID() == testID; } );
if ( iterBank == banks.end() ) {
missing.push_back( (unsigned int)testID );
std::string lostBank = "lost bank " + boost::lexical_cast<std::string>( testID );
@@ -330,15 +328,17 @@ namespace LHCb::Pr {
const auto& aWord = *iterDecoder;
const auto fracStrip = aWord.fracStripBits();
const int geomIdx = bank->sourceID() * 6 + ( aWord.channelID() / 512 );
const int strip = ( aWord.channelID() & 511 ) + 1;
const std::size_t geomIdx = bank->sourceID() * 6 + ( aWord.channelID() / 512 );
const std::size_t strip = ( aWord.channelID() & 511 ) + 1;
// auto&& [fullChan, strip, interStrip] = aBoard->DAQToOfflineFull( fracStrip, bankVersion, aWord.channelID()
// ); get the sector associated to the channelID and use it to create the Hit auto aSector =
// m_utDet->getSector( fullChan.station, fullChan.layer, fullChan.detRegion, fullChan.sector,
// fullChan.uniqueSector );
auto aSector = m_sectors_cache[geomIdx];
auto fullChan = m_fullchan_cache[geomIdx];
assert( geomIdx < m_sectors_cache.size() );
assert( geomIdx < m_fullchan_cache.size() );
const auto& aSector = m_sectors_cache[geomIdx];
const auto& fullChan = m_fullchan_cache[geomIdx];
// note that the channel ID given to AddHit does no have strip bits set
// this is fine as they are never used. The only use of the given chanID
Loading