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;
57 if( ((lat+1) !=
latencies_.end()) && ((lat+1)->mode == lat->mode) && ((lat+1)->latency == lat->latency) ) {
104 return std::make_pair(255, 0);
106 return std::make_pair(pos->latency, pos->mode);
114 int differentLatenciesNum = 0;
117 if( it->latency != (it+1)->latency ) {
118 ++differentLatenciesNum;
121 if( differentLatenciesNum == 0 ) {
132 int differentModesNum = 0;
135 if( it->mode != (it+1)->mode ) {
139 if( differentModesNum == 0 ) {
148 allModesVector.push_back(it->mode);
151 sort( allModesVector.begin(), allModesVector.end() );
152 allModesVector.erase( unique( allModesVector.begin(), allModesVector.end() ), allModesVector.end() );
160 if( (mode & READMODEMASK) == 0 )
return 0;
164 bool allInPeakMode =
true;
165 bool allInDecoMode =
true;
166 std::vector<uint16_t> allModesVector;
168 std::vector<uint16_t>::const_iterator it = allModesVector.begin();
169 for( ; it != allModesVector.end(); ++it ) {
171 if( ((*it) & READMODEMASK) == 0 ) allInPeakMode =
false;
173 if( allInPeakMode )
return 1;
174 if( allInDecoMode )
return 0;
211 allLatenciesVector.push_back(it->latency);
214 sort( allLatenciesVector.begin(), allLatenciesVector.end() );
215 allLatenciesVector.erase( unique( allLatenciesVector.begin(), allLatenciesVector.end() ), allLatenciesVector.end() );
239 ss <<
"All the Tracker has the same latency = " << lat << std::endl;
242 std::vector<uint16_t> allLatenciesVector;
244 if( allLatenciesVector.size() > 1 ) {
245 ss <<
"There is more than one latency value in the Tracker" << std::endl;
248 ss <<
"Latency value is " << lat <<
" that means invalid" << std::endl;
253 ss <<
"All the Tracker has the same mode = " << mode << std::endl;
256 std::vector<uint16_t> allModesVector;
258 if( allModesVector.size() > 1 ) {
259 ss <<
"There is more than one mode in the Tracker" << std::endl;
262 ss <<
"Mode value is " << mode <<
" that means invalid" << std::endl;
266 ss <<
"Total number of ranges = " <<
latencies_.size() << std::endl;
271 ss <<
"List of all the latencies and modes for the " <<
latencies_.size() <<
" ranges in the object:" << std::endl;
273 int detId = it->detIdAndApv >> 3;
274 int apv = it->detIdAndApv & 7;
275 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
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.
void printSummary(std::stringstream &ss) const
Prints the number of ranges as well as the value of singleLatency and singleMode. ...
uint16_t singleMode() const
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_
void printDebug(std::stringstream &ss) const
Prints the full list of all ranges and corresponding values of latency and mode.
std::vector< Latency >::const_iterator latConstIt
std::pair< uint16_t, uint16_t > latencyAndMode(const uint32_t detId, const uint16_t apv) const