Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:39

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