Belle II Software  release-08-01-10
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/pxdDataReduction/PXDROIFinderModule.h>
10 #include <framework/datastore/StoreArray.h>
11 #include <framework/datastore/RelationArray.h>
12 #include <genfit/MaterialEffects.h>
13 
14 using namespace Belle2;
15 
16 //-----------------------------------------------------------------
17 // Register the Module
18 //-----------------------------------------------------------------
19 REG_MODULE(PXDROIFinder);
20 
21 //-----------------------------------------------------------------
22 // Implementation
23 //-----------------------------------------------------------------
24 
26 {
27  //Set module properties
28  setDescription("This module performs the reduction of the PXD data output");
30 
31 
32  addParam("recoTrackListName", m_recoTracksListName, " name of the list of the fitted tracks", std::string(""));
33 
34  addParam("PXDInterceptListName", m_PXDInterceptListName, "name of the list of interceptions", std::string(""));
35  addParam("ROIListName", m_ROIListName, "name of the list of ROIs", std::string(""));
36 
37 
38  addParam("tolerancePhi", m_tolerancePhi,
39  "Tolerance by finding sensor in phi coordinate (radians). Will only be used if overrideDBROICalculation is set to True.",
40  double(0.15));
41  addParam("toleranceZ", m_toleranceZ,
42  "Tolerance by finding sensor in Z coordinate (cm). Will only be used if overrideDBROICalculation is set to True.",
43  double(0.5));
44  addParam("sigmaSystU", m_sigmaSystU,
45  "Systematic sigma in the u local coordinate. Will only be used if overrideDBROICalculation is set to True.",
46  double(0.025));
47  addParam("sigmaSystV", m_sigmaSystV,
48  "Systematic sigma in the V local coordinate. Will only be used if overrideDBROICalculation is set to True.",
49  double(0.025));
50  addParam("numSigmaTotU", m_numSigmaTotU,
51  "Number of sigmas (total) in the U local coordinate. Will only be used if overrideDBROICalculation is set to True.",
52  double(10));
53  addParam("numSigmaTotV", m_numSigmaTotV,
54  "Number of sigmas (total) in the V local coordinate. Will only be used if overrideDBROICalculation is set to True.",
55  double(10));
56  addParam("maxWidthU", m_maxWidthU,
57  "Upper limit on width of the ROI in the U local coordinate (cm). Will only be used if overrideDBROICalculation is set to True.",
58  double(0.5));
59  addParam("maxWidthV", m_maxWidthV,
60  "Upper limit on width of the ROI in the V local coordinate (cm). Will only be used if overrideDBROICalculation is set to True.",
61  double(0.5));
62  addParam("overrideDBROICalculation", m_overrideDBROICalculation,
63  "Override the parameters from DB for testing or debugging. Required to be True to use the other ROI calculation parameters.",
64  false);
65 }
66 
67 
69 {
73 
75  m_PXDIntercepts.registerRelationTo(m_ROIs);
76 
77  if (!genfit::MaterialEffects::getInstance()->isInitialized()) {
78  B2FATAL("Material effects not set up. Please use SetupGenfitExtrapolationModule.");
79  }
80 
81 }
82 
84 {
86  // Use ROI calculation parameters from module parameters.
87  B2WARNING("ROI calculation parameters from DB are valid, but they are overridden by the module parameters.\n"
88  " --> Using module parameters instead of parameters from DB.");
89  } else if (m_ROICalculationParameters.isValid()) {
90  // Use ROI calculation parameters from DB.
91  m_tolerancePhi = m_ROICalculationParameters->getToleranceZ();
92  m_toleranceZ = m_ROICalculationParameters->getTolerancePhi();
93  m_numSigmaTotU = m_ROICalculationParameters->getNumSigmaTotU();
94  m_numSigmaTotV = m_ROICalculationParameters->getNumSigmaTotV();
95  m_sigmaSystU = m_ROICalculationParameters->getSigmaSystU();
96  m_sigmaSystV = m_ROICalculationParameters->getSigmaSystV();
97  m_maxWidthU = m_ROICalculationParameters->getMaxWidthU();
98  m_maxWidthV = m_ROICalculationParameters->getMaxWidthV();
99  } else {
100  // No valid ROI calculation parameters from DB, crash in any case, even though module parameters are provided.
101  B2FATAL("No ROI configuration for the current run found (missing ROICalculationParameters payload).");
102  }
103 
104  B2DEBUG(29, "||| PXDROIFinder Parameters:");
105  B2DEBUG(29, " tolerance: phi = " << m_tolerancePhi);
106  B2DEBUG(29, " z = " << m_toleranceZ);
107  B2DEBUG(29, " n sigma: u = " << m_numSigmaTotU);
108  B2DEBUG(29, " v = " << m_numSigmaTotV);
109  B2DEBUG(29, " systematic: u = " << m_sigmaSystU);
110  B2DEBUG(29, " v = " << m_sigmaSystV);
111  B2DEBUG(29, " max width: u = " << m_maxWidthU);
112  B2DEBUG(29, " v = " << m_maxWidthV);
113 
123 
125 
127 
128 }
129 
130 
132 {
133  B2DEBUG(29, "%%%%%%%% Number of RecoTracks in the events = " << m_RecoTracks.getEntries());
134 
135  RelationArray recoTrackToPXDIntercepts(m_RecoTracks, m_PXDIntercepts);
136  recoTrackToPXDIntercepts.create();
137 
138  RelationArray PXDInterceptsToROIids(m_PXDIntercepts, m_ROIs);
139  PXDInterceptsToROIids.create();
140 
142 
144 
145 }
146 
147 
149 {
152 }
153 
@ 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
The PXDInterceptor class fills a StoreArray of PXDIntercepts that will be used to define the PXD ROIs...
void fillInterceptList(StoreArray< PXDIntercept > *listToBeFilled, const StoreArray< RecoTrack > &trackList, RelationArray *recoTrackToPXDIntercepts)
Fill the list of PXD intecepts corresponding to the list of track candidates.
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.
ROIPixelTranslator * m_thePixelTranslator
the pixel translator object
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.
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
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.
double m_toleranceZ
tolerance for finding sensor in Z coordinate (cm)
PXDInterceptor * m_thePXDInterceptor
the pxd interceptor object
StoreArray< ROIid > m_ROIs
ROIs StoreArray.
Translator for ROI-geometry-information into a list of pixels.
void fillRoiIDList(StoreArray< PXDIntercept > *listOfIntercepts, StoreArray< ROIid > *ROIidList)
Append the ROIid to the list listToBeFilled.
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
REG_MODULE(arichBtest)
Register the Module.
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
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