Belle II Software development
SPTCmomentumSeedRetrieverModule.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 <tracking/modules/spacePointCreator/SPTCmomentumSeedRetrieverModule.h>
10#include <framework/logging/Logger.h>
11#include <framework/geometry/BFieldManager.h>
12
13using namespace Belle2;
14
15
16REG_MODULE(SPTCmomentumSeedRetriever);
17
19{
20 //Set module properties
21 setDescription("A module for creating momentum seeds for spacepoint track candidates.");
23
24 addParam("tcArrayName", m_PARAMtcArrayName, " sets the name of expected StoreArray with SpacePointTrackCand in it.",
25 std::string(""));
26}
27
28
30{
32
33 // BField is required by all QualityEstimators
34 double bFieldZ = BFieldManager::getField(0, 0, 0).Z() / Unit::T;
35
38
39 B2DEBUG(20, "SPTCmomentumSeedRetrieverModule:beginRun: B-Field z-component: " << m_bFieldZ);
40}
41
42
44{
47 B2DEBUG(20, "\n" << "SPTCmomentumSeedRetrieverModule:event: event " << m_eventCounter << ", got " <<
49
50 // create momentum seed for each given SpacePointTrackCand
51 B2DEBUG(20, "Number of TCs in Event = " << m_spacePointTrackCands.getEntries()); // demoted to a B2DEBUG, has been a warning
53 if (!aTC.hasRefereeStatus(SpacePointTrackCand::c_isActive)) continue;
54 B2DEBUG(20, "\n" << "SPTCmomentumSeedRetrieverModule:event: this TC has got " << aTC.size() << " hits\n");
56 }
57
58}
59
60
62{
63 if (m_eventCounter == 0) { m_eventCounter++; } // prevents division by zero
64 double invEvents = 1. / m_eventCounter;
65
66 B2DEBUG(1, "SPTCmomentumSeedRetrieverModule:endRun: events: " << m_eventCounter
67 << ", nSPTCsPerEvent: " << invEvents * float(m_nTCsTotal)
68 );
69}
70
71
73{
74 TVectorD stateSeed(6); //(x,y,z,px,py,pz)
75 TMatrixDSym covSeed(6);
76 // TODO: find out where these numbers come from!
77 covSeed(0, 0) = 0.01 ; covSeed(1, 1) = 0.01 ; covSeed(2, 2) = 0.04 ; // 0.01 = 0.1^2 = dx*dx =dy*dy. 0.04 = 0.2^2 = dz*dz
78 covSeed(3, 3) = 0.01 ; covSeed(4, 4) = 0.01 ; covSeed(5, 5) = 0.04 ;
79
80 auto sortedHits = aTC.getSortedHits();
81
83
84 stateSeed(0) = (sortedHits.front()->X());
85 stateSeed(1) = (sortedHits.front()->Y());
86 stateSeed(2) = (sortedHits.front()->Z());
87 if (results.p) {
88 auto momentumSeed = *(results.p);
89 stateSeed(3) = momentumSeed.X();
90 stateSeed(4) = momentumSeed.Y();
91 stateSeed(5) = momentumSeed.Z();
92 } else {
93 stateSeed(3) = 0;
94 stateSeed(4) = 0;
95 stateSeed(5) = 0;
96 }
97
98 aTC.set6DSeed(stateSeed);
99 aTC.setCovSeed(covSeed);
100
101 double chargeSeed = results.curvatureSign ? -1 * (*(results.curvatureSign)) : 0;
102 aTC.setChargeSeed(chargeSeed);
103
104 return (results.p && results.curvatureSign);
105}
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
void setMagneticFieldStrength(double magneticFieldZ=1.5)
Setter for z component of magnetic field.
virtual QualityEstimationResults estimateQualityAndProperties(std::vector< SpacePoint const * > const &measurements)
Quality estimation providing additional quantities Calculates quality indicator in range [0,...
QualityEstimatorRiemannHelixFit m_estimator
the QualityEstimator used to determine momentum seed.
unsigned int m_eventCounter
knows current event number.
bool createSPTCmomentumSeed(SpacePointTrackCand &aTC)
Generates momentum seed at the position of innermost hit of given TC.
void event() override
Applies the circleFit at given sets of TCs.
void InitializeCounters()
initialize variables to avoid nondeterministic behavior
void endRun() override
Prints a footer for each run which ended.
void beginRun() override
Prints a header for each new run.
double m_bFieldZ
Bz component of the magnetic field, will be updated runwise.
std::string m_PARAMtcArrayName
sets the name of expected StoreArray with SpacePointTrackCand in it.
unsigned int m_nTCsTotal
total number of TCs found in SpacePointTrackCand-container.
StoreArray< SpacePointTrackCand > m_spacePointTrackCands
the storeArray for SpacePointTrackCands as member, is faster than recreating link for each event.
Storage for (VXD) SpacePoint-based track candidates.
void set6DSeed(const TVectorD &state6D)
set the 6D state seed
void setCovSeed(const TMatrixDSym &cov)
set the covariance matrix seed
@ c_isActive
bit 11: SPTC is active (i.e.
const std::vector< const Belle2::SpacePoint * > getSortedHits() const
get hits (space points) sorted by their respective sorting parameter
void setChargeSeed(double charge)
Setter for assumed charge of tracked particle.
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
static const double T
[tesla]
Definition: Unit.h:120
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
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
Definition: BFieldManager.h:91
Abstract base class for different kinds of events.
Container for complete fit/estimation results.