Add new algorithm DecodedDataAddMCInfo
4 unresolved threads
4 unresolved threads
Merge request reports
Activity
added RTA label
mentioned in merge request Rec!3616 (merged)
- [2023-10-09 18:10] Validation started with lhcb-master-mr#9411
mentioned in commit 480ed67e
90 // PDs per module 91 for ( auto& pd : mD ) { 92 // IDs per PD 93 for ( auto& id : pd.smartIDs() ) { 94 // Do we have any MChits for this ID 95 const auto& pix_mchits = hitsPerPix[id]; 96 if ( !pix_mchits.empty() ) { 97 // Find best MCHit to use. Either first labelled as single, otherwise 98 // just the first in the container 99 const auto* mch = pix_mchits.front(); 100 for ( const auto* h : pix_mchits ) { 101 if ( h->isSignal() ) { 102 mch = h; 103 break; 104 } 105 } - Comment on lines +99 to +105
No need for an explicit loop with an
if
statement and abreak
-- just write the code like the comment describes instead (at which point the comment becomes superfluous):99 const auto* mch = pix_mchits.front(); 100 for ( const auto* h : pix_mchits ) { 101 if ( h->isSignal() ) { 102 mch = h; 103 break; 104 } 105 } 99 auto i = std::find_if( pix_mchits.begin(), pix_mchits.end(), 100 [](const auto* h) { return h && h->isSignal(); } ); 101 const auto* mch = ( i != pix_mchits.end() ? *i : pix_mchits.front() );
93 for ( auto& id : pd.smartIDs() ) { 94 // Do we have any MChits for this ID 95 const auto& pix_mchits = hitsPerPix[id]; 96 if ( !pix_mchits.empty() ) { 97 // Find best MCHit to use. Either first labelled as single, otherwise 98 // just the first in the container 99 const auto* mch = pix_mchits.front(); 100 for ( const auto* h : pix_mchits ) { 101 if ( h->isSignal() ) { 102 mch = h; 103 break; 104 } 105 } 106 if ( m_useMCTime ) { 107 // Set time in ID 108 id.setTime( mch->timeOfFlight() ); 27 #include <tuple> 28 29 namespace Rich::Future::MC { 30 31 using namespace Rich::Future::DAQ; 32 33 /** @class DecodedDataFromMCRichHits 34 * 35 * Update decoded data with MC information (e.g. time) 36 * 37 * @author Chris Jones 38 * @date 2016-12-07 39 */ 40 class DecodedDataAddMCInfo final 41 : public LHCb::Algorithm::Transformer<DecodedData( DecodedData const&, LHCb::MCRichHits const& ), 42 Gaudi::Functional::Traits::BaseClass_t<AlgBase<>>> { it does not look like the inheritance of
AlgBase<>
is actually needed here, as there is no use ofobjectLocation
(which should be a free-standing function) orrelaseTool
oracquire
ormessenger()
.
12 // Rich (Future) Kernel 13 #include "RichFutureKernel/RichAlgBase.h" 14 15 // Gaudi Functional 16 #include "LHCbAlgs/Transformer.h" 17 18 // Rich Utils 19 #include "RichFutureUtils/RichDecodedData.h" 20 #include "RichUtils/RichSmartIDSorter.h" 21 22 // Event Model 23 #include "Event/MCRichHit.h" 24 25 #include <map> 26 #include <memory> 27 #include <tuple> - Comment on lines +25 to +27
Please register or sign in to reply