Belle II Software  release-05-02-19
PXDBadSensorTagModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Bjoern Spruck *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <pxd/modules/pxdHelper/PXDBadSensorTagModule.h>
12 #include <framework/core/ModuleParam.templateDetails.h>
13 
14 
15 using namespace std;
16 using namespace Belle2;
17 using namespace Belle2::PXD;
18 using namespace Belle2::PXD::PXDError;
19 
20 
21 REG_MODULE(PXDBadSensorTag)
22 
23 
25  Module()
26 {
27  //Set module properties
28  setDescription("Mark bad-data PXD modules");
29  setPropertyFlags(c_ParallelProcessingCertified);
30  addParam("zeroSuppressionCut", m_0cut, "Minimum charge for a raw hit to carry", 0);
31  addParam("nrHitsCut", m_nrHitsCut, "Cut on nr hits per module [[id1,cut1],[id1,cut2],...]");
32 }
33 
34 void PXDBadSensorTagModule::initialize()
35 {
36  //Register output collections
37  m_storeRawHits.isRequired(m_PXDRawHitsName);
38  m_storeDAQEvtStats.isRequired(m_PXDDAQEvtStatsName);
39 
40  for (auto& m : m_nrHitsCut) {
41  if (m.size() != 2) { B2ERROR("Wrong nr of Parameter " << m.size()); continue;}
42  m_cut[VxdID(m[0])] = m[1];
43  }
44 }
45 
46 void PXDBadSensorTagModule::event()
47 {
48  std::map <VxdID, int> freq;// count the number of RawHits per sensor
49  for (auto& p : m_storeRawHits) {
50  if (p.getCharge() < m_0cut) continue;// only count above some threshold
51  freq[p.getSensorID()]++;
52  }
53 
54  for (auto& p : *m_storeDAQEvtStats) {
55  for (auto& c : p) {
56  for (auto& e : c) {
57  if (freq[e.getSensorID()] > m_cut[e.getSensorID()]) {
58  e.markUnusable();
59  }
60  }
61  }
62  }
63 }
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
prepareAsicCrosstalkSimDB.e
e
aux.
Definition: prepareAsicCrosstalkSimDB.py:53
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::PXD
Namespace to encapsulate code needed for simulation and reconstrucion of the PXD.
Definition: PXDCalibrationUtilities.h:28
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::PXD::PXDBadSensorTagModule
The PXD bad sensor tagger module.
Definition: PXDBadSensorTagModule.h:46