Belle II Software development
TrackFinderVXDCosmicsStandalone.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
9#include <framework/logging/Logger.h>
10#include <tracking/modules/vxdtfRedesign/TrackFinderVXDCosmicsStandalone.h>
11
12using namespace Belle2;
13
14REG_MODULE(TrackFinderVXDCosmicsStandalone);
15
20{
21 //Set module properties
22 setDescription("The TrackFinderVXDCosmicsStandalone module.");
24
25
26 addParam("SpacePointTrackCandArrayName",
28 "name for StoreArray< SpacePointTrackCand> to be filled.",
29 std::string(""));
30
31 addParam("SpacePoints", m_spacePointsNames,
32 "SpacePoints collection name", m_spacePointsNames);
33
34 addParam("QualityCut", m_qualityCut,
35 "Cut value to be applied to reduced chi2 of fit.", m_qualityCut);
36
37 addParam("MinSPs", m_minSPs,
38 "Minimal number of SpacePoints for a candidate.", m_minSPs);
39
40 addParam("MaxRejectedSPs", m_maxRejectedSPs,
41 "Maximal number of rejected SPs in the event.", m_maxRejectedSPs);
42
43 addParam("SortingMode", m_sortingMode,
44 "Sorting mode used when adding new SPs.\n 1: by radius,\n 2: by x,\n 3: by y (default).", m_sortingMode);
45}
46
47
49{
50 for (auto& spacePointsName : m_spacePointsNames) {
51 m_spacePoints.push_back(StoreArray<SpacePoint>(spacePointsName));
52 m_spacePoints.back().isRequired();
53 }
56}
57
58
60{
62
64 std::pair<std::vector<double>, std::vector<double>> res = m_SCC.getResult();
65
66 auto sptc = SpacePointTrackCand(m_SCC.getSPTC());
67 sptc.setChargeSeed(1.);
68 sptc.setQualityIndicator(m_SCC.getReducedChi2());
69
70 TMatrixDSym covSeed(6);
71 covSeed(0, 0) = 0.01;
72 covSeed(1, 1) = 0.01;
73 covSeed(2, 2) = 0.04;
74 covSeed(3, 3) = 0.1;
75 covSeed(4, 4) = 0.1;
76 covSeed(5, 5) = 0.4;
77 sptc.setCovSeed(covSeed);
78
79 TVectorD stateSeed6D(6);
80 double momentumFactor = 100.;
81 stateSeed6D(0) = res.first[0];
82 stateSeed6D(1) = res.first[1];
83 stateSeed6D(2) = res.first[2];
84 stateSeed6D(3) = momentumFactor * res.second[0];
85 stateSeed6D(4) = momentumFactor * res.second[1];
86 stateSeed6D(5) = momentumFactor * res.second[2];
87
88 sptc.set6DSeed(stateSeed6D);
89 B2DEBUG(10, "new SPTC with nhits = " << sptc.getNHits() << " and reduced chi2 = " << sptc.getQualityIndicator() << ".");
90 m_TCs.appendNew(sptc);
91 }
92}
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
Definition: DataStore.h:71
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
Storage for (VXD) SpacePoint-based track candidates.
void addSpacePoints(std::vector< StoreArray< SpacePoint > > SPs)
Function to initialize the track finder anew for an event with its set of SpacePoints provided via th...
bool doFit(double qualityCut, int maxRejected, int minSPs)
Function to perform the actual line fit based on the StoreArray of SpacePoints provided.
std::vector< const SpacePoint * > getSPTC()
Getter for the sorted list of SpacePoints used for the final fit which met the given requirements.
std::pair< std::vector< double >, std::vector< double > > getResult()
Getter for the position and momentum seed resulting from the linear fit.
void setSortingMode(unsigned short index)
Set sorting mode used in addSpacePoints.
double getReducedChi2()
Getter for the final reduced chi squared value obtained for the set of SpacePoints used for the last ...
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:246
unsigned short m_sortingMode
Sorting mode used for adding new SpacePoints of a candidate.
int m_maxRejectedSPs
Parameter for the maximal number of SpacePoints to be excluded for a refit before rejecting the event...
StandaloneCosmicsCollector m_SCC
Line fit algorithm used for VXD standalone cosmics track finding.
StoreArray< Belle2::SpacePointTrackCand > m_TCs
Output container: StoreArray for the TCs created in this module.
double m_qualityCut
Module parameter to set maximal reduced chi2 value allowed for the fit.
int m_minSPs
Module parameter setting the minimal required number of SpacePoints for the fit.
std::vector< std::string > m_spacePointsNames
SpacePoint collection name.
std::vector< StoreArray< SpacePoint > > m_spacePoints
The storeArray for SpacePoints.
std::string m_PARAMSpacePointTrackCandArrayName
Name for StoreArray<SpacePointTrackCand> to be filled.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.