CMS 3D CMS Logo

OmtfEleIndex.h
Go to the documentation of this file.
1 #ifndef EventFilter_L1TRawToDigi_Omtf_EleIndex_H
2 #define EventFilter_L1TRawToDigi_Omtf_EleIndex_H
3 
4 #include <cstdint>
5 #include <string>
6 #include <ostream>
7 
8 namespace omtf {
9  class EleIndex {
10  public:
11  EleIndex() : packed_(0) {}
12  EleIndex(const std::string &board, unsigned int link) {
13  unsigned int fed = 0;
14  if (board.substr(4, 1) == "n")
15  fed = 1380;
16  else if (board.substr(4, 1) == "p")
17  fed = 1381;
18  unsigned int amc = std::stoi(board.substr(5, 1));
19  packed_ = fed * 1000 + amc * 100 + link;
20  }
21  EleIndex(unsigned int fed, unsigned int amc, unsigned int link) { packed_ = fed * 1000 + amc * 100 + link; }
22  unsigned int fed() const { return packed_ / 1000; }
23  unsigned int amc() const { return ((packed_ / 100) % 10); }
24  unsigned int link() const { return packed_ % 100; }
25  friend std::ostream &operator<<(std::ostream &out, const EleIndex &o) {
26  out << "OMTF";
27  if (o.fed() == 1380)
28  out << "n";
29  if (o.fed() == 1381)
30  out << "p";
31  out << o.amc();
32  out << " (fed: " << o.fed() << "), ln: " << o.link();
33  return out;
34  }
35  inline bool operator<(const EleIndex &o) const { return this->packed_ < o.packed_; }
36 
37  private:
38  uint32_t packed_;
39  };
40 
41 } // namespace omtf
42 #endif
omtf::EleIndex::packed_
uint32_t packed_
Definition: OmtfEleIndex.h:38
omtf::EleIndex::operator<
bool operator<(const EleIndex &o) const
Definition: OmtfEleIndex.h:35
omtf::EleIndex::amc
unsigned int amc() const
Definition: OmtfEleIndex.h:23
omtf::EleIndex::operator<<
friend std::ostream & operator<<(std::ostream &out, const EleIndex &o)
Definition: OmtfEleIndex.h:25
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
omtf::EleIndex
Definition: OmtfEleIndex.h:9
omtf::EleIndex::EleIndex
EleIndex(const std::string &board, unsigned int link)
Definition: OmtfEleIndex.h:12
omtf::EleIndex::EleIndex
EleIndex()
Definition: OmtfEleIndex.h:11
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
omtf::EleIndex::link
unsigned int link() const
Definition: OmtfEleIndex.h:24
omtf::EleIndex::EleIndex
EleIndex(unsigned int fed, unsigned int amc, unsigned int link)
Definition: OmtfEleIndex.h:21
omtf::EleIndex::fed
unsigned int fed() const
Definition: OmtfEleIndex.h:22
amc
Definition: AMCSpec.h:8
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
omtf
Definition: OmtfCscDataWord64.h:7