11 if (
detId > 536870911) {
12 std::stringstream
error;
14 <<
" is bigger than the maximum acceptable value = 2^(29) - 1 = " << 536870911 << std::endl;
15 error <<
"Since we are using 29 bits for the detId and 3 bits for the apv value. The maximum tracker detId at the " 19 <<
"of the writing of this class was 47017836 as defined in CalibTracker/SiStripCommon/data/SiStripDetInfo.dat." 21 error <<
"If the maximum value has changed a revision of this calss is needed, possibly changing the detIdAndApv " 24 error <<
"from uint32_t to uint64_t." << std::endl;
30 uint32_t detIdAndApv = (
detId << 3) | apv;
34 std::cout <<
"Value already inserted, skipping insertion" << std::endl;
74 return std::make_pair(255, 0);
76 return std::make_pair(
pos->latency,
pos->mode);
83 int differentLatenciesNum = 0;
86 if (it->latency != (it + 1)->latency) {
87 ++differentLatenciesNum;
90 if (differentLatenciesNum == 0) {
100 int differentModesNum = 0;
103 if (it->mode != (it + 1)->mode) {
107 if (differentModesNum == 0) {
115 allModesVector.push_back(it->mode);
118 sort(allModesVector.begin(), allModesVector.end());
119 allModesVector.erase(
unique(allModesVector.begin(), allModesVector.end()), allModesVector.end());
131 bool allInPeakMode =
true;
132 bool allInDecoMode =
true;
133 std::vector<uint16_t> allModesVector;
135 std::vector<uint16_t>::const_iterator it = allModesVector.begin();
136 if (allModesVector.size() == 1 && allModesVector[0] == 0)
137 allInPeakMode =
false;
139 for (; it != allModesVector.end(); ++it) {
143 allInDecoMode =
false;
145 allInPeakMode =
false;
158 allLatenciesVector.push_back(it->latency);
161 sort(allLatenciesVector.begin(), allLatenciesVector.end());
162 allLatenciesVector.erase(
unique(allLatenciesVector.begin(), allLatenciesVector.end()), allLatenciesVector.end());
176 ss <<
"SingleReadOut = PEAK" << std::endl;
178 ss <<
"SingleReadOut = DECO" << std::endl;
180 ss <<
"SingleReadOut = MIXED" << std::endl;
184 ss <<
"All the Tracker has the same latency = " <<
lat << std::endl;
186 std::vector<uint16_t> allLatenciesVector;
188 if (allLatenciesVector.size() > 1) {
189 ss <<
"There is more than one latency value in the Tracker" << std::endl;
191 ss <<
"Latency value is " <<
lat <<
" that means invalid" << std::endl;
194 ss <<
"Total number of ranges = " <<
latencies_.size() << std::endl;
199 ss <<
"List of all the latencies and modes for the " <<
latencies_.size() <<
" ranges in the object:" << std::endl;
201 int detId = it->detIdAndApv >> 3;
202 int apv = it->detIdAndApv & 7;
203 ss <<
"for detId = " <<
detId <<
" and apv pair = " << apv <<
" latency = " <<
int(it->latency)
204 <<
" and mode = " <<
int(it->mode) << std::endl;
bool put(const uint32_t detId, const uint16_t apv, const uint16_t latency, const uint16_t mode)
std::vector< Latency > allUniqueLatencyAndModes()
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints the full list of all ranges and corresponding values of latency and mode.
void allLatencies(std::vector< uint16_t > &allLatenciesVector) const
Fills the passed vector with all the possible latencies in the Tracker.
Log< level::Error, false > LogError
uint16_t mode(const uint32_t detId, const uint16_t apv) const
const latConstIt position(const uint32_t detId, const uint16_t apv) const
Used to compute the position with the lower_bound binary search.
std::vector< Latency >::iterator latIt
def unique(seq, keepstr=True)
int16_t singleReadOutMode() const
uint16_t singleMode() const
std::vector< Latency > latencies_
uint16_t singleLatency() const
If all the latency values stored are equal return that value, otherwise return -1.
uint16_t latency(const uint32_t detId, const uint16_t apv) const
std::pair< uint16_t, uint16_t > latencyAndMode(const uint32_t detId, const uint16_t apv) const
std::vector< Latency >::const_iterator latConstIt
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints the number of ranges as well as the value of singleLatency and singleMode. ...
void allModes(std::vector< uint16_t > &allModesVector) const
Fills the passed vector with all the possible modes in the Tracker.