CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/L1Trigger/TextToDigi/src/SourceCardRouting.h

Go to the documentation of this file.
00001 /*
00002   SourceCardRouting library
00003   Copyright Andrew Rose 2007
00004 */
00005 
00006 #ifndef SOURCECARDROUTING_H
00007 #define SOURCECARDROUTING_H
00008 
00009 // The string and stream definitions
00010 #include <iostream>
00011 #include <string>
00012 
00013 class SourceCardRouting {
00014 
00015  public:
00016 
00017   SourceCardRouting();
00018   ~SourceCardRouting();
00019 
00021   struct EmuToSfpData
00022   {
00023     // Input data.
00024     unsigned short eIsoRank[4];
00025     unsigned short eIsoCardId[4];
00026     unsigned short eIsoRegionId[4];
00027     unsigned short eNonIsoRank[4];
00028     unsigned short eNonIsoCardId[4];
00029     unsigned short eNonIsoRegionId[4];
00030     unsigned short mipBits[7][2];
00031     unsigned short qBits[7][2];
00032     // Output data.
00033     unsigned short sfp[2][4]; // [ cycle ] [ output number ]
00034   };
00035 
00036 //SFP arrays are SFP[cycle<2][sfp number<4]
00037 //electron arrays are eIsoRank[candidate number<4]
00038 //muon arrays are MIPbits[rec card number<7][region<2]
00039     void EMUtoSFP(      unsigned short (&eIsoRank)[4],
00040                         unsigned short (&eIsoCardId)[4],
00041                         unsigned short (&eIsoRegionId)[4],
00042                         unsigned short (&eNonIsoRank)[4],
00043                         unsigned short (&eNonIsoCardId)[4],
00044                         unsigned short (&eNonIsoRegionId)[4],
00045                         unsigned short (&MIPbits)[7][2],
00046                         unsigned short (&Qbits)[7][2],
00047                         unsigned short (&SFP)[2][4]     ) const;
00048 
00049 //SFP arrays are SFP[cycle<2][sfp number<4]
00050 //electron arrays are eIsoRank[candidate number<4]
00051 //muon arrays are MIPbits[rec card number<7][region<2]
00052     void SFPtoEMU(      unsigned short (&eIsoRank)[4],
00053                         unsigned short (&eIsoCardId)[4],
00054                         unsigned short (&eIsoRegionId)[4],
00055                         unsigned short (&eNonIsoRank)[4],
00056                         unsigned short (&eNonIsoCardId)[4],
00057                         unsigned short (&eNonIsoRegionId)[4],
00058                         unsigned short (&MIPbits)[7][2],
00059                         unsigned short (&Qbits)[7][2],
00060                         unsigned short (&SFP)[2][4]     ) const;
00061 
00062 /***********************************************************************************************************************/
00063 //RC arrays are RC[receiver card number<7][region<2]
00064 //HF arrays are HF[eta<4][HF region<2]
00065 //SFP arrays are SFP[cycle<2][sfp number<4]
00066     void RC56HFtoSFP(   unsigned short (&RC)[7][2],
00067                         unsigned short (&RCof)[7][2],
00068                         unsigned short (&RCtau)[7][2],
00069                         unsigned short (&HF)[4][2],
00070                         unsigned short (&HFQ)[4][2],
00071                         unsigned short (&SFP)[2][4]     ) const;
00072 
00073 //RC arrays are RC[receiver card number<7][region<2]
00074 //HF arrays are HF[eta<4][HF region<2]
00075 //SFP arrays are SFP[cycle<2][sfp number<4]
00076     void SFPtoRC56HF(   unsigned short (&RC)[7][2],
00077                         unsigned short (&RCof)[7][2],
00078                         unsigned short (&RCtau)[7][2],
00079                         unsigned short (&HF)[4][2],
00080                         unsigned short (&HFQ)[4][2],
00081                         unsigned short (&SFP)[2][4]     ) const;
00082 
00083 //RC arrays are RC[receiver card number<7][region<2]
00084 //SFP arrays are SFP[cycle<2][sfp number<4]
00085     void RC012toSFP(    unsigned short (&RC)[7][2],
00086                         unsigned short (&RCof)[7][2],
00087                         unsigned short (&RCtau)[7][2],
00088                         unsigned short (&SFP)[2][4]     ) const;
00089 
00090 //RC arrays are RC[receiver card number<7][region<2]
00091 //SFP arrays are SFP[cycle<2][sfp number<4]
00092     void SFPtoRC012(    unsigned short (&RC)[7][2],
00093                         unsigned short (&RCof)[7][2],
00094                         unsigned short (&RCtau)[7][2],
00095                         unsigned short (&SFP)[2][4]     ) const;
00096 
00097 //RC arrays are RC[receiver card number<7][region<2]
00098 //SFP arrays are SFP[cycle<2][sfp number<4]
00099     void RC234toSFP(    unsigned short (&RC)[7][2],
00100                         unsigned short (&RCof)[7][2],
00101                         unsigned short (&RCtau)[7][2],
00102                         unsigned short (&sisterRC)[7][2],
00103                         unsigned short (&sisterRCof)[7][2],
00104                         unsigned short (&sisterRCtau)[7][2],
00105                         unsigned short (&SFP)[2][4]     ) const;
00106 
00107 //RC arrays are RC[receiver card number<7][region<2]
00108 //SFP arrays are SFP[cycle<2][sfp number<4]
00109     void SFPtoRC234(    unsigned short (&RC)[7][2],
00110                         unsigned short (&RCof)[7][2],
00111                         unsigned short (&RCtau)[7][2],
00112                         unsigned short (&sisterRC)[7][2],
00113                         unsigned short (&sisterRCof)[7][2],
00114                         unsigned short (&sisterRCtau)[7][2],
00115                         unsigned short (&SFP)[2][4]     ) const;
00116 
00117 /***********************************************************************************************************************/
00118 
00119 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
00120 //SFP arrays are SFP[cycle<2][sfp number<4]
00121 
00122     void SFPtoVHDCI(    int RoutingMode,
00123                         unsigned short (&SFP)[2][4],
00124                         unsigned long (&VHDCI)[2][2] ) const;
00125 
00126 
00127 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
00128 //SFP arrays are SFP[cycle<2][sfp number<4]
00129     void VHDCItoSFP(    int RoutingMode,
00130                         unsigned short (&SFP)[2][4],
00131                         unsigned long (&VHDCI)[2][2]    ) const;
00132 
00133 /***********************************************************************************************************************/
00134 
00135 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
00136 //electron arrays are eIsoRank[candidate number<4]
00137 //muon arrays are MIPbits[rec card number<7][region<2]
00138 
00139     void EMUtoVHDCI(    unsigned short (&eIsoRank)[4],
00140                         unsigned short (&eIsoCardId)[4],
00141                         unsigned short (&eIsoRegionId)[4],
00142                         unsigned short (&eNonIsoRank)[4],
00143                         unsigned short (&eNonIsoCardId)[4],
00144                         unsigned short (&eNonIsoRegionId)[4],
00145                         unsigned short (&MIPbits)[7][2],
00146                         unsigned short (&Qbits)[7][2],
00147                         unsigned long (&VHDCI)[2][2]    ) const;
00148 
00149 
00150 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
00151 //electron arrays are eIsoRank[candidate number<4]
00152 //muon arrays are MIPbits[rec card number<7][region<2]
00153     void VHDCItoEMU(    unsigned short (&eIsoRank)[4],
00154                         unsigned short (&eIsoCardId)[4],
00155                         unsigned short (&eIsoRegionId)[4],
00156                         unsigned short (&eNonIsoRank)[4],
00157                         unsigned short (&eNonIsoCardId)[4],
00158                         unsigned short (&eNonIsoRegionId)[4],
00159                         unsigned short (&MIPbits)[7][2],
00160                         unsigned short (&Qbits)[7][2],
00161                         unsigned long (&VHDCI)[2][2]    ) const;
00162 
00163 
00164 
00165 /***********************************************************************************************************************/
00166 
00167 //RC arrays are RC[receiver card number<7][region<2]
00168 //HF arrays are HF[eta<4][HF region<2]
00169 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
00170     void RC56HFtoVHDCI( unsigned short (&RC)[7][2],
00171                         unsigned short (&RCof)[7][2],
00172                         unsigned short (&RCtau)[7][2],
00173                         unsigned short (&HF)[4][2],
00174                         unsigned short (&HFQ)[4][2],
00175                         unsigned long (&VHDCI)[2][2]    ) const;
00176 
00177 //RC arrays are RC[receiver card number<7][region<2]
00178 //HF arrays are HF[eta<4][HF region<2]
00179 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
00180     void VHDCItoRC56HF( unsigned short (&RC)[7][2],
00181                         unsigned short (&RCof)[7][2],
00182                         unsigned short (&RCtau)[7][2],
00183                         unsigned short (&HF)[4][2],
00184                         unsigned short (&HFQ)[4][2],
00185                         unsigned long (&VHDCI)[2][2]    ) const;
00186 
00187 //RC arrays are RC[receiver card number<7][region<2]
00188 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
00189     void RC012toVHDCI(  unsigned short (&RC)[7][2],
00190                         unsigned short (&RCof)[7][2],
00191                         unsigned short (&RCtau)[7][2],
00192                         unsigned long (&VHDCI)[2][2]) const;
00193 
00194 //RC arrays are RC[receiver card number<7][region<2]
00195 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
00196     void VHDCItoRC012(  unsigned short (&RC)[7][2],
00197                         unsigned short (&RCof)[7][2],
00198                         unsigned short (&RCtau)[7][2],
00199                         unsigned long (&VHDCI)[2][2]    ) const;
00200 
00201 //RC arrays are RC[receiver card number<7][region<2]
00202 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
00203     void RC234toVHDCI(  unsigned short (&RC)[7][2],
00204                         unsigned short (&RCof)[7][2],
00205                         unsigned short (&RCtau)[7][2],
00206                         unsigned short (&sisterRC)[7][2],
00207                         unsigned short (&sisterRCof)[7][2],
00208                         unsigned short (&sisterRCtau)[7][2],
00209                         unsigned long (&VHDCI)[2][2]    ) const;
00210 
00211 //RC arrays are RC[receiver card number<7][region<2]
00212 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
00213     void VHDCItoRC234(  unsigned short (&RC)[7][2],
00214                         unsigned short (&RCof)[7][2],
00215                         unsigned short (&RCtau)[7][2],
00216                         unsigned short (&sisterRC)[7][2],
00217                         unsigned short (&sisterRCof)[7][2],
00218                         unsigned short (&sisterRCtau)[7][2],
00219                         unsigned long (&VHDCI)[2][2]    ) const;
00220 
00221 /***********************************************************************************************************************/
00222 
00223 //electron arrays are eIsoRank[candidate number<4]
00224 //muon arrays are MIPbits[rec card number<7][region<2]
00225 
00226     void EMUtoSTRING(   unsigned short &logicalCardID,
00227                         unsigned short &eventNumber,
00228                         unsigned short (&eIsoRank)[4],
00229                         unsigned short (&eIsoCardId)[4],
00230                         unsigned short (&eIsoRegionId)[4],
00231                         unsigned short (&eNonIsoRank)[4],
00232                         unsigned short (&eNonIsoCardId)[4],
00233                         unsigned short (&eNonIsoRegionId)[4],
00234                         unsigned short (&MIPbits)[7][2],
00235                         unsigned short (&Qbits)[7][2],
00236                         std::string &dataString ) const;
00237 
00238 //RC arrays are RC[receiver card number<7][region<2]
00239 //HF arrays are HF[eta<4][HF region<2]
00240     void RC56HFtoSTRING(        unsigned short &logicalCardID,
00241                         unsigned short &eventNumber,
00242                         unsigned short (&RC)[7][2],
00243                         unsigned short (&RCof)[7][2],
00244                         unsigned short (&RCtau)[7][2],
00245                         unsigned short (&HF)[4][2],
00246                         unsigned short (&HFQ)[4][2],
00247                         std::string &dataString ) const;
00248 
00249 //RC arrays are RC[receiver card number<7][region<2]
00250     void RC012toSTRING( unsigned short &logicalCardID,
00251                         unsigned short &eventNumber,
00252                         unsigned short (&RC)[7][2],
00253                         unsigned short (&RCof)[7][2],
00254                         unsigned short (&RCtau)[7][2],
00255                         std::string &dataString ) const;
00256 
00257 //RC arrays are RC[receiver card number<7][region<2]
00258     void RC234toSTRING( unsigned short &logicalCardID,
00259                         unsigned short &eventNumber,
00260                         unsigned short (&RC)[7][2],
00261                         unsigned short (&RCof)[7][2],
00262                         unsigned short (&RCtau)[7][2],
00263                         unsigned short (&sisterRC)[7][2],
00264                         unsigned short (&sisterRCof)[7][2],
00265                         unsigned short (&sisterRCtau)[7][2],
00266                         std::string &dataString ) const;
00267 
00268 /***********************************************************************************************************************/
00269 
00270 //SFP arrays are SFP[cycle<2][sfp number<4]
00271     void SFPtoSTRING(   unsigned short &logicalCardID,
00272                         unsigned short &eventNumber,
00273                         int RoutingMode,
00274                         unsigned short (&SFP)[2][4],
00275                         std::string &dataString ) const;
00276 
00277 /***********************************************************************************************************************/
00278 
00279 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
00280     void STRINGtoVHDCI( unsigned short &logicalCardID,
00281                         unsigned short &eventNumber,
00282                         std::string &dataString,
00283                         unsigned long (&VHDCI)[2][2]    ) const;
00284 
00285 
00286 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
00287     void VHDCItoSTRING( unsigned short &logicalCardID,
00288                         unsigned short &eventNumber,
00289                         std::string &dataString,
00290                         unsigned long (&VHDCI)[2][2]    ) const;
00291 
00292 /***********************************************************************************************************************/
00293 
00294     void LogicalCardIDtoRoutingMode( unsigned short &logicalCardID,
00295                                      int &RoutingMode,
00296                                      int &RCTCrateNumber        ) const;
00297 
00298    void RoutingModetoLogicalCardID( unsigned short &logicalCardID,
00299                                      int &RoutingMode,
00300                                      int &RCTCrateNumber        ) const;
00301 
00302 
00303 
00304 }; //class SourceCardRouting
00305 
00306 #endif //~SOURCECARDMANAGER_H
00307 
00308 
00309 
00310 
00311 
00312 
00313 
00314 
00315 
00316 
00317 
00318 
00319 
00321 //These were going to be implimented but made things a lot more complicated than necessary
00322 /*
00323 //RC arrays are RC[receiver card number<7][region<2]
00324 //HF arrays are HF[eta<4][HF region<2]
00325 //SFP arrays are SFP[cycle<2][sfp number<4]
00326     void RCtoSFP(       int &RoutingMode,
00327                         unsigned short (&RC)[7][2],
00328                         unsigned short (&RCof)[7][2],
00329                         unsigned short (&RCtau)[7][2],
00330                         unsigned short (&sisterRC)[7][2],
00331                         unsigned short (&sisterRCof)[7][2],
00332                         unsigned short (&sisterRCtau)[7][2],
00333                         unsigned short (&HF)[4][2],
00334                         unsigned short (&HFQ)[4][2],
00335                         unsigned short (&SFP)[2][4] );
00336 
00337 
00338 //RC arrays are RC[receiver card number<7][region<2]
00339 //HF arrays are HF[eta<4][HF region<2]
00340 //SFP arrays are SFP[cycle<2][sfp number<4]
00341     void SFPtoRC(       int &RoutingMode,
00342                         unsigned short (&RC)[7][2],
00343                         unsigned short (&RCof)[7][2],
00344                         unsigned short (&RCtau)[7][2],
00345                         unsigned short (&sisterRC)[7][2],
00346                         unsigned short (&sisterRCof)[7][2],
00347                         unsigned short (&sisterRCtau)[7][2],
00348                         unsigned short (&HF)[4][2],
00349                         unsigned short (&HFQ)[4][2],
00350                         unsigned short (&SFP)[2][4] );*/
00351 
00352 /*
00353 //RC arrays are RC[receiver card number<7][region<2]
00354 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
00355     void RCtoSTRING(    unsigned short &logicalCardID,
00356                         unsigned short &eventNumber,
00357                         unsigned short (&RC)[7][2],
00358                         unsigned short (&RCof)[7][2],
00359                         unsigned short (&RCtau)[7][2],
00360                         unsigned short (&sisterRC)[7][2],
00361                         unsigned short (&sisterRCof)[7][2],
00362                         unsigned short (&sisterRCtau)[7][2],
00363                         unsigned short (&HF)[4][2],
00364                         unsigned short (&HFQ)[4][2],
00365                         std::string &dataString );
00366 */      
00367 
00368 /*
00369 //RC arrays are RC[receiver card number<7][region<2]
00370 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
00371     void RCtoVHDCI(     int &RoutingMode,
00372                         unsigned short (&RC)[7][2],
00373                         unsigned short (&RCof)[7][2],
00374                         unsigned short (&RCtau)[7][2],
00375                         unsigned short (&sisterRC)[7][2],
00376                         unsigned short (&sisterRCof)[7][2],
00377                         unsigned short (&sisterRCtau)[7][2],
00378                         unsigned short (&HF)[4][2],
00379                         unsigned short (&HFQ)[4][2],
00380                         unsigned long (&VHDCI)[2][2]    );
00381 
00382 //RC arrays are RC[receiver card number<7][region<2]
00383 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
00384     void VHDCItoRC(     int &RoutingMode,
00385                         unsigned short (&RC)[7][2],
00386                         unsigned short (&RCof)[7][2],
00387                         unsigned short (&RCtau)[7][2],
00388                         unsigned short (&sisterRC)[7][2],
00389                         unsigned short (&sisterRCof)[7][2],
00390                         unsigned short (&sisterRCtau)[7][2],
00391                         unsigned short (&HF)[4][2],
00392                         unsigned short (&HFQ)[4][2],
00393                         unsigned long (&VHDCI)[2][2]    );
00394 */
00395 
00396 
00397 
00398 
00399 
00400 
00401 
00402 
00403 
00404 
00405 
00406 
00407