11 #include <tracking/modules/DATCON/DATCONTrackingModule.h>
28 setDescription(
"DATCON: Data Acquisition Tracking Concentrator Online Node \n"
29 "Algorithm for online data reduction in the PXD. \n"
30 "DATCON takes SVD hits as input and performs track reconstruction based on these data. \n"
31 "The tracks are extrapolated from the origin in the x-y-plane to the PXD sensors. \n"
32 "Around each extrapolated hit (called Most Probable Hit, MPH), a Region of Interest (ROI) is created."
33 "The data of the ROIs (namely two opposing corners) are sent to the \n"
34 "Online Selector Node (ONSEN) which also receives ROIs of the Higher Level Trigger (HLT). \n"
35 "This C++ Implementation of DATCON is the development environment, the algorithms will later \n"
36 "be transferred to FPGA, as DATCON is a hardware based online data reduction system.");
37 setPropertyFlags(c_ParallelProcessingCertified);
45 DATCONTrackingModule::initialize()
47 storeDATCONTracks.registerInDataStore(m_storeDATCONTracksName, DataStore::c_DontWriteOut);
48 m_storeDATCONTracksName = storeDATCONTracks.getName();
50 storeDATCONSVDCluster.isRequired(m_storeDATCONSVDClusterName);
51 storeDATCONSVDSpacePoints.isRequired(m_storeDATCONSVDSpacePointsName);
53 m_storeDATCONSVDClusterName = storeDATCONSVDCluster.getName();
54 m_storeDATCONSVDSpacePointsName = storeDATCONSVDSpacePoints.getName();
56 if (m_useSVDSpacePoints)
57 storeSVDSpacePoints.isRequired(m_storeSVDSpacePointsName);
59 storeDATCONRecoTracks.registerInDataStore(m_storeDATCONRecoTracksName, DataStore::c_DontWriteOut);
60 m_storeDATCONRecoTracksName = storeDATCONRecoTracks.getName();
62 storeRecoHitInformation.registerInDataStore(m_storeRecoHitInformationName, DataStore::c_DontWriteOut);
63 m_storeRecoHitInformationName = storeRecoHitInformation.getName();
65 storeRecoHitInformation.registerRelationTo(storeDATCONSVDCluster, DataStore::c_Event, DataStore::c_DontWriteOut);
66 storeDATCONSVDCluster.registerRelationTo(storeRecoHitInformation, DataStore::c_Event, DataStore::c_DontWriteOut);
68 storeDATCONRecoTracks.registerRelationTo(storeRecoHitInformation);
70 RecoTrack::registerRequiredRelations(storeDATCONRecoTracks,
71 "", m_storeDATCONSVDClusterName,
"",
72 "",
"", m_storeRecoHitInformationName);
74 storeMCParticles.isOptional();
76 if (m_independentSectors) {
77 ArrayOfActiveSectorsPhiHS =
new int* [m_nVertSectorsU];
78 for (
int i = 0; i < m_nVertSectorsU; ++i) {
79 ArrayOfActiveSectorsPhiHS[i] =
new int[m_nAngleSectorsU];
82 ArrayOfActiveSectorsThetaHS =
new int* [m_nVertSectorsV];
83 for (
int i = 0; i < m_nVertSectorsV; ++i) {
84 ArrayOfActiveSectorsThetaHS[i] =
new int[m_nAngleSectorsV];
87 ArrayOfActiveSectorsPhiHS =
new int* [(int)pow(2, m_maxIterationsU + 1)];
88 for (
int i = 0; i < (int)pow(2, m_maxIterationsU + 1); ++i) {
89 ArrayOfActiveSectorsPhiHS[i] =
new int[(int)pow(2, m_maxIterationsU + 1)];
92 ArrayOfActiveSectorsThetaHS =
new int* [(int)pow(2, m_maxIterationsV + 1)];
93 for (
int i = 0; i < (int)pow(2, m_maxIterationsV + 1); ++i) {
94 ArrayOfActiveSectorsThetaHS[i] =
new int[(int)pow(2, m_maxIterationsV + 1)];
102 DATCONTrackingModule::event()
110 uHoughSpaceClusterCand.clear();
111 vHoughSpaceClusterCand.clear();
112 DATCONTracks.clear();
114 if (m_useHoughSpaceClustering) {
116 if (m_independentSectors) {
117 for (
int i = 0; i < m_nVertSectorsU; i++) {
118 for (
int j = 0; j < m_nAngleSectorsU; j++) {
119 ArrayOfActiveSectorsPhiHS[i][j] = 0;
122 for (
int i = 0; i < m_nVertSectorsV; i++) {
123 for (
int j = 0; j < m_nAngleSectorsV; j++) {
124 ArrayOfActiveSectorsThetaHS[i][j] = 0;
128 for (
int i = 0; i < (int)pow(2, m_maxIterationsU + 1); i++) {
129 for (
int j = 0; j < (int)pow(2, m_maxIterationsU + 1); j++) {
130 ArrayOfActiveSectorsPhiHS[i][j] = 0;
133 for (
int i = 0; i < (int)pow(2, m_maxIterationsV + 1); i++) {
134 for (
int j = 0; j < (int)pow(2, m_maxIterationsV + 1); j++) {
135 ArrayOfActiveSectorsThetaHS[i][j] = 0;
140 activeSectorVectorPhi.clear();
141 activeSectorVectorTheta.clear();
145 if (m_useDATCONSVDSpacePoints && m_useSVDSpacePoints) {
146 B2WARNING(
"Using both DATCONSVDSpacePoints and SVDSpacePoints is not possible! Using DATCONSVDSpacePoints.");
147 prepareDATCONSVDSpacePoints();
148 }
else if (m_useDATCONSVDSpacePoints && !m_useSVDSpacePoints) {
149 prepareDATCONSVDSpacePoints();
150 }
else if (!m_useDATCONSVDSpacePoints && m_useSVDSpacePoints) {
151 prepareSVDSpacePoints();
152 }
else if (!m_useDATCONSVDSpacePoints && !m_useSVDSpacePoints) {
153 B2WARNING(
"You should use some SpacePoints at least... Using DATCONSVDSpacePoints.");
154 prepareDATCONSVDSpacePoints();
157 if (m_usePhase2Simulation) {
160 B2WARNING(
"This mode is not yet implemented, nothing will happen! Return...");
165 TVector2 v1_s, v2_s, v4_s;
168 houghTrafo2d(uClusters,
true);
169 houghTrafo2d(vClusters,
false);
175 v1_s.Set(-M_PI, m_rectSizeU);
176 v2_s.Set(M_PI, m_rectSizeU);
177 v4_s.Set(-M_PI, -m_rectSizeU);
179 if (m_independentSectors) {
180 slowInterceptFinder2d(uHough,
true);
182 fastInterceptFinder2d(uHough,
true, v1_s, v2_s, v4_s, 0, m_maxIterationsU);
189 v1_s.Set(-M_PI, m_rectSizeV);
190 v2_s.Set(0., m_rectSizeV);
191 v4_s.Set(-M_PI, -m_rectSizeV);
193 if (m_independentSectors) {
194 slowInterceptFinder2d(vHough,
false);
196 fastInterceptFinder2d(vHough,
false, v1_s, v2_s, v4_s, 0, m_maxIterationsV);
199 if (m_useHoughSpaceClustering) {
200 FindHoughSpaceCluster(
true);
201 FindHoughSpaceCluster(
false);
206 purifyTrackCandsList();
210 if (m_useTrackCandMerger) {
218 if (m_useTrackMerger) {
226 DATCONTrackingModule::terminate()
229 if (m_independentSectors) {
230 for (
int i = 0; i < m_nVertSectorsU; ++i) {
231 delete [] ArrayOfActiveSectorsPhiHS[i];
234 for (
int i = 0; i < m_nVertSectorsV; ++i) {
235 delete [] ArrayOfActiveSectorsThetaHS[i];
238 for (
int i = 0; i < (int)pow(2, m_maxIterationsU + 1); ++i) {
239 delete [] ArrayOfActiveSectorsPhiHS[i];
242 for (
int i = 0; i < (int)pow(2, m_maxIterationsV + 1); ++i) {
243 delete [] ArrayOfActiveSectorsThetaHS[i];
247 delete [] ArrayOfActiveSectorsPhiHS;
248 delete [] ArrayOfActiveSectorsThetaHS;