Belle II Software  release-05-01-25
StereoHitTruthVarSet.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/filters/stereoHits/StereoHitTruthVarSet.h>
11 
12 #include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
13 #include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHit.h>
14 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
15 #include <tracking/trackFindingCDC/mclookup/CDCMCHitLookUp.h>
16 #include <tracking/trackFindingCDC/mclookup/CDCMCTrackLookUp.h>
17 
18 using namespace Belle2;
19 using namespace TrackFindingCDC;
20 
22 {
23  const CDCRLWireHit* rlWireHit = testPair->getTo();
24  const CDCTrack* track = testPair->getFrom();
25 
26  if (not testPair or not rlWireHit or not track) return false;
27 
28  const CDCMCTrackLookUp& mcTrackLookup = CDCMCTrackLookUp::getInstance();
29  const CDCMCHitLookUp& hitLookup = CDCMCHitLookUp::getInstance();
30 
31  const Belle2::CDCHit* hit = rlWireHit->getWireHit().getHit();
32 
33  ITrackType trackMCMatch = mcTrackLookup.getMCTrackId(track);
34  ITrackType hitMCMatch = hitLookup.getMCTrackId(hit);
35  ERightLeft hitMCRLInfo = hitLookup.getRLInfo(rlWireHit->getWireHit().getHit());
36 
37  if (trackMCMatch == INVALID_ITRACK) {
38  var<named("track_is_fake_truth")>() = true;
39  var<named("truth_may_reversed")>() = false;
40  var<named("truth")>() = false;
41  } else {
42  var<named("track_is_fake_truth")>() = false;
43  var<named("truth_may_reversed")>() = trackMCMatch == hitMCMatch;
44  var<named("truth")>() = trackMCMatch == hitMCMatch and hitMCRLInfo == rlWireHit->getRLInfo();
45  }
46 
47  return true;
48 }
Belle2::TrackFindingCDC::CDCTrack
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:51
Belle2::TrackFindingCDC::CDCRLWireHit::getWireHit
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
Definition: CDCRLWireHit.h:202
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::CDCWireHit::getHit
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
Definition: CDCWireHit.h:167
Belle2::TrackFindingCDC::CDCMCHitCollectionLookUp::getMCTrackId
ITrackType getMCTrackId(const ACDCHitCollection *ptrHits) const
Getter for the Monte Carlo track id matched to this collection of hits.
Definition: CDCMCHitCollectionLookUp.icc.h:101
Belle2::TrackFindingCDC::CDCMCHitLookUp::getMCTrackId
ITrackType getMCTrackId(const CDCHit *ptrHit) const
Returns the track id for the hit.
Definition: CDCMCHitLookUp.cc:122
Belle2::TrackFindingCDC::StereoHitTruthVarSet::extract
bool extract(const BaseStereoHitFilter::Object *testPair) override
Generate and assign the contained variables.
Definition: StereoHitTruthVarSet.cc:21
Belle2::TrackFindingCDC::CDCMCTrackLookUp::getInstance
static const CDCMCTrackLookUp & getInstance()
Getter for the singletone instance.
Definition: CDCMCTrackLookUp.cc:23
Belle2::TrackFindingCDC::CDCRLWireHit::getRLInfo
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRLWireHit.h:244
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::CDCRLWireHit
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:51
Belle2::TrackFindingCDC::CDCMCHitLookUp
Interface class to the Monte Carlo information for individual hits.
Definition: CDCMCHitLookUp.h:41
Belle2::TrackFindingCDC::NRightLeft::ERightLeft
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition: ERightLeft.h:35
Belle2::TrackFindingCDC::CDCMCHitLookUp::getInstance
static const CDCMCHitLookUp & getInstance()
Getter for the singletone instance.
Definition: CDCMCHitLookUp.cc:32
Belle2::TrackFindingCDC::VarSet< StereoHitTruthVarNames >::named
constexpr static int named(const char *name)
Getter for the index from the name.
Definition: VarSet.h:88
Belle2::TrackFindingCDC::CDCMCHitLookUp::getRLInfo
ERightLeft getRLInfo(const CDCHit *ptrHit) const
Returns the true right left passage information.
Definition: CDCMCHitLookUp.cc:109
Belle2::TrackFindingCDC::VarSet< StereoHitTruthVarNames >::var
Float_t & var()
Reference getter for the value of the ith variable. Static version.
Definition: VarSet.h:103
Belle2::TrackFindingCDC::CDCMCTrackLookUp
Specialisation of the lookup for the truth values of reconstructed tracks.
Definition: CDCMCTrackLookUp.h:33
Belle2::TrackFindingCDC::Filter::Object
AObject Object
Type of the object to be analysed.
Definition: Filter.dcl.h:43