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