Belle II Software development
PXDROIFinderModule.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/roiFinding/pxd/PXDROIFinderModule.h>
10
11#include <framework/datastore/StoreArray.h>
12#include <framework/datastore/RelationArray.h>
13
14#include <genfit/MaterialEffects.h>
15
16#include <tracking/dbobjects/ROICalculationParameters.h>
17#include <tracking/dataobjects/RecoTrack.h>
18#include <tracking/dataobjects/ROIid.h>
19#include <tracking/dataobjects/PXDIntercept.h>
20#include <tracking/roiFinding/ROIToUnitTranslator.templateDetails.h>
21#include <tracking/roiFinding/VXDInterceptor.templateDetails.h>
22
23using namespace Belle2;
24
25//-----------------------------------------------------------------
26// Register the Module
27//-----------------------------------------------------------------
28REG_MODULE(PXDROIFinder);
29
30//-----------------------------------------------------------------
31// Implementation
32//-----------------------------------------------------------------
33
35{
36 //Set module properties
37 setDescription("This module performs the reduction of the PXD data output");
39
40
41 addParam("recoTrackListName", m_recoTracksListName, " name of the list of the fitted tracks", std::string(""));
42
43 addParam("PXDInterceptListName", m_PXDInterceptListName, "name of the list of interceptions", std::string(""));
44 addParam("ROIListName", m_ROIListName, "name of the list of ROIs", std::string(""));
45
46
47 addParam("tolerancePhi", m_tolerancePhi,
48 "Tolerance by finding sensor in phi coordinate (radians). Will only be used if overrideDBROICalculation is set to True.",
49 double(0.15));
50 addParam("toleranceZ", m_toleranceZ,
51 "Tolerance by finding sensor in Z coordinate (cm). Will only be used if overrideDBROICalculation is set to True.",
52 double(0.5));
53 addParam("sigmaSystU", m_sigmaSystU,
54 "Systematic sigma in the u local coordinate. Will only be used if overrideDBROICalculation is set to True.",
55 double(0.025));
56 addParam("sigmaSystV", m_sigmaSystV,
57 "Systematic sigma in the V local coordinate. Will only be used if overrideDBROICalculation is set to True.",
58 double(0.025));
59 addParam("numSigmaTotU", m_numSigmaTotU,
60 "Number of sigmas (total) in the U local coordinate. Will only be used if overrideDBROICalculation is set to True.",
61 double(10));
62 addParam("numSigmaTotV", m_numSigmaTotV,
63 "Number of sigmas (total) in the V local coordinate. Will only be used if overrideDBROICalculation is set to True.",
64 double(10));
65 addParam("maxWidthU", m_maxWidthU,
66 "Upper limit on width of the ROI in the U local coordinate (cm). Will only be used if overrideDBROICalculation is set to True.",
67 double(0.5));
68 addParam("maxWidthV", m_maxWidthV,
69 "Upper limit on width of the ROI in the V local coordinate (cm). Will only be used if overrideDBROICalculation is set to True.",
70 double(0.5));
71 addParam("overrideDBROICalculation", m_overrideDBROICalculation,
72 "Override the parameters from DB for testing or debugging. Required to be True to use the other ROI calculation parameters.",
73 false);
74 addParam("ROIFindingForDQM", m_ROIFindingForDQM,
75 "Is this ROI finding for DQM? If false, create PXDIntercepts by extrapolating tracks in both directions. If true, only extrapolate backwards.",
77}
78
79
81{
85
87 m_PXDIntercepts.registerRelationTo(m_ROIs);
88
89 if (!genfit::MaterialEffects::getInstance()->isInitialized()) {
90 B2FATAL("Material effects not set up. Please use SetupGenfitExtrapolationModule.");
91 }
92
93}
94
96{
98 // Use ROI calculation parameters from module parameters.
99 B2WARNING("ROI calculation parameters from DB are valid, but they are overridden by the module parameters.\n"
100 " --> Using module parameters instead of parameters from DB.");
101 } else if (m_ROICalculationParameters.isValid()) {
102 // Use ROI calculation parameters from DB.
104 m_toleranceZ = m_ROICalculationParameters->getTolerancePhi();
105 m_numSigmaTotU = m_ROICalculationParameters->getNumSigmaTotU();
106 m_numSigmaTotV = m_ROICalculationParameters->getNumSigmaTotV();
107 m_sigmaSystU = m_ROICalculationParameters->getSigmaSystU();
108 m_sigmaSystV = m_ROICalculationParameters->getSigmaSystV();
109 m_maxWidthU = m_ROICalculationParameters->getMaxWidthU();
110 m_maxWidthV = m_ROICalculationParameters->getMaxWidthV();
111 } else {
112 // No valid ROI calculation parameters from DB, crash in any case, even though module parameters are provided.
113 B2FATAL("No ROI configuration for the current run found (missing ROICalculationParameters payload).");
114 }
115
116 B2DEBUG(29, "||| PXDROIFinder Parameters:");
117 B2DEBUG(29, " tolerance: phi = " << m_tolerancePhi);
118 B2DEBUG(29, " z = " << m_toleranceZ);
119 B2DEBUG(29, " n sigma: u = " << m_numSigmaTotU);
120 B2DEBUG(29, " v = " << m_numSigmaTotV);
121 B2DEBUG(29, " systematic: u = " << m_sigmaSystU);
122 B2DEBUG(29, " v = " << m_sigmaSystV);
123 B2DEBUG(29, " max width: u = " << m_maxWidthU);
124 B2DEBUG(29, " v = " << m_maxWidthV);
125
135
137 std::vector<float> {1.42854, 2.21218},
141
142}
143
144
146{
147 B2DEBUG(29, "%%%%%%%% Number of RecoTracks in the events = " << m_RecoTracks.getEntries());
148
149 RelationArray recoTrackToPXDIntercepts(m_RecoTracks, m_PXDIntercepts);
150 recoTrackToPXDIntercepts.create();
151
152 RelationArray PXDInterceptsToROIids(m_PXDIntercepts, m_ROIs);
153 PXDInterceptsToROIids.create();
154
155 if (m_thePXDInterceptor) m_thePXDInterceptor->fillInterceptList(&m_PXDIntercepts, m_RecoTracks, &recoTrackToPXDIntercepts);
156
158
159}
160
161
163{
166}
167
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
Definition: DataStore.h:72
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
double m_maxWidthV
maximum V width of the ROI
bool m_overrideDBROICalculation
Override DB parameters for ROI calculation for debugging and testing.
std::string m_recoTracksListName
track list name
std::string m_ROIListName
ROI list name.
void initialize() override
Initializes the module.
std::string m_PXDInterceptListName
intercept list name
double m_maxWidthU
maximum U width of the ROI
void event() override
This method is called for each event.
void endRun() override
This method is called at the end of the event processing.
VXDInterceptor< PXDIntercept > * m_thePXDInterceptor
the pxd interceptor object
double m_tolerancePhi
tolerance for finding sensor in phi coordinate (radians)
PXDROIFinderModule()
Constructor of the module.
double m_sigmaSystV
fixed width to add in quadrature to the extrapolation error and obtain the ROI V width
bool m_ROIFindingForDQM
ROI finding for DQM or for data reduction.
double m_numSigmaTotV
number of sigma (stat+syst) determining the U width of the ROI
void beginRun() override
Called when entering a new run.
DBObjPtr< ROICalculationParameters > m_ROICalculationParameters
Configuration parameters for ROIs.
double m_sigmaSystU
fixed width to add in quadrature to the extrapolation error and obtain the ROI U width
StoreArray< PXDIntercept > m_PXDIntercepts
PXDIntercepts StoreArray.
ROIinfo m_ROIinfo
contains the parameters that can be changed by the user
double m_numSigmaTotU
number of sigma (stat+syst) determining the U width of the ROI
StoreArray< RecoTrack > m_RecoTracks
RecoTracks StoreArray.
ROIToUnitTranslator< PXDIntercept > * m_thePixelTranslator
the pixel translator object
double m_toleranceZ
tolerance for finding sensor in Z coordinate (cm)
StoreArray< ROIid > m_ROIs
ROIs StoreArray.
Translator for ROI-geometry-information into a list of pixels or strips.
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.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
Definition: StoreArray.h:140
This Class implements the interceptor of the SVD tracks on the PXD layers.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#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.
double sigmaSystV
fixed width to add in quadrature to the extrapolation error and obtain the ROI V width
Definition: ROIinfo.h:17
double numSigmaTotU
number of sigma (stat+syst) determining the U width of the ROI
Definition: ROIinfo.h:18
double maxWidthU
maximum U width of the ROI
Definition: ROIinfo.h:20
std::string PXDInterceptListName
Intercept list name.
Definition: ROIinfo.h:23
double sigmaSystU
fixed width to add in quadrature to the extrapolation error and obtain the ROI U width
Definition: ROIinfo.h:16
std::string recoTracksListName
track list name
Definition: ROIinfo.h:25
double numSigmaTotV
number of sigma (stat+syst) determining the U width of the ROI
Definition: ROIinfo.h:19
std::string ROIListName
ROI list name.
Definition: ROIinfo.h:24
double maxWidthV
maximum U width of the ROI
Definition: ROIinfo.h:21