Belle II Software  release-05-01-25
TrackFinderVXDCosmicsStandalone.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2018 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Felix Metzner *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <framework/logging/Logger.h>
12 #include <tracking/modules/vxdtfRedesign/TrackFinderVXDCosmicsStandalone.h>
13 
14 using namespace Belle2;
15 
16 REG_MODULE(TrackFinderVXDCosmicsStandalone);
17 
22 {
23  //Set module properties
24  setDescription("The TrackFinderVXDCosmicsStandalone module.");
26 
27 
28  addParam("SpacePointTrackCandArrayName",
30  "name for StoreArray< SpacePointTrackCand> to be filled.",
31  std::string(""));
32 
33  addParam("SpacePoints", m_spacePointsNames,
34  "SpacePoints collection name", m_spacePointsNames);
35 
36  addParam("QualityCut", m_qualityCut,
37  "Cut value to be applied to reduced chi2 of fit.", m_qualityCut);
38 
39  addParam("MinSPs", m_minSPs,
40  "Minimal number of SpacePoints for a candidate.", m_minSPs);
41 
42  addParam("MaxRejectedSPs", m_maxRejectedSPs,
43  "Maximal number of rejected SPs in the event.", m_maxRejectedSPs);
44 
45  addParam("SortingMode", m_sortingMode,
46  "Sorting mode used when adding new SPs.\n 1: by radius,\n 2: by x,\n 3: by y (default).", m_sortingMode);
47 }
48 
49 
51 {
52  for (auto& spacePointsName : m_spacePointsNames) {
53  m_spacePoints.push_back(StoreArray<SpacePoint>(spacePointsName));
54  m_spacePoints.back().isRequired();
55  }
58 }
59 
60 
62 {
64 
66  std::pair<std::vector<double>, std::vector<double>> res = m_SCC.getResult();
67 
68  auto sptc = SpacePointTrackCand(m_SCC.getSPTC());
69  sptc.setChargeSeed(1.);
70  sptc.setQualityIndicator(m_SCC.getReducedChi2());
71 
72  TMatrixDSym covSeed(6);
73  covSeed(0, 0) = 0.01;
74  covSeed(1, 1) = 0.01;
75  covSeed(2, 2) = 0.04;
76  covSeed(3, 3) = 0.1;
77  covSeed(4, 4) = 0.1;
78  covSeed(5, 5) = 0.4;
79  sptc.setCovSeed(covSeed);
80 
81  TVectorD stateSeed6D(6);
82  double momentumFactor = 100.;
83  stateSeed6D(0) = res.first[0];
84  stateSeed6D(1) = res.first[1];
85  stateSeed6D(2) = res.first[2];
86  stateSeed6D(3) = momentumFactor * res.second[0];
87  stateSeed6D(4) = momentumFactor * res.second[1];
88  stateSeed6D(5) = momentumFactor * res.second[2];
89 
90  sptc.set6DSeed(stateSeed6D);
91  B2DEBUG(10, "new SPTC with nhits = " << sptc.getNHits() << " and reduced chi2 = " << sptc.getQualityIndicator() << ".");
92  m_TCs.appendNew(sptc);
93  }
94 }
Belle2::StoreArray::appendNew
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:256
Belle2::TrackFinderVXDCosmicsStandaloneModule::m_spacePoints
std::vector< StoreArray< SpacePoint > > m_spacePoints
The storeArray for SpacePoints.
Definition: TrackFinderVXDCosmicsStandalone.h:68
Belle2::Module::setDescription
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:216
Belle2::TrackFinderVXDCosmicsStandaloneModule::m_spacePointsNames
std::vector< std::string > m_spacePointsNames
SpacePoint collection name.
Definition: TrackFinderVXDCosmicsStandalone.h:65
Belle2::StandaloneCosmicsCollector::getSPTC
std::vector< const SpacePoint * > getSPTC()
Getter for the sorted list of SpacePoints used for the final fit which met the given requirements.
Definition: StandaloneCosmicsCollector.h:144
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::Module::c_ParallelProcessingCertified
@ 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:82
Belle2::TrackFinderVXDCosmicsStandaloneModule::TrackFinderVXDCosmicsStandaloneModule
TrackFinderVXDCosmicsStandaloneModule()
Constructor.
Definition: TrackFinderVXDCosmicsStandalone.cc:21
Belle2::TrackFinderVXDCosmicsStandaloneModule::m_minSPs
int m_minSPs
Module parameter setting the minimal required number of SpacePoints for the fit.
Definition: TrackFinderVXDCosmicsStandalone.h:86
Belle2::TrackFinderVXDCosmicsStandaloneModule::m_PARAMSpacePointTrackCandArrayName
std::string m_PARAMSpacePointTrackCandArrayName
Name for StoreArray<SpacePointTrackCand> to be filled.
Definition: TrackFinderVXDCosmicsStandalone.h:71
Belle2::StandaloneCosmicsCollector::getReducedChi2
double getReducedChi2()
Getter for the final reduced chi squared value obtained for the set of SpacePoints used for the last ...
Definition: StandaloneCosmicsCollector.h:155
Belle2::DataStore::c_DontWriteOut
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
Definition: DataStore.h:73
Belle2::TrackFinderVXDCosmicsStandaloneModule::initialize
void initialize() override
Initialize.
Definition: TrackFinderVXDCosmicsStandalone.cc:50
Belle2::StandaloneCosmicsCollector::addSpacePoints
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...
Definition: StandaloneCosmicsCollector.h:76
Belle2::TrackFinderVXDCosmicsStandaloneModule::m_SCC
StandaloneCosmicsCollector m_SCC
Line fit algorithm used for VXD standalone cosmics track finding.
Definition: TrackFinderVXDCosmicsStandalone.h:74
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::Module::setPropertyFlags
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:210
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFinderVXDCosmicsStandaloneModule::m_TCs
StoreArray< Belle2::SpacePointTrackCand > m_TCs
Output container: StoreArray for the TCs created in this module.
Definition: TrackFinderVXDCosmicsStandalone.h:91
Belle2::StandaloneCosmicsCollector::doFit
bool doFit(double qualityCut, int maxRejected, int minSPs)
Function to perform the actual line fit based on the StoreArray of SpacePoints provided.
Definition: StandaloneCosmicsCollector.h:102
Belle2::StandaloneCosmicsCollector::setSortingMode
void setSortingMode(unsigned short index)
Set sorting mode used in addSpacePoints.
Definition: StandaloneCosmicsCollector.h:61
Belle2::TrackFinderVXDCosmicsStandaloneModule::m_sortingMode
unsigned short m_sortingMode
Sorting mode used for adding new SpacePoints of a candidate.
Definition: TrackFinderVXDCosmicsStandalone.h:81
Belle2::TrackFinderVXDCosmicsStandaloneModule::m_qualityCut
double m_qualityCut
Module parameter to set maximal reduced chi2 value allowed for the fit.
Definition: TrackFinderVXDCosmicsStandalone.h:84
Belle2::Module::addParam
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:562
Belle2::StandaloneCosmicsCollector::getResult
std::pair< std::vector< double >, std::vector< double > > getResult()
Getter for the position and momentum seed resulting from the linear fit.
Definition: StandaloneCosmicsCollector.h:132
Belle2::StoreArray< SpacePoint >
Belle2::TrackFinderVXDCosmicsStandaloneModule::event
void event() override
event
Definition: TrackFinderVXDCosmicsStandalone.cc:61
Belle2::TrackFinderVXDCosmicsStandaloneModule::m_maxRejectedSPs
int m_maxRejectedSPs
Parameter for the maximal number of SpacePoints to be excluded for a refit before rejecting the event...
Definition: TrackFinderVXDCosmicsStandalone.h:88
Belle2::SpacePointTrackCand
Storage for (VXD) SpacePoint-based track candidates.
Definition: SpacePointTrackCand.h:51