Belle II Software  release-08-01-10
TrackExporter.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/findlets/minimal/TrackExporter.h>
9 
10 #include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
11 
12 #include <tracking/trackFindingCDC/eventdata/utils/RecoTrackUtil.h>
13 
14 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
15 
16 #include <tracking/dataobjects/RecoTrack.h>
17 
18 #include <framework/datastore/StoreArray.h>
19 #include <framework/core/ModuleParamList.templateDetails.h>
20 
21 #include <TMatrixDSym.h>
22 
23 using namespace Belle2;
24 using namespace TrackFindingCDC;
25 
27 {
28  return "Creates a RecoTrack from each CDCTrack.";
29 }
30 
31 void TrackExporter::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
32 {
33  moduleParamList->addParameter(prefixed(prefix, "RecoTracksStoreArrayName"),
35  "Alias for exportTracksInto",
37 
38  moduleParamList->addParameter(prefixed(prefix, "WriteRecoTracks"),
40  "Alias for exportTracks",
42 
43  moduleParamList->addParameter(prefixed(prefix, "exportTracks"),
45  "Switch for the creation of reco tracks for each cdc track.",
47 
48  moduleParamList->addParameter(prefixed(prefix, "exportTracksInto"),
50  "Name of the output StoreArray of RecoTracks.",
52 
53  moduleParamList->addParameter(prefixed(prefix, "discardCovarianceMatrix"),
55  "Discard covariance matrix in favour of a hand written one.",
57  moduleParamList->addParameter(prefixed(prefix, "monopoleMomSeed"),
59  "If non-zero, estimate seeds as for monopoles and set the momentum magnitude as this value.",
61 }
62 
64 {
65  // Output StoreArray
69  RecoTrack::registerRequiredRelations(storedRecoTracks);
70  }
72 }
73 
74 void TrackExporter::apply(std::vector<CDCTrack>& tracks)
75 {
76  TMatrixDSym defaultCovSeed(6);
77  defaultCovSeed(0, 0) = 1e-3;
78  defaultCovSeed(1, 1) = 1e-3;
79  defaultCovSeed(2, 2) = 4e-3;
80  defaultCovSeed(3, 3) = 0.01e-3;
81  defaultCovSeed(4, 4) = 0.01e-3;
82  defaultCovSeed(5, 5) = 0.04e-3;
83 
84  // Put code to generate gf track cands here if requested.
87  for (const CDCTrack& track : tracks) {
88  RecoTrack* newRecoTrack;
89  if (m_param_monopoleMomSeed != 0.0)
90  newRecoTrack = RecoTrackUtil::storeInto(track, storedRecoTracks, m_param_monopoleMomSeed);
91  else
92  newRecoTrack = RecoTrackUtil::storeInto(track, storedRecoTracks);
93  if (newRecoTrack) {
94  newRecoTrack->setQualityIndicator(track.getQualityIndicator());
95  }
96  if (newRecoTrack and m_param_discardCovarianceMatrix) {
97  newRecoTrack->setSeedCovariance(defaultCovSeed);
98  }
99  }
100  }
101 }
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
Definition: DataStore.h:72
The Module parameter list class.
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
void setSeedCovariance(const TMatrixDSym &seedCovariance)
Set the covariance of the seed. ATTENTION: This is not the fitted covariance.
Definition: RecoTrack.h:614
void setQualityIndicator(const float qualityIndicator)
Set the quality index attached to this RecoTrack. 0 means likely fake.
Definition: RecoTrack.h:847
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:53
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41
void initialize() override
Receive and dispatch signal before the start of the event processing.
void apply(std::vector< CDCTrack > &tracks) final
Write give tracks into track store array.
void initialize() final
Signal initialisation phase to register store array for export.
bool m_param_exportTracks
Parameter: Switch if a RecoTrack be generated for each track.
Definition: TrackExporter.h:47
std::string getDescription() final
Short description of the findlet.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
std::string m_param_exportTracksInto
Parameter: Name of the output StoreArray of the RecoTracks generated by this module.
Definition: TrackExporter.h:50
bool m_param_discardCovarianceMatrix
Parameter: Discard covariance matrix in favour of a hand written one.
Definition: TrackExporter.h:53
double m_param_monopoleMomSeed
Parameter: If non-zero, estimate seeds as for monopoles and set the momentum magnitude as this value.
Definition: TrackExporter.h:56
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.
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...