File indexing completed on 2024-09-07 04:35:41
0001 #ifndef SiStripPedestals_h
0002 #define SiStripPedestals_h
0003
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005
0006 #include <vector>
0007 #include <map>
0008 #include <iostream>
0009
0010
0011 #include "CondFormats/SiStripObjects/interface/SiStripDetSummary.h"
0012 #include <cstdint>
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 class SiStripPedestals {
0028 public:
0029
0030
0031
0032
0033
0034
0035
0036 struct DetRegistry {
0037 uint32_t detid;
0038 uint32_t ibegin;
0039 uint32_t iend;
0040
0041 COND_SERIALIZABLE;
0042 };
0043
0044 class StrictWeakOrdering {
0045 public:
0046 bool operator()(const DetRegistry& p, const uint32_t& i) const { return p.detid < i; }
0047 };
0048
0049 typedef std::vector<char> Container;
0050 typedef std::vector<char>::const_iterator ContainerIterator;
0051 typedef std::pair<ContainerIterator, ContainerIterator> Range;
0052 typedef std::vector<DetRegistry> Registry;
0053 typedef Registry::const_iterator RegistryIterator;
0054 typedef std::vector<uint16_t> InputVector;
0055
0056 SiStripPedestals() {}
0057 ~SiStripPedestals() {}
0058
0059
0060 bool put(const uint32_t& detID, InputVector& input);
0061 const Range getRange(const uint32_t& detID) const;
0062 void getDetIds(std::vector<uint32_t>& DetIds_) const;
0063
0064 ContainerIterator getDataVectorBegin() const { return v_pedestals.begin(); }
0065 ContainerIterator getDataVectorEnd() const { return v_pedestals.end(); }
0066 RegistryIterator getRegistryVectorBegin() const { return indexes.begin(); }
0067 RegistryIterator getRegistryVectorEnd() const { return indexes.end(); }
0068
0069 void setData(float ped, InputVector& vped);
0070 float getPed(const uint16_t& strip, const Range& range) const;
0071 void allPeds(std::vector<int>& pefs, const Range& range) const;
0072
0073
0074 void printSummary(std::stringstream& ss, const TrackerTopology* trackerTopo) const;
0075
0076 void printDebug(std::stringstream& ss, const TrackerTopology* trackerTopo) const;
0077
0078 private:
0079 void encode(InputVector& Vi, std::vector<unsigned char>& Vo_CHAR);
0080 uint16_t decode(const uint16_t& strip, const Range& range) const;
0081 inline uint16_t get10bits(const uint8_t*& ptr, int8_t skip) const;
0082
0083 Container v_pedestals;
0084 Registry indexes;
0085
0086 COND_SERIALIZABLE;
0087 };
0088
0089 #endif