Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:29

0001 /****************************************************************************
0002  *
0003  * This is a part of CTPPS offline software.
0004  * Authors:
0005  *   Christopher Misan
0006  *   Filip Dej
0007  *   Laurent Forthomme
0008  *
0009  ****************************************************************************/
0010 
0011 #include "CondFormats/PPSObjects/interface/PPSTimingCalibrationLUT.h"
0012 #include <ostream>
0013 
0014 //--------------------------------------------------------------------------
0015 
0016 bool PPSTimingCalibrationLUT::Key::operator<(const PPSTimingCalibrationLUT::Key& rhs) const {
0017   if (sector == rhs.sector) {
0018     if (station == rhs.station) {
0019       if (plane == rhs.plane)
0020         return channel < rhs.channel;
0021       return plane < rhs.plane;
0022     }
0023     return station < rhs.station;
0024   }
0025   return sector < rhs.sector;
0026 }
0027 
0028 std::ostream& operator<<(std::ostream& os, const PPSTimingCalibrationLUT::Key& key) {
0029   return os << key.sector << " " << key.station << " " << key.plane << " " << key.channel;
0030 }
0031 
0032 //--------------------------------------------------------------------------
0033 
0034 std::vector<double> PPSTimingCalibrationLUT::bins(int key1, int key2, int key3, int key4) const {
0035   Key key{key1, key2, key3, key4};
0036   auto out = binMap_.find(key);
0037   if (out == binMap_.end())
0038     return {};
0039   return out->second;
0040 }
0041 
0042 std::ostream& operator<<(std::ostream& os, const PPSTimingCalibrationLUT& data) {
0043   os << "\nSECTOR STATION PLANE CHANNEL SAMPLES \n";
0044   for (const auto& kv : data.binMap_) {
0045     os << kv.first << "\n[";
0046     for (size_t i = 0; i < kv.second.size(); ++i)
0047       os << (i > 0 ? ", " : "") << kv.second.at(i);
0048     os << " ]\n";
0049   }
0050   return os;
0051 }