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/trackFindingCDC/eventdata/segments/CDCWireHitCluster.h>
11#include <tracking/trackFindingCDC/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;
17
19{
22}
23
25{
28}
29
31{
32 if (not ptrCluster) return false;
33 const CDCWireHitCluster& cluster = *ptrCluster;
34
35 int nBackgroundHits = 0;
36
37 for (const CDCWireHit* wireHit : cluster) {
38 const CDCHit* hit = wireHit->getHit();
39
40 if (CDCMCHitLookUp::getInstance().isBackground(hit)) {
41 ++nBackgroundHits;
42 }
43 }
44
45 // Variables with Monte Carlo information should carry truth in their name.
46 var<named("n_background_hits_truth")>() = nBackgroundHits;
47 var<named("background_fraction_truth")>() = 1.0 * nBackgroundHits / cluster.size();
48 var<named("weight")>() = cluster.size();
49 var<named("truth")>() = (1.0 * nBackgroundHits / cluster.size() > 0.8) ? 0 : 1;
50 return true;
51}
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 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 singletone instance.
Definition: CDCMCManager.cc:74
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:55
void initialize() override
Receive and dispatch signal before the start of the event processing.
void beginEvent() override
Receive and dispatch signal for the start of a new event.
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.