Skip to content

Commit d7e453d

Browse files
committed
unite V0- and Casc-argument functions
1 parent e5dc16d commit d7e453d

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

DPG/Tasks/TPC/tpcSkimsTableCreator.cxx

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -378,42 +378,40 @@ struct TreeWriterTpcV0 {
378378
}
379379
} /// fillSkimmedV0Table
380380

381-
/// Evaluate cosPA of the v0
382-
template <typename CollisionType>
383-
double getCosPA(V0sWithID::iterator const& v0, CollisionType const&)
381+
/// Evaluate cosPA of v0 or casc
382+
template <typename V0Casc, typename CollisionType>
383+
double getCosPA(V0Casc const& v0casc, CollisionType const& collision)
384384
{
385-
return v0.v0cosPA();
385+
static_assert(std::is_same_v<V0Casc, V0sWithID::iterator> || std::is_same_v<V0Casc, CascsWithID::iterator>,
386+
"getCosPA() v0casc's type must be either V0sWithID::iterator or CascsWithID::iterator");
387+
if constexpr (std::is_same_v<V0Casc, V0sWithID::iterator>)
388+
return v0casc.v0cosPA();
389+
else
390+
return v0casc.casccosPA(collision.posX(), collision.posY(), collision.posZ());
386391
}
387392

388-
/// Evaluate cosPA of the cascade
389-
template <typename CollisionType>
390-
double getCosPA(CascsWithID::iterator const& casc, CollisionType const& collision)
393+
/// Evaluate radius of v0 or casc
394+
template <typename V0Casc>
395+
double getRadius(V0Casc const& v0casc)
391396
{
392-
return casc.casccosPA(collision.posX(), collision.posY(), collision.posZ());
397+
static_assert(std::is_same_v<V0Casc, V0sWithID::iterator> || std::is_same_v<V0Casc, CascsWithID::iterator>,
398+
"getRadius() v0casc's type must be either V0sWithID::iterator or CascsWithID::iterator");
399+
if constexpr (std::is_same_v<V0Casc, V0sWithID::iterator>)
400+
return v0casc.v0radius();
401+
else
402+
return v0casc.cascradius();
393403
}
394404

395-
/// Evaluate radius of the v0
396-
double getRadius(V0sWithID::iterator const& v0)
405+
/// Evaluate add id of v0 or casc
406+
template <typename V0Casc>
407+
int getAddId(V0Casc const& v0casc)
397408
{
398-
return v0.v0radius();
399-
}
400-
401-
/// Evaluate radius of the cascade
402-
double getRadius(CascsWithID::iterator const& casc)
403-
{
404-
return casc.cascradius();
405-
}
406-
407-
/// Evaluate add id of the v0
408-
double getAddId(V0sWithID::iterator const& v0)
409-
{
410-
return v0.v0addid();
411-
}
412-
413-
/// Evaluate add id of the cascade
414-
double getAddId(CascsWithID::iterator const& casc)
415-
{
416-
return casc.cascaddid();
409+
static_assert(std::is_same_v<V0Casc, V0sWithID::iterator> || std::is_same_v<V0Casc, CascsWithID::iterator>,
410+
"getAddId() v0casc's type must be either V0sWithID::iterator or CascsWithID::iterator");
411+
if constexpr (std::is_same_v<V0Casc, V0sWithID::iterator>)
412+
return v0casc.v0addid();
413+
else
414+
return v0casc.cascaddid();
417415
}
418416

419417
template <bool IsCorrectedDeDx, int ModeId, typename TrksType, typename BCType, typename TrkQAType>

0 commit comments

Comments
 (0)