CMS 3D CMS Logo

L1RPCConeBuilder.h
Go to the documentation of this file.
1 #ifndef CondFormats_RPCObjects_L1RPCConeBuilder_h
2 #define CondFormats_RPCObjects_L1RPCConeBuilder_h
3 // -*- C++ -*-
4 //
5 // Package: RPCObjects
6 // Class : L1RPCConeBuilder
7 //
16 //
17 // Original Author: Tomasz Fruboes
18 // Created: Fri Feb 22 12:27:02 CET 2008
19 // $Id: L1RPCConeBuilder.h,v 1.8 2009/03/20 15:10:53 michals Exp $
20 //
21 
23 
24 #include <vector>
25 #include <map>
26 #include <cstdint>
27 #include <cstdlib>
29 #include <memory>
30 #include <boost/serialization/shared_ptr.hpp>
31 
33 public:
34  // uncompressed connections
35  struct TStripCon {
36  signed char m_tower;
37  unsigned char m_PAC;
38  unsigned char m_logplane;
39  unsigned char m_logstrip;
40 
42  };
43  typedef std::vector<TStripCon> TStripConVec;
44  typedef std::map<unsigned char, TStripConVec> TStrip2ConVec;
45  typedef std::map<uint32_t, TStrip2ConVec> TConMap;
46 
47  // compressed connections
48  struct TCompressedCon {
49  signed char m_tower;
50  signed char m_mul;
51  unsigned char m_PAC;
52  unsigned char m_logplane;
53  unsigned char m_validForStripFirst;
54  unsigned char m_validForStripLast;
55  signed short m_offset;
56 
58  : m_tower(99),
59  m_mul(99),
60  m_PAC(0),
61  m_logplane(99),
64  m_offset(-1000){};
65 
66  int getLogStrip(int strip, const L1RPCConeDefinition::TLPSizeVec& LPSizeVec) const {
67  int ret = -1;
69  ret = int(m_mul) * strip + int(m_offset);
70 
71  int lpSize = -1;
72  L1RPCConeDefinition::TLPSizeVec::const_iterator it = LPSizeVec.begin();
73  L1RPCConeDefinition::TLPSizeVec::const_iterator itEnd = LPSizeVec.end();
74  for (; it != itEnd; ++it) {
75  if (it->m_tower != std::abs(m_tower) || it->m_LP != m_logplane - 1)
76  continue;
77  lpSize = it->m_size;
78  }
79 
80  //FIXME
81  if (lpSize == -1) {
82  //throw cms::Exception("getLogStrip") << " lpSize==-1\n";
83  }
84 
85  //if (ret<0 || ret > LPSizesInTowers.at(std::abs(m_tower)).at(m_logplane-1) )
86  if (ret < 0 || ret > lpSize)
87  return -1;
88  }
89  return ret;
90  }
91 
92  void addStrip(unsigned char strip) {
93  if (m_validForStripFirst == 0) {
96  } else if (strip < m_validForStripFirst) {
98  } else if (strip > m_validForStripLast) {
100  }
101  }
102 
104  };
105 
106  typedef std::vector<TCompressedCon> TCompressedConVec;
107  typedef std::map<uint32_t, TCompressedConVec> TCompressedConMap;
108 
110  virtual ~L1RPCConeBuilder();
111 
112  void setConeConnectionMap(const std::shared_ptr<TConMap> connMap) { m_coneConnectionMap = connMap; };
113 
114  void setCompressedConeConnectionMap(const std::shared_ptr<TCompressedConMap> cmpConnMap) {
115  m_compressedConeConnectionMap = cmpConnMap;
116  };
117 
118  std::pair<TStripConVec::const_iterator, TStripConVec::const_iterator> getConVec(uint32_t det,
119  unsigned char strip) const;
120 
121  std::pair<TCompressedConVec::const_iterator, TCompressedConVec::const_iterator> getCompConVec(uint32_t det) const;
122 
123  void setFirstTower(int tow) { m_firstTower = tow; };
124  void setLastTower(int tow) { m_lastTower = tow; };
125 
126 private:
127  int m_firstTower;
129 
130  std::shared_ptr<TConMap> m_coneConnectionMap;
131  std::shared_ptr<TCompressedConMap> m_compressedConeConnectionMap;
132 
134 };
135 
136 #endif
int getLogStrip(int strip, const L1RPCConeDefinition::TLPSizeVec &LPSizeVec) const
ret
prodAgent to be discontinued
void addStrip(unsigned char strip)
std::vector< TLPSize > TLPSizeVec
std::map< unsigned char, TStripConVec > TStrip2ConVec
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::pair< TCompressedConVec::const_iterator, TCompressedConVec::const_iterator > getCompConVec(uint32_t det) const
void setLastTower(int tow)
void setConeConnectionMap(const std::shared_ptr< TConMap > connMap)
std::vector< TCompressedCon > TCompressedConVec
std::map< uint32_t, TStrip2ConVec > TConMap
std::map< uint32_t, TCompressedConVec > TCompressedConMap
void setFirstTower(int tow)
void setCompressedConeConnectionMap(const std::shared_ptr< TCompressedConMap > cmpConnMap)
#define COND_SERIALIZABLE
Definition: Serializable.h:39
std::shared_ptr< TCompressedConMap > m_compressedConeConnectionMap
std::pair< TStripConVec::const_iterator, TStripConVec::const_iterator > getConVec(uint32_t det, unsigned char strip) const
virtual ~L1RPCConeBuilder()
std::shared_ptr< TConMap > m_coneConnectionMap
std::vector< TStripCon > TStripConVec