Velo format
asdfghjkl;
Merge request reports
Activity
67 67 // Standard constructor, initializes variables 68 68 //============================================================================= 69 69 PrPixelTracking::PrPixelTracking( const std::string& name, ISvcLocator* pSvcLocator ) 70 : Transformer( name, pSvcLocator, 71 {KeyValue{"ClusterLocation", LHCb::VPClusterLocation::Light}, 72 KeyValue{"ClusterOffsets", LHCb::VPClusterLocation::Offsets}}, 73 KeyValue{"OutputTracksName", LHCb::Event::v2::TrackLocation::Velo} ) { 70 : MultiTransformer( name, pSvcLocator, 71 {KeyValue{"ClusterLocation", LHCb::VPClusterLocation::Light}, 72 KeyValue{"ClusterOffsets", LHCb::VPClusterLocation::Offsets}}, 73 {KeyValue{"BackwardStates", LHCb::Hlt1Event::VeloTESLocation::BackwardVertexingStates}, 74 KeyValue{"BackwardSel", LHCb::Hlt1Event::VeloTESLocation::BackwardVertexingStateSel}, 75 KeyValue{"ForwardHits", LHCb::Hlt1Event::VeloTESLocation::ForwardHits}, 104 109 //============================================================================= 105 110 // Main execution 106 111 //============================================================================= 107 std::vector<PrPixelTracking::Track> PrPixelTracking:: 108 operator()( const EventContext& ctx, const std::vector<LHCb::VPLightCluster>& clusters, 112 PrPixelTrackingOutput PrPixelTracking:: 113 operator()( const EventContext& ctx, const std::vector<LHCb::VPLightCluster>& clusters, 109 114 const std::array<unsigned, VeloInfo::Numbers::NOffsets>& offsets ) const { 115 Zipping::ZipContainer<SOA::Container<std::vector, LHCb::Hlt1Event::v1::AtVertexState>> outputVertexStatesBackward; 116 auto zipid = outputVertexStatesBackward.zipIdentifier(); 607 PrPixelTrackingInternalOutputStruct& outputTracks ) const { 608 // Decide if this is a forward or backward track. 609 // Calculate z where the track passes closest to the beam. 610 const float zBeam = track.zBeam(); 611 // Define backward as z closest to beam downstream of hits. 612 const bool backward = zBeam > track.hitsZ().front(); 613 614 if ( !backward ) { 596 615 // In Forward approach ids already reversed-sorted if lhcbID is increasing for increasing moduleID (direct order for 597 616 // backward tracks) 598 std::vector<LHCb::LHCbID> ids; 599 std::vector<LHCb::TrackHit> trackHits; 600 ids.reserve( hitbuffer.size() ); 601 trackHits.reserve( hitbuffer.size() ); 617 outputTracks.fwdHits->emplace_back(); 618 auto hits = outputTracks.fwdHits->back(); 600 ids.reserve( hitbuffer.size() ); 601 trackHits.reserve( hitbuffer.size() ); 617 outputTracks.fwdHits->emplace_back(); 618 auto hits = outputTracks.fwdHits->back(); 619 hits.reserve( hitbuffer.size() ); 620 // ids trackHits 602 621 603 622 if ( configuration == SearchDirection::Forward ) { 604 623 // tracks are created by large z to small z, lhcbID ordered with increasing z, reverse iteration on hit buffer. 605 624 for ( unsigned i = hitbuffer.size(); i-- != 0; ) { 606 ids.push_back( clusters[hitbuffer[i]].channelID() ); 607 trackHits.emplace_back( MakeFitterHit( vpInfo, clusters[hitbuffer[i]] ) ); 625 hits.push_back( clusters[hitbuffer[i]].channelID(), MakeFitterHit( vpInfo, clusters[hitbuffer[i]] ) ); 608 626 } 609 627 } 610 628 if ( configuration == SearchDirection::Backward ) { 611 629 // tracks are created by small to larger z, lhcbID ordered with decreasing z 612 630 for ( size_t hit : hitbuffer ) { 613 ids.push_back( clusters[hit].channelID() ); 614 trackHits.emplace_back( MakeFitterHit( vpInfo, clusters[hit] ) ); 631 hits.push_back( clusters[hit].channelID(), MakeFitterHit( vpInfo, clusters[hit] ) ); 615 632 } 616 633 } 617 634 if ( configuration == SearchDirection::Default ) { 618 635 for ( size_t hit : hitbuffer ) { 619 ids.push_back( clusters[hit].channelID() ); 620 trackHits.emplace_back( MakeFitterHit( vpInfo, clusters[hit] ) ); 636 hits.push_back( clusters[hit].channelID(), MakeFitterHit( vpInfo, clusters[hit] ) ); 621 637 } 622 std::sort( ids.begin(), ids.end() ); 623 std::sort( trackHits.begin(), trackHits.end(), 638 std::sort( hits.veloHitBlock().m_VeloLHCbIDContainer.begin(), hits.veloHitBlock().m_VeloLHCbIDContainer.end() ); My fault for using bad names in my examples. I think my point still stands: with
SearchDirection::Default
then for one individual track you havesmall_vector<TrackHit, ...> hits_for_this_one_track
andsmall_vector<LHCbID, ...> ids_for_this_one_track
buthits_for_this_one_track[i]
does not correspond to the same "hit" asids_for_this_one_track[i]
for any giveni
.Edited by Olli Lupton
120 PrPixelTrackingInternalOutputStruct buffer{&outputVertexStatesBackward, &outputHits, &outputVertexStates, 121 &outputTrackingStates}; 110 122 111 123 const auto& vpInfo = m_vpInfo.get( getConditionContext( ctx ) ); 112 124 113 125 //---- Get for each cluster the phi value, clusters have been already sorted in VPClus algorithm 114 126 const std::vector<float> phi_hits = getPhi( clusters, offsets ); 115 auto outputTracks = searchByPair( vpInfo, clusters, offsets, phi_hits ); 116 m_tracksCounter += outputTracks.size(); 127 searchByPair( vpInfo, clusters, offsets, phi_hits, buffer ); 128 m_tracksCounter += ( outputVertexStatesBackward.size() + outputVertexStates.size() ); 117 129 m_clustersCounter += clusters.size(); 118 return outputTracks; 130 131 Zipping::ExportedSelection<> backwardSel( outputVertexStatesBackward, Zipping::details::alwaysTrue{} ); 132 Zipping::ExportedSelection<> trivialSel( outputHits, Zipping::details::alwaysTrue{} ); good idea. maybe we can go that far and just zip the outputs and create the exported selection based on the zip. (SOAContainer checks lengths on zipping, and we get the zipIdentifier check).
though SOAContainer checks the lengths in all builds while the assert would disappear in optimised builds.
unfortunately not. I was thinking
... operator() ... { ... auto forward = semantic_zip<...>(forwardstates, forwardtrackingstates, forwardhits); Zipping::ExportedSelection<> forward_selection{forward, Zipping::details::alwaysTrue{} ); return std::tuple<backwardstates, backwardstates_selection, forwardstates, forwardtrackingstates, forwardhits, forward_selection>; }
one can't write non-owning SOA::Views to TES (which the zips are) without also writing the owning SOA::Containers to TES (and if so, one has to write first the owning container, then create the view, and then write the view).
One alternative that's stuck in my head is to create a big SOA::Container with all columns to only one TES location and rely on no-overhead when reading. (except that breaks the "move exchange format to Rec" idea a bit).
OK, and in that example then the
forward_selection
constructor does some length-checking, butforward_selection
doesn't have any memory offorward
or the underlying containers themselves, so it doesn't matter that they get moved onto the TES? The only net change is that we get length-checking "for free"?Can we have an algorithm (we can call it
ProtoParticleMaker
) that takes a bunch of owning SOA::Containers (think "everything that we put in av1::Track
") and returns a non-owning SOA::View (+ a selection) containing all that? I'm not sure if that's what you mean? (it makes sense if SOA::Container was meant to be SOA::View in your last paragraph, as-written it sounds like you're suggesting a lot of data-copying so I am confused)
- Pr/PrKernel/PrKernel/PixelToVeloUTExchange.h 0 → 100644
51 52 operator LHCb::State const&() const { return this->endOfVeloState(); } 53 operator LHCb::State&() { return this->endOfVeloState(); } 54 }; 55 56 SOASKIN( VeloUTInput, EndOfVeloStateField, VeloHitBlockField ) { 57 SOASKIN_INHERIT_DEFAULT_METHODS( VeloUTInput ); 58 59 operator LHCb::State const&() const { return this->endOfVeloState(); } 60 std::size_t nLHCbIDs() const { return this->veloHitBlock().size(); } 61 // operator LHCb::State&() { return this->endOfVeloState(); } 62 63 /** 64 * @brief Number of Velo hits on the track 65 */ 66 auto size() const { return this->veloHitBlock().m_VeloHitContainer.size(); } 65 69 inline std::ostream& operator<<( std::ostream& os, const ConfAlgo& s ) { return toStream( s, os ); } 66 70 } // namespace VPConf 67 71 72 using PrPixelTrackingOutput = 73 std::tuple<Zipping::ZipContainer<SOA::Container<std::vector, LHCb::Hlt1Event::v1::AtVertexState>>, 74 Zipping::ExportedSelection<>,