Belle II Software  release-05-01-25
TrackExporter.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, Dmitrii Neverov *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/findlets/minimal/TrackExporter.h>
11 
12 #include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
13 
14 #include <tracking/trackFindingCDC/eventdata/utils/RecoTrackUtil.h>
15 
16 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
17 
18 #include <tracking/dataobjects/RecoTrack.h>
19 
20 #include <framework/datastore/StoreArray.h>
21 #include <framework/core/ModuleParamList.templateDetails.h>
22 
23 #include <TMatrixDSym.h>
24 
25 using namespace Belle2;
26 using namespace TrackFindingCDC;
27 
29 {
30  return "Creates a RecoTrack from each CDCTrack.";
31 }
32 
33 void TrackExporter::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
34 {
35  moduleParamList->addParameter(prefixed(prefix, "RecoTracksStoreArrayName"),
37  "Alias for exportTracksInto",
39 
40  moduleParamList->addParameter(prefixed(prefix, "WriteRecoTracks"),
42  "Alias for exportTracks",
44 
45  moduleParamList->addParameter(prefixed(prefix, "exportTracks"),
47  "Switch for the creation of reco tracks for each cdc track.",
49 
50  moduleParamList->addParameter(prefixed(prefix, "exportTracksInto"),
52  "Name of the output StoreArray of RecoTracks.",
54 
55  moduleParamList->addParameter(prefixed(prefix, "discardCovarianceMatrix"),
57  "Discard covariance matrix in favour of a hand written one.",
59  moduleParamList->addParameter(prefixed(prefix, "monopoleMomSeed"),
61  "If non-zero, estimate seeds as for monopoles and set the momentum magnitude as this value.",
63 }
64 
66 {
67  // Output StoreArray
70  storedRecoTracks.registerInDataStore(DataStore::c_ErrorIfAlreadyRegistered);
71  RecoTrack::registerRequiredRelations(storedRecoTracks);
72  }
74 }
75 
76 void TrackExporter::apply(std::vector<CDCTrack>& tracks)
77 {
78  TMatrixDSym defaultCovSeed(6);
79  defaultCovSeed(0, 0) = 1e-3;
80  defaultCovSeed(1, 1) = 1e-3;
81  defaultCovSeed(2, 2) = 4e-3;
82  defaultCovSeed(3, 3) = 0.01e-3;
83  defaultCovSeed(4, 4) = 0.01e-3;
84  defaultCovSeed(5, 5) = 0.04e-3;
85 
86  // Put code to generate gf track cands here if requested.
89  for (const CDCTrack& track : tracks) {
90  RecoTrack* newRecoTrack;
91  if (m_param_monopoleMomSeed != 0.0)
92  newRecoTrack = RecoTrackUtil::storeInto(track, storedRecoTracks, m_param_monopoleMomSeed);
93  else
94  newRecoTrack = RecoTrackUtil::storeInto(track, storedRecoTracks);
95  if (newRecoTrack) {
96  newRecoTrack->setQualityIndicator(track.getQualityIndicator());
97  }
98  if (newRecoTrack and m_param_discardCovarianceMatrix) {
99  newRecoTrack->setSeedCovariance(defaultCovSeed);
100  }
101  }
102  }
103 }
Belle2::RecoTrack::registerRequiredRelations
static void registerRequiredRelations(StoreArray< RecoTrack > &recoTracks, std::string const &pxdHitsStoreArrayName="", std::string const &svdHitsStoreArrayName="", std::string const &cdcHitsStoreArrayName="", std::string const &bklmHitsStoreArrayName="", std::string const &eklmHitsStoreArrayName="", std::string const &recoHitInformationStoreArrayName="")
Convenience method which registers all relations required to fully use a RecoTrack.
Definition: RecoTrack.cc:42
Belle2::TrackFindingCDC::TrackExporter::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
Definition: TrackExporter.cc:33
Belle2::TrackFindingCDC::CDCTrack
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:51
Belle2::TrackFindingCDC::TrackExporter::m_param_exportTracksInto
std::string m_param_exportTracksInto
Parameter: Name of the output StoreArray of the RecoTracks generated by this module.
Definition: TrackExporter.h:60
Belle2::RecoTrack::setSeedCovariance
void setSeedCovariance(const TMatrixDSym &seedCovariance)
Set the covariance of the seed. ATTENTION: This is not the fitted covariance.
Definition: RecoTrack.h:530
Belle2::TrackFindingCDC::TrackExporter::m_param_discardCovarianceMatrix
bool m_param_discardCovarianceMatrix
Parameter: Discard covariance matrix in favour of a hand written one.
Definition: TrackExporter.h:63
Belle2::RecoTrack::setQualityIndicator
void setQualityIndicator(const float qualityIndicator)
Set the quality index attached to this RecoTrack. 0 means likely fake.
Definition: RecoTrack.h:736
Belle2::TrackFindingCDC::TrackExporter::m_param_monopoleMomSeed
double m_param_monopoleMomSeed
Parameter: If non-zero, estimate seeds as for monopoles and set the momentum magnitude as this value.
Definition: TrackExporter.h:66
Belle2::TrackFindingCDC::CompositeProcessingSignalListener::initialize
void initialize() override
Receive and dispatch signal before the start of the event processing.
Definition: CompositeProcessingSignalListener.cc:17
Belle2::TrackFindingCDC::RecoTrackUtil::storeInto
static RecoTrack * storeInto(const CDCTrack &track, StoreArray< RecoTrack > &recoTracks, const double momentumSeedMagnitude)
For magnetic monopoles; estimates charge sign from all stereo hits, momentum direction from hits in c...
Definition: RecoTrackUtil.cc:41
Belle2::TrackFindingCDC::TrackExporter::m_param_exportTracks
bool m_param_exportTracks
Parameter: Switch if a RecoTrack be generated for each track.
Definition: TrackExporter.h:57
Belle2::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2::ModuleParamList::addParameter
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Definition: ModuleParamList.templateDetails.h:38
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::TrackExporter::apply
void apply(std::vector< CDCTrack > &tracks) final
Write give tracks into track store array.
Definition: TrackExporter.cc:76
Belle2::TrackFindingCDC::TrackExporter::getDescription
std::string getDescription() final
Short description of the findlet.
Definition: TrackExporter.cc:28
Belle2::TrackFindingCDC::TrackExporter::initialize
void initialize() final
Signal initialisation phase to register store array for export.
Definition: TrackExporter.cc:65
Belle2::DataStore::c_ErrorIfAlreadyRegistered
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
Definition: DataStore.h:74
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::ModuleParamList
The Module parameter list class.
Definition: ModuleParamList.h:46