Belle II Software development
TOPRecoManager Class Reference

Singleton class providing pre-constructed reconstruction objects. More...

#include <TOPRecoManager.h>

Static Public Member Functions

static TOPRecoManagergetInstance ()
 Returns instance of the class.
 
static const InverseRaytracergetInverseRaytracer (int moduleID)
 Returns inverse ray-tracer of a given module.
 
static const FastRaytracergetFastRaytracer (int moduleID)
 Returns fast ray-tracer of a given module.
 
static const YScannergetYScanner (int moduleID)
 Returns y-scanner of a given module.
 
static const BackgroundPDFgetBackgroundPDF (int moduleID)
 Returns background PDF of a given module.
 
static const std::vector< BackgroundPDF > & getBackgroundPDFs ()
 Returns background PDF's of all modules.
 
static double getMinTime ()
 Returns time window lower edge.
 
static double getMaxTime ()
 Returns time window upper edge.
 
static double getTimeWindowSize ()
 Returns size of time window.
 
static void setTimeWindow (double minTime, double maxTime)
 Sets time window.
 
static void setDefaultTimeWindow ()
 Sets default time window (functions getMinTime(), getMaxTime() will then return default values from DB)
 
static void setChannelMask (const DBObjPtr< TOPCalChannelMask > &mask, const TOPAsicMask &asicMask)
 Sets channel masks.
 
static void setUncalibratedChannelsOff (const DBObjPtr< TOPCalChannelT0 > &channelT0)
 Sets uncalibrated channels off.
 
static void setUncalibratedChannelsOff (const DBObjPtr< TOPCalTimebase > &timebase)
 Sets uncalibrated channels off.
 
static void setChannelEffi ()
 Sets relative efficiencies of pixels.
 
static void setMirrorCenter (int moduleID, double xc, double yc)
 Sets the mirror center-of-curvature.
 

Private Member Functions

 TOPRecoManager ()=default
 Singleton: private constructor.
 
 TOPRecoManager (TOPRecoManager &)=delete
 Singleton: no copy constructor.
 
TOPRecoManageroperator= (const TOPRecoManager &)=delete
 Singleton: no assignment operator.
 
 ~TOPRecoManager ()=default
 Singleton: private destructor.
 
void set ()
 Sets the reconstruction object collections.
 
std::vector< InverseRaytracer > & inverseRaytracers ()
 Interface to inverse ray-tracers of all modules.
 
std::vector< FastRaytracer > & fastRaytracers ()
 Interface to fast ray-tracers of all modules.
 
std::vector< YScanner > & yScanners ()
 Interface to y-scanners of all modules.
 
std::vector< BackgroundPDF > & backgroundPDFs ()
 Interface to background PDF's of all modules.
 

Private Attributes

std::vector< InverseRaytracerm_inverseRaytracers
 collection of inverse raytracers
 
std::vector< FastRaytracerm_fastRaytracers
 collection of fast raytracers
 
std::vector< YScannerm_yScanners
 collection of y-scanners
 
std::vector< BackgroundPDFm_backgroundPDFs
 collection of background PDF's
 
double m_minTime = 0
 time window lower edge
 
double m_maxTime = 0
 time window upper edge
 
bool m_redoBkg = false
 flag to signal whether backgroundPDF has to be redone
 

Detailed Description

Singleton class providing pre-constructed reconstruction objects.

Definition at line 34 of file TOPRecoManager.h.

Member Function Documentation

◆ backgroundPDFs()

std::vector< BackgroundPDF > & backgroundPDFs ( )
inlineprivate

Interface to background PDF's of all modules.

Any accesses to underlying collection must be made with this method.

Returns
collection of background PDF's (index = moduleID - 1)

Definition at line 233 of file TOPRecoManager.h.

234 {
235 if (m_backgroundPDFs.empty()) set();
236 if (m_redoBkg) {
237 for (auto& pdf : m_backgroundPDFs) pdf.set();
238 m_redoBkg = false;
239 }
240 return m_backgroundPDFs;
241 }
std::vector< BackgroundPDF > m_backgroundPDFs
collection of background PDF's
void set()
Sets the reconstruction object collections.
bool m_redoBkg
flag to signal whether backgroundPDF has to be redone

◆ fastRaytracers()

std::vector< FastRaytracer > & fastRaytracers ( )
inlineprivate

Interface to fast ray-tracers of all modules.

Any accesses to underlying collection must be made with this method.

Returns
collection of fast ray-tracers (index = moduleID - 1)

Definition at line 221 of file TOPRecoManager.h.

222 {
223 if (m_fastRaytracers.empty()) set();
224 return m_fastRaytracers;
225 }
std::vector< FastRaytracer > m_fastRaytracers
collection of fast raytracers

◆ getBackgroundPDF()

const BackgroundPDF * getBackgroundPDF ( int  moduleID)
static

Returns background PDF of a given module.

Parameters
moduleIDslot ID (1-based)
Returns
pointer to background PDF or null pointer if moduleID is not valid

Definition at line 76 of file TOPRecoManager.cc.

77 {
78 const auto& collection = getInstance().backgroundPDFs();
79 unsigned k = moduleID - 1;
80 if (k < collection.size()) {
81 return &collection[k];
82 }
83
84 B2ERROR("TOPRecoManager::getBackgroundPDF: invalid moduleID" << LogVar("moduleID", moduleID));
85 return 0;
86 }
std::vector< BackgroundPDF > & backgroundPDFs()
Interface to background PDF's of all modules.
static TOPRecoManager & getInstance()
Returns instance of the class.
Class to store variables with their name which were sent to the logging service.

◆ getBackgroundPDFs()

static const std::vector< BackgroundPDF > & getBackgroundPDFs ( )
inlinestatic

Returns background PDF's of all modules.

Returns
collection of background PDF's (index = moduleID - 1)

Definition at line 76 of file TOPRecoManager.h.

76{return getInstance().backgroundPDFs();}

◆ getFastRaytracer()

const FastRaytracer * getFastRaytracer ( int  moduleID)
static

Returns fast ray-tracer of a given module.

Parameters
moduleIDslot ID (1-based)
Returns
pointer to fast ray-tracer or null pointer if moduleID is not valid

Definition at line 49 of file TOPRecoManager.cc.

50 {
51 const auto& collection = getInstance().fastRaytracers();
52 unsigned k = moduleID - 1;
53 if (k < collection.size()) {
54 collection[k].clear();
55 return &collection[k];
56 }
57
58 B2ERROR("TOPRecoManager::getFastRaytracer: invalid moduleID" << LogVar("moduleID", moduleID));
59 return 0;
60 }
std::vector< FastRaytracer > & fastRaytracers()
Interface to fast ray-tracers of all modules.

◆ getInstance()

TOPRecoManager & getInstance ( )
static

Returns instance of the class.

Returns
class instance

Definition at line 19 of file TOPRecoManager.cc.

20 {
21 static TOPRecoManager instance;
22 return instance;
23 }
TOPRecoManager()=default
Singleton: private constructor.

◆ getInverseRaytracer()

const InverseRaytracer * getInverseRaytracer ( int  moduleID)
static

Returns inverse ray-tracer of a given module.

Parameters
moduleIDslot ID (1-based)
Returns
pointer to inverse ray-tracer or null pointer if moduleID is not valid

Definition at line 36 of file TOPRecoManager.cc.

37 {
38 const auto& collection = getInstance().inverseRaytracers();
39 unsigned k = moduleID - 1;
40 if (k < collection.size()) {
41 collection[k].clear();
42 return &collection[k];
43 }
44
45 B2ERROR("TOPRecoManager::getInverseRaytracer: invalid moduleID" << LogVar("moduleID", moduleID));
46 return 0;
47 }
std::vector< InverseRaytracer > & inverseRaytracers()
Interface to inverse ray-tracers of all modules.

◆ getMaxTime()

static double getMaxTime ( )
inlinestatic

Returns time window upper edge.

Returns
time window upper edge

Definition at line 94 of file TOPRecoManager.h.

95 {
97 return getInstance().m_maxTime;
98 }
100 }
const TOPNominalTDC & getNominalTDC() const
Returns nominal time-to-digit conversion parameters.
Definition: TOPGeometry.h:218
double getTimeMax() const
Returns time range upper limit.
const TOPGeometry * getGeometry() const
Returns pointer to geometry object using basf2 units.
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.
double m_maxTime
time window upper edge
double m_minTime
time window lower edge

◆ getMinTime()

static double getMinTime ( )
inlinestatic

Returns time window lower edge.

Returns
time window lower edge

Definition at line 82 of file TOPRecoManager.h.

83 {
85 return getInstance().m_minTime;
86 }
88 }
double getTimeMin() const
Returns time range lower limit.

◆ getTimeWindowSize()

static double getTimeWindowSize ( )
inlinestatic

Returns size of time window.

Returns
size of time window

Definition at line 106 of file TOPRecoManager.h.

106{return getMaxTime() - getMinTime();}
static double getMaxTime()
Returns time window upper edge.
static double getMinTime()
Returns time window lower edge.

◆ getYScanner()

const YScanner * getYScanner ( int  moduleID)
static

Returns y-scanner of a given module.

Parameters
moduleIDslot ID (1-based)
Returns
pointer to y-scanner or null pointer if moduleID is not valid

Definition at line 62 of file TOPRecoManager.cc.

63 {
64 const auto& collection = getInstance().yScanners();
65 unsigned k = moduleID - 1;
66 if (k < collection.size()) {
67 collection[k].clear();
68 return &collection[k];
69 }
70
71 B2ERROR("TOPRecoManager::getYScanner: invalid moduleID" << LogVar("moduleID", moduleID));
72 return 0;
73 }
std::vector< YScanner > & yScanners()
Interface to y-scanners of all modules.

◆ inverseRaytracers()

std::vector< InverseRaytracer > & inverseRaytracers ( )
inlineprivate

Interface to inverse ray-tracers of all modules.

Any accesses to underlying collection must be made with this method.

Returns
collection of inverse ray-tracers (index = moduleID - 1)

Definition at line 215 of file TOPRecoManager.h.

216 {
217 if (m_inverseRaytracers.empty()) set();
218 return m_inverseRaytracers;
219 }
std::vector< InverseRaytracer > m_inverseRaytracers
collection of inverse raytracers

◆ set()

void set ( )
private

Sets the reconstruction object collections.

Definition at line 25 of file TOPRecoManager.cc.

26 {
27 const auto* geo = TOPGeometryPar::Instance()->getGeometry();
28 for (unsigned moduleID = 1; moduleID <= geo->getNumModules(); moduleID++) {
29 m_yScanners.push_back(YScanner(moduleID));
30 m_inverseRaytracers.push_back(InverseRaytracer(moduleID, m_yScanners.back().getCosTotal()));
31 m_fastRaytracers.push_back(FastRaytracer(moduleID));
32 m_backgroundPDFs.push_back(BackgroundPDF(moduleID));
33 }
34 }
std::vector< YScanner > m_yScanners
collection of y-scanners

◆ setChannelEffi()

void setChannelEffi ( )
static

Sets relative efficiencies of pixels.

Definition at line 150 of file TOPRecoManager.cc.

151 {
152 const double minEffi = 0.1;
153 const double maxEffi = 2.0;
154 for (auto& yScanner : getInstance().yScanners()) {
155 auto& pixelEfficiencies = yScanner.pixelEfficiencies();
156 int moduleID = pixelEfficiencies.getModuleID();
157 int numPixels = pixelEfficiencies.getNumPixels();
158 for (int pixelID = 1; pixelID <= numPixels; pixelID++) {
159 double effi = TOPGeometryPar::Instance()->getRelativePixelEfficiency(moduleID, pixelID);
160 if (effi < minEffi) {
161 B2WARNING("TOPRecoManager::setChannelEffi: relative pixel efficiency found rather small"
162 << LogVar("slot", moduleID)
163 << LogVar("pixel", pixelID)
164 << LogVar("efficiency", effi)
165 << " -> will set it to " << minEffi);
166 effi = minEffi;
167 } else if (effi > maxEffi) {
168 B2WARNING("TOPRecoManager::setChannelEffi: relative pixel efficiency found rather large"
169 << LogVar("slot", moduleID)
170 << LogVar("pixel", pixelID)
171 << LogVar("efficiency", effi)
172 << " -> will set it to " << maxEffi);
173 effi = maxEffi;
174 }
175 pixelEfficiencies.set(pixelID, effi);
176 }
177 }
178 getInstance().m_redoBkg = true;
179
180 B2INFO("TOPRecoManager: new relative pixel efficiencies have been passed to reconstruction");
181 }
double getRelativePixelEfficiency(int moduleID, int pixelID) const
Returns relative pixel efficiency (including CE, RQE and threshold efficiency)

◆ setChannelMask()

void setChannelMask ( const DBObjPtr< TOPCalChannelMask > &  mask,
const TOPAsicMask asicMask 
)
static

Sets channel masks.

Parameters
maskchannel mask
asicMaskmasked asics

Definition at line 88 of file TOPRecoManager.cc.

90 {
91 const auto& mapper = TOPGeometryPar::Instance()->getChannelMapper();
92 for (auto& yScanner : getInstance().yScanners()) {
93 auto& pixelMasks = yScanner.pixelMasks();
94 int moduleID = pixelMasks.getModuleID();
95 unsigned numChannels = pixelMasks.getNumPixels();
96 for (unsigned channel = 0; channel < numChannels; channel++) {
97 int pixelID = mapper.getPixelID(channel);
98 pixelMasks.set(pixelID, mask->isActive(moduleID, channel) and asicMask.isActive(moduleID, channel));
99 }
100 }
101 getInstance().m_redoBkg = true;
102
103 B2INFO("TOPRecoManager: new channel masks have been passed to reconstruction");
104 }
const ChannelMapper & getChannelMapper() const
Returns default channel mapper (mapping of channels to pixels)

◆ setDefaultTimeWindow()

static void setDefaultTimeWindow ( )
inlinestatic

Sets default time window (functions getMinTime(), getMaxTime() will then return default values from DB)

Definition at line 122 of file TOPRecoManager.h.

123 {
126 }

◆ setMirrorCenter()

void setMirrorCenter ( int  moduleID,
double  xc,
double  yc 
)
static

Sets the mirror center-of-curvature.

Parameters
moduleIDslot ID (1-based)
xccenter of curvature in x
yccenter of curvature in y

Definition at line 183 of file TOPRecoManager.cc.

184 {
187 auto& yScanners = getInstance().yScanners();
188 unsigned k = moduleID - 1;
189 if (k < yScanners.size()) {
190 inverseRaytracers[k].setMirrorCenter(xc, yc);
191 fastRaytracers[k].setMirrorCenter(xc, yc);
192 yScanners[k].setMirrorCenter(xc, yc);
193 return;
194 }
195
196 B2ERROR("TOPRecoManager::setMirrorCenter: invalid moduleID" << LogVar("moduleID", moduleID));
197 }

◆ setTimeWindow()

static void setTimeWindow ( double  minTime,
double  maxTime 
)
inlinestatic

Sets time window.

Parameters
minTimelower edge
maxTimeupper edge

Definition at line 113 of file TOPRecoManager.h.

114 {
115 getInstance().m_minTime = minTime;
116 getInstance().m_maxTime = maxTime;
117 }

◆ setUncalibratedChannelsOff() [1/2]

void setUncalibratedChannelsOff ( const DBObjPtr< TOPCalChannelT0 > &  channelT0)
static

Sets uncalibrated channels off.

Parameters
channelT0channel T0 calibration

Definition at line 106 of file TOPRecoManager.cc.

107 {
108 const auto& mapper = TOPGeometryPar::Instance()->getChannelMapper();
109 for (auto& yScanner : getInstance().yScanners()) {
110 auto& pixelMasks = yScanner.pixelMasks();
111 int moduleID = pixelMasks.getModuleID();
112 unsigned numChannels = pixelMasks.getNumPixels();
113 for (unsigned channel = 0; channel < numChannels; channel++) {
114 if (channelT0->isCalibrated(moduleID, channel)) continue;
115 int pixelID = mapper.getPixelID(channel);
116 pixelMasks.setPixelOff(pixelID);
117 }
118 }
119 getInstance().m_redoBkg = true;
120
121 B2INFO("TOPRecoManager: channelT0-uncalibrated channels have been masked off");
122 }

◆ setUncalibratedChannelsOff() [2/2]

void setUncalibratedChannelsOff ( const DBObjPtr< TOPCalTimebase > &  timebase)
static

Sets uncalibrated channels off.

Parameters
timebasetimebase calibration

Definition at line 124 of file TOPRecoManager.cc.

125 {
126 const auto& ch_mapper = TOPGeometryPar::Instance()->getChannelMapper();
127 const auto& fe_mapper = TOPGeometryPar::Instance()->getFrontEndMapper();
128 for (auto& yScanner : getInstance().yScanners()) {
129 auto& pixelMasks = yScanner.pixelMasks();
130 int moduleID = pixelMasks.getModuleID();
131 unsigned numChannels = pixelMasks.getNumPixels();
132 for (unsigned channel = 0; channel < numChannels; channel++) {
133 const auto* fe = fe_mapper.getMap(moduleID, channel / 128);
134 if (not fe) {
135 B2ERROR("TOPRecoManager::setUncalibratedChannelsOff no front-end map found");
136 continue;
137 }
138 auto scrodID = fe->getScrodID();
139 const auto* sampleTimes = timebase->getSampleTimes(scrodID, channel);
140 if (sampleTimes->isCalibrated()) continue;
141 int pixelID = ch_mapper.getPixelID(channel);
142 pixelMasks.setPixelOff(pixelID);
143 }
144 }
145 getInstance().m_redoBkg = true;
146
147 B2INFO("TOPRecoManager: timebase-uncalibrated channels have been masked off");
148 }
const FrontEndMapper & getFrontEndMapper() const
Returns front-end mapper (mapping of SCROD's to positions within TOP modules)

◆ yScanners()

std::vector< YScanner > & yScanners ( )
inlineprivate

Interface to y-scanners of all modules.

Any accesses to underlying collection must be made with this method.

Returns
collection of y-scanners (index = moduleID - 1)

Definition at line 227 of file TOPRecoManager.h.

228 {
229 if (m_yScanners.empty()) set();
230 return m_yScanners;
231 }

Member Data Documentation

◆ m_backgroundPDFs

std::vector<BackgroundPDF> m_backgroundPDFs
private

collection of background PDF's

Definition at line 206 of file TOPRecoManager.h.

◆ m_fastRaytracers

std::vector<FastRaytracer> m_fastRaytracers
private

collection of fast raytracers

Definition at line 204 of file TOPRecoManager.h.

◆ m_inverseRaytracers

std::vector<InverseRaytracer> m_inverseRaytracers
private

collection of inverse raytracers

Definition at line 203 of file TOPRecoManager.h.

◆ m_maxTime

double m_maxTime = 0
private

time window upper edge

Definition at line 208 of file TOPRecoManager.h.

◆ m_minTime

double m_minTime = 0
private

time window lower edge

Definition at line 207 of file TOPRecoManager.h.

◆ m_redoBkg

bool m_redoBkg = false
private

flag to signal whether backgroundPDF has to be redone

Definition at line 209 of file TOPRecoManager.h.

◆ m_yScanners

std::vector<YScanner> m_yScanners
private

collection of y-scanners

Definition at line 205 of file TOPRecoManager.h.


The documentation for this class was generated from the following files: