CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CondFormats/RPCObjects/interface/L1RPCConeBuilder.h

Go to the documentation of this file.
00001 #ifndef CondFormats_RPCObjects_L1RPCConeBuilder_h
00002 #define CondFormats_RPCObjects_L1RPCConeBuilder_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     RPCObjects
00006 // Class  :     L1RPCConeBuilder
00007 // 
00016 //
00017 // Original Author:  Tomasz Fruboes
00018 //         Created:  Fri Feb 22 12:27:02 CET 2008
00019 // $Id: L1RPCConeBuilder.h,v 1.10 2009/04/10 15:36:25 fruboes Exp $
00020 //
00021 
00022 #include <vector>
00023 #include <map>
00024 #include <stdint.h>
00025 #include <cstdlib>
00026 #include "CondFormats/L1TObjects/interface/L1RPCConeDefinition.h"
00027 #include <boost/shared_ptr.hpp>
00028 
00029 
00030 class L1RPCConeBuilder
00031 {
00032    
00033    public:
00034 
00035 
00036       // uncompressed connections
00037       struct TStripCon{
00038         signed char m_tower;
00039         unsigned char m_PAC;
00040         unsigned char m_logplane;
00041         unsigned char m_logstrip;
00042       };
00043       typedef std::vector<TStripCon> TStripConVec;
00044       typedef std::map<unsigned char, TStripConVec> TStrip2ConVec;
00045       typedef std::map<uint32_t, TStrip2ConVec> TConMap;
00046       
00047       
00048 
00049       // compressed connections
00050       struct TCompressedCon{
00051         signed char m_tower;
00052         signed char m_mul; 
00053         unsigned char m_PAC;
00054         unsigned char m_logplane;
00055         unsigned char m_validForStripFirst; 
00056         unsigned char m_validForStripLast; 
00057         signed short m_offset;
00058         
00059         TCompressedCon() : m_tower(99),  m_mul(99), m_PAC(0), 
00060           m_logplane(99), m_validForStripFirst(0), m_validForStripLast(0), m_offset(-1000){};
00061           
00062         int getLogStrip(int strip, const L1RPCConeDefinition::TLPSizeVec & LPSizeVec) const{
00063           int ret = -1;
00064           if ( strip >= m_validForStripFirst && strip <= m_validForStripLast ){ 
00065             ret = int(m_mul)*strip+int(m_offset);
00066           
00067             int lpSize = -1;
00068             L1RPCConeDefinition::TLPSizeVec::const_iterator it = LPSizeVec.begin();
00069             L1RPCConeDefinition::TLPSizeVec::const_iterator itEnd = LPSizeVec.end();
00070             for (;it!=itEnd;++it){
00071             
00072               if (it->m_tower != std::abs(m_tower) || it->m_LP != m_logplane-1) continue;
00073               lpSize = it->m_size;
00074             
00075             }
00076 
00077             //FIXME
00078             if (lpSize==-1) {
00079               //throw cms::Exception("getLogStrip") << " lpSize==-1\n";
00080             }
00081             
00082             //if (ret<0 || ret > LPSizesInTowers.at(std::abs(m_tower)).at(m_logplane-1)  )
00083             if (ret<0 || ret > lpSize )
00084               return -1;
00085           
00086           }
00087           return ret;
00088         }
00089         
00090         void addStrip(unsigned char strip) {
00091           if (m_validForStripFirst==0) {
00092             m_validForStripFirst = strip;
00093             m_validForStripLast = strip;
00094           } else if (strip < m_validForStripFirst){
00095             m_validForStripFirst = strip;
00096           }
00097           else if (strip > m_validForStripLast){
00098             m_validForStripLast = strip;
00099           }
00100         
00101         }
00102         
00103       };
00104       
00105       typedef std::vector<TCompressedCon> TCompressedConVec;
00106       typedef std::map<uint32_t, TCompressedConVec> TCompressedConMap;
00107       
00108       
00109       
00110       L1RPCConeBuilder();
00111       virtual ~L1RPCConeBuilder();
00112 
00113             
00114       void setConeConnectionMap(const boost::shared_ptr< TConMap > connMap) 
00115                       { m_coneConnectionMap = connMap;};
00116                       
00117       void setCompressedConeConnectionMap(const boost::shared_ptr< TCompressedConMap >
00118                                               cmpConnMap) 
00119       {  
00120             m_compressedConeConnectionMap = cmpConnMap;
00121       };
00122       
00123       std::pair<TStripConVec::const_iterator, TStripConVec::const_iterator> 
00124           getConVec(uint32_t det, unsigned char strip) const ;
00125       
00126       std::pair<TCompressedConVec::const_iterator, TCompressedConVec::const_iterator> 
00127           getCompConVec(uint32_t det) const ;
00128       
00129       void setFirstTower(int tow) {m_firstTower = tow;};
00130       void setLastTower(int tow) {m_lastTower = tow;};
00131       
00132 
00133       
00134    private:
00135          
00136      int m_firstTower;
00137      int m_lastTower;
00138 
00139      boost::shared_ptr< TConMap > m_coneConnectionMap; 
00140      boost::shared_ptr< TCompressedConMap >  m_compressedConeConnectionMap;
00141 };
00142 
00143 
00144 #endif