Belle II Software  release-05-01-25
SVDZeroSuppressionEmulatorModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - 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 <svd/modules/svdSimulation/SVDZeroSuppressionEmulatorModule.h>
12 
13 using namespace Belle2;
14 using namespace std;
15 
16 //-----------------------------------------------------------------
17 // Register the Module
18 //-----------------------------------------------------------------
19 REG_MODULE(SVDZeroSuppressionEmulator)
20 
21 //-----------------------------------------------------------------
22 // Implementation
23 //-----------------------------------------------------------------
24 
26 {
27  setDescription("Filters out SVDShaperDigit with less than 1 (default) sample is below a certain threshold, by default set at SN = 3.");
28  setPropertyFlags(c_ParallelProcessingCertified);
29 
30  addParam("FADCmode", m_FADCmode,
31  "FADC mode: if true the approximation to integer is done", bool(true));
32  addParam("ShaperDigits", m_storeShaperDigitsName,
33  "ShaperDigits collection name", string(""));
34  addParam("ShaperDigitsIN", m_SVDShaperDigitsIN,
35  "Kept ShaperDigits collection name", string(""));
36  addParam("ShaperDigitsOUT", m_SVDShaperDigitsOUT,
37  "ShaperDigits collection name", string(""));
38  addParam("SNthreshold", m_cutSN,
39  "minimum SN to be kept", float(3));
40  addParam("numberOfSamples", m_nSample,
41  "number of samples above threshold to be kept ", int(1));
42  addParam("createOUTStripsList", m_createOutside,
43  "create the StoreArray of outside strips", bool(false));
44 
45 
46 }
47 
48 
49 SVDZeroSuppressionEmulatorModule::~SVDZeroSuppressionEmulatorModule()
50 {
51 }
52 
53 
55 {
56  m_storeShaper.isRequired(m_storeShaperDigitsName);
57 
58  m_selectorIN.registerSubset(m_storeShaper, m_SVDShaperDigitsIN);
59  // m_selectorIN.inheritAllRelations();
60 
61  if (m_createOutside) {
62  m_selectorOUT.registerSubset(m_storeShaper, m_SVDShaperDigitsOUT);
63  // m_selectorOUT.inheritAllRelations();
64  }
65 
66 }
67 
68 
70 {
71 
72  // If no digits, nothing to do
73  if (!m_storeShaper || !m_storeShaper.getEntries()) return;
74 
75  m_selectorIN.select([&](const SVDShaperDigit * shaper) { return this->passesZS(shaper) ;});
76 
77  if (m_createOutside)
78  m_selectorOUT.select([&](const SVDShaperDigit * shaper) { return ! this->passesZS(shaper) ;});
79 
80  B2DEBUG(10, " shaper digits = " << m_storeShaper.getEntries() <<
81  ", shaper digits IN = " << (((StoreArray<SVDShaperDigit>*)(m_selectorIN.getSubSet()))->getEntries()));
82 
83  if (m_createOutside)
84  B2DEBUG(10, " shaper digits = " << m_storeShaper.getEntries() <<
85  ", shaper digits IN = " << (((StoreArray<SVDShaperDigit>*)(m_selectorIN.getSubSet()))->getEntries()) <<
86  ", shaper digits OUT = " << (((StoreArray<SVDShaperDigit>*)(m_selectorOUT.getSubSet()))->getEntries()));
87 
88 }
89 
90 
92 {
93 
94  VxdID thisSensorID = shaper->getSensorID();
95  bool thisSide = shaper->isUStrip();
96  int thisCellID = shaper->getCellID();
97 
98  float noise = m_NoiseCal.getNoise(thisSensorID, thisSide, thisCellID);
99  float cutMinSignal = m_cutSN * noise;
100 
101  // B2INFO("before = "<<cutMinSignal);
102  if (m_FADCmode) {
103  cutMinSignal = cutMinSignal + 0.5;
104  cutMinSignal = (int)cutMinSignal;
105  }
106  // B2INFO("after = "<<cutMinSignal);
107  if (shaper->passesZS(m_nSample, cutMinSignal))
108  return true;
109 
110  return false;
111 };
112 
Belle2::SVDZeroSuppressionEmulatorModule
This module filters out strips that do not pass a ZS cut from the SVDShaperDigit StoreArray.
Definition: SVDZeroSuppressionEmulatorModule.h:44
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::SVDShaperDigit::getSensorID
VxdID getSensorID() const
Get the sensor ID.
Definition: SVDShaperDigit.h:116
Belle2::SVDZeroSuppressionEmulatorModule::event
virtual void event() override
This method is the core of the SVDZeroSuppressionEmulator.
Definition: SVDZeroSuppressionEmulatorModule.cc:69
Belle2::SVDShaperDigit
The SVD ShaperDigit class.
Definition: SVDShaperDigit.h:46
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::SVDZeroSuppressionEmulatorModule::initialize
virtual void initialize() override
Initialize the SVDZeroSuppressionEmulator.
Definition: SVDZeroSuppressionEmulatorModule.cc:54
Belle2::SVDShaperDigit::passesZS
bool passesZS(int nSamples, float cutMinSignal) const
does the strip pass the ZS cut?
Definition: SVDShaperDigit.h:269
Belle2::SVDZeroSuppressionEmulatorModule::passesZS
bool passesZS(const SVDShaperDigit *)
returns true if the strip passes the ZS cut
Definition: SVDZeroSuppressionEmulatorModule.cc:91
Belle2::SVDShaperDigit::getCellID
short int getCellID() const
Get strip ID.
Definition: SVDShaperDigit.h:132
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::SVDShaperDigit::isUStrip
bool isUStrip() const
Get strip direction.
Definition: SVDShaperDigit.h:127