11 if (detId > 536870911) {
12 std::stringstream
error;
13 error <<
"ERROR: the detId = " << detId
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;
33 if (pos !=
latencies_.end() && pos->detIdAndApv == detIdAndApv) {
34 std::cout <<
"Value already inserted, skipping insertion" << std::endl;
47 if (((lat + 1) !=
latencies_.end()) && ((lat + 1)->mode == lat->mode) && ((lat + 1)->latency == lat->latency)) {
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());
127 if ((mode & READMODEMASK) == 0)
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;
144 if (((*it) & READMODEMASK) == 0)
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()
int16_t singleReadOutMode() const
Log< level::Error, false > LogError
std::vector< Latency >::iterator latIt
uint16_t mode(const uint32_t detId, const uint16_t apv) const
void allLatencies(std::vector< uint16_t > &allLatenciesVector) const
Fills the passed vector with all the possible latencies in the Tracker.
uint16_t singleLatency() const
If all the latency values stored are equal return that value, otherwise return -1.
void allModes(std::vector< uint16_t > &allModesVector) const
Fills the passed vector with all the possible modes in the Tracker.
uint16_t singleMode() const
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints the full list of all ranges and corresponding values of latency and mode.
const latConstIt position(const uint32_t detId, const uint16_t apv) const
Used to compute the position with the lower_bound binary search.
uint16_t latency(const uint32_t detId, const uint16_t apv) const
std::vector< Latency > latencies_
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
std::vector< Latency >::const_iterator latConstIt
std::pair< uint16_t, uint16_t > latencyAndMode(const uint32_t detId, const uint16_t apv) const
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints the number of ranges as well as the value of singleLatency and singleMode. ...