Belle II Software development
BkgTruthClusterVarSet.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/trackFindingCDC/filters/cluster/BkgTruthClusterVarSet.h>
9
10#include <tracking/trackingUtilities/eventdata/segments/CDCWireHitCluster.h>
11#include <tracking/trackingUtilities/eventdata/hits/CDCWireHit.h>
12#include <tracking/trackFindingCDC/mclookup/CDCMCManager.h>
13#include <tracking/trackFindingCDC/mclookup/CDCMCHitLookUp.h>
14
15using namespace Belle2;
16using namespace TrackFindingCDC;
17using namespace TrackingUtilities;
18
24
30
32{
33 if (not ptrCluster) return false;
34 const CDCWireHitCluster& cluster = *ptrCluster;
35
36 int nBackgroundHits = 0;
37
38 for (const CDCWireHit* wireHit : cluster) {
39 const CDCHit* hit = wireHit->getHit();
40
41 if (CDCMCHitLookUp::getInstance().isBackground(hit)) {
42 ++nBackgroundHits;
43 }
44 }
45
46 // Variables with Monte Carlo information should carry truth in their name.
47 var<named("n_background_hits_truth")>() = nBackgroundHits;
48 var<named("background_fraction_truth")>() = 1.0 * nBackgroundHits / cluster.size();
49 var<named("weight")>() = cluster.size();
50 var<named("truth")>() = (1.0 * nBackgroundHits / cluster.size() > 0.8) ? 0 : 1;
51 return true;
52}
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition CDCHit.h:40
void initialize() override
Signal the initialisation of the event processing - requires the Monte Carlo information.
void beginEvent() override
Signal the beginning of a new event - loads the Monte Carlo information.
bool extract(const TrackingUtilities::CDCWireHitCluster *ptrCluster) final
Generate and assign the contained variables.
static const CDCMCHitLookUp & getInstance()
Getter for the singletone instance.
void requireTruthInformation()
Require the MC information store arrays.
void fill()
Fill Monte Carlo look up maps from the DataStore.
static CDCMCManager & getInstance()
Getter for the singleton instance.
Class representing a hit wire in the central drift chamber.
Definition CDCWireHit.h:58
static constexpr int named(const char *name)
Definition VarSet.h:78
Abstract base class for different kinds of events.