Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:13:26

0001 #ifndef L1Trigger_RPCConst_h
0002 #define L1Trigger_RPCConst_h
0003 
0004 #ifndef _STAND_ALONE
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 #endif  //_STAND_ALONE
0007 
0008 #include <string>
0009 #include <map>
0010 #include <vector>
0011 #include <bitset>
0012 /** \class RPCConst
0013  * 
0014  * Class contains number of L1RpcTrigger specific
0015  * constanst, and transforming methods (eg. phi <-> segment number)
0016  * (Should migrate to DDD?)
0017  *
0018  * \author  Marcin Konecki, Warsaw
0019  *          Artur Kalinowski, Warsaw
0020  *
0021  ********************************************************************/
0022 
0023 class RPCConst {
0024 public:
0025   enum {
0026     ITOW_MIN = 0,   //!< Minimal number of abs(m_tower_number)
0027     ITOW_MAX = 16,  //!< Maximal number of abs(m_tower_number)
0028     //ITOW_MAX_LOWPT  = 7,      //!< Max m_tower number to which low_pt algorithm is used
0029     IPT_MAX = 31,        //!< Max pt bin code
0030     NSTRIPS = 1152,      //!< m_Number of Rpc strips in phi direction.
0031     NSEG = NSTRIPS / 8,  //!< m_Number of trigger segments. One segment covers 8 RPC strips
0032                          //!<in referencial plane (hardware 2 or 6(2')
0033     OFFSET = 5           //!< Offset of the first trigger phi sector [deg]
0034   };
0035 
0036   //static const int m_TOWER_COUNT = 16 + 1; //!< Only half of the detector.
0037 
0038   //-----------------import from L1RpcParameters beg------------------
0039 
0040   //static const double m_pi = 3.14159265358979;
0041   static const int m_TOWER_COUNT = 16 + 1;  //!< Only half of the detector.
0042 
0043   static const int m_PT_CODE_MAX = 31;  //!< Pt_code range = 0-m_PT_CODE_MAX
0044 
0045   static const int m_LOGPLANES_COUNT = 6;  //!< Max Logic Planes Count in trigger towers
0046 
0047   static const int m_LOGPLANE1 =
0048       0;  //!< The Logic Planes are named starting from '1', but in varoius loop indeks are from '0', that's why always use these consts
0049   static const int m_LOGPLANE2 = 1;
0050   static const int m_LOGPLANE3 = 2;
0051   static const int m_LOGPLANE4 = 3;
0052   static const int m_LOGPLANE5 = 4;
0053   static const int m_LOGPLANE6 = 5;
0054 
0055   static const int m_FIRST_PLANE = m_LOGPLANE1;  //!< Use ase a first index in loops.
0056   static const int m_LAST_PLANE = m_LOGPLANE6;   //!< Use ase a last index in loops.
0057 
0058   /*
0059   
0060     static const int m_TOWER_COUNT = 16 + 1; //!< Only half of the detector.
0061     
0062     static const int m_PT_CODE_MAX; //!< Pt_code range = 0-m_PT_CODE_MAX
0063     
0064     static const int m_LOGPLANES_COUNT = 6; //!< Max Logic Planes Count in trigger towers
0065     
0066     static const int m_LOGPLANE1; //!< The Logic Planes are named starting from '1', but in varoius loop indeks are from '0', that's why always use these consts 
0067     static const int m_LOGPLANE2;
0068     static const int m_LOGPLANE3;
0069     static const int m_LOGPLANE4;
0070     static const int m_LOGPLANE5;
0071     static const int m_LOGPLANE6;
0072     
0073     static const int m_FIRST_PLANE; //!< Use ase a first index in loops.
0074     static const int m_LAST_PLANE; //!< Use ase a last index in loops.
0075     */
0076 
0077   ///Log Planes names.
0078   static const std::string m_LOGPLANE_STR[];
0079 
0080   /// Definition of Logic Cone Sizes - number of Logic m_Strips in each plane
0081   static const unsigned int m_LOGPLANE_SIZE[m_TOWER_COUNT][m_LOGPLANES_COUNT];
0082 
0083   ///Definition of Referenece Plane for each m_Tower.
0084   static const int m_REF_PLANE[m_TOWER_COUNT];
0085 
0086   ///m_Number of Logic Planes existing in each m_Tower.
0087   static const int m_USED_PLANES_COUNT[m_TOWER_COUNT];
0088 
0089   ///m_Number of Logic Planes used for Very Low Pt patterns.
0090   static const int m_VLPT_PLANES_COUNT[m_TOWER_COUNT];
0091 
0092   static const int m_VLPT_CUT = 7;  //!< Max Pt code of Very Low Pt patterns.
0093 
0094   static const int m_NOT_CONECTED =
0095       99;  //!< Denotes Logic m_Strips that is not valid (f.e. in Patterns denotes, that in given plane the pattern is not defined).
0096 
0097   //-------------------------quallity tab-----------------------------------------
0098   //should be moved somwhere else
0099   /*
0100     typedef std::bitset<m_LOGPLANES_COUNT> TQualityBitset; //for quallity tab
0101     
0102     struct bitsetLes : public std::less<TQualityBitset>
0103     {
0104       bool operator() (const TQualityBitset& x, const TQualityBitset& y) const
0105       {
0106         return(x.count() < y.count());
0107       }
0108     };
0109     
0110     typedef std::multimap<TQualityBitset, int , bitsetLes> TQualityTab;
0111     typedef TQualityTab::value_type TQualityTabValueType;
0112     */
0113   typedef std::vector<short> TQualityTab;
0114   typedef std::vector<TQualityTab> TQualityTabsVec;
0115   //----------------------end quallity tab----------------------------------------
0116 
0117   ///The coordinates of Logic Cone: m_Tower, m_LogSector,  m_LogSegment.
0118   struct l1RpcConeCrdnts {
0119     int m_Tower;
0120     int m_LogSector;
0121     int m_LogSegment;
0122 
0123     l1RpcConeCrdnts() {
0124       m_Tower = 0;
0125       m_LogSector = 0;
0126       m_LogSegment = 0;
0127     }
0128 
0129     l1RpcConeCrdnts(int m_tower, int logSector, int logSegment) {
0130       m_Tower = m_tower;
0131       m_LogSector = logSector;
0132       m_LogSegment = logSegment;
0133     }
0134 
0135     int getSegmentNum() { return m_LogSector * 12 + m_LogSegment; }
0136 
0137     bool operator<(const l1RpcConeCrdnts& cone) const;
0138 
0139     bool operator==(const l1RpcConeCrdnts& cone) const;
0140   };
0141 
0142   /*
0143     class RPCMuonGen {
0144     public:
0145       int m_RunNum, m_EventNum, m_PtCodeGen;
0146       double m_EtaGen, m_PhiGen, m_PtGen;
0147       int m_Sign, m_MaxFiredPlanesCnt;
0148     
0149       int possibleTrigger;
0150 };*/
0151 
0152   //hardware consts - fixed by board design
0153   static const unsigned int m_TOWERS_ON_TB_CNT = 4;  //!< Max number of towers covered by one Trugger Board.
0154   static const unsigned int m_SEGMENTS_IN_SECTOR_CNT =
0155       12;  //!< m_Number of Logic Segments in one Logic Sector, defines also the number of Logic Cones for one Logic Sector of one m_Tower.
0156   static const unsigned int m_GBPHI_OUT_MUONS_CNT =
0157       4;  //!< m_Number of muon candidates return by Trigger Board's phi Ghost Buster
0158   static const unsigned int m_GBETA_OUT_MUONS_CNT =
0159       4;  //!< m_Number of muon candidates return by Trigger Board's eta Ghost Buster
0160   static const unsigned int m_TCGB_OUT_MUONS_CNT =
0161       4;  //!< m_Number of muon candidates return by Trigger Crate's Ghost Buster
0162   static const unsigned int m_FINAL_OUT_MUONS_CNT =
0163       4;  //!< m_Number of muon candidates return by Final GhostBuster&Sorter
0164   //const that are dependent on trigger configuration (f.e. TBs cnt in TC)
0165   //are in RPCTriggerConfiguration
0166 
0167   ///Converts string to inteager number. If string contains chars, that are not digits, throws RPCException.
0168   int stringToInt(std::string str);
0169 
0170   ///Converts inteager number to string.
0171   std::string intToString(int number);
0172 
0173   //-----------------import from L1RpcParameters end------------------
0174   ///
0175   ///Method converts pt [Gev/c] into pt bin number (0, 31).
0176   ///
0177   static int iptFromPt(const double pt);
0178 
0179   ///
0180   ///Method converts pt bin number (0, 31) to pt [GeV/c].
0181   ///
0182   static double ptFromIpt(const int ipt);
0183 
0184   ///
0185   ///Method converts from m_tower number to eta (gives center of m_tower).
0186   ///
0187   static double etaFromTowerNum(const int atower);
0188 
0189   ///
0190   ///Method converts from eta to trigger m_tower number.
0191   ///
0192   static int towerNumFromEta(const double eta);
0193 
0194   ///
0195   ///Method converts from segment number (0, 144).
0196   ///obsolete
0197   static double phiFromSegmentNum(const int iseg);
0198 
0199   ///
0200   ///Method converts from logSegment (0..11) and logSector(0...11) .
0201   ///
0202   static double phiFromLogSegSec(const int logSegment, const int logSector);
0203 
0204   ///obsolete
0205   ///Method converts phi to segment number (0, 144).
0206   ///
0207   static int segmentNumFromPhi(const double phi);
0208 
0209   /* obsolete
0210   ///
0211   ///Method checks if m_tower is in barrel (<ITOW_MAX_LOWPT).
0212   ///
0213   static int checkBarrel(const int atower);
0214   */
0215 
0216   /* obsolete
0217   ///
0218   ///Matrix with pt thresholds between high, low and very low pt
0219   ///algorithms.
0220   static const int IPT_THRESHOLD [2][ITOW_MAX+1];
0221   */
0222 
0223   ///
0224   ///Spectrum of muons originating from vertex. See CMS-TN-1995/150
0225   ///
0226   static double vxMuRate(int ptCode);
0227 
0228   static double vxIntegMuRate(int ptCode, double etaFrom, double etaTo);
0229 
0230   static double vxIntegMuRate(int ptCode, int m_tower);
0231 
0232 private:
0233   ///
0234   ///Matrix with pt bins upper limits.
0235   ///
0236   static const double m_pts[RPCConst::IPT_MAX + 1];
0237 
0238   ///Matrix with approximate upper towers limits. Only positive ones are reported,
0239   ///for negative ones mirror symmetry assumed.
0240   static const double m_etas[RPCConst::ITOW_MAX + 2];
0241 };
0242 #endif