Skip to content
Snippets Groups Projects

SOA Track Fix

Closed Alexander Leon Gilman requested to merge SOATrack_Fix into master

Fix conflicts between SOA Track MR !2920 (merged). Run concurrent with Rec!2408 (merged) and Phys!925 (closed).

Merge request reports

Pipeline #2517979 passed

Pipeline passed for 2a910e7d on SOATrack_Fix

Approval is optional

Closed by Rosen MatevRosen Matev 4 years ago (Apr 21, 2021 9:58pm UTC)

Merge details

  • The changes were not merged into master.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
130 struct available_states<TrackType::Ttrack> {
131 using type = state_collection<SL::FirstMeasurement, SL::LastMeasurement>;
132 };
133
134 template <>
135 struct available_states<TrackType::Muon> {
136 using type = state_collection<SL::FirstMeasurement, SL::LastMeasurement>;
137 };
138
139 template <>
140 struct available_states<TrackType::Calo> {
141 using type = state_collection<SL::FirstMeasurement, SL::LastMeasurement>;
142 };
143
144 template <>
145 struct available_states<TrackType::TT> {
  • Do we plan to use this also for Run1/2 at some point? Otherwise I would remove all references to Run1/2 detectors / track types. (Same for VeloR).

  • This is to allow v1::Track/v2::Track to PrFittedGenericTrack conversions (the old versions of the tracks define all those state locations). I don't think locations like VeloR are used by old track versions either, but I would keep it as it is for now in order to have full compatibility. As soon as we have done the necessary checks with the ThOr functors and we are sure we don't need to convert among track types any more I agree we can remove them.

  • I don't quite understand. Nothing in Run3 will make VeloR or TT tracks, so I cannot see any scenario why this would be needed. And if unexpectedly it would still turn up somewhere, at least it would crash now :)

  • The idea is to preserve the direct mapping of v1::Track and v2::Track objects to the new track type. We can drop such functionality here and raise exceptions in such specific cases (like trying to create a VeloR track), but I was inclined to do it step-by-step.

  • I have done the appropriate modifications. TT and VeloR are no longer supported.

  • Please register or sign in to reply
  • Gerhard Raven @graven started a thread on commit a37da0e9
  • 126 outTrack.template field<Tag::StateCov_YQoverP>( L ).set( cov[1][4] );
    127 // tX
    128 outTrack.template field<Tag::StateCov_tXtX>( L ).set( cov[2][2] );
    129 outTrack.template field<Tag::StateCov_tXtY>( L ).set( cov[2][3] );
    130 outTrack.template field<Tag::StateCov_tXQoverP>( L ).set( cov[2][4] );
    131 // tY
    132 outTrack.template field<Tag::StateCov_tYtY>( L ).set( cov[3][3] );
    133 outTrack.template field<Tag::StateCov_tYQoverP>( L ).set( cov[3][4] );
    134 // q/p
    135 outTrack.template field<Tag::StateCov_QoverPQoverP>( L ).set( cov[4][4] );
    136
    112 outTrack.template field<Tag::StateCov>( L ).set( cov[0][0], cov[0][1], cov[0][2], cov[0][3], cov[0][4], //X
    113 cov[1][1], cov[1][2], cov[1][3], cov[1][4], // Y
    114 cov[2][2], cov[2][3], cov[2][4], // TX
    115 cov[3][3], cov[3][4], //TY
    116 cov[4][4] ); //QoverP
    • it would be nicer if set would be the sole place where all this indexing has to be done, eg. it would support writing the above as:

          outTrack.template field<Tag::StateCov>( L ).set( cov );

      instead.

      That way, all that indexing only happens in one location... (but/and it forces the order of elements, which depending on your point of view could be good or bad -- but I think it would be good ;-)

    • Please register or sign in to reply
  • Gerhard Raven @graven started a thread on commit 53c265f7
  • 38 38 meta_enum_class( StateLocation, unsigned int, Unknown = 0, ClosestToBeam, FirstMeasurement, LastMeasurement, BegRich1,
    39 39 EndRich1, BegRich2, EndRich2 )
    40 40
    41 constexpr unsigned int
    42 operator+( unsigned int i, StateLocation s ) {
    43 return i + static_cast<unsigned int>( s );
    41 /// Index associated to a StateLocation value
    42 constexpr auto index( StateLocation s ) {
    43 constexpr auto array = members_of<StateLocation>();
    44 for ( auto i = 0u; i < array.size(); ++i )
    45 if ( array[i] == s ) return i;
    46 // we would reach this point if we pass Unknown to the function,
    47 // which never happens
    48 __builtin_unreachable();
    • there is a macro ASSUME defined here which in debug builds will actually check whether the assumption is correct or not -- so:

          ASSUME( false );

      which at least in debug builds will report that an assertion failed, instead of 'undefined behavior'

      Also, nicer would be:

          for ( auto [ idx, i ] : LHCb::range::enumerate( members_of<StateLocation>() ) ) {
            if ( i == s ) return idx;
          }
          ASSUME( false );

      Anyway, a lot faster would be to avoid having to loop at all:

         constexpr auto index( StateLocation s ) {
            ASSUME( s != StateLocation::Unknown );
            return s-1;
         }

      and make sure that ends up as the correct answer 'by construction'...

    • Sounds good. Concerning the loop, it is not quite safe to do a static_cast since enumeration types could correspond to non-consecutive numbers. Although since the definition of StateLocation is right above maybe it can be done.

    • As defined, the numbers are consecutive -- and if you're paranoid, you could explicitly assign them (and make Unknown to be huge, or '-1', or ... so that no subtraction is needed). And I would expect this to be 'very hot' code, so avoiding the loop here should matter.

    • I was hoping that the compiler could optimize it since the array is static constexpr, but I just checked that this is not always the case. Let's keep it simple then.

    • that is a necessary, but as you found out, not sufficient condition -- as it depends on whether the StateLocation argument is (also) a compile-time known constant or not, which depends on the caller...

    • I was actually wondering if the compiler could reduce it to a switch/case-like statement, of course, since the addition operation is not used as constexpr (this is why we accidentally ran into an undefined behaviour before, which suggested these changes), the checks need to be done a runtime.

    • Please register or sign in to reply
  • mentioned in merge request Phys!925 (closed)

  • mentioned in merge request Rec!2408 (merged)

  • closed

  • mentioned in issue Moore#272 (closed)

  • Please register or sign in to reply
    Loading