[Rivet] chaining projections together in analysis code

William Hamish Bell w.bell at cern.ch
Thu Jan 16 13:22:22 GMT 2014


Hi,

I would like to chain together two projections that both inherit from FinalState.  Ideally, one would like to produce a projection from the combination of the requirements in the analysis code, e.g.:

    // Projection to find the electrons
    std::vector<std::pair<double, double> > eta_elec;
    eta_elec.push_back(make_pair(-2.5,2.5));
    IdentifiedFinalState el_id(eta_elec, 25.0*GeV);
    el_id.acceptIdPair(PID::ELECTRON);
    FinalState *fs = dynamic_cast<FinalState*>(&el_id);
    assert(fs);
    FromElectroweakDecay elecs(*fs);
    addProjection(elecs, "elecs");

Since the constructor expects a reference to a FinalState instance, there is a dynamic_cast on a pointer to the instance.  The code compiles and runs, but it is safe in terms of the Rivet design?  (I am using Rivet 2.0.0)

Thanks and best regards,

Will


More information about the Rivet mailing list