Belle II Software development
CDCStateTruthVarSet.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <tracking/ckf/cdc/filters/states/CDCStateTruthVarSet.h>
9
10#include <tracking/ckf/cdc/entities/CDCCKFState.h>
11
12#include <mdst/dataobjects/MCParticle.h>
13
14#include <tracking/dataobjects/RecoTrack.h>
15
16using namespace Belle2;
17
19{
20 const auto& path = pair->first;
21 const auto& state = pair->second;
22
23 // check if hit belongs to same seed
24 const auto& seed = path->front();
25 const auto* seedRecoTrack = seed.getSeed();
26 const auto* seedMCTrack = seedRecoTrack->getRelated<RecoTrack>("MCRecoTracks");
27 const auto* seedMCParticle = seedMCTrack->getRelated<MCParticle>();
28
29 const auto* wireHit = state->getWireHit();
30 const auto* cdcHit = wireHit->getHit();
31 const auto* hitMCTrack = cdcHit->getRelated<RecoTrack>("MCRecoTracks");
32
33 // Bremsstrahlung etc (works for electron gun, check for other events later)
34 while (seedMCParticle->getMother()) {
35 seedMCParticle = seedMCParticle->getMother();
36 }
37
38 // calculate the interesting quantities
39 var<named("match")>() = seedMCTrack == hitMCTrack ? true : false;
40 var<named("PDG")>() = seedMCParticle->getPDG();
41
42 return true;
43}
virtual bool extract(const BaseCDCStateFilter::Object *result) override
Generate and assign the variables from the object.
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.
AObject Object
Type of the object to be analysed.
Definition: Filter.dcl.h:35
static constexpr int named(const char *name)
Getter for the index from the name.
Definition: VarSet.h:78
Float_t & var()
Reference getter for the value of the ith variable. Static version.
Definition: VarSet.h:93
Abstract base class for different kinds of events.