Skip to content

Algorithms which take iguana-created banks as input may use the wrong bank variant, when calling Run(hipo::banklist&) #412

@c-dilks

Description

@c-dilks

Reproducer

// define sequence
iguana::AlgorithmSequence iguana_seq;
iguana_seq.Add("physics::InclusiveKinematics", "kin_rec");    // for reconstructed particles
iguana_seq.Add("physics::Depolarization",      "depol_rec");
iguana_seq.Add("physics::InclusiveKinematics", "kin_gen");    // for generated particles
iguana_seq.Add("physics::Depolarization",      "depol_gen");
// configuration for generated particles
// NOTE: at the moment, `physics::Depolarization` has no configuration
iguana_seq.SetOption("kin_gen", "particle_bank", "MC::Lund");
iguana_seq.SetOption("kin_gen", "lepton_finder", "lund_beam_daughter");
// start
iguana_seq.Start(banks); // `banks` is the initial `hipo::banklist`

Now there are two created banks named physics::InclusiveKinematics in the hipo::banklist banks:

  • the one from kin_rec has variant==0
  • the one from kin_gen has variant==1

However, the variant==0 bank will always be used by both depol_rec and depol_gen. There is currently no way to tell depol_gen to use the variant==1 bank.

Potential Solution

Add a config parameter input_bank_variant to physics::Depolarization; however, variant numbers are not known until after Start is called, whereas algorithms must be configured before Start is called, so the user would need to "guess" it, and that is no good.

Alternatively, could the algorithm provide a method to set the variant number, to be called after Start? Something like:

void Depolarization::ConnectInclusiveKinematicsBank(hipo::banklist& bank, Algorithm const& algo) {
  // update `b_inc_kin`, the banklist index
  auto variant = algo.GetCreatedBankVariant();
  b_inc_kin = tools::GetBankIndex(banks, "physics::InclusiveKinematics", variant);
}

Then the caller could:

iguana_seq.Get("depol_gen")->ConnectInclusiveKinematicsBank(banks, *iguana_seq.Get("kin_gen"));

I'm afraid this is confusing for the user, and difficult to explain. It may also not be friendly to language bindings.

Workaround

do not run depol_gen in the sequence; instead, run it separately using the specialized Run(hipo::bank&, ...) function

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Unsorted

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions