Belle II Software  release-05-02-19
BkgTruthClusterVarSet.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/filters/cluster/BkgTruthClusterVarSet.h>
11 
12 #include <tracking/trackFindingCDC/eventdata/segments/CDCWireHitCluster.h>
13 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
14 #include <tracking/trackFindingCDC/mclookup/CDCMCManager.h>
15 #include <tracking/trackFindingCDC/mclookup/CDCMCHitLookUp.h>
16 
17 using namespace Belle2;
18 using namespace TrackFindingCDC;
19 
21 {
24 }
25 
27 {
30 }
31 
33 {
34  if (not ptrCluster) return false;
35  const CDCWireHitCluster& cluster = *ptrCluster;
36 
37  int nBackgroundHits = 0;
38 
39  for (const CDCWireHit* wireHit : cluster) {
40  const CDCHit* hit = wireHit->getHit();
41 
42  if (CDCMCHitLookUp::getInstance().isBackground(hit)) {
43  ++nBackgroundHits;
44  }
45  }
46 
47  // Variables with Monte Carlo information should carry truth in their name.
48  var<named("n_background_hits_truth")>() = nBackgroundHits;
49  var<named("background_fraction_truth")>() = 1.0 * nBackgroundHits / cluster.size();
50  var<named("weight")>() = cluster.size();
51  var<named("truth")>() = (1.0 * nBackgroundHits / cluster.size() > 0.8) ? 0 : 1;
52  return true;
53 }
Belle2::CDCHit
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:51
Belle2::TrackFindingCDC::CompositeProcessingSignalListener::initialize
void initialize() override
Receive and dispatch signal before the start of the event processing.
Definition: CompositeProcessingSignalListener.cc:17
Belle2::TrackFindingCDC::CDCMCManager::requireTruthInformation
void requireTruthInformation()
Require the mc information store arrays.
Definition: CDCMCManager.cc:117
Belle2::TrackFindingCDC::CDCMCManager::fill
void fill()
Fill Monte Carlo look up maps from the DataStore.
Definition: CDCMCManager.cc:137
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::BkgTruthClusterVarSet::initialize
void initialize() override
Signal the initialisation of the event processing - requires the Monte Carlo information.
Definition: BkgTruthClusterVarSet.cc:20
Belle2::TrackFindingCDC::CDCMCManager::getInstance
static CDCMCManager & getInstance()
Getter for the singletone instance.
Definition: CDCMCManager.cc:76
Belle2::TrackFindingCDC::BkgTruthClusterVarSet::beginEvent
void beginEvent() override
Signal the beginning of a new event - loads the Monte Carlo information.
Definition: BkgTruthClusterVarSet.cc:26
Belle2::TrackFindingCDC::CompositeProcessingSignalListener::beginEvent
void beginEvent() override
Receive and dispatch signal for the start of a new event.
Definition: CompositeProcessingSignalListener.cc:33
Belle2::TrackFindingCDC::CDCWireHitCluster
An aggregation of CDCWireHits.
Definition: CDCWireHitCluster.h:31
Belle2::TrackFindingCDC::CDCMCHitLookUp::getInstance
static const CDCMCHitLookUp & getInstance()
Getter for the singletone instance.
Definition: CDCMCHitLookUp.cc:32
Belle2::TrackFindingCDC::VarSet< BkgTruthClusterVarNames >::named
constexpr static int named(const char *name)
Getter for the index from the name.
Definition: VarSet.h:88
Belle2::TrackFindingCDC::VarSet< BkgTruthClusterVarNames >::var
Float_t & var()
Reference getter for the value of the ith variable. Static version.
Definition: VarSet.h:103
Belle2::TrackFindingCDC::CDCWireHit
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:65
Belle2::TrackFindingCDC::BkgTruthClusterVarSet::extract
bool extract(const CDCWireHitCluster *ptrCluster) final
Generate and assign the contained variables.
Definition: BkgTruthClusterVarSet.cc:32