Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "L1Trigger/L1TMuonOverlap/interface/OmtfName.h"
0002 
0003 namespace {
0004   template <typename T>
0005   int sgn(T val) {
0006     return (T(0) < val) - (val < T(0));
0007   }
0008 }  // namespace
0009 
0010 OmtfName::OmtfName(unsigned int iProcesor, int endcap) {
0011   int iproc = (iProcesor <= 5) ? static_cast<int>(iProcesor) : -1;
0012   int position = (abs(endcap) == 1) ? endcap : 0;
0013   theBoard = static_cast<Board>(sgn(position) * (iproc + 1));
0014 }
0015 
0016 OmtfName::OmtfName(unsigned int iProcesor, l1t::tftype endcap) {
0017   int iproc = (iProcesor <= 5) ? static_cast<int>(iProcesor) : -1;
0018   int position = (endcap == l1t::omtf_pos) ? 1 : ((endcap == l1t::omtf_neg) ? -1 : 0);
0019   theBoard = static_cast<Board>(sgn(position) * (iproc + 1));
0020 }
0021 
0022 OmtfName::OmtfName(const std::string& board) {
0023   if (board == "OMTFn1")
0024     theBoard = OMTFn1;
0025   else if (board == "OMTFn2")
0026     theBoard = OMTFn2;
0027   else if (board == "OMTFn3")
0028     theBoard = OMTFn3;
0029   else if (board == "OMTFn4")
0030     theBoard = OMTFn4;
0031   else if (board == "OMTFn5")
0032     theBoard = OMTFn5;
0033   else if (board == "OMTFn6")
0034     theBoard = OMTFn6;
0035   else if (board == "OMTFp1")
0036     theBoard = OMTFp1;
0037   else if (board == "OMTFp2")
0038     theBoard = OMTFp2;
0039   else if (board == "OMTFp3")
0040     theBoard = OMTFp3;
0041   else if (board == "OMTFp4")
0042     theBoard = OMTFp4;
0043   else if (board == "OMTFp5")
0044     theBoard = OMTFp5;
0045   else if (board == "OMTFp6")
0046     theBoard = OMTFp6;
0047   else
0048     theBoard = OMTFp6;
0049 }
0050 
0051 std::string OmtfName::name() const {
0052   switch (theBoard) {
0053     case (OMTFn1):
0054       return "OMTFn1";
0055     case (OMTFn2):
0056       return "OMTFn2";
0057     case (OMTFn3):
0058       return "OMTFn3";
0059     case (OMTFn4):
0060       return "OMTFn4";
0061     case (OMTFn5):
0062       return "OMTFn5";
0063     case (OMTFn6):
0064       return "OMTFn6";
0065     case (OMTFp1):
0066       return "OMTFp1";
0067     case (OMTFp2):
0068       return "OMTFp2";
0069     case (OMTFp3):
0070       return "OMTFp3";
0071     case (OMTFp4):
0072       return "OMTFp4";
0073     case (OMTFp5):
0074       return "OMTFp5";
0075     case (OMTFp6):
0076       return "OMTFp6";
0077     default:
0078       return "UNKNOWN";
0079   }
0080 }
0081 
0082 int OmtfName::position() const { return sgn(theBoard); }
0083 
0084 unsigned int OmtfName::processor() const { return abs(theBoard) - 1; }
0085 
0086 l1t::tftype OmtfName::tftype() const { return sgn(theBoard) > 0 ? l1t::omtf_pos : l1t::omtf_neg; }