Belle II Software development
SPTCvirtualIPRemoverModule.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/SPTCvirtualIPRemoverModule.h>
10#include <framework/logging/Logger.h>
11
12using namespace Belle2;
13
14
15REG_MODULE(SPTCvirtualIPRemover);
16
18{
20
21 //Set module properties
22 setDescription("The quality estimator module for SpacePointTrackCandidates using a circleFit.");
24
25 addParam("tcArrayName", m_PARAMtcArrayName, " sets the name of expected StoreArray with SpacePointTrackCand in it",
26 std::string(""));
27
28 addParam("doCheckOnly", m_PARAMdoCheckOnly, " if true, no vIP is removed, but only nVIPs are counted.", bool(false));
29
30 addParam("maxTCLengthForVIPKeeping", m_PARAMmaxTCLengthForVIPKeeping,
31 "If you want to keep the vIP only for short TCs, then set this value to the number of hits a TC is maximally allowed to have to not loose its vIP (number of hits without counting the vIP).",
32 unsigned(3));
33}
34
35
37{
39 B2DEBUG(20, "\n" << "SPTCvirtualIPRemoverModule:event: event " << m_eventCounter << "\n");
41
42 unsigned nTC = 0;
43 // assign a QI computed using a circleFit for each given SpacePointTrackCand
45
46 unsigned nHits = aTC.size();
47 bool hasVIP = false;
48
49 // search for first vIP in SPTC and remove if parameter doCheckOnly == false. all further VIPs are ignored!
50 const std::vector<const SpacePoint*>& spacePoints = aTC.getHits();
51 for (unsigned int iSp = 0; iSp < spacePoints.size(); ++iSp) {
52 const SpacePoint* aHit = spacePoints[iSp];
53 if (aHit->getType() == VXD::SensorInfoBase::SensorType::VXD) { // vIP found
55 hasVIP = true;
56 if (m_PARAMdoCheckOnly or (m_PARAMmaxTCLengthForVIPKeeping + 1 >= nHits)) continue;
57
58 aTC.removeSpacePoint(iSp);
60 break; // stopping here, since now the list of SpacePoint* do not anymore more with actual Spacepoints in SPTC!
61 }
62 }
63
64 B2DEBUG(20, "SPTCvirtualIPRemoverModule:event: event " << m_eventCounter
65 << ": TC " << nTC
66 << " with " << nHits
67 << " hits has vIP: " << (hasVIP ? "true" : "false")
68 << " and was removed " << (m_PARAMdoCheckOnly ? "false" : "true")
69 );
70 ++nTC;
71 }
72
73}
74
75
77{
78 if (m_eventCounter == 0) { m_eventCounter++; } // prevents division by zero
79 double invEvents = 1. / m_eventCounter;
80
81 B2DEBUG(20, "SPTCvirtualIPRemoverModule:endRun: events: " << m_eventCounter
82 << ", nSPTCsPerEvent: " << invEvents * float(m_nTCsTotal)
83 << ", nVIPsPerEvent: " << invEvents * float(m_nVIPsTotal)
84 << ", nVIPsRemovedPerEvent: " << invEvents * float(m_nVIPsRemoved)
85 );
86}
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
unsigned int m_nVIPsRemoved
total number of TCs removed from TCs.
unsigned int m_eventCounter
knows current event number.
SPTCvirtualIPRemoverModule()
Constructor of the module.
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.
bool m_PARAMdoCheckOnly
if true, no vIP is removed, but only nVIPs are counted.
unsigned int m_PARAMmaxTCLengthForVIPKeeping
If you want to keep the vIP only for short TCs, then set this value to the number of hits a TC is max...
std::string m_PARAMtcArrayName
sets the name of expected StoreArray with SpacePointTrackCand in it.
unsigned int m_nVIPsTotal
total number virtualIPs found.
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.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition: SpacePoint.h:42
Belle2::VXD::SensorInfoBase::SensorType getType() const
Return SensorType (PXD, SVD, ...) on which the SpacePoint lives.
Definition: SpacePoint.h:145
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
@ VXD
Any type of VXD Sensor.
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.