Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1Trigger_RPCLogCone_h
0002 #define L1Trigger_RPCLogCone_h
0003 
0004 /** \class RPCLogCone
0005  *
0006  * The input for m_PAC. State of strips in smalest unit of volum in RPC trigger
0007  * system (Logic Cone), defined by 8 strips of reference plane.
0008  * \author Karol Bunkowski (Warsaw),
0009  * \author Porting to CMSSW - Tomasz Frueboes
0010  *
0011  */
0012 
0013 #include <vector>
0014 #include <string>
0015 #include <set>
0016 #include <map>
0017 
0018 #include "L1Trigger/RPCTrigger/interface/RPCLogHit.h"
0019 
0020 #include "L1Trigger/RPCTrigger/interface/RPCConst.h"
0021 //------------------------------------------------------------------------------
0022 
0023 class RPCLogCone {
0024 public:
0025   /** Hits in one Logic Plane, if strips is fired, its number is added to the map as a key.
0026     * Vector stores the indexes in DigisVec (stored in L1RpcTrigg) of  Digis that formed log hits
0027     * Logic m_Strips are diferent from RPC strips - Logic m_Strips it is usaly OR
0028     * of 2 RPC strips with diferent eta (but the same phi). @see RPCLogHit
0029     */
0030   typedef std::map<int, std::vector<int> > TLogPlane;
0031 
0032   /// Default constructor. No hits, no muon.
0033   RPCLogCone();
0034 
0035   ///Constructor. Cone coordinates are set.
0036   RPCLogCone(int m_tower, int logSector, int logSegment);
0037 
0038   ///Constructor. One hit is added, cone coordinates are set from logHit.
0039   RPCLogCone(const RPCLogHit &logHit);
0040 
0041   ///Constructor. The cone is built from unsigned long long
0042   RPCLogCone(const unsigned long long &pat, int tower, int logSector, int logSegment);
0043 
0044   /// Compresses cone. Throws exception, if there is more than one hit in any logplane
0045   unsigned long long getCompressedCone();
0046 
0047   ///Adds next logHit .
0048   bool addLogHit(const RPCLogHit &logHit);
0049 
0050   TLogPlane getLogPlane(int logPlane) const;
0051 
0052   ///Gets fired strips count in given logPlane.
0053   int getHitsCnt(int logPlane) const;
0054 
0055   ///Set logic strip as fired. m_digiIdx - index of digi in digis vector stored by L1RpcTrigg
0056   void setLogStrip(int logPlane, int logStripNum, int m_digiIdx);
0057 
0058   ///Set logic strip as fired.
0059   void setLogStrip(int logPlane, int logStripNum);
0060 
0061   /** Get logic strip state. @return true if fired */
0062   bool getLogStripState(int logPlane, unsigned int logStripNum) const;
0063 
0064   /** Get vector of didgis indexes (in digis vector stored by L1RpcTrigg) 
0065     * for given logic strip. If strip was not fired returns empty vector*/
0066   std::vector<int> getLogStripDigisIdxs(int logPlane, unsigned int logStripNum) const;
0067 
0068   void setMuonCode(int code);
0069 
0070   int getMuonCode() const;
0071 
0072   void setMuonSign(int sign);
0073 
0074   int getMuonSign() const;
0075 
0076   ///Changes fired LogStrips: from "stripNum" to "stripNum + pos"
0077   void shift(int pos);
0078 
0079   bool isPlaneFired(int logPlane) const;
0080 
0081   int getFiredPlanesCnt() const;
0082 
0083   /** @return 0 - trigger not possible, 1 - 3 inner planes fired, 2 - 4 or more planes fired*/
0084   int possibleTrigger() const;
0085 
0086   int getTower() const;
0087 
0088   int getLogSector() const;
0089 
0090   int getLogSegment() const;
0091 
0092   RPCConst::l1RpcConeCrdnts getConeCrdnts() const;
0093 
0094   void setIdx(int index);
0095 
0096   int getIdx() const;
0097 
0098   std::string toString() const;
0099 
0100 private:
0101   ///Logic Planes
0102   std::vector<TLogPlane> m_LogPlanesVec;
0103 
0104   /** Digis that formed log hits in this LogCone, 
0105     * m_DigisIdx[logPlaneNum][i] gets the index in DigisVec stored in L1RpcTrigg
0106     */
0107   std::vector<std::vector<int> > m_DigisIdx;
0108 
0109   RPCConst::l1RpcConeCrdnts m_ConeCrdnts;
0110 
0111   int m_MuonCode;
0112 
0113   int m_MuonSign;
0114 
0115   ///m_Index in LogConesVec stored by L1RpcTrigg
0116   int m_Index;
0117 };
0118 
0119 typedef std::vector<RPCLogCone> L1RpcLogConesVec;
0120 #endif