Belle II Software  release-08-01-10
SegmentNetworkProducerModule.h
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 #pragma once
10 
11 #include <string>
12 #include <vector>
13 
14 #include <framework/datastore/StoreArray.h>
15 #include <framework/datastore/StoreObjPtr.h>
16 #include <framework/core/Module.h>
17 #include <framework/logging/Logger.h>
18 #include <framework/geometry/B2Vector3.h>
19 
20 #include <mdst/dataobjects/EventLevelTrackingInfo.h>
21 
22 #include <tracking/trackFindingVXD/segmentNetwork/DirectedNodeNetworkContainer.h>
23 #include <tracking/trackFindingVXD/segmentNetwork/TrackNode.h>
24 #include <tracking/spacePointCreation/SpacePoint.h>
25 #include <tracking/dataobjects/FullSecID.h>
26 #include <tracking/trackFindingVXD/filterMap/map/FiltersContainer.h>
27 
28 namespace Belle2 {
41 
42  public:
45 
47  struct RawSectorData {
50 
52  bool wasCreated;
53 
56 
59 
61  std::vector<Belle2::TrackNode*> hits;
62  };
63 
66 
68  void initialize() override;
69 
71  void beginRun() override
72  {
74  if (m_vxdtfFilters == nullptr) {
75  B2FATAL("Requested secMapName '" << m_PARAMsecMapName << "' does not exist! Can not continue...");
76  }
77  }
78 
85  void event() override;
86 
87 
89  std::vector<RawSectorData> matchSpacePointToSectors();
90 
91 
94  {
95  if (not m_vxdtfFilters->areCoordinatesValid(aSP.getVxdID(), aSP.getNormalizedLocalU(), aSP.getNormalizedLocalV())) {
96  return nullptr;
97  }
98 
99  FullSecID spSecID = m_vxdtfFilters->getFullID(aSP.getVxdID(), aSP.getNormalizedLocalU(), aSP.getNormalizedLocalV());
100  return m_vxdtfFilters->getStaticSector(spSecID);
101  }
102 
103 
106  void buildActiveSectorNetwork(std::vector<RawSectorData>& collectedData);
107 
108 
114  template <class ObserverType>
115  bool buildTrackNodeNetwork();
116 
117 
121  template <class ObserverType>
122  void buildSegmentNetwork();
123 
124 
125  protected:
128  std::vector<std::string> m_PARAMSpacePointsArrayNames = {"SVDSpacePoints", "PXDSpacePoints"};
129 
132 
135 
137  bool m_PARAMAddVirtualIP = false;
138 
140  std::vector<double> m_PARAMVirtualIPCoordinates = {0, 0, 0};
141 
143  std::vector<double> m_PARAMVirtualIPErrors = {0.2, 0.2, 1.};
144 
146  std::string m_PARAMsecMapName = "testMap";
147 
149  bool m_PARAMprintNetworks = false;
150 
153 
155  bool m_PARAMallFiltersOff = false;
156 
158  unsigned short m_PARAMmaxNetworkSize = 40000;
159 
161  unsigned int m_PARAMmaxSegmentConnections = 30000;
162 
164  unsigned int m_PARAMmaxSegmentAddedConnections = 300000;
165 
167  unsigned short m_PARAMmaxTrackNodeConnections = 8000;
168 
170  unsigned int m_PARAMmaxTrackNodeAddedConnections = 200000;
171 
172 
176 
179 
182 
185 
187  std::vector<StoreArray<Belle2::SpacePoint>> m_spacePoints;
188 
191 
194 
195 
198  unsigned int m_eventCounter = 0;
199  };
201 }
202 
The ActiveSector Class.
Definition: ActiveSector.h:29
This class contains everything needed by the VXDTF that is not going to change during a RUN,...
static FiltersContainer & getInstance()
one and only way to access the singleton object
Class to identify a sector inside of the VXD.
Definition: FullSecID.h:33
Base class for Modules.
Definition: Module.h:72
The Segment Network Producer Module.
bool m_PARAMprintNetworks
If true for each event and each network a file with a graph of the network is created.
void buildSegmentNetwork()
Use connected SpacePoints to form segments which will stored and linked in a DirectedNodeNetwork<Segm...
unsigned short m_PARAMmaxNetworkSize
Maximal size of SegmentNetwork; if exceeded, filling of SegmentNetwork will be stopped and the event ...
std::string m_PARAMNetworkOutputName
Name for network container data store object created by this module.
void initialize() override
Modul initialization: performing checks on input parameter and registration of network container in d...
unsigned int m_PARAMmaxSegmentConnections
Maximal number of Segment connections; if exceeded, filling of SegmentNetwork will be stopped and the...
StoreObjPtr< EventLevelTrackingInfo > m_eventLevelTrackingInfo
Acccess to the EventLevelTrackingInfo object in the datastore.
void buildActiveSectorNetwork(std::vector< RawSectorData > &collectedData)
Builds a DirectedNodeNetwork<ActiveSector>, containing ActiveSectors which have SpacePoints and compa...
std::vector< double > m_PARAMVirtualIPCoordinates
Coordinates for virtual interaction point SpacePoint.
std::string m_PARAMEventLevelTrackingInfoName
Name of the EventLevelTrackingInfo that should be used (different one for ROI-finding)
StoreObjPtr< DirectedNodeNetworkContainer > m_network
Access to the DirectedNodeNetwork, which will be produced by this module.
unsigned int m_PARAMmaxTrackNodeAddedConnections
Maximal number of added hit connections; if exceeded, filling of HitNetwork will be stopped and the e...
std::vector< StoreArray< Belle2::SpacePoint > > m_spacePoints
Contains all SPacePoint storeArrays to be evaluated.
SegmentNetworkProducerModule()
Constructor of the module.
unsigned int m_PARAMmaxSegmentAddedConnections
Maximal number of added Segment connections; if exceeded, filling of SegmentNetwork will be stopped a...
std::vector< RawSectorData > matchSpacePointToSectors()
Create TrackNodes from SpacePoints and collect fullSecIDs of 'active' sectors with SpacePoints for th...
VXDTFFilters< SpacePoint > * m_vxdtfFilters
Pointer to the current filters, contains all sectorCombinations and Filters including cuts.
std::vector< double > m_PARAMVirtualIPErrors
Errors on coordinates for virtual interaction point SpacePoint.
void beginRun() override
Begin Run which load the filters from the provided SectorMap and checks if this was successful.
std::string m_PARAMsecMapName
Name of SectorMap used for this instance.
FiltersContainer< SpacePoint > & m_filtersContainer
Reference to container which contains all the sector to filter maps and with it the VXDTFFilters.
bool m_PARAMallFiltersOff
If true, all filters are deactivated for all hit-combinations and therefore all combinations are acce...
unsigned short m_PARAMmaxTrackNodeConnections
Maximal number of hit connections; if exceeded, filling of HitNetwork will be stopped and the event s...
bool m_PARAMprintToMathematica
If true a file containing Mathematica code to generate a graph of the segment network is created.
const StaticSectorType * findSectorForSpacePoint(const SpacePoint &aSP)
Returns pointer to static sector of a provided SpacePoint; returns nullptr if no sector could be foun...
bool buildTrackNodeNetwork()
Evaluate TrackNodes in the ActiveSectors and link them if they fulfill the filter criteria of the Sec...
std::vector< std::string > m_PARAMSpacePointsArrayNames
Module Parameters.
B2Vector3D m_virtualIPErrors
Vector for errors on coordinates of virtual IP.
bool m_PARAMAddVirtualIP
Boolean to set whether to add an additional SpacePoint as a virtual interaction point.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition: SpacePoint.h:42
double getNormalizedLocalV() const
Return normalized local coordinates of the cluster in v (0 <= posV <= 1).
Definition: SpacePoint.h:154
VxdID getVxdID() const
Return the VxdID of the sensor on which the the cluster of the SpacePoint lives.
Definition: SpacePoint.h:148
double getNormalizedLocalU() const
Return normalized local coordinates of the cluster in u (0 <= posU <= 1).
Definition: SpacePoint.h:151
class to describe a static sector of the sector map.
Definition: StaticSector.h:29
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Class that contains all the static sectors to which the filters are attached.
Definition: VXDTFFilters.h:63
Abstract base class for different kinds of events.
Simple struct for collecting raw data for a single sector.
bool wasCreated
Whether the sector was already added to the network.
ActiveSector< StaticSectorType, TrackNode > * sector
Stores a sector if one is found, nullptr else.
const StaticSectorType * staticSector
Stores a static sector.
std::vector< Belle2::TrackNode * > hits
collects the hits found on this sector