CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <stdint.h>
27 #include <cstdlib>
29 #include <boost/shared_ptr.hpp>
30 
31 
33 {
34 
35  public:
36 
37 
38  // uncompressed connections
39  struct TStripCon{
40  signed char m_tower;
41  unsigned char m_PAC;
42  unsigned char m_logplane;
43  unsigned char m_logstrip;
44 
46  };
47  typedef std::vector<TStripCon> TStripConVec;
48  typedef std::map<unsigned char, TStripConVec> TStrip2ConVec;
49  typedef std::map<uint32_t, TStrip2ConVec> TConMap;
50 
51 
52 
53  // compressed connections
55  signed char m_tower;
56  signed char m_mul;
57  unsigned char m_PAC;
58  unsigned char m_logplane;
59  unsigned char m_validForStripFirst;
60  unsigned char m_validForStripLast;
61  signed short m_offset;
62 
63  TCompressedCon() : m_tower(99), m_mul(99), m_PAC(0),
65 
66  int getLogStrip(int strip, const L1RPCConeDefinition::TLPSizeVec & LPSizeVec) const{
67  int ret = -1;
68  if ( strip >= m_validForStripFirst && strip <= m_validForStripLast ){
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 
76  if (it->m_tower != std::abs(m_tower) || it->m_LP != m_logplane-1) continue;
77  lpSize = it->m_size;
78 
79  }
80 
81  //FIXME
82  if (lpSize==-1) {
83  //throw cms::Exception("getLogStrip") << " lpSize==-1\n";
84  }
85 
86  //if (ret<0 || ret > LPSizesInTowers.at(std::abs(m_tower)).at(m_logplane-1) )
87  if (ret<0 || ret > lpSize )
88  return -1;
89 
90  }
91  return ret;
92  }
93 
94  void addStrip(unsigned char strip) {
95  if (m_validForStripFirst==0) {
96  m_validForStripFirst = strip;
97  m_validForStripLast = strip;
98  } else if (strip < m_validForStripFirst){
99  m_validForStripFirst = strip;
100  }
101  else if (strip > m_validForStripLast){
102  m_validForStripLast = strip;
103  }
104 
105  }
106 
108  };
109 
110  typedef std::vector<TCompressedCon> TCompressedConVec;
111  typedef std::map<uint32_t, TCompressedConVec> TCompressedConMap;
112 
113 
114 
116  virtual ~L1RPCConeBuilder();
117 
118 
119  void setConeConnectionMap(const boost::shared_ptr< TConMap > connMap)
120  { m_coneConnectionMap = connMap;};
121 
122  void setCompressedConeConnectionMap(const boost::shared_ptr< TCompressedConMap >
123  cmpConnMap)
124  {
125  m_compressedConeConnectionMap = cmpConnMap;
126  };
127 
128  std::pair<TStripConVec::const_iterator, TStripConVec::const_iterator>
129  getConVec(uint32_t det, unsigned char strip) const ;
130 
131  std::pair<TCompressedConVec::const_iterator, TCompressedConVec::const_iterator>
132  getCompConVec(uint32_t det) const ;
133 
134  void setFirstTower(int tow) {m_firstTower = tow;};
135  void setLastTower(int tow) {m_lastTower = tow;};
136 
137 
138 
139  private:
140 
141  int m_firstTower;
143 
144  boost::shared_ptr< TConMap > m_coneConnectionMap;
145  boost::shared_ptr< TCompressedConMap > m_compressedConeConnectionMap;
146 
148 };
149 
150 
151 #endif
boost::shared_ptr< TConMap > m_coneConnectionMap
void setConeConnectionMap(const boost::shared_ptr< TConMap > connMap)
std::pair< TCompressedConVec::const_iterator, TCompressedConVec::const_iterator > getCompConVec(uint32_t det) const
void setCompressedConeConnectionMap(const boost::shared_ptr< TCompressedConMap > cmpConnMap)
void addStrip(unsigned char strip)
std::vector< TLPSize > TLPSizeVec
std::map< unsigned char, TStripConVec > TStrip2ConVec
int getLogStrip(int strip, const L1RPCConeDefinition::TLPSizeVec &LPSizeVec) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void setLastTower(int tow)
std::pair< TStripConVec::const_iterator, TStripConVec::const_iterator > getConVec(uint32_t det, unsigned char strip) const
std::vector< TCompressedCon > TCompressedConVec
std::map< uint32_t, TStrip2ConVec > TConMap
std::map< uint32_t, TCompressedConVec > TCompressedConMap
void setFirstTower(int tow)
#define COND_SERIALIZABLE
Definition: Serializable.h:30
boost::shared_ptr< TCompressedConMap > m_compressedConeConnectionMap
virtual ~L1RPCConeBuilder()
std::vector< TStripCon > TStripConVec