Skip to content
Snippets Groups Projects
Commit 1c5f3c4c authored by Rosen Matev's avatar Rosen Matev :sunny:
Browse files

Merge branch 'lohenry-fixSmallMisordered' into 'master'

Check for misordered small clusters as well

See merge request !4307
parents 5aa9b013 5a91e351
No related branches found
No related tags found
2 merge requests!4386Merge master into FTRetinaSeedRawBanks,!4307Check for misordered small clusters as well
Pipeline #6328122 passed
......@@ -579,7 +579,9 @@ FTLiteClusters FTRawBankDecoder::decode( const EventContext& evtCtx, LHCb::RawBa
LHCb::Detector::FTChannelID globalSiPMID;
// Define Lambda functions to be used in loop
auto make_cluster = [&globalSiPMID, &clustersInBankPerLinkID, &localLinkIndex]( unsigned chan, int fraction,
short int lastCluster( 0 );
unsigned lastLink( 0 );
auto make_cluster = [&globalSiPMID, &clustersInBankPerLinkID, &localLinkIndex]( unsigned chan, int fraction,
int size ) {
clustersInBankPerLinkID[localLinkIndex].emplace_back( LHCb::Detector::FTChannelID( globalSiPMID + chan ),
fraction, size );
......@@ -625,8 +627,8 @@ FTLiteClusters FTRawBankDecoder::decode( const EventContext& evtCtx, LHCb::RawBa
if ( !clusters.empty() && clusters.back() == 0 )
clusters = clusters.first( clusters.size() - 1 ); // Remove padding at the end
while ( !clusters.empty() ) { // loop over the clusters
unsigned channel = channelInBank( clusters[0] );
localLinkIndex = getLinkInBank( clusters[0] );
unsigned channelInSiPM = cell( clusters[0] );
localLinkIndex = getLinkInBank( clusters[0] );
if ( localLinkIndex >= FTRawBank::BankProperties::NbLinksPerBank ) {
++m_wrongLocalLink;
++m_wrongLocalLink_hist[iRow];
......@@ -640,7 +642,15 @@ FTLiteClusters FTRawBankDecoder::decode( const EventContext& evtCtx, LHCb::RawBa
clusters = clusters.subspan( 1 );
continue;
}
unsigned channelInSiPM = LHCb::Detector::FTChannelID( channel ).channel();
if ( localLinkIndex == lastLink && clusters[0] < lastCluster ) {
++m_misordered;
++m_misordered_hist[iRow * FTRawBank::BankProperties::NbLinksPerBank + localLinkIndex];
// Skip the cluster
clusters = clusters.subspan( 1 );
continue;
}
lastCluster = clusters[0];
lastLink = localLinkIndex;
if ( !cSize( clusters[0] ) ) { // Not flagged as large
make_cluster( channelInSiPM, fraction( clusters[0] ), LHCb::Detector::FT::RawBank::maxClusterWidth );
} else { // Large cluster
......@@ -659,16 +669,6 @@ FTLiteClusters FTRawBankDecoder::decode( const EventContext& evtCtx, LHCb::RawBa
// Contrary to v8, size 4 means that the first fragment of a large cluster always has fraction 0
++m_corrupt2;
++m_corruptCluster2_hist[iRow * FTRawBank::BankProperties::NbLinksPerBank + localLinkIndex];
} else if ( clusters[1] < clusters[0] ) {
// FIXME
// Clusters should come in order. This is behaviour puts into question the whole concept of large
// clusters
//(imagine we got two large clusters and their beginning/end get scrambled)
// For the time being, we will assume this is a simple local swap and keep the clusters
++m_misordered;
++m_misordered_hist[iRow * FTRawBank::BankProperties::NbLinksPerBank + localLinkIndex];
// make_clusters( channelInSiPM, clusters[1], clusters[0] );
clusters = clusters.subspan( 1 );
} else {
make_clusters( channelInSiPM, clusters[0], clusters[1] );
clusters = clusters.subspan( 1 );
......@@ -680,6 +680,7 @@ FTLiteClusters FTRawBankDecoder::decode( const EventContext& evtCtx, LHCb::RawBa
// last cluster in bank or in sipm
if ( clusters.size() == 1 || getLinkInBank( clusters[0] ) != getLinkInBank( clusters[1] ) ) {
make_cluster( channelInSiPM, fraction( clusters[0] ), 0 );
lastLink = localLinkIndex;
}
// flagged as first cluster of a large one
else if ( fraction( clusters[0] ) ) {
......@@ -689,19 +690,10 @@ FTLiteClusters FTRawBankDecoder::decode( const EventContext& evtCtx, LHCb::RawBa
++m_corrupt1;
++m_corruptCluster1_hist[iRow * FTRawBank::BankProperties::NbLinksPerBank + localLinkIndex];
clusters = clusters.subspan( 1 );
} else if ( clusters[1] < clusters[0] ) {
// FIXME
// Clusters should come in order. This is behaviour puts into question the whole concept of large
// clusters
//(imagine we got two large clusters and their beginning/end get scrambled)
// For the time being, we will assume this is a simple local swap and keep the clusters
++m_misordered;
++m_misordered_hist[iRow * FTRawBank::BankProperties::NbLinksPerBank + localLinkIndex];
// make_clusters( channelInSiPM, clusters[1], clusters[0] );
clusters = clusters.subspan( 1 );
} else { // this should always be true
make_clusters( channelInSiPM, clusters[0], clusters[1] );
clusters = clusters.subspan( 1 );
lastLink = localLinkIndex;
}
}
}
......
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