Skip to content
Snippets Groups Projects
Commit eb50dbce authored by Sebastien Ponce's avatar Sebastien Ponce
Browse files

Merge branch 'decianm-fitPrResidualPrUTHits' into 'master'

Adapt PrResidualPrUTHits for new UT numbering scheme

See merge request !3413
parents 0156e385 0413df3b
No related branches found
No related tags found
1 merge request!3413Adapt PrResidualPrUTHits for new UT numbering scheme
Pipeline #5610404 passed
......@@ -38,7 +38,6 @@ gaudi_add_module(PrAlgorithms
src/PrResidualPrUTHits.cpp
src/PrResidualSciFiHits.cpp
src/PrResidualSeeding.cpp
src/PrResidualUTHits.cpp
src/PrResidualVeloTracks.cpp
src/PrStoreFTHit.cpp
src/PrStoreSciFiHits.cpp
......
......@@ -77,8 +77,9 @@ LHCb::Pr::UT::Hits PrResidualPrUTHits<T>::operator()( const EventContext& evtCtx
}
const int fullChanIdx =
static_cast<int>( UTInfo::DetectorNumbers::Layers ) * static_cast<int>( UTInfo::DetectorNumbers::Stations ) *
static_cast<int>( UTInfo::DetectorNumbers::Regions ) * static_cast<int>( UTInfo::DetectorNumbers::Sectors );
static_cast<int>( UTInfo::DetectorNumbers::Sides ) * static_cast<int>( UTInfo::DetectorNumbers::HalfLayers ) *
static_cast<int>( UTInfo::DetectorNumbers::Staves ) * static_cast<int>( UTInfo::DetectorNumbers::Faces ) *
static_cast<int>( UTInfo::DetectorNumbers::Modules ) * static_cast<int>( UTInfo::DetectorNumbers::SubSectors );
for ( auto fullchan = 0; fullchan < fullChanIdx; fullchan++ ) {
const auto indexs = uthithandler.indices( fullchan );
......
/*****************************************************************************\
* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
// Include files
#include "DetDesc/IConditionDerivationMgr.h"
#include "Event/ODIN.h"
#include "Event/PrLongTracks.h"
#include "Gaudi/Accumulators.h"
#include "GaudiKernel/IRegistry.h"
#include "LHCbAlgs/Transformer.h"
#include "PrKernel/PrHit.h"
#include "PrKernel/UTHit.h"
#include "PrKernel/UTHitHandler.h"
#include "UTDAQ/UTInfo.h"
#include "UTDet/DeUTDetector.h"
#include <Vc/Vc>
#include <vector>
#include "boost/container/small_vector.hpp"
#include "boost/container/static_vector.hpp"
#include <memory>
namespace LHCb::Pr {
//-----------------------------------------------------------------------------
// class : PrResidualUTHits
// Store residual UTHits after other Algorithms, e.g. PrMatchNN/PrForward used
//
// 2020-04-21 : Peilian Li
//
//-----------------------------------------------------------------------------
class PrResidualUTHits
: public Algorithm::Transformer<UT::HitHandler( Long::Tracks const&, UT::HitHandler const&, DeUTDetector const& ),
DetDesc::usesConditions<DeUTDetector>> {
public:
PrResidualUTHits( const std::string& name, ISvcLocator* pSvcLocator );
UT::HitHandler operator()( Long::Tracks const&, UT::HitHandler const&, DeUTDetector const& ) const override;
};
// Declaration of the Algorithm Factory
DECLARE_COMPONENT_WITH_ID( LHCb::Pr::PrResidualUTHits, "PrResidualUTHits" )
} // namespace LHCb::Pr
LHCb::Pr::PrResidualUTHits::PrResidualUTHits( const std::string& name, ISvcLocator* pSvcLocator )
: Transformer( name, pSvcLocator,
{{"TracksLocation", ""}, {"UTHitsLocation", ""}, {"DeUTLocation", DeUTDetLocation::location()}},
{"UTHitsOutput", ""} ) {}
UT::HitHandler LHCb::Pr::PrResidualUTHits::operator()( Long::Tracks const& tracks, UT::HitHandler const& uthithandler,
DeUTDetector const& utDet ) const {
UT::HitHandler tmp{};
if ( tracks.size() == 0 ) {
if ( msgLevel( MSG::DEBUG ) )
debug() << "Track container '" << inputLocation<Long::Tracks>() << "' is empty" << endmsg;
return uthithandler;
}
std::vector<long unsigned int> usedUTHits{};
usedUTHits.reserve( uthithandler.nbHits() );
for ( const auto& track : tracks.scalar() ) {
const auto ids = track.lhcbIDs();
for ( auto id : ids ) {
if ( !( id.isUT() ) ) continue;
usedUTHits.emplace_back( id.utID().channelID() );
}
}
for ( int iSide = 0; iSide < static_cast<int>( UTInfo::DetectorNumbers::Sides ); ++iSide ) {
for ( int iLayer = 0; iLayer < static_cast<int>( UTInfo::DetectorNumbers::HalfLayers ); ++iLayer ) {
for ( int iStave = 0; iStave < static_cast<int>( UTInfo::DetectorNumbers::Staves ); ++iStave ) {
for ( int iFace = 0; iFace < static_cast<int>( UTInfo::DetectorNumbers::Faces ); ++iFace ) {
for ( int iModule = 0; iModule < static_cast<int>( UTInfo::DetectorNumbers::Modules ); ++iModule ) {
for ( int iSector = 1; iSector <= static_cast<int>( UTInfo::DetectorNumbers::SubSectors ); ++iSector ) {
for ( auto& uthit : uthithandler.hits( iSide, iLayer, iStave, iFace, iModule, iSector ) ) {
bool used = std::any_of( usedUTHits.begin(), usedUTHits.end(),
[utid = uthit.chanID().channelID()]( const auto& id ) { return utid == id; } );
if ( used ) continue;
const unsigned int fullChanIdx =
UT::HitHandler::HitsInUT::idx( iSide, iLayer, iStave, iFace, iModule, iSector );
auto& aSector = utDet.getSector( uthit.chanID() );
tmp.emplace_back( aSector, fullChanIdx, uthit.strip(), uthit.fracStrip(), uthit.chanID(), uthit.size(),
uthit.highThreshold() );
}
}
}
}
}
}
}
return tmp;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment