Belle II Software development
SVDZeroSuppressionEmulatorModule.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 <svd/modules/svdSimulation/SVDZeroSuppressionEmulatorModule.h>
10
11using namespace Belle2;
12using namespace std;
13
14//-----------------------------------------------------------------
15// Register the Module
16//-----------------------------------------------------------------
17REG_MODULE(SVDZeroSuppressionEmulator);
18
19//-----------------------------------------------------------------
20// Implementation
21//-----------------------------------------------------------------
22
24{
25 setDescription("Filters out SVDShaperDigit with less than 1 (default) sample is below a certain threshold, by default set at SN = 3.");
27
28 addParam("FADCmode", m_FADCmode,
29 "FADC mode: if true the approximation to integer is done", bool(true));
30 addParam("ShaperDigits", m_storeShaperDigitsName,
31 "ShaperDigits collection name", string(""));
32 addParam("ShaperDigitsIN", m_SVDShaperDigitsIN,
33 "Kept ShaperDigits collection name", string(""));
34 addParam("ShaperDigitsOUT", m_SVDShaperDigitsOUT,
35 "ShaperDigits collection name", string(""));
36 addParam("SNthreshold", m_cutSN,
37 "minimum SN to be kept", float(3));
38 addParam("numberOfSamples", m_nSample,
39 "number of samples above threshold to be kept ", int(1));
40 addParam("createOUTStripsList", m_createOutside,
41 "create the StoreArray of outside strips", bool(false));
42
43
44}
45
46
47SVDZeroSuppressionEmulatorModule::~SVDZeroSuppressionEmulatorModule()
48{
49}
50
51
53{
55
57 m_selectorIN.registerSubset(m_storeShaper);
58 } else {
60 m_selectorIN.inheritAllRelations();
61 }
62
63 if (m_createOutside) {
65 m_selectorOUT.registerSubset(m_storeShaper);
66 } else {
68 m_selectorOUT.inheritAllRelations();
69 }
70 }
71
72}
73
74
76{
77
78 // If no digits, nothing to do
79 if (!m_storeShaper || !m_storeShaper.getEntries()) return;
80
81 m_selectorIN.select([&](const SVDShaperDigit * shaper) { return this->passesZS(shaper) ;});
82
84 m_selectorOUT.select([&](const SVDShaperDigit * shaper) { return ! this->passesZS(shaper) ;});
85
86 B2DEBUG(10, " shaper digits = " << m_storeShaper.getEntries() <<
87 ", shaper digits IN = " << (((StoreArray<SVDShaperDigit>*)(m_selectorIN.getSubSet()))->getEntries()));
88
90 B2DEBUG(10, " shaper digits = " << m_storeShaper.getEntries() <<
91 ", shaper digits IN = " << (((StoreArray<SVDShaperDigit>*)(m_selectorIN.getSubSet()))->getEntries()) <<
92 ", shaper digits OUT = " << (((StoreArray<SVDShaperDigit>*)(m_selectorOUT.getSubSet()))->getEntries()));
93
94}
95
96
98{
99
100 VxdID thisSensorID = shaper->getSensorID();
101 bool thisSide = shaper->isUStrip();
102 int thisCellID = shaper->getCellID();
103
104 float noise = m_NoiseCal.getNoise(thisSensorID, thisSide, thisCellID);
105 float cutMinSignal = m_cutSN * noise;
106
107 // B2INFO("before = "<<cutMinSignal);
108 if (m_FADCmode) {
109 cutMinSignal = cutMinSignal + 0.5;
110 cutMinSignal = (int)cutMinSignal;
111 }
112 // B2INFO("after = "<<cutMinSignal);
113 if (shaper->passesZS(m_nSample, cutMinSignal))
114 return true;
115
116 return false;
117};
118
@ c_WriteOut
Object/array should be saved by output modules.
Definition: DataStore.h:70
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
float getNoise(const VxdID &sensorID, const bool &isU, const unsigned short &strip) const
This is the method for getting the noise.
The SVD ShaperDigit class.
bool passesZS(int nSamples, float cutMinSignal) const
does the strip pass the ZS cut?
VxdID getSensorID() const
Get the sensor ID.
short int getCellID() const
Get strip ID.
bool isUStrip() const
Get strip direction.
SelectSubset< SVDShaperDigit > m_selectorIN
selector of the subset of the SVDShaperDigit passing ZS
bool m_FADCmode
if true, same algorithm as on FADC is applied
virtual void initialize() override
Initialize the SVDZeroSuppressionEmulator.
std::string m_storeShaperDigitsName
Name of the collections to use for the SVDShaperDigits.
virtual void event() override
This method is the core of the SVDZeroSuppressionEmulator.
SVDNoiseCalibrations m_NoiseCal
SVDNoise calibration db object.
bool passesZS(const SVDShaperDigit *)
returns true if the strip passes the ZS cut
SelectSubset< SVDShaperDigit > m_selectorOUT
selector of the subset of the SVDShaperDigit not passing ZS
SVDZeroSuppressionEmulatorModule()
Constructor defining the parameters.
int m_nSample
minimum number of samples required to be above threshold
bool m_createOutside
if true a StoreArray of Strips zero-suppressed is created
StoreArray< SVDShaperDigit > m_storeShaper
store arrays
std::string m_SVDShaperDigitsOUT
name of SVDShaperDigits NOT passing ZS
std::string m_SVDShaperDigitsIN
name of SVDShaperDigits passing ZS
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
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.
STL namespace.