Example #1
0
std::vector<TruthVariables> TruthLevel::Jets(Event const& event, PreCuts const& pre_cuts, std::function<Particle(Particle&)> const&)const
{
    INFO0;
    auto particle = event.Partons().GenParticles();
    auto tops = CopyIfParticle(particle, Id::top);
    CHECK(tops.size() == 2, tops.size());
    std::vector<TruthVariables> truths;
    for (auto const & top : tops) {
        if (top.Pt() < pre_cuts.PtLowerCut().Get(Id::top) || top.Pt() > pre_cuts.PtUpperCut().Get(Id::top)) continue;
        TruthVariables truth;
        truth.SetTop(top);
        auto bottoms = CopyIfMother(CopyIfParticle(particle, Id::bottom), top);
        CHECK(bottoms.size() == 1, bottoms.size());
        truth.SetBottom(bottoms.front());
        auto Ws = CopyIfMother(CopyIfParticle(particle, Id::W), top);
        CHECK(Ws.size() == 1, Ws.size());
        truth.SetW(Ws.front());
        auto quarks = CopyIfGrandMother(CopyIfQuark(particle), top);
        CHECK(quarks.size() == 2, quarks.size());
        truth.SetQuark1(quarks.at(0));
        truth.SetQuark2(quarks.at(1));
        truths.emplace_back(truth);
    }
    return truths;
}
std::vector<Particle> VetoTopPartnerLeptonic::Particles(boca::Event const& event) const
{
    auto particles = event.GenParticles();
    auto leptons = CopyIfLepton(particles);
    auto candidate = CopyIfGreatGrandMother(leptons, Id::top_partner);
    int id;
    if (candidate.empty()) {
        candidate = CopyIfMother(CopyIfGrandMother(leptons, Id::top_partner), Id::W);
        if (candidate.empty()) return {};
        id = candidate.front().Info().Family().Member(Relative::grand_mother).Id();
    } else id = candidate.front().Info().Family().Member(Relative::great_grand_mother).Id();
    return CopyIfExactParticle(particles, id);
}
std::vector<Particle> NewPartnerLeptonic::Particles(boca::Event const& event) const
{
    auto particles = event.GenParticles();
    auto leptons = CopyIfLepton(particles);
    auto candidate = CopyIfGreatGrandMother(leptons, Id::top_partner);
    if (!candidate.empty()) {
        CHECK(leptons.size() == 1, leptons.size());
        auto grand_grand_mother = candidate.front().Info().Family().Member(Relative::great_grand_mother).Id();
        return CopyIfExactParticle(particles, grand_grand_mother);
    } else { // this is necessary because madspin doesnt label relations correctly
        candidate = CopyIfGrandMother(leptons, Id::top_partner);
        candidate = CopyIfMother(candidate, Id::W);
        if (candidate.empty()) return {};
        auto grand_mother = candidate.front().Info().Family().Member(Relative::grand_mother).Id();
        return CopyIfExactParticle(particles, grand_mother);
    }
}
std::vector<Particle> WLeptonic::Particles(boca::Event const &event) const
{
    INFO0;
    auto particles = event.GenParticles();
    return CopyIfDaughter(CopyIfParticle(particles, Id::W), CopyIfMother(CopyIfLepton(particles), Id::W));
}
int SignatureNeutral::Train(boca::Event const& event, PreCuts const&, Tag tag)
{
    INFO0;
    auto higgs = heavy_higgs_semi_reader_.Tagger().HiggsParticle(event, tag);
    auto sextets = heavy_higgs_semi_reader_.Multiplets(event);
    sextets = BestMatches(sextets, higgs, tag);

    auto doublets = jet_pair_reader_.Multiplets(event);
    auto bottoms = SortedByPt(jet_pair_reader_.Tagger().PairBottomQuarks(event, tag));

    auto particles = event.GenParticles();
    auto tops = CopyIfParticle(particles, Id::top);
    auto tops_even = CopyIfMother(tops, Id::heavy_higgs);
    auto tops_odd = CopyIfMother(tops, Id::CP_odd_higgs);
    auto top_higgs = Combine(tops_even, tops_odd);
    auto one_close_to_top = 0, two_close_to_top = 0;

    if (top_higgs.size() == 2) {

        for (auto const & doublet : doublets) {
            if ((Close<boca::Jet>(top_higgs.at(0))(doublet.Singlet1()) && Close<boca::Jet>(top_higgs.at(1))(doublet.Singlet2())) || (Close<boca::Jet>(top_higgs.at(1))(doublet.Singlet1()) && Close<boca::Jet>(top_higgs.at(0))(doublet.Singlet2()))) two_close_to_top++;
            if ((Close<boca::Jet>(top_higgs.at(0))(doublet.Singlet1()) || Close<boca::Jet>(top_higgs.at(1))(doublet.Singlet2())) || (Close<boca::Jet>(top_higgs.at(1))(doublet.Singlet1()) || Close<boca::Jet>(top_higgs.at(0))(doublet.Singlet2()))) one_close_to_top++;
        }
    }

//     ERROR(one_close_to_top, two_close_to_top);
    static auto close_to_top_ = 0;
    if (one_close_to_top == 6) {
        ++close_to_top_;
    }

    std::vector<Doublet> final_doublets;
    switch (tag) {
    case Tag::signal :
        if (bottoms.size() == 2) {

            for (auto const & doublet : doublets) {
                if ((Close<boca::Jet>(bottoms.at(0))(doublet.Singlet1()) && Close<boca::Jet>(bottoms.at(1))(doublet.Singlet2())) || (Close<boca::Jet>(bottoms.at(1))(doublet.Singlet1()) && Close<boca::Jet>(bottoms.at(0))(doublet.Singlet2()))) final_doublets.emplace_back(doublet);

            }
        } else ERROR(bottoms.size());
        break;
    case Tag::background :
        final_doublets = doublets;
        break;
    }

    static auto zero_doublets = 0;
    if (one_close_to_top < 6 && final_doublets.empty()) {
        ++zero_doublets;
    }

    std::vector<Octet62> octets;
    for (auto const & doublet : final_doublets) {
        for (auto const & sextet : sextets) {
            Octet62 octet(sextet, doublet);
            if (octet.Overlap()) continue;
            octet.SetTag(tag);
            octets.emplace_back(octet);
        }
    }
    static auto zero_octets = 0;
    if (one_close_to_top < 6 && !final_doublets.empty() && octets.empty()) {
        ++zero_octets;
    }
//     ERROR(close_to_top_, zero_doublets, zero_octets);

    if (tag == Tag::signal && octets.size() > 1) {
        INFO(octets.size());
        std::sort(octets.begin(), octets.end());
        octets.erase(octets.begin() + 1, octets.end());
    }

    return SaveEntries(octets);
}