Belle II Software  release-06-02-00
SVDROIFinderModule.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/svdROIFinder/SVDROIFinderModule.h>
10 #include <framework/datastore/StoreArray.h>
11 #include <framework/datastore/RelationArray.h>
12 #include <genfit/MaterialEffects.h>
13 
14 using namespace std;
15 using namespace Belle2;
16 
17 //-----------------------------------------------------------------
18 // Register the Module
19 //-----------------------------------------------------------------
20 REG_MODULE(SVDROIFinder)
21 
22 //-----------------------------------------------------------------
23 // Implementation
24 //-----------------------------------------------------------------
25 
27 {
28  //Set module properties
29  setDescription("This module finds the ROI on the SVD planes");
30  setPropertyFlags(c_ParallelProcessingCertified);
31 
32 
33  addParam("recoTrackListName", m_recoTracksListName, " name of the list of the fitted tracks", std::string(""));
34 
35  addParam("tolerancePhi", m_tolerancePhi, "Tolerance by finding sensor in phi coordinate (radians).", double(0.15));
36 
37  addParam("toleranceZ", m_toleranceZ, "Tolerance by finding sensor in Z coordinate (cm).", double(0.5));
38 
39  addParam("sigmaSystU", m_sigmaSystU, " systematic sigma in the u local coordinate ", double(0.025));
40  addParam("sigmaSystV", m_sigmaSystV, " systematic sigma in the V local coordinate ", double(0.025));
41  addParam("numSigmaTotU", m_numSigmaTotU, " number of sigmas (total) in the U local coordinate ", double(10));
42  addParam("numSigmaTotV", m_numSigmaTotV, " number of sigmas (total) in the V local coordinate ", double(10));
43  addParam("maxWidthU", m_maxWidthU, " upper limit on width of the ROI in the U local coordinate (cm) ", double(0.5));
44  addParam("maxWidthV", m_maxWidthV, " upper limit on width of the ROI in the V local coordinate (cm) ", double(0.5));
45 
46  addParam("SVDInterceptListName", m_SVDInterceptListName, "name of the list of interceptions", std::string(""));
47  addParam("ROIListName", m_ROIListName, "name of the list of ROIs", std::string(""));
48 
49 }
50 
51 SVDROIFinderModule::~SVDROIFinderModule()
52 {
53 }
54 
55 
56 void SVDROIFinderModule::initialize()
57 {
58  m_recotracks.isOptional(m_recoTracksListName);
59 
60  m_rois.registerInDataStore(m_ROIListName);
61 
62  m_intercepts.registerInDataStore(m_SVDInterceptListName);
63 
64  m_recotracks.registerRelationTo(m_intercepts);
65  m_intercepts.registerRelationTo(m_rois);
66 
67 
68  if (!genfit::MaterialEffects::getInstance()->isInitialized()) {
69  B2FATAL("Material effects not set up. Please use SetupGenfitExtrapolationModule.");
70  }
71 
72 }
73 
74 void SVDROIFinderModule::beginRun()
75 {
76 
77  B2DEBUG(21, "||| SVDROIFinder Parameters:");
78  B2DEBUG(21, " tolerance: phi = " << m_tolerancePhi);
79  B2DEBUG(21, " z = " << m_toleranceZ);
80  B2DEBUG(21, " n sigma: u = " << m_numSigmaTotU);
81  B2DEBUG(21, " v = " << m_numSigmaTotV);
82  B2DEBUG(21, " systematic: u = " << m_sigmaSystU);
83  B2DEBUG(21, " v = " << m_sigmaSystV);
84  B2DEBUG(21, " max width: u = " << m_maxWidthU);
85  B2DEBUG(21, " v = " << m_maxWidthV);
86 
87  m_ROIinfo.sigmaSystU = m_sigmaSystU;
88  m_ROIinfo.sigmaSystV = m_sigmaSystV;
89  m_ROIinfo.numSigmaTotU = m_numSigmaTotU;
90  m_ROIinfo.numSigmaTotV = m_numSigmaTotV;
91  m_ROIinfo.maxWidthU = m_maxWidthU;
92  m_ROIinfo.maxWidthV = m_maxWidthV;
93  m_ROIinfo.PXDInterceptListName = m_SVDInterceptListName;
94  m_ROIinfo.ROIListName = m_ROIListName;
95  m_ROIinfo.recoTracksListName = m_recoTracksListName;
96 
97  m_theSVDInterceptor = new SVDInterceptor(&m_ROIinfo, m_toleranceZ, m_tolerancePhi);
98 
99  m_theStripTranslator = new ROIStripTranslator(&m_ROIinfo);
100 
101 }
102 
103 
104 void SVDROIFinderModule::event()
105 {
106 
107  if (!m_recotracks.isValid()) {
108  B2DEBUG(21, "RecoTracks array is missing, no SVD ROIs");
109  return;
110  }
111 
112 
113  B2DEBUG(21, "%%%%%%%% Number of RecoTracks in the events = " << m_recotracks.getEntries());
114 
115  RelationArray recoTrackToSVDIntercepts(m_recotracks, m_intercepts);
116  recoTrackToSVDIntercepts.create();
117 
118  RelationArray SVDInterceptsToROIids(m_intercepts, m_rois);
119  SVDInterceptsToROIids.create();
120 
121  m_theSVDInterceptor->fillInterceptList(&m_intercepts, m_recotracks, &recoTrackToSVDIntercepts);
122 
123  m_theStripTranslator->fillRoiIDList(&m_intercepts, &m_rois);
124 
125 }
126 
127 
128 void SVDROIFinderModule::endRun()
129 {
130  delete m_theStripTranslator;
131  delete m_theSVDInterceptor;
132 }
133 
134 
135 void SVDROIFinderModule::terminate()
136 {
137 }
138 
Base class for Modules.
Definition: Module.h:72
Translator for ROI-geometry-information into a list of pixels.
Low-level class to create/modify relations between StoreArrays.
Definition: RelationArray.h:62
bool create(bool replace=false)
Create an empty relation array in the data store.
This Class implements the interceptor of the SVD tracks on the PXD layers.
The SVD ROI Finder Module.
#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.