Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1Trigger_RPCPacData_h
0002 #define L1Trigger_RPCPacData_h
0003 /*
0004 todo
0005 sprawdzic konwencje znaku mionu !!!!! (takze w L1RpcMuon0)
0006 */
0007 
0008 /** \class RPCPacData
0009  *
0010  * Performes Pattern Comparator algorithm for one LogCone. Returns one muon candidate.
0011  * The algorithm details i.e. patterns list, algorthm type for each pattern,
0012  * qaulity definition, are set from m_PAC definition file.
0013  * \author Karol Bunkowski (Warsaw),
0014  * \author Tomasz Fruboes (Warsaw) - porting to CMSSW
0015  */
0016 
0017 #include <vector>
0018 #include <string>
0019 #include <bitset>
0020 #include <map>
0021 #include <list>
0022 #include <iostream>
0023 #include "CondFormats/L1TObjects/interface/RPCPattern.h"
0024 //#include "L1Trigger/RPCTrigger/interface/RPCPacBase.h"
0025 #include "L1Trigger/RPCTrigger/interface/RPCPatternsParser.h"
0026 #include "L1Trigger/RPCTrigger/interface/TPatternsGroup.h"
0027 #include "L1Trigger/RPCTrigger/interface/TEPatternsGroup.h"
0028 #include "L1Trigger/RPCTrigger/interface/TTPatternsGroup.h"
0029 #include "CondFormats/L1TObjects/interface/L1RPCConfig.h"
0030 //------------------------------------------------------------------------------
0031 
0032 //class RPCPacData: public RPCPacBase {
0033 class RPCPacData {
0034   friend class RPCPac;
0035 
0036 public:
0037   RPCPacData(std::string patFilesDir, int m_tower, int logSector, int logSegment);
0038 
0039   RPCPacData(const RPCPattern::RPCPatVec &patVec, const RPCPattern::TQualityVec &qualVec);
0040 
0041   RPCPacData(const L1RPCConfig *patConf, const int tower, const int sector, const int segment);
0042 
0043   void init(const RPCPatternsParser &parser, const RPCConst::l1RpcConeCrdnts &coneCrdnts);
0044 
0045   /*RPCPacMuon run(const RPCLogCone& cone) const;*/
0046 
0047   bool getEPatternsGroupShape(int groupNum, int logPlane, int logStripNum);
0048 
0049   bool getTPatternsGroupShape(int logPlane, int logStripNum);
0050 
0051   int getPatternsCount();
0052 
0053   RPCPattern getPattern(int patNum) const;
0054 
0055   int getPatternsGroupCount();
0056 
0057   std::string getPatternsGroupDescription(int patternGroupNum);
0058 
0059 private:
0060   //---------------------needed types------------
0061   //----------------------------------------------------------------------------
0062   //----------------------------------------------------------------------------
0063   typedef std::list<TEPatternsGroup> TEPatternsGroupList;
0064 
0065 private:
0066   //Pac parametrs
0067   short m_RefGroupCount;  //!<From pac file - TT_REF_GROUP_NUMBERS.
0068 
0069   short m_MaxQuality;
0070 
0071   /** filled only if in constructor RPCPacData() createPatternsVec == true.
0072     * Contains all patterns from pac file. Needed for patterns expolorer,
0073     * does not used in trigger algorithm. */
0074   RPCPattern::RPCPatVec m_PatternsVec;
0075 
0076   /** The definiton of allowed coincidence of hits in planes and quality values assigned to them.
0077     * There can be few quality tables in one m_PAC, to every pattern one of those quality table is asigned.
0078     * (In barrel usualy 2 quality tables are used: one for high pt (4/6) and one for low pt (3/4).
0079     * One qaulity table is multimap<biteset, int>, bitset defines allowed coincidance,
0080     * int defines the quality value. m_QualityTabsVec is a vector of these maps,
0081     * the index in vector correspondes to the m_QualityTabNumber in pattern.
0082     * @see TQualityBitset, TQualityTab, TQualityTabsVec.
0083     */
0084   RPCConst::TQualityTabsVec m_QualityTabsVec;
0085 
0086   /** Container containig EPatternsGroups. Is filled by InsertPattern() during
0087     * parsing the pac file ParsePatternFile().*/
0088   TEPatternsGroupList m_EnergeticPatternsGroupList;
0089 
0090   ///Here patters used in "baseline" algorith are stored.
0091   TTPatternsGroup m_TrackPatternsGroup;
0092 
0093 private:
0094   /** Adds one qaulity record to m_QualityTabsVec.
0095     * @param qualityTabNumber - index of QualityTab (index in m_QualityTabsVec),
0096     * to which new record should be add.
0097     * @param qualityBitset - definition of plnaes in coincidance.
0098     * (qualityBitset[0] == true means, that LogPlane1 should be fired).
0099     *  @param quality - quality value assigned to given coincidance. */
0100   void insertQualityRecord(unsigned int qualityTabNumber, unsigned short firedPlanes, short quality);
0101 
0102   /** Adds pattern to m_TrackPatternsGroup or appropriate group
0103     * from m_EnergeticPatternsGroupList. If the appropriate TEPatternsGroup does
0104     * not exist, it is created.*/
0105   void insertPatterns(const RPCPattern::RPCPatVec &pattern,
0106                       const int tower = 99,
0107                       const int sector = 99,
0108                       const int segment = 99);
0109 
0110   /** Runs the "baselie" m_PAC algorithm. Compares the hits from cone with patterns
0111    * from m_TrackPatternsGroup. If many patterns fist to the hits (like usual),
0112    * the pattern, in which the hits coincidance had highest qauality is chosen
0113    * Next criteria is higer code.
0114    * the quality, code, and sign of this pattern are assigned to the returned RPCPacMuon. */
0115   /*RPCPacMuon runTrackPatternsGroup(const RPCLogCone& cone) const;*/
0116 
0117   /** Runs the "improved" m_PAC algorithm. Compares the hits from cone with patterns
0118    * from m_EnergeticPatternsGroupList. The main diferences from "baselie" m_PAC algorithm
0119    * is that here the coincidance (and quality) are searched for LogStrips belonging to the group,
0120    * and not for every pattern separetly.
0121    * @see For detailes of algorith see
0122    * "Pattern Comparator Trigger Algorithm  implementation in FPGA" */
0123   /*RPCPacMuon runEnergeticPatternsGroups(const RPCLogCone& cone) const;*/
0124 };
0125 #endif