Skip to content
Snippets Groups Projects

Fixed MCHit->Pixel associator issue in VPClusterEffSimDQ

Merged David Hutchcroft requested to merge dhcroft-VPSimDQFix into master
@@ -38,7 +38,6 @@ namespace {
// it->second;
}
}
} // namespace
namespace LHCb {
@@ -171,16 +170,18 @@ void LHCb::VPClusterEffSimDQ::operator()( const std::vector<LHCb::VPFullCluster>
debug() << "Found " << mcHits.size() << " mcHits" << endmsg;
}
using namespace LHCb::Detector; // access VPChannelID without full qualifiers
// Table linking a LHCb::Detector::VPChannelID* to std::vector<LHCb::MCHit>
std::map<const unsigned int, std::vector<LHCb::MCHit const*>> MCHitForchannelId;
links.applyToAllLinks( [&MCHitForchannelId, &mcHits]( unsigned int channelId, unsigned int mcHitKey, float ) {
MCHitForchannelId[channelId].emplace_back( mcHits[mcHitKey] );
MCHitForchannelId[VPChannelID::pixelID( channelId )].emplace_back( mcHits[mcHitKey] );
} );
// Table linking a LHCb::MCHit const* to std::vector<LHCb::Detector::VPChannelID>> --orig
std::map<LHCb::MCHit const*, std::vector<unsigned int>> channelIdForMCHit;
links.applyToAllLinks( [&channelIdForMCHit, &mcHits]( unsigned int channelId, unsigned int mcHitKey, float ) {
channelIdForMCHit[mcHits[mcHitKey]].emplace_back( channelId );
channelIdForMCHit[mcHits[mcHitKey]].emplace_back( VPChannelID::pixelID( channelId ) );
} );
++m_numCalls; // update counter for number of calls
for ( const auto& mcH : mcHits ) {
@@ -203,9 +204,9 @@ void LHCb::VPClusterEffSimDQ::operator()( const std::vector<LHCb::VPFullCluster>
m_eff3DMCHit[{mcH->sensDetID(), mcH->midPoint().x(), mcH->midPoint().y()}] += efficiency;
// make local efficiency maps in the sensors (to compare to 16x16 efficiency tiles)
const DeVPSensor& sensor = det.sensor( LHCb::Detector::VPChannelID::SensorID( mcH->sensDetID() ) );
LHCb::Detector::VPChannelID chan;
auto inSens = sensor.pointToChannel( mcH->midPoint(), false, chan );
const DeVPSensor& sensor = det.sensor( VPChannelID::SensorID( mcH->sensDetID() ) );
VPChannelID chan;
auto inSens = sensor.pointToChannel( mcH->midPoint(), false, chan );
if ( inSens ) { // if not in sensitive area cam ignore this MChit
m_mapSensEffRC.at( mcH->sensDetID() )[{chan.scol(), static_cast<double>( chan.row() )}] += efficiency;
}
@@ -218,8 +219,8 @@ void LHCb::VPClusterEffSimDQ::operator()( const std::vector<LHCb::VPFullCluster>
std::set<unsigned int> mcKeysClus;
for ( auto& channelID : clus.pixels() ) {
unsigned int numMC = 0;
if ( MCHitForchannelId.find( channelID.channelID() ) != MCHitForchannelId.end() ) {
numMC = ( MCHitForchannelId.find( channelID.channelID() )->second.size() );
if ( MCHitForchannelId.find( VPChannelID::pixelID( channelID.channelID() ) ) != MCHitForchannelId.end() ) {
numMC = ( MCHitForchannelId.find( VPChannelID::pixelID( channelID.channelID() ) )->second.size() );
}
++m_hitPerPix[(double)numMC];
@@ -246,8 +247,8 @@ void LHCb::VPClusterEffSimDQ::operator()( const std::vector<LHCb::VPFullCluster>
for ( auto& clus : clusters ) {
std::set<LHCb::MCHit const*> associated_hits;
for ( auto& channelID : clus.pixels() ) {
if ( MCHitForchannelId.find( channelID.channelID() ) != MCHitForchannelId.end() ) {
for ( auto& mcHit : ( MCHitForchannelId.find( channelID.channelID() ) )->second ) {
if ( MCHitForchannelId.find( VPChannelID::pixelID( channelID.channelID() ) ) != MCHitForchannelId.end() ) {
for ( auto& mcHit : ( MCHitForchannelId.find( VPChannelID::pixelID( channelID.channelID() ) ) )->second ) {
if ( channelIdForMCHit.find( mcHit ) != channelIdForMCHit.end() ) { associated_hits.insert( mcHit ); }
}
}
@@ -276,8 +277,8 @@ void LHCb::VPClusterEffSimDQ::operator()( const std::vector<LHCb::VPFullCluster>
std::set<LHCb::MCHit const*> associated_hits;
std::vector<unsigned int> ids_clu;
for ( auto& channelID : clus.pixels() ) {
ids_clu.push_back( channelID.channelID() );
auto i = MCHitForchannelId.find( channelID.channelID() );
ids_clu.push_back( VPChannelID::pixelID( channelID.channelID() ) );
auto i = MCHitForchannelId.find( VPChannelID::pixelID( channelID.channelID() ) );
if ( i != MCHitForchannelId.end() ) associated_hits.insert( i->second.begin(), i->second.end() );
}
for ( auto& mcHit : associated_hits ) {
Loading