Belle II Software  release-08-01-10
ARICHBadChannels.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 <arich/dbobjects/ARICHBadChannels.h>
10 
11 #include <algorithm>
12 
13 using namespace Belle2;
14 using namespace std;
15 
16 int ARICHBadChannels::getHapdCutChannel(unsigned int i) const
17 {
18  if (i < m_hapdCutChannels.size()) return m_hapdCutChannels[i];
19  else return -1;
20 }
21 
22 
23 int ARICHBadChannels::getHapdBadChannel(unsigned int i) const
24 {
25  if (i < m_hapdBadChannels.size()) return m_hapdBadChannels[i];
26  else return -1;
27 }
28 
29 void ARICHBadChannels::setHapdCutChannel(std::vector<int> channels)
30 {
31  m_hapdCutChannels = channels;
32  m_hapdListOfBadChannels.insert(m_hapdListOfBadChannels.end(), channels.begin(), channels.end());
33  std::sort(m_hapdListOfBadChannels.begin(), m_hapdListOfBadChannels.end());
34  m_hapdListOfBadChannels.erase(std::unique(m_hapdListOfBadChannels.begin(), m_hapdListOfBadChannels.end()),
35  m_hapdListOfBadChannels.end());
36 }
37 
38 void ARICHBadChannels::setHapdBadChannel(std::vector<int> channels)
39 {
40  m_hapdBadChannels = channels;
41  m_hapdListOfBadChannels.insert(m_hapdListOfBadChannels.end(), channels.begin(), channels.end());
42  std::sort(m_hapdListOfBadChannels.begin(), m_hapdListOfBadChannels.end());
43  m_hapdListOfBadChannels.erase(std::unique(m_hapdListOfBadChannels.begin(), m_hapdListOfBadChannels.end()),
44  m_hapdListOfBadChannels.end());
45 }
46 
48 {
49  std::vector<int> m_hapdAllBadCHs = ARICHBadChannels::getHapdListOfBadChannels();
50  if (i < m_hapdAllBadCHs.size()) return m_hapdAllBadCHs[i];
51  else return -1;
52 }
53 
54 int ARICHBadChannels::getFebDeadChannel(unsigned int i) const
55 {
56  if (i < m_febDeadChannels.size()) return m_febDeadChannels[i];
57  else return -1;
58 }
59 
60 
61 int ARICHBadChannels::getAsicDeadChannel(unsigned int i) const
62 {
63  if (i < m_asicDeadChannels.size()) return m_asicDeadChannels[i];
64  else return -1;
65 }
66 
67 
68 int ARICHBadChannels::getAsicBadConnChannel(unsigned int i) const
69 {
70  if (i < m_asicBadConnChannels.size()) return m_asicBadConnChannels[i];
71  else return -1;
72 }
73 
74 
76 {
77  if (i < m_asicBadOffsetChannels.size()) return m_asicBadOffsetChannels[i];
78  else return -1;
79 }
80 
81 
82 int ARICHBadChannels::getAsicBadLinChannel(unsigned int i) const
83 {
84  if (i < m_asicBadLinChannels.size()) return m_asicBadLinChannels[i];
85  else return -1;
86 }
87 
88 void ARICHBadChannels::setFebDeadChannels(std::vector<int> deadChannels)
89 {
90  m_febDeadChannels = deadChannels;
91  m_febListOfBadChannels.insert(m_febListOfBadChannels.end(), deadChannels.begin(), deadChannels.end());
92  std::sort(m_febListOfBadChannels.begin(), m_febListOfBadChannels.end());
93  m_febListOfBadChannels.erase(std::unique(m_febListOfBadChannels.begin(), m_febListOfBadChannels.end()),
94  m_febListOfBadChannels.end());
95 }
96 
97 
98 void ARICHBadChannels::setAsicDeadChannels(std::vector<int> deadChannels)
99 {
100  m_asicDeadChannels = deadChannels;
101  m_febListOfBadChannels.insert(m_febListOfBadChannels.end(), deadChannels.begin(), deadChannels.end());
102  std::sort(m_febListOfBadChannels.begin(), m_febListOfBadChannels.end());
103  m_febListOfBadChannels.erase(std::unique(m_febListOfBadChannels.begin(), m_febListOfBadChannels.end()),
104  m_febListOfBadChannels.end());
105 }
106 
107 void ARICHBadChannels::setAsicBadConnChannels(std::vector<int> badConnChannels)
108 {
109  m_asicBadConnChannels = badConnChannels;
110  m_febListOfBadChannels.insert(m_febListOfBadChannels.end(), badConnChannels.begin(), badConnChannels.end());
111  std::sort(m_febListOfBadChannels.begin(), m_febListOfBadChannels.end());
112  m_febListOfBadChannels.erase(std::unique(m_febListOfBadChannels.begin(), m_febListOfBadChannels.end()),
113  m_febListOfBadChannels.end());
114 }
115 
116 void ARICHBadChannels::setAsicBadOffsetChannels(std::vector<int> badOffsetChannels)
117 {
118  m_asicBadOffsetChannels = badOffsetChannels;
119  m_febListOfBadChannels.insert(m_febListOfBadChannels.end(), badOffsetChannels.begin(), badOffsetChannels.end());
120  std::sort(m_febListOfBadChannels.begin(), m_febListOfBadChannels.end());
121  m_febListOfBadChannels.erase(std::unique(m_febListOfBadChannels.begin(), m_febListOfBadChannels.end()),
122  m_febListOfBadChannels.end());
123 }
124 
125 
126 void ARICHBadChannels::setAsicBadLinChannels(std::vector<int> badLinChannels)
127 {
128  m_asicBadLinChannels = badLinChannels;
129  m_febListOfBadChannels.insert(m_febListOfBadChannels.end(), badLinChannels.begin(), badLinChannels.end());
130  std::sort(m_febListOfBadChannels.begin(), m_febListOfBadChannels.end());
131  m_febListOfBadChannels.erase(std::unique(m_febListOfBadChannels.begin(), m_febListOfBadChannels.end()),
132  m_febListOfBadChannels.end());
133 }
134 
136 {
137  std::vector<int> m_febAllBadCHs = ARICHBadChannels::getFebListOfBadChannels();
138  if (i < m_febAllBadCHs.size()) return m_febAllBadCHs[i];
139  else return -1;
140 }
std::vector< int > getFebListOfBadChannels() const
Return a list of all bad channels.
void setHapdBadChannel(std::vector< int > channels)
Set the list of bad channels.
int getAsicBadConnChannel(unsigned int i) const
Return a channel number from the list of channels with bad connections.
int getAsicDeadChannel(unsigned int i) const
Return a channel number from the list of dead channels.
void setFebDeadChannels(std::vector< int > deadChannels)
Set vector of dead channel numbers.
int getFebListOfBadChannel(unsigned int i) const
Return a channel number from the list of channels with bad linearity.
void setHapdCutChannel(std::vector< int > channels)
Set the list of cut channels.
void setAsicBadConnChannels(std::vector< int > badConnChannels)
Set vector of bad connection channel numbers.
int getHapdCutChannel(unsigned int i) const
Return a channel number from the list of cut channels.
int getHapdListOfBadChannel(unsigned int i) const
Return a channel number from the list of channels with bad linearity.
std::vector< int > getHapdListOfBadChannels() const
Return a list of all bad channels.
void setAsicBadLinChannels(std::vector< int > badLinChannels)
Set vector of bad linearity channel numbers.
int getHapdBadChannel(unsigned int i) const
Return a channel number from the list of cut channels.
void setAsicBadOffsetChannels(std::vector< int > badOffsetChannels)
Set vector of bad offset channel numbers.
int getAsicBadLinChannel(unsigned int i) const
Return a channel number from the list of channels with bad linearity.
int getAsicBadOffsetChannel(unsigned int i) const
Return a channel number from the list of channels with bad offset adjustment.
int getFebDeadChannel(unsigned int i) const
Return a channel number from the list of dead channels.
void setAsicDeadChannels(std::vector< int > deadChannels)
Set vector of dead channel numbers.
Abstract base class for different kinds of events.