Skip to content

Add MCPrimaries and more MC functors

Jiahui Zhuo requested to merge jzhuo_MCPrimaries into master

Following the discussion in Rec#409 (closed)

This MR creates the necessary tools to replace the MCTupleToolPrimaries in Funtuple, and also adds some useful MC functors.

What is done?

  • Read all MC PVs from MC_Header FYI: @amathad
  • Refactor MC functors like: MOTHER and ORIGINVERTEX
  • New MC functors are included like MC_LIFETIME, MC_VTX_TYPE..
  • New functional functor TARGET to get the pointer from LHCb::SmartRef (Needed to get objects from MC_Header)

FAQs:

How does get_mc_header() work?

as @ldufour discussed in Rec#409 (comment 6241665), the get_mc_header() will require first the MCVertices are unpacked, since the MCVertices are unpacked automatically using get_mc_particles(), the dependency here is to require mc_particles as inputs to chain the dependency automatically.

Why do we refactor F.MOTHER and F.ORIGINVERTEX?

before ORIGIN_VX, ORIGIN_VY, and ORIGIN_VZ are three different functors which don't make sense, not it's defined as a composition of more basic functors like:

ORIGIN_VX = X_COORDINATE @ POSITION @ MC_ORIGINVERTEX
ORIGIN_VY = Y_COORDINATE @ POSITION @ MC_ORIGINVERTEX
ORIGIN_VZ = Z_COORDINATE @ POSITION @ MC_ORIGINVERTEX

which is more elegant and cleaner in the code.

Why do we need F.TARGET?

The LHCb::SmartRef will only fetch the object when the object is called, the Sel::Utils::deref_if_ptr can't handle this smart pointer correctly, so the F.TARGET is called to convert this LHCb::SmartRef to the classic pointer.

This should be tested with Analysis!946 (merged) Rec!3279 (merged) LHCb!3935 (merged)

FYI: @pkoppenb @erodrigu @amathad @ldufour

Edited by Jiahui Zhuo

Merge request reports