From c9c4632aa0047f4fcbf5314d0ca08f3b47421294 Mon Sep 17 00:00:00 2001 From: Xuhao Yuan Date: Wed, 13 Apr 2022 22:55:35 +0200 Subject: [PATCH 1/6] rebase and merged --- Detector/UT/include/Detector/UT/ChannelID.h | 68 ++-- Detector/UT/include/Detector/UT/DeUT.h | 368 ++----------------- Detector/UT/include/Detector/UT/DeUTLayer.h | 3 + Detector/UT/include/Detector/UT/DeUTSensor.h | 1 - Detector/UT/src/ChannelID.cpp | 4 +- Detector/UT/src/DeUT.cpp | 2 +- 6 files changed, 82 insertions(+), 364 deletions(-) diff --git a/Detector/UT/include/Detector/UT/ChannelID.h b/Detector/UT/include/Detector/UT/ChannelID.h index 9b3583d2d1..cd18567a68 100644 --- a/Detector/UT/include/Detector/UT/ChannelID.h +++ b/Detector/UT/include/Detector/UT/ChannelID.h @@ -24,16 +24,19 @@ namespace LHCb::Detector::UT { /// Bitmasks for UT bitfield that are different from TT/IT enum struct Mask : unsigned { - strip = 0x3ff, // FIXME: maxstrip seems to be 512, so why not 0x1ff, but then what is the meaning of the bit - // corresponding to 0x200 ? - sector = 0x1fc00, - detRegion = 0x60000, - layer = 0x180000, - station = 0x600000, - type = 0x1800000, - uniqueLayer = station | layer, - uniqueDetRegion = uniqueLayer | detRegion, - uniqueSector = uniqueDetRegion | sector + strip = 0x1ffL, + sector = 0x200L, + module = 0x1c00L, + face = 0x2000L, + stave = 0x3c000L, + layer = 0xc0000L, + side = 0x100000, + type = 0x600000, + uniquelayer = layer | side, + uniquestave = uniquelayer | stave, + uniqueface = uniquestave | face, + uniquemodule = uniqueface | module, + uniqueSector = uniquemodule | sector }; template @@ -62,12 +65,13 @@ namespace LHCb::Detector::UT { /// constructor with int constexpr explicit ChannelID( unsigned int id ) : m_channelID( id ) {} - /// constructor with station, layer, detRegion, sector , strip, - ChannelID( const unsigned int iType, const unsigned int iStation, const unsigned int iLayer, - const unsigned int iDetRegion, const unsigned int iSector, const unsigned int iStrip ) - : ChannelID{shift( iType ) | shift( iStation ) | shift( iLayer ) | - shift( iDetRegion ) | shift( iSector ) | - shift( iStrip )} {} + /// constructor with side, halflayer, stave, face, module, sector, strip. New style + ChannelID( const unsigned int iType, const unsigned int iSide, const unsigned int iHalflayer, + const unsigned int iStave, const unsigned int iFace, const unsigned int iModule, + const unsigned int iSubsector, const unsigned int iStrip ) + : ChannelID{shift( iType ) | shift( iSide ) | shift( iHalflayer ) | + shift( iStave ) | shift( iFace ) | shift( iModule ) | + shift( iSubsector ) | shift( iStrip )} {} /// cast constexpr operator unsigned int() const { return m_channelID; } @@ -82,18 +86,13 @@ namespace LHCb::Detector::UT { [[nodiscard]] constexpr unsigned int sector() const { return extract( m_channelID ); } /// Retrieve detRegion - [[nodiscard]] constexpr unsigned int detRegion() const { return extract( m_channelID ); } + [[nodiscard]] constexpr unsigned int detRegion() const { return stave() < 2 ? 2 : side() == 0 ? 1 : 3; } /// Retrieve layer [[nodiscard]] constexpr unsigned int layer() const { return extract( m_channelID ); } /// Retrieve unique layer - [[nodiscard]] constexpr unsigned int uniqueLayer() const { return extract( m_channelID ); } - - /// Retrieve unique detRegion - [[nodiscard]] constexpr unsigned int uniqueDetRegion() const { - return extract( m_channelID ); - } + [[nodiscard]] constexpr unsigned int uniqueLayer() const { return extract( m_channelID ); } /// Print method for python NOT NEEDED + SLOW IN C++ use operator<< [[nodiscard]] std::string toString() const; @@ -111,11 +110,32 @@ namespace LHCb::Detector::UT { [[nodiscard]] constexpr unsigned int strip() const { return extract( m_channelID ); } /// Retrieve station - [[nodiscard]] constexpr unsigned int station() const { return extract( m_channelID ); } + [[nodiscard]] constexpr unsigned int station() const { return ( this->layer() / 2 + 1u ); } /// Retrieve unique sector [[nodiscard]] constexpr unsigned int uniqueSector() const { return extract( m_channelID ); } + /// Retrieve side + [[nodiscard]] constexpr unsigned int side() const { return extract( m_channelID ); } + + /// Retrieve stave + [[nodiscard]] constexpr unsigned int stave() const { return extract( m_channelID ); } + + /// Retrieve face + [[nodiscard]] constexpr unsigned int face() const { return extract( m_channelID ); } + + /// Retrieve module + [[nodiscard]] constexpr unsigned int module() const { return extract( m_channelID ); } + + /// Retrieve unique Stave + [[nodiscard]] constexpr unsigned int uniqueStave() const { return extract( m_channelID ); } + + /// Retrieve unique Face + [[nodiscard]] constexpr unsigned int uniqueFace() const { return extract( m_channelID ); } + + /// Retrieve unique Module + [[nodiscard]] constexpr unsigned int uniqueModule() const { return extract( m_channelID ); } + friend std::ostream& operator<<( std::ostream& str, const ChannelID& obj ); private: diff --git a/Detector/UT/include/Detector/UT/DeUT.h b/Detector/UT/include/Detector/UT/DeUT.h index c2ffaeaf36..108633c624 100644 --- a/Detector/UT/include/Detector/UT/DeUT.h +++ b/Detector/UT/include/Detector/UT/DeUT.h @@ -49,6 +49,26 @@ namespace LHCb::Detector::UT { struct DeUTElement : DeIOVElement { using DeIOVElement::DeIOVElement; + using Sectors = std::vector; + using Layers = std::vector; + using Modules = std::vector; + using Sides = std::vector; + struct LayerGeom { + float z; + int nColsPerSide; + int nRowsPerSide; + float invHalfSectorYSize; + float invHalfSectorXSize; + float dxDy; + }; + enum class LayerID_t : unsigned int {}; + enum struct Side_t : unsigned int {}; + enum struct Layer_t : unsigned int {}; + enum struct Stave_t : unsigned int {}; + enum struct Face_t : unsigned int {}; + enum struct Module_t : unsigned int {}; + enum struct Sector_t : unsigned int {}; + enum struct GeoVersion { ErrorVersion = 0, v0, v1 }; /** Implementation of sensitive volume identifier for a given point in the global reference frame. This is the sensor number defined in the xml. */ @@ -69,6 +89,16 @@ namespace LHCb::Detector::UT { /// flat vector of sectors const DeUTSector& sector( unsigned int ) const { throw NotImplemented(); } + const Sectors sectors( LayerID_t ) const { throw( "Not implemented" ); } + + const LayerGeom getLayerGeom( unsigned int ) const { throw( "Not implemented" ); } + + bool SectorsSwapped() const { return true; } + + double zStation( unsigned int ) const { throw( "Not implemented" ); } + + auto version() const { return GeoVersion::v1; } + /// @return number of sectors unsigned int nSectors() const { throw NotImplemented(); } @@ -161,343 +191,9 @@ namespace LHCb::Detector::UT { std::optional findStation( ChannelID ) const { throw NotImplemented(); } const DeUTSide& station( unsigned int ) const { throw NotImplemented(); } + const DeUTSide& side( unsigned int ) const { throw NotImplemented(); } unsigned int nStation() const { throw NotImplemented(); } - -#if 0 - using Side = DeUTSide; - using Layer = DeUTLayer; - using Stave = DeUTStave; - using Face = DeUTFace; - using Module = DeUTModule; - using Sector = DeUTSector; - using Sensor = DeUTSensor; - - using Sectors = std::vector; - using Layers = std::vector; - using Modules = std::vector; - struct LayerGeom { - float z; - int nColsPerSide; - int nRowsPerSide; - float invHalfSectorYSize; - float invHalfSectorXSize; - float dxDy; - }; - Layers m_layers = (&)[] { - for ( auto ptrside : m_sides ) { - for ( auto ptrlayer : dynamic_cast( ptrside )->layers() ) { m_layers.push_back( ptrlayer ); } - } - } - (); - Sectors m_sectors = (&)[] { - for ( auto ptrlayer : m_layers ) { - const auto& vecptrsectors = ptrlayer->sectors(); - m_sectors.insert( m_sectors.end(), vecptrsectors.begin(), vecptrsectors.end() ); - } - } - (); - // For new Geo no need for DeUTDetector::setOffset - unsigned int m_nStrip = m_sectors.front()->nStrip() * m_sectors.size(); - unsigned int nStrip() const { return m_nStrip; } - inline const std::string& location() { return ( ""; /*DeUTDetLocation::UT*/ ); } - // inline unsigned int DeUTDetLocation::detType() { return ( ChannelID::detType::typeUT ); } - inline unsigned int detType() { return ( template UTChannelID::detType::typeUT ); } - inline unsigned int firstStation() const { return m_firstSide; } - inline unsigned int lastStation() const { return m_firstSide + m_sides.size() - 1u; } - inline unsigned int firstSide() const { return m_firstSide; } - inline unsigned int lastSide() const { return m_firstSide + m_sides.size() - 1u; } - inline unsigned int nSide() const { return m_sides.size(); } - inline bool contains( const ChannelID aChannel ) const { - return aChannel.template - () < lastSide(); - } - unsigned int m_version = 1u; // Suppose always be 1 in new Geo - std::map m_sMap = (&)[] { - std::map t_sMap; - for ( auto i : m_sectors ) { m_sMap.insert( i->m_elementID.template (), i ); } - return t_sMap; - } - (); - unsigned int m_firstSide = 0u; - void setFirstSide( const unsigned int iSide ) { m_firstSide = iSide; } // Actually no need! - double fractionActive() const { - return std::accumulate( m_sectors.begin(), m_sectors.end(), 0.0, - [&]( double fA, const DeUTSector* s ) { return fA + s->fractionActive(); } ) / - double( m_sectors.size() ); - } - const DeUTSide* findSide( const ChannelID aChannel ) const { - auto iter = - std::find_if( m_sides.begin(), m_sides.end(), [&]( const DeUTSide* s ) { return s->contains( aChannel ); } ); - return iter != m_sides.end() ? *iter : nullptr; - } - const DeUTSide* findSide( const ROOT::Math::XYZPoint& point ) const { - auto iter = - std::find_if( m_sides.begin(), m_sides.end(), [&]( const DeUTSide* s ) { return s->isInside( point ); } ); - return iter != m_sides.end() ? *iter : nullptr; - } - const DeUTLayer* findLayer( const ROOT::Math::XYZPoint& point ) const { - auto iter = - std::find_if( m_layers.begin(), m_layers.end(), [&]( const DeUTLayer* l ) { return l->isInside( point ); } ); - return iter != m_layers.end() ? *iter : nullptr; - } -# if 0 // not sure we still need this or not - const DeUTSector* findSector( std::string_view nickname ) const { - // return pointer to the sector from the nickname - auto iter = std::find_if( m_sectors.begin(), m_sectors.end(), UTDetFun::equal_by_name( nickname ) ); - return iter != m_sectors.end() ? *iter : nullptr; - } -# endif - const DeUTSector* findSector( const ROOT::Math::XYZPoint& aPoint ) const { - const DeUTSector* aSector = nullptr; - const DeUTSide* tSide = findSide( aPoint ); - if ( tSide ) { - const DeUTSide* aSide = dynamic_cast( tSide ); - const DeUTLayer* aLayer = aSide->findLayer( aPoint ); - if ( aLayer ) { - const DeUTStave* aStave = aLayer->findStave( aPoint ); - if ( aStave ) { aSector = aStave->findSector( aPoint ); } - } - } - return aSector; - } - const DeUTSector* findSector( const ChannelID aChannel ) const { - auto iter = std::find_if( m_sectors.begin(), m_sectors.end(), - [&]( const DeUTSector* l ) { return l->contains( aChannel ); } ); - return iter != m_sectors.end() ? *iter : nullptr; - } - int sensitiveVolumeID( const ROOT::Math::XYZPoint& point ) const { - const DeUTSector* sector = findSector( point ); - if ( !sector ) { - // MsgStream msg( msgSvc(), name() ); - // msg << MSG::ERROR << "sensitiveVolumeID: no sensitive volume at " << point << endmsg; - // throw out error report - return -1; - } - return sector->m_elementID; - } - const Sectors& sectors() const { return m_sectors; } - Sectors disabledSectors() const { - Sectors disabled; - const auto& vec = sectors(); - std::copy_if( vec.begin(), vec.end(), std::back_inserter( disabled ), - []( const DeUTSector* s ) { return s->sectorStatus() == DeUTSector::ReadoutProblems; } ); - return disabled; - } - std::vector disabledBeetles() const { - std::vector disabledBeetles; - for ( auto s : sectors() ) { - auto bStatus = s->beetleStatus(); - for ( unsigned int i = 0; i < bStatus.size(); ++i ) { - if ( bStatus[i] == DeUTSector::ReadoutProblems ) { - const unsigned int firstStripOnBeetle = ( i * LHCbConstants::nStripsInBeetle ) + 1; - disabledBeetles.push_back( s->stripToChan( firstStripOnBeetle ) ); - } - } // i - } - return disabledBeetles; - } - LineTraj trajectory( const LHCbID& id, const double offset ) const { - if ( !id.isUT() ) { - // throw GaudiException( "The LHCbID is not of UT type!", "DeUTDetector.cpp", StatusCode::FAILURE ); - // should throw but not in Gaudi... - } - const DeUTSector* aSector = findSector( id.utID() ); - if ( !aSector ) { /*throw GaudiException( "Failed to find sector", "DeUTDetector.cpp", StatusCode::FAILURE );*/ - } - return aSector->trajectory( id.template (), offset ); - } - LineTraj trajectoryFirstStrip( const LHCbID& id ) const { - if ( !id.isUT() ) { - // throw GaudiException( "The LHCbID is not of UT type!", "DeUTDetector.cpp", StatusCode::FAILURE ); - // should throw but not in Gaudi... - } - const DeUTSector* aSector = findSector( id.template () ); - if ( !aSector ) { /*throw GaudiException( "Failed to find sector", "DeUTDetector.cpp", StatusCode::FAILURE );*/ - } - return aSector->trajectoryFirstStrip(); - } - - LineTraj trajectoryLastStrip( const LHCbID& id ) const { - if ( !id.template () ) { - // throw GaudiException( "The LHCbID is not of UT type!", "DeUTDetector.cpp", StatusCode::FAILURE ); - // should throw but not in Gaudi... - } - const DeUTSector* aSector = findSector( id.template () ); - if ( !aSector ) { /*throw GaudiException( "Failed to find sector", "DeUTDetector.cpp", StatusCode::FAILURE ); */ - } - return aSector->trajectoryLastStrip(); - } - - double fractionActive() const { - return std::accumulate( m_sectors.begin(), m_sectors.end(), 0.0, - [&]( double fA, const DeUTSector* s ) { return fA + s->fractionActive(); } ) / - double( m_sectors.size() ); - } - std::map m_STCBmap = {{0, 0}, {2, 1}, {4, 2}, {5, 3}, {6, 4}, {7, 5}, - {8, 6}, {9, 7}, {10, 8}, {12, 9}, {14, 10}}; - std::map m_STCFmap = {{0, 0}, {2, 1}, {4, 2}, {6, 3}, {7, 4}, {8, 5}, - {9, 6}, {10, 7}, {11, 8}, {12, 9}, {14, 10}}; - std::map m_STBBmap = {{0, 0}, {2, 1}, {4, 2}, {5, 3}, {8, 4}, - {9, 5}, {10, 6}, {12, 7}, {14, 8}}; - std::map m_STBFmap = {{0, 0}, {2, 1}, {4, 2}, {6, 3}, {7, 4}, - {10, 5}, {11, 6}, {12, 7}, {14, 8}}; - std::map m_STABmap = {{0, 0}, {2, 1}, {4, 2}, {8, 3}, {10, 4}, {12, 5}, {14, 6}}; - std::map m_STAFmap = {{0, 0}, {2, 1}, {4, 2}, {6, 3}, {10, 4}, {12, 5}, {14, 6}}; - inline static const unsigned int NTOTSECTOR = 1048; - inline static const unsigned int NSECTSTA = 124; - inline static const unsigned int NSECTSTB = 138; - inline static const unsigned int NSECTSTVC = 22; - inline static const unsigned int NSECTSTVB = 18; - inline static const unsigned int NSECTSTVA = 14; - const DeUTSector* getSector( unsigned int side, // - unsigned int layer, // - unsigned int stave, // - unsigned int face, // - unsigned int module, // - unsigned int sector ) const { - - const DeUTSector* res = nullptr; - - if ( m_version != ChannelID::IDType::v1 ) return res; - if ( side < NBSIDE && layer < NBHALFLAYER && stave < NBSTAVE && face < NBFACE && module < NBMODULE && - sector < NBSUBSECTOR ) { - const unsigned int id_Layer = - side * NTOTSECTOR / 2 + ( ( layer < 2 ) ? layer * NSECTSTA : 2 * NSECTSTA + ( layer - 2 ) * NSECTSTB ); - const unsigned int id_Stave = ( ( stave > 0 ) ? NSECTSTVC : 0 ) + ( ( stave > 1 ) ? NSECTSTVB : 0 ) + - ( ( stave > 2 ) ? ( stave - 2 ) * NSECTSTVA : 0 ); - const unsigned int id_Face = ( ( stave == 0 ) ? ( ( face + side ) % 2 ) * ( NSECTSTVC / 2 ) : 0 ) + - ( ( stave == 1 ) ? ( ( face + side ) % 2 ) * ( NSECTSTVB / 2 ) : 0 ) + - ( ( stave > 1 ) ? ( ( face + side ) % 2 ) * ( NSECTSTVA / 2 ) : 0 ); - const unsigned int id_Module = 2 * module + sector; - unsigned int id_Sector; - if ( side == 0 ) { - if ( face == 0 ) { - if ( stave == 0 ) - id_Sector = m_STCBmap.find( id_Module )->second; - else if ( stave == 1 ) - id_Sector = m_STBBmap.find( id_Module )->second; - else - id_Sector = m_STABmap.find( id_Module )->second; - } else { - if ( stave == 0 ) - id_Sector = m_STCFmap.find( id_Module )->second; - else if ( stave == 1 ) - id_Sector = m_STBFmap.find( id_Module )->second; - else - id_Sector = m_STAFmap.find( id_Module )->second; - } - } else { - if ( face == 1 ) { - if ( stave == 0 ) - id_Sector = m_STCBmap.find( id_Module )->second; - else if ( stave == 1 ) - id_Sector = m_STBBmap.find( id_Module )->second; - else - id_Sector = m_STABmap.find( id_Module )->second; - } else { - if ( stave == 0 ) - id_Sector = m_STCFmap.find( id_Module )->second; - else if ( stave == 1 ) - id_Sector = m_STBFmap.find( id_Module )->second; - else - id_Sector = m_STAFmap.find( id_Module )->second; - } - } - const auto i = id_Sector + id_Face + id_Stave + id_Layer; - res = ( i < m_sectors.size() ? m_sectors[i] : nullptr ); - } - - return res; - } - std::size_t getOffset( const std::size_t index ) const noexcept; // no need for new Geo - inline const Layers& layers() const { return m_layers; } - inline unsigned int nLayer() const { return layers().size(); } - inline unsigned int nReadoutSector() const { return sectors().size(); } - inline unsigned int nLayersPerStation() const { return 0; } - inline unsigned int nLayersPerSide() const { return nLayer() / nSide(); } - inline void setNstrip( const unsigned int nStrip ) { m_nStrip = nStrip; } - inline const Sides& sides() const { return m_sides; } - inline const Sectors sectorsinLayer( unsigned int layerID ) const { - const DeUTLayer* layerC = m_layers[layerID]; - Sectors tsectors = layerC->sectors(); - const DeUTLayer* layerA = m_layers[layerID + 4]; - tsectors.insert( tsectors.end(), layerA->sectors().begin(), layerA->sectors().end() ); - return tsectors; - } - // still need? always true for new Geo - inline bool SectorsSwapped() const { - float xPos24( 0.0f ), xPos25( 0.0f ); - auto SectorsInLayer = sectorsinLayer( 0 ); - xPos24 = SectorsInLayer[107]->toGlobal( {0, 0, 0} ).X(); - xPos25 = SectorsInLayer[108]->toGlobal( {0, 0, 0}().X(); - if ( m_version == ChannelID::IDType::v1 ) { - return true; - } else { - if ( xPos24 < xPos25 ) - return true; - else - return false; - } - } - inline double zStation( unsigned int stationid ) const { - if ( stationid > 2 ) throw std::runtime_error( "wrong stationID in DeUTDetector::zStation" ); - return ( m_sides[0]->layers()[stationid * 2]->toGlobal( {0, 0, 0} ).z() + - m_sides[0]->layers()[stationid * 2 + 1]->toGlobal( {0, 0, 0} ).z() ) / - 2; - } - inline bool layerSizeOK() const { return ( m_layers.size() == 8 ); } - inline const LayerGeom getLayerGeom( unsigned int layerid ) const { - LayerGeom layergoem; - auto SectorsInLayer = sectorsinLayer( layerid ); - auto tStation = layerid / 2; - unsigned int keysectorID = 0; - if ( m_version == ChannelID::IDType::v1 ) { keysectorID = ( tStation == 0 ) ? 31 : 11; } - layergoem.z = SectorsInLayer[keysectorID]->globalCentre().z(); - - float YFirstRow = std::numeric_limits::max(); - float YLastRow = std::numeric_limits::lowest(); - float smallestXLastCol = std::numeric_limits::max(); - float smallestXFirstcol = std::numeric_limits::max(); - float biggestXFirstCol = std::numeric_limits::lowest(); - unsigned int biggestColumn = ( tStation == 0 ) ? 16u : 18u; - unsigned int smallestColumn = 1u; - unsigned int topMostRow = 14u; - unsigned int bottomMostRow = 1u; - // Second pass - // find x and y values in the corners to deduce the geometry of the layer - for ( const auto& sector : SectorsInLayer ) { - // deal with x,y coordinates. Remember the corner coordinates - const DeUTSector& utSector = dynamic_cast( *sector ); - auto column = utSector.column(); // should be defined in DeUTSector - auto row = utSector.row(); // should be defined in DeUTSector - auto center = sector->toGlobal( ROOT::Math::XYZPoint{0, 0, 0} ); // This one should be better? - // auto center = sector->geometry()->toGlobal( Gaudi::XYZPoint{0, 0, 0} ); - if ( column == smallestColumn ) { - if ( row == bottomMostRow ) { - smallestXFirstcol = center.x(); - YFirstRow = center.y(); - } else if ( row == topMostRow ) { - biggestXFirstCol = center.x(); - YLastRow = center.y(); - } - } - if ( column == biggestColumn && row == bottomMostRow ) { smallestXLastCol = center.x(); } - } - // gather all information into the corresponding LayerInfo object - auto ncols = biggestColumn - smallestColumn + 1; - auto nrows = topMostRow - bottomMostRow + 1; - layergoem.nColsPerSide = ncols / 2; - layergoem.nRowsPerSide = nrows / 2; - layergoem.invHalfSectorYSize = 2 * ( nrows - 1 ) / ( YLastRow - YFirstRow ); - layergoem.invHalfSectorXSize = 2 * ( ncols - 1 ) / ( smallestXLastCol - smallestXFirstcol ); - layergoem.dxDy = ( biggestXFirstCol - smallestXFirstcol ) / ( YLastRow - YFirstRow ); - - return layergoem; - } - bool isValid() const override { return true; /*ValidDataObject::isValid();*/ } - // bool isValid( const Gaudi::Time& t ) const override { return ValidDataObject::isValid( t ); } //what is - // Gaudi::Time in dd4hep -#endif + bool layerSizeOK() const { throw NotImplemented(); } }; using DeUT = DeUTElement; diff --git a/Detector/UT/include/Detector/UT/DeUTLayer.h b/Detector/UT/include/Detector/UT/DeUTLayer.h index 9738f49908..b5d6a475da 100644 --- a/Detector/UT/include/Detector/UT/DeUTLayer.h +++ b/Detector/UT/include/Detector/UT/DeUTLayer.h @@ -34,6 +34,7 @@ namespace LHCb::Detector::UT { void applyToAllChildren( const std::function& func ) const override { for ( auto& stave : m_staves ) { func( &stave ); }; } + ROOT::Math::XYZPoint globalCentre() const { throw "Not implemednted"; } }; } // End namespace detail @@ -55,6 +56,8 @@ namespace LHCb::Detector::UT { /// detector element id - for experts only ! ChannelID elementID() const { throw "Not implemednted"; } + ROOT::Math::XYZPoint globalCentre() const { throw "Not implemednted"; } + DeUTSector sector( unsigned int ) const { throw "Not implemednted"; } void applyToAllSectors( const std::function& ) const { throw "Not implemednted"; } diff --git a/Detector/UT/include/Detector/UT/DeUTSensor.h b/Detector/UT/include/Detector/UT/DeUTSensor.h index 9e5bf78083..c72c9c5936 100644 --- a/Detector/UT/include/Detector/UT/DeUTSensor.h +++ b/Detector/UT/include/Detector/UT/DeUTSensor.h @@ -95,7 +95,6 @@ namespace LHCb::Detector::UT { } bool getStripflip() const { return this->access()->m_stripflip; } unsigned int firstStrip() const { return this->access()->m_firstStrip; }; - unsigned int version() const { return this->access()->m_version; }; LineTraj trajectory( unsigned int, double ) const { throw NotImplemented(); /* const double arclen = ( ( xInverted() && getStripflip() ) ? ( nStrip() - offset - strip - ( firstStrip() + 1 ) diff --git a/Detector/UT/src/ChannelID.cpp b/Detector/UT/src/ChannelID.cpp index ad782380eb..1fdd41f5ea 100644 --- a/Detector/UT/src/ChannelID.cpp +++ b/Detector/UT/src/ChannelID.cpp @@ -30,7 +30,7 @@ namespace LHCb::Detector::UT { s << "{ "; if ( obj.isUT() ) s << "UT "; return s << "UTChannelID : " << obj.channelID() << " : type=" << obj.type() << " strip=" << obj.strip() - << " sector=" << obj.sector() << " detRegion=" << obj.detRegion() << " layer=" << obj.layer() - << " station=" << obj.station() << " }"; + << " sector=" << obj.sector() << " module=" << obj.module() << " face=" << obj.face() + << " stave=" << obj.stave() << " layer=" << obj.layer() << " side=" << obj.side() << " }"; } } // namespace LHCb::Detector::UT diff --git a/Detector/UT/src/DeUT.cpp b/Detector/UT/src/DeUT.cpp index 6facc5c5a8..65db874b03 100644 --- a/Detector/UT/src/DeUT.cpp +++ b/Detector/UT/src/DeUT.cpp @@ -16,4 +16,4 @@ LHCb::Detector::UT::detail::DeUTObject::DeUTObject( const dd4hep::DetElement& de, dd4hep::cond::ConditionUpdateContext& ctxt ) - : DeIOVObject( de, ctxt, 9301 ), sides{{{de.child( "Aside" ), ctxt}, {de.child( "Cside" ), ctxt}}} {} + : DeIOVObject( de, ctxt, 9301 ), sides{{{de.child( "Cside" ), ctxt}, {de.child( "Aside" ), ctxt}}} {} -- GitLab From bb32913c695327d93175b633c347039504f5994d Mon Sep 17 00:00:00 2001 From: Giovanni Bassi Date: Wed, 26 Apr 2023 15:23:52 +0200 Subject: [PATCH 2/6] Define applyToAllSectorsAllen function for DD4HEP --- Detector/UT/include/Detector/UT/DeUT.h | 3 +++ Detector/UT/include/Detector/UT/DeUTLayer.h | 15 ++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Detector/UT/include/Detector/UT/DeUT.h b/Detector/UT/include/Detector/UT/DeUT.h index 108633c624..1ee9bd10c1 100644 --- a/Detector/UT/include/Detector/UT/DeUT.h +++ b/Detector/UT/include/Detector/UT/DeUT.h @@ -104,6 +104,9 @@ namespace LHCb::Detector::UT { /// apply given callable to all sectors void applyToAllSectors( const std::function& ) const { throw NotImplemented(); } + + /// apply given callable to all sectors + void applyToAllSectorsAllen( const std::function& ) const { throw NotImplemented(); } /// check no sector returns true for the given callable bool none_of_sectors( const std::function& ) const { throw NotImplemented(); } diff --git a/Detector/UT/include/Detector/UT/DeUTLayer.h b/Detector/UT/include/Detector/UT/DeUTLayer.h index b5d6a475da..779e771555 100644 --- a/Detector/UT/include/Detector/UT/DeUTLayer.h +++ b/Detector/UT/include/Detector/UT/DeUTLayer.h @@ -34,7 +34,7 @@ namespace LHCb::Detector::UT { void applyToAllChildren( const std::function& func ) const override { for ( auto& stave : m_staves ) { func( &stave ); }; } - ROOT::Math::XYZPoint globalCentre() const { throw "Not implemednted"; } + ROOT::Math::XYZPoint globalCentre() const { throw "Not implemented"; } }; } // End namespace detail @@ -54,12 +54,13 @@ namespace LHCb::Detector::UT { ROOT::Math::Plane3D plane() const { return this->access()->m_plane; } /// detector element id - for experts only ! - ChannelID elementID() const { throw "Not implemednted"; } + ChannelID elementID() const { throw "Not implemented"; } - ROOT::Math::XYZPoint globalCentre() const { throw "Not implemednted"; } + ROOT::Math::XYZPoint globalCentre() const { throw "Not implemented"; } - DeUTSector sector( unsigned int ) const { throw "Not implemednted"; } - void applyToAllSectors( const std::function& ) const { throw "Not implemednted"; } + DeUTSector sector( unsigned int ) const { throw "Not implemented"; } + void applyToAllSectors( const std::function& ) const { throw "Not implemented"; } + void applyToAllSectorsAllen( const std::function& ) const { throw "Not implemented"; } auto chanID() { return this->access()->ChanID; } double fractionActive() const { @@ -78,7 +79,7 @@ namespace LHCb::Detector::UT { return iter != staves().end() ? *iter : nullptr; } - bool contains( const ChannelID ) const { throw "Not implemednted"; } + bool contains( const ChannelID ) const { throw "Not implemented"; } /*( chanID().side() == aChannel.side() && chanID().layer() == aChannel.layer() );*/ double sinAngle() const { return this->access()->m_sinAngle; } @@ -88,6 +89,6 @@ namespace LHCb::Detector::UT { using DeUTLayer = DeUTLayerElement; - inline std::ostream& operator<<( std::ostream&, const DeUTLayer& ) { throw "Not implemednted"; } + inline std::ostream& operator<<( std::ostream&, const DeUTLayer& ) { throw "Not implemented"; } } // namespace LHCb::Detector::UT -- GitLab From 9379497f47253b0bc63f7e7f1ad74924d415a40e Mon Sep 17 00:00:00 2001 From: Gitlab CI Date: Wed, 26 Apr 2023 13:24:30 +0000 Subject: [PATCH 3/6] Fixed formatting patch generated by https://gitlab.cern.ch/lhcb/Detector/-/jobs/29143184 --- Detector/UT/include/Detector/UT/DeUT.h | 2 +- Detector/UT/include/Detector/UT/DeUTLayer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Detector/UT/include/Detector/UT/DeUT.h b/Detector/UT/include/Detector/UT/DeUT.h index 1ee9bd10c1..cad4eea2e2 100644 --- a/Detector/UT/include/Detector/UT/DeUT.h +++ b/Detector/UT/include/Detector/UT/DeUT.h @@ -104,7 +104,7 @@ namespace LHCb::Detector::UT { /// apply given callable to all sectors void applyToAllSectors( const std::function& ) const { throw NotImplemented(); } - + /// apply given callable to all sectors void applyToAllSectorsAllen( const std::function& ) const { throw NotImplemented(); } diff --git a/Detector/UT/include/Detector/UT/DeUTLayer.h b/Detector/UT/include/Detector/UT/DeUTLayer.h index 779e771555..11cbe03798 100644 --- a/Detector/UT/include/Detector/UT/DeUTLayer.h +++ b/Detector/UT/include/Detector/UT/DeUTLayer.h @@ -60,7 +60,7 @@ namespace LHCb::Detector::UT { DeUTSector sector( unsigned int ) const { throw "Not implemented"; } void applyToAllSectors( const std::function& ) const { throw "Not implemented"; } - void applyToAllSectorsAllen( const std::function& ) const { throw "Not implemented"; } + void applyToAllSectorsAllen( const std::function& ) const { throw "Not implemented"; } auto chanID() { return this->access()->ChanID; } double fractionActive() const { -- GitLab From b6fa90ae22b75ee0505dd0c1d9317a4d9b7b122d Mon Sep 17 00:00:00 2001 From: Basem Khanji Date: Fri, 28 Apr 2023 15:15:34 +0200 Subject: [PATCH 4/6] Update DeUT.h to resolve the thread: https://gitlab.cern.ch/lhcb/Detector/-/merge_requests/181#note_6388153 default-initialize data members --- Detector/UT/include/Detector/UT/DeUT.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Detector/UT/include/Detector/UT/DeUT.h b/Detector/UT/include/Detector/UT/DeUT.h index cad4eea2e2..90ed4ec1cc 100644 --- a/Detector/UT/include/Detector/UT/DeUT.h +++ b/Detector/UT/include/Detector/UT/DeUT.h @@ -54,12 +54,12 @@ namespace LHCb::Detector::UT { using Modules = std::vector; using Sides = std::vector; struct LayerGeom { - float z; - int nColsPerSide; - int nRowsPerSide; - float invHalfSectorYSize; - float invHalfSectorXSize; - float dxDy; + float z{}; + int nColsPerSide{}; + int nRowsPerSide{}; + float invHalfSectorYSize{}; + float invHalfSectorXSize{}; + float dxDy{}; }; enum class LayerID_t : unsigned int {}; enum struct Side_t : unsigned int {}; -- GitLab From 1ae1b52c21f9fff1b5140ce65912b1e64454af1b Mon Sep 17 00:00:00 2001 From: Basem Khanji Date: Fri, 28 Apr 2023 15:19:42 +0200 Subject: [PATCH 5/6] Update DeUTLayer.h to resolve the thread : https://gitlab.cern.ch/lhcb/Detector/-/merge_requests/181#note_6388160 Can I resolve the thread now ? --- Detector/UT/include/Detector/UT/DeUTLayer.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Detector/UT/include/Detector/UT/DeUTLayer.h b/Detector/UT/include/Detector/UT/DeUTLayer.h index 11cbe03798..2a49131447 100644 --- a/Detector/UT/include/Detector/UT/DeUTLayer.h +++ b/Detector/UT/include/Detector/UT/DeUTLayer.h @@ -27,9 +27,9 @@ namespace LHCb::Detector::UT { std::vector m_staves; ChannelID ChanID; ROOT::Math::Plane3D m_plane; - double m_angle; - double m_sinAngle; - double m_cosAngle; + double m_angle{}; + double m_sinAngle{}; + double m_cosAngle{}; void applyToAllChildren( const std::function& func ) const override { for ( auto& stave : m_staves ) { func( &stave ); }; -- GitLab From 72a1185e7f1b49edcea28228822589f8cca3b564 Mon Sep 17 00:00:00 2001 From: Basem Khanji Date: Tue, 2 May 2023 16:40:30 +0200 Subject: [PATCH 6/6] Update DeUT.h to resolve this thread https://gitlab.cern.ch/lhcb/Detector/-/merge_requests/181#note_6676787 --- Detector/UT/include/Detector/UT/DeUT.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Detector/UT/include/Detector/UT/DeUT.h b/Detector/UT/include/Detector/UT/DeUT.h index 90ed4ec1cc..0dc7a411dd 100644 --- a/Detector/UT/include/Detector/UT/DeUT.h +++ b/Detector/UT/include/Detector/UT/DeUT.h @@ -62,13 +62,13 @@ namespace LHCb::Detector::UT { float dxDy{}; }; enum class LayerID_t : unsigned int {}; - enum struct Side_t : unsigned int {}; - enum struct Layer_t : unsigned int {}; - enum struct Stave_t : unsigned int {}; - enum struct Face_t : unsigned int {}; - enum struct Module_t : unsigned int {}; - enum struct Sector_t : unsigned int {}; - enum struct GeoVersion { ErrorVersion = 0, v0, v1 }; + enum class Side_t : unsigned int {}; + enum class Layer_t : unsigned int {}; + enum class Stave_t : unsigned int {}; + enum class Face_t : unsigned int {}; + enum class Module_t : unsigned int {}; + enum class Sector_t : unsigned int {}; + enum class GeoVersion { ErrorVersion = 0, v0, v1 }; /** Implementation of sensitive volume identifier for a given point in the global reference frame. This is the sensor number defined in the xml. */ -- GitLab