Skip to content
Snippets Groups Projects

Fix UT geometry and tracking

Merged Hangyi Wu requested to merge ut-geo-fixes into master
1 file
+ 43
30
Compare changes
  • Side-by-side
  • Inline
@@ -229,7 +229,11 @@ namespace LHCb::Detector::UT {
applyToAllSectors( func );
}
bool SectorsSwapped() const { return true; }
bool SectorsSwapped() const {
// UT in DD4hep supports only GeoVersion::v1 which
// does not have swapped sectors
return false;
}
bool layerSizeOK() const {
return static_cast<unsigned int>( version() ) != static_cast<unsigned int>( GeoVersion::v0 );
@@ -238,44 +242,53 @@ namespace LHCb::Detector::UT {
const LayerGeom getLayerGeom( unsigned int layerid ) const {
LayerGeom layergeom;
auto SectorsInLayer = sectors( LayerID_t{layerid} );
auto tStation = layerid / 2;
unsigned int keysectorID = ( tStation == 0 ) ? 31 : 11;
auto stationID = layerid / 2;
unsigned int keysectorID = ( stationID == 0 ) ? 31 : 11;
layergeom.z = SectorsInLayer[keysectorID].globalCentre().z();
float YFirstRow = 0;
float YLastRow = 0;
float smallestXLastCol = 0;
float smallestXFirstcol = 0;
float biggestXFirstCol = 0;
unsigned int biggestColumn = ( tStation == 0 ) ? 16u : 18u;
unsigned int smallestColumn = 1u;
unsigned int topMostRow = 14u; // corner sectors expected on StaveA
unsigned int bottomMostRow = 1u;
float yFirstRow = 0; // y of bottommost sector of outmost stave
float yLastRow = 0; // y of topmost sector of outmost stave
float xFirstColFirstRow = 0; // x of bottommost sector of Cside outmost stave
float xLastColFirstRow = 0; // x of bottommost sector of Cside outmost stave
float xFirstColLastRow = 0; // x of topmost sector of Cside outmost stave
unsigned int lastColumn =
( stationID == 0 ) ? 16u : 18u; // number of staves, UTaX/U -> stationID 0, UTbX/V -> stationID 1
unsigned int maxStaveID = ( stationID == 0 ) ? 7u : 8u;
unsigned int firstColumn = 1u; // count from 1
unsigned int lastRow = 14u; // top most sector
unsigned int firstRow = 1u; // bottom most sector
std::map<std::string, ChannelID> cornerSectorChanIDs{
{// Cside, LayerID, maxStaveID, Face1, Module0
{"FirstColFirstRow", ChannelID( ChannelID::detType::typeUT, 0, layerid, maxStaveID, 1, 0, 0, 0 )},
// Cside, LayerID, maxStaveID, Face0, Module7
{"FirstColLastRow", ChannelID( ChannelID::detType::typeUT, 0, layerid, maxStaveID, 0, 7, 0, 0 )},
// Aside, LayerID, maxStaveID, Face1, Module0
{"LastColFirstRow", ChannelID( ChannelID::detType::typeUT, 1, layerid, maxStaveID, 1, 0, 0, 0 )}}};
// loop over sectors within this layer to get x, y of corner sectors
std::for_each( SectorsInLayer.begin(), SectorsInLayer.end(), [&]( DeUTSector const& utSector ) {
if ( utSector.channelID().stave() < 1 ) return; // skip Stave0 due to its Y shift
auto pos = utSector.toGlobal( ROOT::Math::XYZPoint{0, 0, 0} );
auto pos_x = pos.x();
auto pos_y = pos.y();
if ( pos_x < smallestXFirstcol ) smallestXFirstcol = pos_x;
if ( pos_x > smallestXLastCol ) smallestXLastCol = pos_x;
if ( pos_y < YFirstRow ) YFirstRow = pos_y;
if ( pos_y > YLastRow ) YLastRow = pos_y;
if ( utSector.channelID() == cornerSectorChanIDs["FirstColFirstRow"] ) {
yFirstRow = utSector.globalCentre().y();
xFirstColFirstRow = utSector.globalCentre().x();
} else if ( utSector.channelID() == cornerSectorChanIDs["FirstColLastRow"] ) {
yLastRow = utSector.globalCentre().y();
xFirstColLastRow = utSector.globalCentre().x();
} else if ( utSector.channelID() == cornerSectorChanIDs["LastColFirstRow"] ) {
xLastColFirstRow = utSector.globalCentre().x();
}
} );
dd4hep::printout( dd4hep::DEBUG, "DeUT::getLayerGeom", "smallestXFirstcol = %.3f", smallestXFirstcol );
dd4hep::printout( dd4hep::DEBUG, "DeUT::getLayerGeom", "smallestXLastCol = %.3f", smallestXLastCol );
dd4hep::printout( dd4hep::DEBUG, "DeUT::getLayerGeom", "YFirstRow = %.3f", YFirstRow );
dd4hep::printout( dd4hep::DEBUG, "DeUT::getLayerGeom", "YLastRow = %.3f", YLastRow );
dd4hep::printout( dd4hep::DEBUG, "DeUT::getLayerGeom", "xFirstColFirstRow = %.3f", xFirstColFirstRow );
dd4hep::printout( dd4hep::DEBUG, "DeUT::getLayerGeom", "xFirstColLastRow = %.3f", xFirstColLastRow );
dd4hep::printout( dd4hep::DEBUG, "DeUT::getLayerGeom", "xLastColFirstRow = %.3f", xLastColFirstRow );
dd4hep::printout( dd4hep::DEBUG, "DeUT::getLayerGeom", "yFirstRow = %.3f", yFirstRow );
// gather all information into the corresponding LayerInfo object
auto ncols = biggestColumn - smallestColumn + 1;
auto nrows = topMostRow - bottomMostRow + 1;
auto ncols = lastColumn - firstColumn + 1;
auto nrows = lastRow - firstRow + 1;
layergeom.nColsPerSide = ncols / 2;
layergeom.nRowsPerSide = nrows / 2;
layergeom.invHalfSectorYSize = 2 * ( nrows - 1 ) / ( YLastRow - YFirstRow );
layergeom.invHalfSectorXSize = 2 * ( ncols - 1 ) / ( smallestXLastCol - smallestXFirstcol );
layergeom.dxDy = ( biggestXFirstCol - smallestXFirstcol ) / ( YLastRow - YFirstRow );
layergeom.invHalfSectorYSize = 2 * ( nrows - 1 ) / ( yLastRow - yFirstRow );
layergeom.invHalfSectorXSize = 2 * ( ncols - 1 ) / ( xLastColFirstRow - xFirstColFirstRow );
layergeom.dxDy = ( xFirstColLastRow - xFirstColFirstRow ) / ( yLastRow - yFirstRow );
return layergeom;
}
Loading