12 if( detId > 536870911 ) {
13 std::stringstream
error;
14 error <<
"ERROR: the detId = " << detId <<
" 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 moment" << std::endl;
16 error <<
"of the writing of this class was 47017836 as defined in CalibTracker/SiStripCommon/data/SiStripDetInfo.dat." << std::endl;
17 error <<
"If the maximum value has changed a revision of this calss is needed, possibly changing the detIdAndApv value from" << std::endl;
18 error <<
"from uint32_t to uint64_t." << std::endl;
24 uint32_t detIdAndApv = (detId << 3) | apv;
27 if( pos !=
latencies_.end() && pos->detIdAndApv == detIdAndApv ) {
28 std::cout <<
"Value already inserted, skipping insertion" << std::endl;
42 if( ((lat+1) !=
latencies_.end()) && ((lat+1)->mode == lat->mode) && ((lat+1)->latency == lat->latency) ) {
73 return std::make_pair(255, 0);
75 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 ) {
101 int differentModesNum = 0;
104 if( it->mode != (it+1)->mode ) {
108 if( differentModesNum == 0 ) {
117 allModesVector.push_back(it->mode);
120 sort( allModesVector.begin(), allModesVector.end() );
121 allModesVector.erase(
unique( allModesVector.begin(), allModesVector.end() ), allModesVector.end() );
129 if( (mode & READMODEMASK) == 0 )
return 0;
133 bool allInPeakMode =
true;
134 bool allInDecoMode =
true;
135 std::vector<uint16_t> allModesVector;
137 std::vector<uint16_t>::const_iterator it = allModesVector.begin();
138 if (allModesVector.size() == 1 && allModesVector[0] == 0) allInPeakMode =
false;
140 for( ; it != allModesVector.end(); ++it ) {
141 if( (*it) % 2 == 0 )
continue;
143 if( ((*it) & READMODEMASK) == 0 ) allInPeakMode =
false;
146 if( allInPeakMode )
return 1;
147 if( allInDecoMode )
return 0;
157 allLatenciesVector.push_back(it->latency);
160 sort( allLatenciesVector.begin(), allLatenciesVector.end() );
161 allLatenciesVector.erase(
unique( allLatenciesVector.begin(), allLatenciesVector.end() ), allLatenciesVector.end() );
177 ss <<
"SingleReadOut = PEAK" << std::endl;
179 ss <<
"SingleReadOut = DECO" << std::endl;
181 ss <<
"SingleReadOut = MIXED" << std::endl;
185 ss <<
"All the Tracker has the same latency = " << lat << std::endl;
188 std::vector<uint16_t> allLatenciesVector;
190 if( allLatenciesVector.size() > 1 ) {
191 ss <<
"There is more than one latency value in the Tracker" << std::endl;
194 ss <<
"Latency value is " << lat <<
" that means invalid" << std::endl;
197 ss <<
"Total number of ranges = " <<
latencies_.size() << std::endl;
204 ss <<
"List of all the latencies and modes for the " <<
latencies_.size() <<
" ranges in the object:" << std::endl;
206 int detId = it->detIdAndApv >> 3;
207 int apv = it->detIdAndApv & 7;
208 ss <<
"for detId = " << detId <<
" and apv pair = " << apv <<
" latency = " <<
int(it->latency) <<
" 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
std::vector< Latency >::iterator latIt
uint16_t mode(const uint32_t detId, const uint16_t apv) const
def unique(seq, keepstr=True)
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_
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. ...