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 
22 #include <vector>
23 #include <map>
24 #include <stdint.h>
25 #include <cstdlib>
27 #include <boost/shared_ptr.hpp>
28 
29 
31 {
32 
33  public:
34 
35 
36  // uncompressed connections
37  struct TStripCon{
38  signed char m_tower;
39  unsigned char m_PAC;
40  unsigned char m_logplane;
41  unsigned char m_logstrip;
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 
48 
49  // compressed connections
51  signed char m_tower;
52  signed char m_mul;
53  unsigned char m_PAC;
54  unsigned char m_logplane;
55  unsigned char m_validForStripFirst;
56  unsigned char m_validForStripLast;
57  signed short m_offset;
58 
59  TCompressedCon() : m_tower(99), m_mul(99), m_PAC(0),
61 
62  int getLogStrip(int strip, const L1RPCConeDefinition::TLPSizeVec & LPSizeVec) const{
63  int ret = -1;
64  if ( strip >= m_validForStripFirst && strip <= m_validForStripLast ){
65  ret = int(m_mul)*strip+int(m_offset);
66 
67  int lpSize = -1;
68  L1RPCConeDefinition::TLPSizeVec::const_iterator it = LPSizeVec.begin();
69  L1RPCConeDefinition::TLPSizeVec::const_iterator itEnd = LPSizeVec.end();
70  for (;it!=itEnd;++it){
71 
72  if (it->m_tower != std::abs(m_tower) || it->m_LP != m_logplane-1) continue;
73  lpSize = it->m_size;
74 
75  }
76 
77  //FIXME
78  if (lpSize==-1) {
79  //throw cms::Exception("getLogStrip") << " lpSize==-1\n";
80  }
81 
82  //if (ret<0 || ret > LPSizesInTowers.at(std::abs(m_tower)).at(m_logplane-1) )
83  if (ret<0 || ret > lpSize )
84  return -1;
85 
86  }
87  return ret;
88  }
89 
90  void addStrip(unsigned char strip) {
91  if (m_validForStripFirst==0) {
92  m_validForStripFirst = strip;
93  m_validForStripLast = strip;
94  } else if (strip < m_validForStripFirst){
95  m_validForStripFirst = strip;
96  }
97  else if (strip > m_validForStripLast){
98  m_validForStripLast = strip;
99  }
100 
101  }
102 
103  };
104 
105  typedef std::vector<TCompressedCon> TCompressedConVec;
106  typedef std::map<uint32_t, TCompressedConVec> TCompressedConMap;
107 
108 
109 
111  virtual ~L1RPCConeBuilder();
112 
113 
114  void setConeConnectionMap(const boost::shared_ptr< TConMap > connMap)
115  { m_coneConnectionMap = connMap;};
116 
117  void setCompressedConeConnectionMap(const boost::shared_ptr< TCompressedConMap >
118  cmpConnMap)
119  {
120  m_compressedConeConnectionMap = cmpConnMap;
121  };
122 
123  std::pair<TStripConVec::const_iterator, TStripConVec::const_iterator>
124  getConVec(uint32_t det, unsigned char strip) const ;
125 
126  std::pair<TCompressedConVec::const_iterator, TCompressedConVec::const_iterator>
127  getCompConVec(uint32_t det) const ;
128 
129  void setFirstTower(int tow) {m_firstTower = tow;};
130  void setLastTower(int tow) {m_lastTower = tow;};
131 
132 
133 
134  private:
135 
136  int m_firstTower;
138 
139  boost::shared_ptr< TConMap > m_coneConnectionMap;
140  boost::shared_ptr< TCompressedConMap > m_compressedConeConnectionMap;
141 };
142 
143 
144 #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)
boost::shared_ptr< TCompressedConMap > m_compressedConeConnectionMap
virtual ~L1RPCConeBuilder()
std::vector< TStripCon > TStripConVec