Belle II Software  release-08-01-10
StereoHitTruthVarSet.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/stereoHits/StereoHitTruthVarSet.h>
9 
10 #include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
11 #include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHit.h>
12 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
13 #include <tracking/trackFindingCDC/mclookup/CDCMCHitLookUp.h>
14 #include <tracking/trackFindingCDC/mclookup/CDCMCTrackLookUp.h>
15 
16 using namespace Belle2;
17 using namespace TrackFindingCDC;
18 
20 {
21  const CDCRLWireHit* rlWireHit = testPair->getTo();
22  const CDCTrack* track = testPair->getFrom();
23 
24  if (not testPair or not rlWireHit or not track) return false;
25 
26  const CDCMCTrackLookUp& mcTrackLookup = CDCMCTrackLookUp::getInstance();
27  const CDCMCHitLookUp& hitLookup = CDCMCHitLookUp::getInstance();
28 
29  const Belle2::CDCHit* hit = rlWireHit->getWireHit().getHit();
30 
31  ITrackType trackMCMatch = mcTrackLookup.getMCTrackId(track);
32  ITrackType hitMCMatch = hitLookup.getMCTrackId(hit);
33  ERightLeft hitMCRLInfo = hitLookup.getRLInfo(rlWireHit->getWireHit().getHit());
34 
35  if (trackMCMatch == INVALID_ITRACK) {
36  var<named("track_is_fake_truth")>() = true;
37  var<named("truth_may_reversed")>() = false;
38  var<named("truth")>() = false;
39  } else {
40  var<named("track_is_fake_truth")>() = false;
41  var<named("truth_may_reversed")>() = trackMCMatch == hitMCMatch;
42  var<named("truth")>() = trackMCMatch == hitMCMatch and hitMCRLInfo == rlWireHit->getRLInfo();
43  }
44 
45  return true;
46 }
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:40
ITrackType getMCTrackId(const ACDCHitCollection *ptrHits) const
Getter for the Monte Carlo track id matched to this collection of hits.
Interface class to the Monte Carlo information for individual hits.
ITrackType getMCTrackId(const CDCHit *ptrHit) const
Returns the track id for the hit.
static const CDCMCHitLookUp & getInstance()
Getter for the singletone instance.
ERightLeft getRLInfo(const CDCHit *ptrHit) const
Returns the true right left passage information.
Specialisation of the lookup for the truth values of reconstructed tracks.
static const CDCMCTrackLookUp & getInstance()
Getter for the singletone instance.
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:41
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
Definition: CDCRLWireHit.h:192
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRLWireHit.h:234
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
Definition: CDCWireHit.h:159
AObject Object
Type of the object to be analysed.
Definition: Filter.dcl.h:33
bool extract(const BaseStereoHitFilter::Object *testPair) override
Generate and assign the contained variables.
constexpr static 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
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition: ERightLeft.h:25
Abstract base class for different kinds of events.