Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-07 02:12:44

0001 /*
0002   SourceCardRouting library
0003   Andrew Rose 2007
0004 */
0005 
0006 #ifndef SOURCECARDROUTING_H
0007 #define SOURCECARDROUTING_H
0008 
0009 // The string and stream definitions
0010 #include <iostream>
0011 #include <string>
0012 
0013 class SourceCardRouting {
0014 public:
0015   SourceCardRouting();
0016   ~SourceCardRouting();
0017 
0018   /// Struct of all data needed for running the emulator to SFP (sourcecard
0019   /// optical output) conversion.
0020   struct EmuToSfpData {
0021     // Input data.
0022     unsigned short eIsoRank[4];
0023     unsigned short eIsoCardId[4];
0024     unsigned short eIsoRegionId[4];
0025     unsigned short eNonIsoRank[4];
0026     unsigned short eNonIsoCardId[4];
0027     unsigned short eNonIsoRegionId[4];
0028     unsigned short mipBits[7][2];
0029     unsigned short qBits[7][2];
0030     // Output data.
0031     unsigned short sfp[2][4];  // [ cycle ] [ output number ]
0032   };
0033 
0034   // SFP arrays are SFP[cycle<2][sfp number<4]
0035   // electron arrays are eIsoRank[candidate number<4]
0036   // muon arrays are MIPbits[rec card number<7][region<2]
0037   void EMUtoSFP(unsigned short (&eIsoRank)[4],
0038                 unsigned short (&eIsoCardId)[4],
0039                 unsigned short (&eIsoRegionId)[4],
0040                 unsigned short (&eNonIsoRank)[4],
0041                 unsigned short (&eNonIsoCardId)[4],
0042                 unsigned short (&eNonIsoRegionId)[4],
0043                 unsigned short (&MIPbits)[7][2],
0044                 unsigned short (&Qbits)[7][2],
0045                 unsigned short (&SFP)[2][4]) const;
0046 
0047   // SFP arrays are SFP[cycle<2][sfp number<4]
0048   // electron arrays are eIsoRank[candidate number<4]
0049   // muon arrays are MIPbits[rec card number<7][region<2]
0050   void SFPtoEMU(unsigned short (&eIsoRank)[4],
0051                 unsigned short (&eIsoCardId)[4],
0052                 unsigned short (&eIsoRegionId)[4],
0053                 unsigned short (&eNonIsoRank)[4],
0054                 unsigned short (&eNonIsoCardId)[4],
0055                 unsigned short (&eNonIsoRegionId)[4],
0056                 unsigned short (&MIPbits)[7][2],
0057                 unsigned short (&Qbits)[7][2],
0058                 unsigned short (&SFP)[2][4]) const;
0059 
0060   /***********************************************************************************************************************/
0061   // RC arrays are RC[receiver card number<7][region<2]
0062   // HF arrays are HF[eta<4][HF region<2]
0063   // SFP arrays are SFP[cycle<2][sfp number<4]
0064   void RC56HFtoSFP(unsigned short (&RC)[7][2],
0065                    unsigned short (&RCof)[7][2],
0066                    unsigned short (&RCtau)[7][2],
0067                    unsigned short (&HF)[4][2],
0068                    unsigned short (&HFQ)[4][2],
0069                    unsigned short (&SFP)[2][4]) const;
0070 
0071   // RC arrays are RC[receiver card number<7][region<2]
0072   // HF arrays are HF[eta<4][HF region<2]
0073   // SFP arrays are SFP[cycle<2][sfp number<4]
0074   void SFPtoRC56HF(unsigned short (&RC)[7][2],
0075                    unsigned short (&RCof)[7][2],
0076                    unsigned short (&RCtau)[7][2],
0077                    unsigned short (&HF)[4][2],
0078                    unsigned short (&HFQ)[4][2],
0079                    unsigned short (&SFP)[2][4]) const;
0080 
0081   // RC arrays are RC[receiver card number<7][region<2]
0082   // SFP arrays are SFP[cycle<2][sfp number<4]
0083   void RC012toSFP(unsigned short (&RC)[7][2],
0084                   unsigned short (&RCof)[7][2],
0085                   unsigned short (&RCtau)[7][2],
0086                   unsigned short (&SFP)[2][4]) const;
0087 
0088   // RC arrays are RC[receiver card number<7][region<2]
0089   // SFP arrays are SFP[cycle<2][sfp number<4]
0090   void SFPtoRC012(unsigned short (&RC)[7][2],
0091                   unsigned short (&RCof)[7][2],
0092                   unsigned short (&RCtau)[7][2],
0093                   unsigned short (&SFP)[2][4]) const;
0094 
0095   // RC arrays are RC[receiver card number<7][region<2]
0096   // SFP arrays are SFP[cycle<2][sfp number<4]
0097   void RC234toSFP(unsigned short (&RC)[7][2],
0098                   unsigned short (&RCof)[7][2],
0099                   unsigned short (&RCtau)[7][2],
0100                   unsigned short (&sisterRC)[7][2],
0101                   unsigned short (&sisterRCof)[7][2],
0102                   unsigned short (&sisterRCtau)[7][2],
0103                   unsigned short (&SFP)[2][4]) const;
0104 
0105   // RC arrays are RC[receiver card number<7][region<2]
0106   // SFP arrays are SFP[cycle<2][sfp number<4]
0107   void SFPtoRC234(unsigned short (&RC)[7][2],
0108                   unsigned short (&RCof)[7][2],
0109                   unsigned short (&RCtau)[7][2],
0110                   unsigned short (&sisterRC)[7][2],
0111                   unsigned short (&sisterRCof)[7][2],
0112                   unsigned short (&sisterRCtau)[7][2],
0113                   unsigned short (&SFP)[2][4]) const;
0114 
0115   /***********************************************************************************************************************/
0116 
0117   // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
0118   // SFP arrays are SFP[cycle<2][sfp number<4]
0119 
0120   void SFPtoVHDCI(int RoutingMode, unsigned short (&SFP)[2][4], unsigned long (&VHDCI)[2][2]) const;
0121 
0122   // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
0123   // SFP arrays are SFP[cycle<2][sfp number<4]
0124   void VHDCItoSFP(int RoutingMode, unsigned short (&SFP)[2][4], unsigned long (&VHDCI)[2][2]) const;
0125 
0126   /***********************************************************************************************************************/
0127 
0128   // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
0129   // electron arrays are eIsoRank[candidate number<4]
0130   // muon arrays are MIPbits[rec card number<7][region<2]
0131 
0132   void EMUtoVHDCI(unsigned short (&eIsoRank)[4],
0133                   unsigned short (&eIsoCardId)[4],
0134                   unsigned short (&eIsoRegionId)[4],
0135                   unsigned short (&eNonIsoRank)[4],
0136                   unsigned short (&eNonIsoCardId)[4],
0137                   unsigned short (&eNonIsoRegionId)[4],
0138                   unsigned short (&MIPbits)[7][2],
0139                   unsigned short (&Qbits)[7][2],
0140                   unsigned long (&VHDCI)[2][2]) const;
0141 
0142   // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
0143   // electron arrays are eIsoRank[candidate number<4]
0144   // muon arrays are MIPbits[rec card number<7][region<2]
0145   void VHDCItoEMU(unsigned short (&eIsoRank)[4],
0146                   unsigned short (&eIsoCardId)[4],
0147                   unsigned short (&eIsoRegionId)[4],
0148                   unsigned short (&eNonIsoRank)[4],
0149                   unsigned short (&eNonIsoCardId)[4],
0150                   unsigned short (&eNonIsoRegionId)[4],
0151                   unsigned short (&MIPbits)[7][2],
0152                   unsigned short (&Qbits)[7][2],
0153                   unsigned long (&VHDCI)[2][2]) const;
0154 
0155   /***********************************************************************************************************************/
0156 
0157   // RC arrays are RC[receiver card number<7][region<2]
0158   // HF arrays are HF[eta<4][HF region<2]
0159   // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
0160   void RC56HFtoVHDCI(unsigned short (&RC)[7][2],
0161                      unsigned short (&RCof)[7][2],
0162                      unsigned short (&RCtau)[7][2],
0163                      unsigned short (&HF)[4][2],
0164                      unsigned short (&HFQ)[4][2],
0165                      unsigned long (&VHDCI)[2][2]) const;
0166 
0167   // RC arrays are RC[receiver card number<7][region<2]
0168   // HF arrays are HF[eta<4][HF region<2]
0169   // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
0170   void VHDCItoRC56HF(unsigned short (&RC)[7][2],
0171                      unsigned short (&RCof)[7][2],
0172                      unsigned short (&RCtau)[7][2],
0173                      unsigned short (&HF)[4][2],
0174                      unsigned short (&HFQ)[4][2],
0175                      unsigned long (&VHDCI)[2][2]) const;
0176 
0177   // RC arrays are RC[receiver card number<7][region<2]
0178   // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
0179   void RC012toVHDCI(unsigned short (&RC)[7][2],
0180                     unsigned short (&RCof)[7][2],
0181                     unsigned short (&RCtau)[7][2],
0182                     unsigned long (&VHDCI)[2][2]) const;
0183 
0184   // RC arrays are RC[receiver card number<7][region<2]
0185   // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
0186   void VHDCItoRC012(unsigned short (&RC)[7][2],
0187                     unsigned short (&RCof)[7][2],
0188                     unsigned short (&RCtau)[7][2],
0189                     unsigned long (&VHDCI)[2][2]) const;
0190 
0191   // RC arrays are RC[receiver card number<7][region<2]
0192   // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
0193   void RC234toVHDCI(unsigned short (&RC)[7][2],
0194                     unsigned short (&RCof)[7][2],
0195                     unsigned short (&RCtau)[7][2],
0196                     unsigned short (&sisterRC)[7][2],
0197                     unsigned short (&sisterRCof)[7][2],
0198                     unsigned short (&sisterRCtau)[7][2],
0199                     unsigned long (&VHDCI)[2][2]) const;
0200 
0201   // RC arrays are RC[receiver card number<7][region<2]
0202   // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
0203   void VHDCItoRC234(unsigned short (&RC)[7][2],
0204                     unsigned short (&RCof)[7][2],
0205                     unsigned short (&RCtau)[7][2],
0206                     unsigned short (&sisterRC)[7][2],
0207                     unsigned short (&sisterRCof)[7][2],
0208                     unsigned short (&sisterRCtau)[7][2],
0209                     unsigned long (&VHDCI)[2][2]) const;
0210 
0211   /***********************************************************************************************************************/
0212 
0213   // electron arrays are eIsoRank[candidate number<4]
0214   // muon arrays are MIPbits[rec card number<7][region<2]
0215 
0216   void EMUtoSTRING(unsigned short &logicalCardID,
0217                    unsigned short &eventNumber,
0218                    unsigned short (&eIsoRank)[4],
0219                    unsigned short (&eIsoCardId)[4],
0220                    unsigned short (&eIsoRegionId)[4],
0221                    unsigned short (&eNonIsoRank)[4],
0222                    unsigned short (&eNonIsoCardId)[4],
0223                    unsigned short (&eNonIsoRegionId)[4],
0224                    unsigned short (&MIPbits)[7][2],
0225                    unsigned short (&Qbits)[7][2],
0226                    std::string &dataString) const;
0227 
0228   // RC arrays are RC[receiver card number<7][region<2]
0229   // HF arrays are HF[eta<4][HF region<2]
0230   void RC56HFtoSTRING(unsigned short &logicalCardID,
0231                       unsigned short &eventNumber,
0232                       unsigned short (&RC)[7][2],
0233                       unsigned short (&RCof)[7][2],
0234                       unsigned short (&RCtau)[7][2],
0235                       unsigned short (&HF)[4][2],
0236                       unsigned short (&HFQ)[4][2],
0237                       std::string &dataString) const;
0238 
0239   // RC arrays are RC[receiver card number<7][region<2]
0240   void RC012toSTRING(unsigned short &logicalCardID,
0241                      unsigned short &eventNumber,
0242                      unsigned short (&RC)[7][2],
0243                      unsigned short (&RCof)[7][2],
0244                      unsigned short (&RCtau)[7][2],
0245                      std::string &dataString) const;
0246 
0247   // RC arrays are RC[receiver card number<7][region<2]
0248   void RC234toSTRING(unsigned short &logicalCardID,
0249                      unsigned short &eventNumber,
0250                      unsigned short (&RC)[7][2],
0251                      unsigned short (&RCof)[7][2],
0252                      unsigned short (&RCtau)[7][2],
0253                      unsigned short (&sisterRC)[7][2],
0254                      unsigned short (&sisterRCof)[7][2],
0255                      unsigned short (&sisterRCtau)[7][2],
0256                      std::string &dataString) const;
0257 
0258   /***********************************************************************************************************************/
0259 
0260   // SFP arrays are SFP[cycle<2][sfp number<4]
0261   void SFPtoSTRING(unsigned short &logicalCardID,
0262                    unsigned short &eventNumber,
0263                    int RoutingMode,
0264                    unsigned short (&SFP)[2][4],
0265                    std::string &dataString) const;
0266 
0267   /***********************************************************************************************************************/
0268 
0269   // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
0270   void STRINGtoVHDCI(unsigned short &logicalCardID,
0271                      unsigned short &eventNumber,
0272                      std::string &dataString,
0273                      unsigned long (&VHDCI)[2][2]) const;
0274 
0275   // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
0276   void VHDCItoSTRING(unsigned short &logicalCardID,
0277                      unsigned short &eventNumber,
0278                      std::string &dataString,
0279                      unsigned long (&VHDCI)[2][2]) const;
0280 
0281   /***********************************************************************************************************************/
0282 
0283   void LogicalCardIDtoRoutingMode(unsigned short &logicalCardID, int &RoutingMode, int &RCTCrateNumber) const;
0284 
0285   void RoutingModetoLogicalCardID(unsigned short &logicalCardID, int &RoutingMode, int &RCTCrateNumber) const;
0286 
0287 };  // class SourceCardRouting
0288 
0289 #endif  //~SOURCECARDMANAGER_H
0290 
0291 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0292 // These were going to be implimented but made things a lot more complicated
0293 // than necessary
0294 /*
0295 //RC arrays are RC[receiver card number<7][region<2]
0296 //HF arrays are HF[eta<4][HF region<2]
0297 //SFP arrays are SFP[cycle<2][sfp number<4]
0298     void RCtoSFP(   int &RoutingMode,
0299                         unsigned short (&RC)[7][2],
0300                         unsigned short (&RCof)[7][2],
0301                         unsigned short (&RCtau)[7][2],
0302                         unsigned short (&sisterRC)[7][2],
0303                         unsigned short (&sisterRCof)[7][2],
0304                         unsigned short (&sisterRCtau)[7][2],
0305                         unsigned short (&HF)[4][2],
0306                         unsigned short (&HFQ)[4][2],
0307                         unsigned short (&SFP)[2][4] );
0308 
0309 
0310 //RC arrays are RC[receiver card number<7][region<2]
0311 //HF arrays are HF[eta<4][HF region<2]
0312 //SFP arrays are SFP[cycle<2][sfp number<4]
0313     void SFPtoRC(   int &RoutingMode,
0314                         unsigned short (&RC)[7][2],
0315                         unsigned short (&RCof)[7][2],
0316                         unsigned short (&RCtau)[7][2],
0317                         unsigned short (&sisterRC)[7][2],
0318                         unsigned short (&sisterRCof)[7][2],
0319                         unsigned short (&sisterRCtau)[7][2],
0320                         unsigned short (&HF)[4][2],
0321                         unsigned short (&HFQ)[4][2],
0322                         unsigned short (&SFP)[2][4] );*/
0323 
0324 /*
0325 //RC arrays are RC[receiver card number<7][region<2]
0326 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
0327     void RCtoSTRING(    unsigned short &logicalCardID,
0328                         unsigned short &eventNumber,
0329                         unsigned short (&RC)[7][2],
0330                         unsigned short (&RCof)[7][2],
0331                         unsigned short (&RCtau)[7][2],
0332                         unsigned short (&sisterRC)[7][2],
0333                         unsigned short (&sisterRCof)[7][2],
0334                         unsigned short (&sisterRCtau)[7][2],
0335                         unsigned short (&HF)[4][2],
0336                         unsigned short (&HFQ)[4][2],
0337                         std::string &dataString );
0338 */
0339 
0340 /*
0341 //RC arrays are RC[receiver card number<7][region<2]
0342 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
0343     void RCtoVHDCI( int &RoutingMode,
0344                         unsigned short (&RC)[7][2],
0345                         unsigned short (&RCof)[7][2],
0346                         unsigned short (&RCtau)[7][2],
0347                         unsigned short (&sisterRC)[7][2],
0348                         unsigned short (&sisterRCof)[7][2],
0349                         unsigned short (&sisterRCtau)[7][2],
0350                         unsigned short (&HF)[4][2],
0351                         unsigned short (&HFQ)[4][2],
0352                         unsigned long (&VHDCI)[2][2]    );
0353 
0354 //RC arrays are RC[receiver card number<7][region<2]
0355 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
0356     void VHDCItoRC( int &RoutingMode,
0357                         unsigned short (&RC)[7][2],
0358                         unsigned short (&RCof)[7][2],
0359                         unsigned short (&RCtau)[7][2],
0360                         unsigned short (&sisterRC)[7][2],
0361                         unsigned short (&sisterRCof)[7][2],
0362                         unsigned short (&sisterRCtau)[7][2],
0363                         unsigned short (&HF)[4][2],
0364                         unsigned short (&HFQ)[4][2],
0365                         unsigned long (&VHDCI)[2][2]    );
0366 */