Belle II Software  release-05-02-19
SegmentNetworkProducerModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Jakob Lettenbichler, Felix Metzner *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <string>
14 #include <vector>
15 
16 #include <framework/datastore/StoreArray.h>
17 #include <framework/datastore/StoreObjPtr.h>
18 #include <framework/core/Module.h>
19 #include <framework/logging/Logger.h>
20 #include <framework/geometry/B2Vector3.h>
21 
22 #include <mdst/dataobjects/EventLevelTrackingInfo.h>
23 
24 #include <tracking/trackFindingVXD/segmentNetwork/DirectedNodeNetworkContainer.h>
25 #include <tracking/trackFindingVXD/segmentNetwork/TrackNode.h>
26 #include <tracking/spacePointCreation/SpacePoint.h>
27 #include <tracking/dataobjects/FullSecID.h>
28 #include <tracking/trackFindingVXD/filterMap/map/FiltersContainer.h>
29 
30 namespace Belle2 {
42  class SegmentNetworkProducerModule : public Module {
43 
44  public:
47 
49  struct RawSectorData {
51  FullSecID secID;
52 
54  bool wasCreated;
55 
58 
61 
63  std::vector<Belle2::TrackNode*> hits;
64  };
65 
68 
70  void initialize() override;
71 
73  void beginRun() override
74  {
76  if (m_vxdtfFilters == nullptr) {
77  B2FATAL("Requested secMapName '" << m_PARAMsecMapName << "' does not exist! Can not continue...");
78  }
79  }
80 
87  void event() override;
88 
89 
91  std::vector<RawSectorData> matchSpacePointToSectors();
92 
93 
96  {
97  if (not m_vxdtfFilters->areCoordinatesValid(aSP.getVxdID(), aSP.getNormalizedLocalU(), aSP.getNormalizedLocalV())) {
98  return nullptr;
99  }
100 
101  FullSecID spSecID = m_vxdtfFilters->getFullID(aSP.getVxdID(), aSP.getNormalizedLocalU(), aSP.getNormalizedLocalV());
102  return m_vxdtfFilters->getStaticSector(spSecID);
103  }
104 
105 
108  void buildActiveSectorNetwork(std::vector<RawSectorData>& collectedData);
109 
110 
116  template <class ObserverType>
117  bool buildTrackNodeNetwork();
118 
119 
123  template <class ObserverType>
124  void buildSegmentNetwork();
125 
126 
127  protected:
129  std::vector<std::string> m_PARAMSpacePointsArrayNames = {"SVDSpacePoints", "PXDSpacePoints"};
131 
133  std::string m_PARAMNetworkOutputName;
134 
137 
139  bool m_PARAMAddVirtualIP = false;
140 
142  std::vector<double> m_PARAMVirtualIPCoordinates = {0, 0, 0};
143 
145  std::vector<double> m_PARAMVirtualIPErrors = {0.2, 0.2, 1.};
146 
148  std::string m_PARAMsecMapName = "testMap";
149 
151  bool m_PARAMprintNetworks = false;
152 
154  bool m_PARAMprintToMathematica = false;
155 
157  bool m_PARAMallFiltersOff = false;
158 
160  unsigned short m_PARAMmaxNetworkSize = 40000;
161 
163  unsigned int m_PARAMmaxSegmentConnections = 30000;
164 
166  unsigned int m_PARAMmaxSegmentAddedConnections = 300000;
167 
169  unsigned short m_PARAMmaxTrackNodeConnections = 8000;
170 
172  unsigned int m_PARAMmaxTrackNodeAddedConnections = 200000;
173 
174 
178 
181 
184 
187 
189  std::vector<StoreArray<Belle2::SpacePoint>> m_spacePoints;
190 
193 
196 
197 
199  unsigned int m_eventCounter = 0;
201  };
203 }
204 
Belle2::SegmentNetworkProducerModule::m_PARAMmaxNetworkSize
unsigned short m_PARAMmaxNetworkSize
Maximal size of SegmentNetwork; if exceeded, filling of SegmentNetwork will be stopped and the event ...
Definition: SegmentNetworkProducerModule.h:168
Belle2::SegmentNetworkProducerModule::m_PARAMVirtualIPCoordinates
std::vector< double > m_PARAMVirtualIPCoordinates
Coordinates for virtual interaction point SpacePoint.
Definition: SegmentNetworkProducerModule.h:150
Belle2::SegmentNetworkProducerModule::m_PARAMSpacePointsArrayNames
std::vector< std::string > m_PARAMSpacePointsArrayNames
Module Parameters.
Definition: SegmentNetworkProducerModule.h:138
Belle2::FiltersContainer
This class contains everything needed by the VXDTF that is not going to change during a RUN,...
Definition: FiltersContainer.h:38
Belle2::SegmentNetworkProducerModule::RawSectorData::sector
ActiveSector< StaticSectorType, TrackNode > * sector
Stores a sector if one is found, nullptr else.
Definition: SegmentNetworkProducerModule.h:65
Belle2::SegmentNetworkProducerModule::SegmentNetworkProducerModule
SegmentNetworkProducerModule()
Constructor of the module.
Definition: SegmentNetworkProducerModule.cc:23
Belle2::SegmentNetworkProducerModule::StaticSectorType
VXDTFFilters< SpacePoint >::staticSector_t StaticSectorType
Definition of the static sector type.
Definition: SegmentNetworkProducerModule.h:54
Belle2::VXDTFFilters
Class that contains all the static sectors to which the filters are attached.
Definition: VXDTFFilters.h:75
Belle2::SegmentNetworkProducerModule::buildTrackNodeNetwork
bool buildTrackNodeNetwork()
Evaluate TrackNodes in the ActiveSectors and link them if they fulfill the filter criteria of the Sec...
Definition: SegmentNetworkProducerModule.cc:313
Belle2::SegmentNetworkProducerModule::m_PARAMNetworkOutputName
std::string m_PARAMNetworkOutputName
Name for network container data store object created by this module.
Definition: SegmentNetworkProducerModule.h:141
Belle2::ActiveSector
The ActiveSector Class.
Definition: ActiveSector.h:39
Belle2::VXDTFFilters::staticSector_t
StaticSector< point_t, twoHitFilter_t, threeHitFilter_t, int > staticSector_t
typedef to make a static sector type more readable.
Definition: VXDTFFilters.h:129
Belle2::SegmentNetworkProducerModule::RawSectorData::wasCreated
bool wasCreated
Whether the sector was already added to the network.
Definition: SegmentNetworkProducerModule.h:62
Belle2::SegmentNetworkProducerModule::m_virtualIPErrors
B2Vector3D m_virtualIPErrors
Vector for errors on coordinates of virtual IP.
Definition: SegmentNetworkProducerModule.h:188
Belle2::SegmentNetworkProducerModule::m_PARAMmaxSegmentAddedConnections
unsigned int m_PARAMmaxSegmentAddedConnections
Maximal number of added Segment connections; if exceeded, filling of SegmentNetwork will be stopped a...
Definition: SegmentNetworkProducerModule.h:174
Belle2::SegmentNetworkProducerModule::RawSectorData::hits
std::vector< Belle2::TrackNode * > hits
collects the hits found on this sector
Definition: SegmentNetworkProducerModule.h:71
Belle2::SpacePoint
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition: SpacePoint.h:52
Belle2::SegmentNetworkProducerModule::m_PARAMVirtualIPErrors
std::vector< double > m_PARAMVirtualIPErrors
Errors on coordinates for virtual interaction point SpacePoint.
Definition: SegmentNetworkProducerModule.h:153
Belle2::SegmentNetworkProducerModule::m_PARAMmaxSegmentConnections
unsigned int m_PARAMmaxSegmentConnections
Maximal number of Segment connections; if exceeded, filling of SegmentNetwork will be stopped and the...
Definition: SegmentNetworkProducerModule.h:171
Belle2::B2Vector3< double >
Belle2::SegmentNetworkProducerModule::m_PARAMAddVirtualIP
bool m_PARAMAddVirtualIP
Boolean to set whether to add an additional SpacePoint as a virtual interaction point.
Definition: SegmentNetworkProducerModule.h:147
Belle2::FullSecID
Class to identify a sector inside of the VXD.
Definition: FullSecID.h:43
Belle2::SegmentNetworkProducerModule::m_eventLevelTrackingInfo
StoreObjPtr< EventLevelTrackingInfo > m_eventLevelTrackingInfo
Acccess to the EventLevelTrackingInfo object in the datastore.
Definition: SegmentNetworkProducerModule.h:203
Belle2::SegmentNetworkProducerModule::buildSegmentNetwork
void buildSegmentNetwork()
Use connected SpacePoints to form segments which will stored and linked in a DirectedNodeNetwork<Segm...
Definition: SegmentNetworkProducerModule.cc:418
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreObjPtr
Type-safe access to single objects in the data store.
Definition: ParticleList.h:33
Belle2::SegmentNetworkProducerModule::initialize
void initialize() override
Modul initialization: performing checks on input parameter and registration of network container in d...
Definition: SegmentNetworkProducerModule.cc:108
Belle2::SegmentNetworkProducerModule::event
void event() override
Event function.
Definition: SegmentNetworkProducerModule.cc:144
Belle2::SegmentNetworkProducerModule::m_network
StoreObjPtr< DirectedNodeNetworkContainer > m_network
Access to the DirectedNodeNetwork, which will be produced by this module.
Definition: SegmentNetworkProducerModule.h:200
Belle2::SpacePoint::getNormalizedLocalV
double getNormalizedLocalV() const
Return normalized local coordinates of the cluster in v (0 <= posV <= 1).
Definition: SpacePoint.h:164
Belle2::StaticSector
class to describe a static sector of the sector map.
Definition: StaticSector.h:39
Belle2::SegmentNetworkProducerModule::m_spacePoints
std::vector< StoreArray< Belle2::SpacePoint > > m_spacePoints
Contains all SPacePoint storeArrays to be evaluated.
Definition: SegmentNetworkProducerModule.h:197
Belle2::SegmentNetworkProducerModule::RawSectorData::secID
FullSecID secID
secID of rawSector
Definition: SegmentNetworkProducerModule.h:59
Belle2::SegmentNetworkProducerModule::m_filtersContainer
FiltersContainer< SpacePoint > & m_filtersContainer
Reference to container which contains all the sector to filter maps and with it the VXDTFFilters.
Definition: SegmentNetworkProducerModule.h:191
Belle2::FiltersContainer::getInstance
static FiltersContainer & getInstance()
one and only way to access the singleton object
Definition: FiltersContainer.h:64
Belle2::SegmentNetworkProducerModule::m_PARAMmaxTrackNodeAddedConnections
unsigned int m_PARAMmaxTrackNodeAddedConnections
Maximal number of added hit connections; if exceeded, filling of HitNetwork will be stopped and the e...
Definition: SegmentNetworkProducerModule.h:180
Belle2::SegmentNetworkProducerModule::m_PARAMmaxTrackNodeConnections
unsigned short m_PARAMmaxTrackNodeConnections
Maximal number of hit connections; if exceeded, filling of HitNetwork will be stopped and the event s...
Definition: SegmentNetworkProducerModule.h:177
Belle2::SegmentNetworkProducerModule::matchSpacePointToSectors
std::vector< RawSectorData > matchSpacePointToSectors()
Create TrackNodes from SpacePoints and collect fullSecIDs of 'active' sectors with SpacePoints for th...
Definition: SegmentNetworkProducerModule.cc:178
Belle2::SegmentNetworkProducerModule::buildActiveSectorNetwork
void buildActiveSectorNetwork(std::vector< RawSectorData > &collectedData)
Builds a DirectedNodeNetwork<ActiveSector>, containing ActiveSectors which have SpacePoints and compa...
Definition: SegmentNetworkProducerModule.cc:232
Belle2::SegmentNetworkProducerModule::m_PARAMprintNetworks
bool m_PARAMprintNetworks
If true for each event and each network a file with a graph of the network is created.
Definition: SegmentNetworkProducerModule.h:159
Belle2::SegmentNetworkProducerModule::findSectorForSpacePoint
const StaticSectorType * findSectorForSpacePoint(const SpacePoint &aSP)
Returns pointer to static sector of a provided SpacePoint; returns nullptr if no sector could be foun...
Definition: SegmentNetworkProducerModule.h:103
Belle2::SegmentNetworkProducerModule::m_PARAMEventLevelTrackingInfoName
std::string m_PARAMEventLevelTrackingInfoName
Name of the EventLevelTrackingInfo that should be used (different one for ROI-finding)
Definition: SegmentNetworkProducerModule.h:144
Belle2::SegmentNetworkProducerModule::m_virtualIPCoordinates
B2Vector3D m_virtualIPCoordinates
Member Variables.
Definition: SegmentNetworkProducerModule.h:185
Belle2::SegmentNetworkProducerModule::m_vxdtfFilters
VXDTFFilters< SpacePoint > * m_vxdtfFilters
Pointer to the current filters, contains all sectorCombinations and Filters including cuts.
Definition: SegmentNetworkProducerModule.h:194
Belle2::SegmentNetworkProducerModule::m_eventCounter
unsigned int m_eventCounter
Counters.
Definition: SegmentNetworkProducerModule.h:208
Belle2::SegmentNetworkProducerModule::m_PARAMprintToMathematica
bool m_PARAMprintToMathematica
If true a file containing Mathematica code to generate a graph of the segment network is created.
Definition: SegmentNetworkProducerModule.h:162
Belle2::SegmentNetworkProducerModule::beginRun
void beginRun() override
Begin Run which load the filters from the provided SectorMap and checks if this was successful.
Definition: SegmentNetworkProducerModule.h:81
Belle2::SpacePoint::getVxdID
VxdID getVxdID() const
Return the VxdID of the sensor on which the the cluster of the SpacePoint lives.
Definition: SpacePoint.h:158
Belle2::SegmentNetworkProducerModule::m_PARAMallFiltersOff
bool m_PARAMallFiltersOff
If true, all filters are deactivated for all hit-combinations and therefore all combinations are acce...
Definition: SegmentNetworkProducerModule.h:165
Belle2::SpacePoint::getNormalizedLocalU
double getNormalizedLocalU() const
Return normalized local coordinates of the cluster in u (0 <= posU <= 1).
Definition: SpacePoint.h:161
Belle2::SegmentNetworkProducerModule::RawSectorData::staticSector
const StaticSectorType * staticSector
Stores a static sector.
Definition: SegmentNetworkProducerModule.h:68
Belle2::SegmentNetworkProducerModule::m_PARAMsecMapName
std::string m_PARAMsecMapName
Name of SectorMap used for this instance.
Definition: SegmentNetworkProducerModule.h:156