Skip to content
Snippets Groups Projects

Merge master into FTRetinaSeedRawBanks

Merged Francesco Terzuoli requested to merge master into fterzuol/FTRetinaSeedRawBanks
256 files
+ 3446
6518
Compare changes
  • Side-by-side
  • Inline
Files
256
@@ -140,6 +140,8 @@ namespace LHCb::Calo {
Gaudi::Property<bool> m_extraHeader{this, "DetectorSpecificHeader", false};
Gaudi::Property<bool> m_cleanCorrupted{this, "CleanWhenCorruption", false};
Gaudi::Property<bool> m_pinData{this, "DecodePinData", false};
mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_noBanksCounter{this, "No bank found", 1};
mutable Gaudi::Accumulators::Counter<> m_duplicateADCDigits{this, "# duplicate ADC/Digits"};
mutable Gaudi::Accumulators::MsgCounter<MSG::ERROR> m_bankSize_error{this, "Banks with wrong size"};
@@ -224,7 +226,8 @@ namespace LHCb::Calo {
continue;
}
//--- decode the rawbanks
auto dataVecDec = decode_<Decode::Cell>( *bank, status, calo ); // false is to get data, not pinData
auto dataVecDec =
m_pinData ? decode_<Decode::PinData>( *bank, status, calo ) : decode_<Decode::Cell>( *bank, status, calo );
dataVec.insert( dataVec.end(), dataVecDec.begin(), dataVecDec.end() );
if ( dataVecDec.empty() && msgLevel( MSG::DEBUG ) )
@@ -238,12 +241,12 @@ namespace LHCb::Calo {
if ( msgLevel( MSG::DEBUG ) ) debug() << "Processing " << dataVec.size() << " Digits." << endmsg;
enum class Flag : uint8_t { Default, Neighbour, Seed };
std::vector<Flag> caloFlags( calo.numberOfCells(), Flag::Default );
std::vector<Flag> caloFlags( calo.numberOfCells() + calo.numberOfPins(), Flag::Default );
// Get zero suppression values from DB
double zSupThreshold = 0;
double zSupNeighbourThreshold = 0;
double zSupMethod = 0;
int zSupMethod = 0;
if ( m_useParamsFromDB ) {
zSupThreshold = calo.zSupThreshold();
@@ -270,8 +273,9 @@ namespace LHCb::Calo {
for ( const auto& anAdc : dataVec ) {
int digAdc = anAdc.adc;
if ( digAdc < zSupThreshold ) continue;
Detector::Calo::CellID id = anAdc.id;
int index = calo.cellIndex( id );
Detector::Calo::CellID id = anAdc.id;
if ( !( id.area() < 3 ) ) continue;
int index = calo.cellIndex( id );
if ( index < 0 ) // it practically canot happen, but it's technically possible and gcc 12 complains
throw GaudiException( fmt::format( "invalid cell id {}", Gaudi::Utils::toString( id ) ), name(),
StatusCode::FAILURE );
@@ -301,8 +305,8 @@ namespace LHCb::Calo {
for ( const auto& anAdc : dataVec ) {
Detector::Calo::CellID id = anAdc.id;
int index = calo.cellIndex( id );
if ( Flag::Default == caloFlags[index] ) continue;
if ( Flag::Neighbour == caloFlags[index] && anAdc.adc < zSupNeighbourThreshold ) continue;
if ( Flag::Default == caloFlags[index] && id.area() < 3 ) continue;
if ( Flag::Neighbour == caloFlags[index] && id.area() < 3 && anAdc.adc < zSupNeighbourThreshold ) continue;
double energy = m_useCalibration
? ( double( anAdc.adc ) - pedShift ) * calo.cellGain( id ) * calo.getCalibration( id )
@@ -333,7 +337,7 @@ namespace LHCb::Calo {
bool isLittleEndian ) const {
std::vector<Adc> dataVec;
dataVec.reserve( decode == Decode::PinData ? calo.numberOfPins() : calo.numberOfCells() );
dataVec.reserve( decode == Decode::PinData ? calo.numberOfCells() + calo.numberOfPins() : calo.numberOfCells() );
// Get the FE-Cards associated to that bank (via condDB)
std::map<int, std::vector<int>> map = calo.getSourceIDsMap();
@@ -446,9 +450,13 @@ namespace LHCb::Calo {
<< " | ADC value = " << adc << endmsg;
//== Keep only valid cells
if ( 0 != id.index() && !isFiberOff ) {
if ( 0 != id.index() && !isFiberOff && calo.valid( id ) ) {
Adc temp( id, adc );
if ( id.isPin() == ( decode == Decode::PinData ) ) dataVec.push_back( temp );
if ( decode == Decode::Cell ) {
if ( !id.isPin() ) { dataVec.push_back( temp ); }
} else {
dataVec.push_back( temp );
}
}
}
}
Loading