CMS 3D CMS Logo

List of all members | Public Member Functions
PtAssignmentEngineAux2017 Class Reference

#include <PtAssignmentEngineAux2017.h>

Inheritance diagram for PtAssignmentEngineAux2017:
PtAssignmentEngineAux

Public Member Functions

int calcBendFromPattern (const int pattern, const int endcap) const
 
void calcBends (int &bend1, int &bend2, int &bend3, int &bend4, const int pat1, const int pat2, const int pat3, const int pat4, const int dPhSign, const int endcap, const int mode, const bool BIT_COMP=false) const
 
void calcDeltaPhis (int &dPh12, int &dPh13, int &dPh14, int &dPh23, int &dPh24, int &dPh34, int &dPhSign, int &dPhSum4, int &dPhSum4A, int &dPhSum3, int &dPhSum3A, int &outStPh, const int ph1, const int ph2, const int ph3, const int ph4, const int mode, const bool BIT_COMP=false) const
 
void calcDeltaPhiSums (int &dPhSum4, int &dPhSum4A, int &dPhSum3, int &dPhSum3A, int &outStPh, const int dPh12, const int dPh13, const int dPh14, const int dPh23, const int dPh24, const int dPh34) const
 
void calcDeltaThetas (int &dTh12, int &dTh13, int &dTh14, int &dTh23, int &dTh24, int &dTh34, const int th1, const int th2, const int th3, const int th4, const int mode, const bool BIT_COMP=false) const
 
void calcRPCs (int &RPC1, int &RPC2, int &RPC3, int &RPC4, const int mode, const int st1_ring2, const int theta, const bool BIT_COMP=false) const
 
int calcTrackTheta (const int th1, const int th2, const int th3, const int th4, const int ring1, const int mode, const bool BIT_COMP=false) const
 
int get2bRPC (int clctA, int clctB, int clctC) const
 
int get8bMode15 (int theta, int st1_ring2, int endcap, int sPhiAB, int clctA, int clctB, int clctC, int clctD) const
 
int getCLCT (int clct, int endcap, int dPhiSign, int bits=3) const
 
int getdPhiFromBin (int dPhiBin, int bits=7, int max=512) const
 
int getdTheta (int dTheta, int bits=3) const
 
int getNLBdPhi (int dPhi, int bits=7, int max=512) const
 
int getNLBdPhiBin (int dPhi, int bits=7, int max=512) const
 
int getTheta (int theta, int ring2, int bits=5) const
 
void unpack2bRPC (int rpc_2b, int &rpcA, int &rpcB, int &rpcC) const
 
void unpack8bMode15 (int mode15_8b, int &theta, int &st1_ring2, int endcap, int sPhiAB, int &clctA, int &rpcA, int &rpcB, int &rpcC, int &rpcD) const
 
int unpackCLCT (int clct, int endcap, int dPhiSign, int bits) const
 
int unpackdTheta (int dTheta, int bits) const
 
int unpackSt1Ring2 (int theta, int bits) const
 
void unpackTheta (int &theta, int &st1_ring2, int bits) const
 
- Public Member Functions inherited from PtAssignmentEngineAux
std::pair< int, int > getGMTCharge (int mode, const std::vector< int > &phidiffs) const
 
int getGMTDxy (float dxy) const
 
int getGMTEta (int theta, int endcap) const
 
int getGMTPhi (int phi) const
 
int getGMTPhiV2 (int phi) const
 
int getGMTPt (float pt) const
 
int getGMTPtDxy (float pt) const
 
int getGMTQuality (int mode, int theta, bool promoteMode7, int version) const
 
float getPtFromGMTPt (int gmt_pt) const
 
float getPtFromGMTPtDxy (int gmt_pt_dxy) const
 

Detailed Description

Definition at line 6 of file PtAssignmentEngineAux2017.h.

Member Function Documentation

◆ calcBendFromPattern()

int PtAssignmentEngineAux2017::calcBendFromPattern ( const int  pattern,
const int  endcap 
) const

Definition at line 999 of file PtAssignmentEngineAux2017.cc.

References emtf_assert, makeMuonMisalignmentScenario::endcap, and topSingleLeptonDQM_PU_cfi::pattern.

Referenced by calcBends().

999  {
1000  int bend = -99;
1001  if (pattern < 0)
1002  return bend;
1003 
1004  if (pattern == 10)
1005  bend = 0;
1006  else if ((pattern % 2) == 0)
1007  bend = (10 - pattern) / 2;
1008  else if ((pattern % 2) == 1)
1009  bend = -1 * (11 - pattern) / 2;
1010 
1011  // Reverse to match dPhi convention
1012  if (endcap == 1)
1013  bend *= -1;
1014 
1015  emtf_assert(bend != -99);
1016  return bend;
1017 }
#define emtf_assert(expr)
Definition: DebugTools.h:18

◆ calcBends()

void PtAssignmentEngineAux2017::calcBends ( int &  bend1,
int &  bend2,
int &  bend3,
int &  bend4,
const int  pat1,
const int  pat2,
const int  pat3,
const int  pat4,
const int  dPhSign,
const int  endcap,
const int  mode,
const bool  BIT_COMP = false 
) const

Definition at line 895 of file PtAssignmentEngineAux2017.cc.

References calcBendFromPattern(), makeMuonMisalignmentScenario::endcap, getCLCT(), and ALCARECOPromptCalibProdSiPixelAli0T_cff::mode.

Referenced by PtAssignmentEngine2017::calculate_pt_xml().

906  {
907  bend1 = calcBendFromPattern(pat1, endcap);
908  bend2 = calcBendFromPattern(pat2, endcap);
909  bend3 = calcBendFromPattern(pat3, endcap);
910  bend4 = calcBendFromPattern(pat4, endcap);
911 
912  if (BIT_COMP) {
913  int nBits = 3;
914  if (mode == 7 || mode == 11 || mode > 12)
915  nBits = 2;
916 
917  if (mode / 8 > 0) // Has station 1 hit
918  bend1 = getCLCT(pat1, endcap, dPhSign, nBits);
919  if ((mode % 8) / 4 > 0) // Has station 2 hit
920  bend2 = getCLCT(pat2, endcap, dPhSign, nBits);
921  if ((mode % 4) / 2 > 0) // Has station 3 hit
922  bend3 = getCLCT(pat3, endcap, dPhSign, nBits);
923  if ((mode % 2) > 0) // Has station 4 hit
924  bend4 = getCLCT(pat4, endcap, dPhSign, nBits);
925  } // End conditional: if (BIT_COMP)
926 
927 } // End function: void PtAssignmentEngineAux2017::calcBends()
int getCLCT(int clct, int endcap, int dPhiSign, int bits=3) const
int calcBendFromPattern(const int pattern, const int endcap) const

◆ calcDeltaPhis()

void PtAssignmentEngineAux2017::calcDeltaPhis ( int &  dPh12,
int &  dPh13,
int &  dPh14,
int &  dPh23,
int &  dPh24,
int &  dPh34,
int &  dPhSign,
int &  dPhSum4,
int &  dPhSum4A,
int &  dPhSum3,
int &  dPhSum3A,
int &  outStPh,
const int  ph1,
const int  ph2,
const int  ph3,
const int  ph4,
const int  mode,
const bool  BIT_COMP = false 
) const

Definition at line 751 of file PtAssignmentEngineAux2017.cc.

References calcDeltaPhiSums(), emtf_assert, getNLBdPhi(), and ALCARECOPromptCalibProdSiPixelAli0T_cff::mode.

Referenced by PtAssignmentEngine2017::calculate_pt_xml().

768  {
769  dPh12 = ph2 - ph1;
770  dPh13 = ph3 - ph1;
771  dPh14 = ph4 - ph1;
772  dPh23 = ph3 - ph2;
773  dPh24 = ph4 - ph2;
774  dPh34 = ph4 - ph3;
775  dPhSign = 0;
776 
777  if (mode >= 8) { // First hit is station 1
778  if ((mode % 8) / 4 > 0) // Has station 2 hit
779  dPhSign = (dPh12 >= 0 ? +1 : -1);
780  else if ((mode % 4) / 2 > 0) // Has station 3 hit
781  dPhSign = (dPh13 >= 0 ? +1 : -1);
782  else if ((mode % 2) > 0) // Has station 4 hit
783  dPhSign = (dPh14 >= 0 ? +1 : -1);
784  } else if ((mode % 8) / 4 > 0) { // First hit is station 2
785  if ((mode % 4) / 2 > 0) // Has station 3 hit
786  dPhSign = (dPh23 >= 0 ? +1 : -1);
787  else if ((mode % 2) > 0) // Has station 4 hit
788  dPhSign = (dPh24 >= 0 ? +1 : -1);
789  } else if ((mode % 4) / 2 > 0) { // First hit is station 3
790  if ((mode % 2) > 0) // Has station 4 hit
791  dPhSign = (dPh34 >= 0 ? +1 : -1);
792  }
793 
794  emtf_assert(dPhSign != 0);
795 
796  dPh12 *= dPhSign;
797  dPh13 *= dPhSign;
798  dPh14 *= dPhSign;
799  dPh23 *= dPhSign;
800  dPh24 *= dPhSign;
801  dPh34 *= dPhSign;
802 
803  if (BIT_COMP) {
804  int nBitsA = 7;
805  int nBitsB = 7;
806  int nBitsC = 7;
807  int maxA = 512;
808  int maxB = 512;
809  int maxC = 512;
810 
811  if (mode == 7 || mode == 11 || mode > 12) {
812  nBitsB = 5;
813  maxB = 256;
814  nBitsC = 5;
815  maxC = 256;
816  }
817  if (mode == 15) {
818  nBitsC = 4;
819  maxC = 256;
820  }
821 
822  dPh12 = getNLBdPhi(dPh12, nBitsA, maxA);
823  dPh13 = getNLBdPhi(dPh13, nBitsA, maxA);
824  dPh14 = getNLBdPhi(dPh14, nBitsA, maxA);
825  if (mode == 7)
826  dPh23 = getNLBdPhi(dPh23, nBitsA, maxA);
827  else
828  dPh23 = getNLBdPhi(dPh23, nBitsB, maxB);
829  dPh24 = getNLBdPhi(dPh24, nBitsB, maxB);
830  dPh34 = getNLBdPhi(dPh34, nBitsC, maxC);
831 
832  // Some delta phi values must be computed from others
833  switch (mode) {
834  case 15:
835  dPh13 = dPh12 + dPh23;
836  dPh14 = dPh13 + dPh34;
837  dPh24 = dPh23 + dPh34;
838  break;
839  case 14:
840  dPh13 = dPh12 + dPh23;
841  break;
842  case 13:
843  dPh14 = dPh12 + dPh24;
844  break;
845  case 11:
846  dPh14 = dPh13 + dPh34;
847  break;
848  case 7:
849  dPh24 = dPh23 + dPh34;
850  break;
851  default:
852  break;
853  }
854 
855  } // End conditional: if (BIT_COMP)
856 
857  // Compute summed quantities
858  if (mode == 15)
859  calcDeltaPhiSums(dPhSum4, dPhSum4A, dPhSum3, dPhSum3A, outStPh, dPh12, dPh13, dPh14, dPh23, dPh24, dPh34);
860 
861 } // End function: void PtAssignmentEngineAux2017::calcDeltaPhis()
int getNLBdPhi(int dPhi, int bits=7, int max=512) const
void calcDeltaPhiSums(int &dPhSum4, int &dPhSum4A, int &dPhSum3, int &dPhSum3A, int &outStPh, const int dPh12, const int dPh13, const int dPh14, const int dPh23, const int dPh24, const int dPh34) const
#define emtf_assert(expr)
Definition: DebugTools.h:18

◆ calcDeltaPhiSums()

void PtAssignmentEngineAux2017::calcDeltaPhiSums ( int &  dPhSum4,
int &  dPhSum4A,
int &  dPhSum3,
int &  dPhSum3A,
int &  outStPh,
const int  dPh12,
const int  dPh13,
const int  dPh14,
const int  dPh23,
const int  dPh24,
const int  dPh34 
) const

Definition at line 1019 of file PtAssignmentEngineAux2017.cc.

References funct::abs().

Referenced by calcDeltaPhis(), and PtAssignmentEngine2017::calculate_pt_xml().

1029  {
1030  dPhSum4 = dPh12 + dPh13 + dPh14 + dPh23 + dPh24 + dPh34;
1031  dPhSum4A = abs(dPh12) + abs(dPh13) + abs(dPh14) + abs(dPh23) + abs(dPh24) + abs(dPh34);
1032  int devSt1 = abs(dPh12) + abs(dPh13) + abs(dPh14);
1033  int devSt2 = abs(dPh12) + abs(dPh23) + abs(dPh24);
1034  int devSt3 = abs(dPh13) + abs(dPh23) + abs(dPh34);
1035  int devSt4 = abs(dPh14) + abs(dPh24) + abs(dPh34);
1036 
1037  if (devSt4 > devSt3 && devSt4 > devSt2 && devSt4 > devSt1)
1038  outStPh = 4;
1039  else if (devSt3 > devSt4 && devSt3 > devSt2 && devSt3 > devSt1)
1040  outStPh = 3;
1041  else if (devSt2 > devSt4 && devSt2 > devSt3 && devSt2 > devSt1)
1042  outStPh = 2;
1043  else if (devSt1 > devSt4 && devSt1 > devSt3 && devSt1 > devSt2)
1044  outStPh = 1;
1045  else
1046  outStPh = 0;
1047 
1048  if (outStPh == 4) {
1049  dPhSum3 = dPh12 + dPh13 + dPh23;
1050  dPhSum3A = abs(dPh12) + abs(dPh13) + abs(dPh23);
1051  } else if (outStPh == 3) {
1052  dPhSum3 = dPh12 + dPh14 + dPh24;
1053  dPhSum3A = abs(dPh12) + abs(dPh14) + abs(dPh24);
1054  } else if (outStPh == 2) {
1055  dPhSum3 = dPh13 + dPh14 + dPh34;
1056  dPhSum3A = abs(dPh13) + abs(dPh14) + abs(dPh34);
1057  } else {
1058  dPhSum3 = dPh23 + dPh24 + dPh34;
1059  dPhSum3A = abs(dPh23) + abs(dPh24) + abs(dPh34);
1060  }
1061 
1062 } // End function: void PtAssignmentEngineAux2017::calcDeltaPhiSums()
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ calcDeltaThetas()

void PtAssignmentEngineAux2017::calcDeltaThetas ( int &  dTh12,
int &  dTh13,
int &  dTh14,
int &  dTh23,
int &  dTh24,
int &  dTh34,
const int  th1,
const int  th2,
const int  th3,
const int  th4,
const int  mode,
const bool  BIT_COMP = false 
) const

Definition at line 863 of file PtAssignmentEngineAux2017.cc.

References getdTheta(), and ALCARECOPromptCalibProdSiPixelAli0T_cff::mode.

Referenced by PtAssignmentEngine2017::calculate_pt_xml().

874  {
875  dTh12 = th2 - th1;
876  dTh13 = th3 - th1;
877  dTh14 = th4 - th1;
878  dTh23 = th3 - th2;
879  dTh24 = th4 - th2;
880  dTh34 = th4 - th3;
881 
882  if (BIT_COMP) {
883  int nBits = (mode == 15 ? 2 : 3);
884 
885  dTh12 = getdTheta(dTh12, nBits);
886  dTh13 = getdTheta(dTh13, nBits);
887  dTh14 = getdTheta(dTh14, nBits);
888  dTh23 = getdTheta(dTh23, nBits);
889  dTh24 = getdTheta(dTh24, nBits);
890  dTh34 = getdTheta(dTh34, nBits);
891  } // End conditional: if (BIT_COMP)
892 
893 } // Enf function: void PtAssignmentEngineAux2017::calcDeltaThetas()
int getdTheta(int dTheta, int bits=3) const

◆ calcRPCs()

void PtAssignmentEngineAux2017::calcRPCs ( int &  RPC1,
int &  RPC2,
int &  RPC3,
int &  RPC4,
const int  mode,
const int  st1_ring2,
const int  theta,
const bool  BIT_COMP = false 
) const

Definition at line 929 of file PtAssignmentEngineAux2017.cc.

References ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, and theta().

Referenced by PtAssignmentEngine2017::calculate_pt_xml().

936  {
937  if (BIT_COMP) {
938  // Mask some invalid locations for RPC hits
939  // theta is assumed to be the compressed, mode 15 version
940  if (mode == 15 && !st1_ring2) {
941  RPC1 = 0;
942  RPC2 = 0;
943  if (theta < 4) {
944  RPC3 = 0;
945  RPC4 = 0;
946  }
947  }
948 
949  int nRPC = (RPC1 == 1) + (RPC2 == 1) + (RPC3 == 1) + (RPC4 == 1);
950 
951  // In 3- and 4-station modes, only specify some combinations of RPCs
952  if (nRPC >= 2) {
953  if (mode == 15) {
954  if (RPC1 == 1 && RPC2 == 1) {
955  RPC3 = 0;
956  RPC4 = 0;
957  } else if (RPC1 == 1 && RPC3 == 1) {
958  RPC4 = 0;
959  } else if (RPC4 == 1 && RPC2 == 1) {
960  RPC3 = 0;
961  } else if (RPC3 == 1 && RPC4 == 1 && !st1_ring2) {
962  RPC3 = 0;
963  }
964  } else if (mode == 14) {
965  if (RPC1 == 1) {
966  RPC2 = 0;
967  RPC3 = 0;
968  } else if (RPC3 == 1) {
969  RPC2 = 0;
970  }
971  } else if (mode == 13) {
972  if (RPC1 == 1) {
973  RPC2 = 0;
974  RPC4 = 0;
975  } else if (RPC4 == 1) {
976  RPC2 = 0;
977  }
978  } else if (mode == 11) {
979  if (RPC1 == 1) {
980  RPC3 = 0;
981  RPC4 = 0;
982  } else if (RPC4 == 1) {
983  RPC3 = 0;
984  }
985  } else if (mode == 7) {
986  if (RPC2 == 1) {
987  RPC3 = 0;
988  RPC4 = 0;
989  } else if (RPC4 == 1) {
990  RPC3 = 0;
991  }
992  }
993 
994  } // End conditional: if (nRPC >= 2)
995  } // End conditional: if (BIT_COMP)
996 
997 } // End function: void PtAssignmentEngineAux2017::calcRPCs()
Geom::Theta< T > theta() const

◆ calcTrackTheta()

int PtAssignmentEngineAux2017::calcTrackTheta ( const int  th1,
const int  th2,
const int  th3,
const int  th4,
const int  ring1,
const int  mode,
const bool  BIT_COMP = false 
) const

Definition at line 725 of file PtAssignmentEngineAux2017.cc.

References emtf_assert, getTheta(), ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, and theta().

Referenced by PtAssignmentEngine2017::calculate_pt_xml().

731  {
732  int theta = -99;
733 
734  if ((mode % 8) / 4 > 0) // Has station 2 hit
735  theta = th2;
736  else if ((mode % 4) / 2 > 0) // Has station 3 hit
737  theta = th3;
738  else if ((mode % 2) > 0) // Has station 4 hit
739  theta = th4;
740 
741  emtf_assert(theta > 0);
742 
743  if (BIT_COMP) {
744  int nBits = (mode == 15 ? 4 : 5);
745  theta = getTheta(theta, st1_ring2, nBits);
746  }
747 
748  return theta;
749 }
#define emtf_assert(expr)
Definition: DebugTools.h:18
Geom::Theta< T > theta() const
int getTheta(int theta, int ring2, int bits=5) const

◆ get2bRPC()

int PtAssignmentEngineAux2017::get2bRPC ( int  clctA,
int  clctB,
int  clctC 
) const

Definition at line 492 of file PtAssignmentEngineAux2017.cc.

References emtf_assert.

Referenced by PtAssignmentEngine2017::calculate_address().

492  {
493  int rpc_2b = -99;
494 
495  if (clctA == 0)
496  rpc_2b = 0;
497  else if (clctC == 0)
498  rpc_2b = 1;
499  else if (clctB == 0)
500  rpc_2b = 2;
501  else
502  rpc_2b = 3;
503 
504  emtf_assert(rpc_2b >= 0 && rpc_2b < 4);
505  return (rpc_2b);
506 } // End function: int PtAssignmentEngineAux2017::get2bRPC()
#define emtf_assert(expr)
Definition: DebugTools.h:18

◆ get8bMode15()

int PtAssignmentEngineAux2017::get8bMode15 ( int  theta,
int  st1_ring2,
int  endcap,
int  sPhiAB,
int  clctA,
int  clctB,
int  clctC,
int  clctD 
) const

Definition at line 524 of file PtAssignmentEngineAux2017.cc.

References emtf_assert, makeMuonMisalignmentScenario::endcap, getCLCT(), SiStripPI::max, SiStripPI::min, funct::pow(), and theta().

Referenced by PtAssignmentEngine2017::calculate_address().

525  {
526  // std::cout << "Inside get8bMode15, theta = " << theta << ", st1_ring2 = " << st1_ring2 << ", endcap = " << endcap << ", sPhiAB = " << sPhiAB
527  // << ", clctA = " << clctA << ", clctB = " << clctB << ", clctC = " << clctC << ", clctD = " << clctD << std::endl;
528 
529  if (st1_ring2)
530  theta = (std::min(std::max(theta, 46), 87) - 46) / 7;
531  else
532  theta = (std::min(std::max(theta, 5), 52) - 5) / 6;
533 
534  emtf_assert(theta >= 0 && theta < 10);
535 
536  int clctA_2b = getCLCT(clctA, endcap, sPhiAB, 2);
537 
538  int nRPC = (clctA == 0) + (clctB == 0) + (clctC == 0) + (clctD == 0);
539  int rpc_word, rpc_clct, mode15_8b;
540 
541  if (st1_ring2) {
542  if (nRPC >= 2 && clctA == 0 && clctB == 0)
543  rpc_word = 0;
544  else if (nRPC >= 2 && clctA == 0 && clctC == 0)
545  rpc_word = 1;
546  else if (nRPC >= 2 && clctA == 0 && clctD == 0)
547  rpc_word = 2;
548  else if (nRPC == 1 && clctA == 0)
549  rpc_word = 3;
550  else if (nRPC >= 2 && clctD == 0 && clctB == 0)
551  rpc_word = 4;
552  else if (nRPC >= 2 && clctD == 0 && clctC == 0)
553  rpc_word = 8;
554  else if (nRPC >= 2 && clctB == 0 && clctC == 0)
555  rpc_word = 12;
556  else if (nRPC == 1 && clctD == 0)
557  rpc_word = 16;
558  else if (nRPC == 1 && clctB == 0)
559  rpc_word = 20;
560  else if (nRPC == 1 && clctC == 0)
561  rpc_word = 24;
562  else
563  rpc_word = 28;
564  rpc_clct = rpc_word + clctA_2b;
565  mode15_8b = (theta * 32) + rpc_clct + 64;
566  } else {
567  if (theta >= 4 && clctD == 0)
568  rpc_word = 0;
569  else if (theta >= 4 && clctC == 0)
570  rpc_word = 1;
571  else if (theta >= 4)
572  rpc_word = 2;
573  else
574  rpc_word = 3;
575  rpc_clct = rpc_word * 4 + clctA_2b;
576  mode15_8b = ((theta % 4) * 16) + rpc_clct;
577  }
578 
579  // std::cout << " * Output mode15_8b = " << mode15_8b << std::endl;
580 
581  emtf_assert(mode15_8b >= 0 && mode15_8b < pow(2, 8));
582  return (mode15_8b);
583 
584 } // End function: int PtAssignmentEngineAux2017::get8bMode15()
int getCLCT(int clct, int endcap, int dPhiSign, int bits=3) const
#define emtf_assert(expr)
Definition: DebugTools.h:18
Geom::Theta< T > theta() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ getCLCT()

int PtAssignmentEngineAux2017::getCLCT ( int  clct,
int  endcap,
int  dPhiSign,
int  bits = 3 
) const

Definition at line 139 of file PtAssignmentEngineAux2017.cc.

References funct::abs(), ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::bits, emtf_assert, makeMuonMisalignmentScenario::endcap, and funct::pow().

Referenced by calcBends(), PtAssignmentEngine2017::calculate_address(), and get8bMode15().

139  {
140  // std::cout << "Inside getCLCT: clct = " << clct << ", endcap = " << endcap
141  // << ", dPhiSign = " << dPhiSign << ", bits = " << bits << std::endl;
142 
143  emtf_assert(clct >= 0 && clct <= 10 && abs(endcap) == 1 && abs(dPhiSign) == 1 && (bits == 2 || bits == 3));
144 
145  // Convention here: endcap == +/-1, dPhiSign = +/-1.
146  int clct_ = 0;
147  int sign_ = -1 * endcap * dPhiSign; // CLCT bend is with dPhi in ME-, opposite in ME+
148 
149  // CLCT pattern can be converted into |bend| x sign as follows:
150  // |bend| = (10 + (pattern % 2) - pattern) / 2
151  // * 10 --> 0, 9/8 --> 1, 7/6 --> 2, 5/4 --> 3, 3/2 --> 4, 0 indicates RPC hit
152  // sign = ((pattern % 2) == 1 ? -1 : 1) * (endcap == 1 ? -1 : 1)
153  // * In ME+, even CLCTs have negative sign, odd CLCTs have positive
154 
155  // For use in all 3- and 4-station modes (7, 11, 13, 14, 15)
156  // Bends [-4, -3, -2] --> 0, [-1, 0] --> 1, [+1] --> 2, [+2, +3, +4] --> 3
157  if (bits == 2) {
158  switch (clct) {
159  case 10:
160  clct_ = 1;
161  break;
162  case 9:
163  clct_ = (sign_ > 0 ? 1 : 2);
164  break;
165  case 8:
166  clct_ = (sign_ > 0 ? 2 : 1);
167  break;
168  case 7:
169  clct_ = (sign_ > 0 ? 0 : 3);
170  break;
171  case 6:
172  clct_ = (sign_ > 0 ? 3 : 0);
173  break;
174  case 5:
175  clct_ = (sign_ > 0 ? 0 : 3);
176  break;
177  case 4:
178  clct_ = (sign_ > 0 ? 3 : 0);
179  break;
180  case 3:
181  clct_ = (sign_ > 0 ? 0 : 3);
182  break;
183  case 2:
184  clct_ = (sign_ > 0 ? 3 : 0);
185  break;
186  case 1:
187  clct_ = (sign_ > 0 ? 0 : 3);
188  break;
189  case 0:
190  clct_ = 0;
191  break;
192  default:
193  clct_ = 1;
194  break;
195  }
196  } // End conditional: if (bits == 2)
197 
198  // For use in all 2-station modes (3, 5, 6, 9, 10, 12)
199  // Bends [isRPC] --> 0, [-4, -3] --> 1, [-2] --> 2, [-1] --> 3, [0] --> 4, [+1] --> 5, [+2] --> 6, [+3, +4] --> 7
200  else if (bits == 3) {
201  switch (clct) {
202  case 10:
203  clct_ = 4;
204  break;
205  case 9:
206  clct_ = (sign_ > 0 ? 3 : 5);
207  break;
208  case 8:
209  clct_ = (sign_ > 0 ? 5 : 3);
210  break;
211  case 7:
212  clct_ = (sign_ > 0 ? 2 : 6);
213  break;
214  case 6:
215  clct_ = (sign_ > 0 ? 6 : 2);
216  break;
217  case 5:
218  clct_ = (sign_ > 0 ? 1 : 7);
219  break;
220  case 4:
221  clct_ = (sign_ > 0 ? 7 : 1);
222  break;
223  case 3:
224  clct_ = (sign_ > 0 ? 1 : 7);
225  break;
226  case 2:
227  clct_ = (sign_ > 0 ? 7 : 1);
228  break;
229  case 1:
230  clct_ = (sign_ > 0 ? 1 : 7);
231  break;
232  case 0:
233  clct_ = 0;
234  break;
235  default:
236  clct_ = 4;
237  break;
238  }
239  } // End conditional: else if (bits == 3)
240 
241  // std::cout << " * Output clct_ = " << clct_ << std::endl;
242 
243  emtf_assert(clct_ >= 0 && clct_ < pow(2, bits));
244  return clct_;
245 } // End function: int PtAssignmentEngineAux2017::getCLCT()
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define emtf_assert(expr)
Definition: DebugTools.h:18
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ getdPhiFromBin()

int PtAssignmentEngineAux2017::getdPhiFromBin ( int  dPhiBin,
int  bits = 7,
int  max = 512 
) const

Definition at line 115 of file PtAssignmentEngineAux2017.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::bits, photonValidator_cfi::dPhiBin, dPhiNLBMap_4bit_256Max, dPhiNLBMap_5bit_256Max, dPhiNLBMap_7bit_512Max, emtf_assert, and SiStripPI::max.

Referenced by PtAssignmentEngine2017::calculate_pt_xml().

115  {
116  emtf_assert((bits == 4 && max == 256) || (bits == 5 && max == 256) || (bits == 7 && max == 512));
117 
118  int dPhi_ = (1 << bits) - 1;
119 
120  if (dPhiBin > (1 << bits) - 1)
121  dPhiBin = (1 << bits) - 1;
122 
123  if (max == 256) {
124  if (bits == 4)
126  if (bits == 5)
128  } // End conditional: if (max == 256)
129 
130  else if (max == 512) {
131  if (bits == 7)
133  } // End conditional: else if (max == 512)
134 
135  emtf_assert(dPhi_ >= 0 && dPhi_ < max);
136  return (dPhi_);
137 } // End function: int PtAssignmentEngineAux2017::getdPhiFromBin()
static const int dPhiNLBMap_7bit_512Max[128]
static const int dPhiNLBMap_5bit_256Max[32]
static const int dPhiNLBMap_4bit_256Max[16]
#define emtf_assert(expr)
Definition: DebugTools.h:18

◆ getdTheta()

int PtAssignmentEngineAux2017::getdTheta ( int  dTheta,
int  bits = 3 
) const

Definition at line 313 of file PtAssignmentEngineAux2017.cc.

References funct::abs(), ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::bits, emtf_assert, and funct::pow().

Referenced by calcDeltaThetas(), and PtAssignmentEngine2017::calculate_address().

313  {
314  emtf_assert(bits == 2 || bits == 3);
315 
316  int dTheta_ = -99;
317 
318  // For use in mode 15
319  if (bits == 2) {
320  if (abs(dTheta) <= 1)
321  dTheta_ = 2;
322  else if (abs(dTheta) <= 2)
323  dTheta_ = 1;
324  else if (dTheta <= -3)
325  dTheta_ = 0;
326  else
327  dTheta_ = 3;
328  } // End conditional: if (bits == 2)
329 
330  // For use in all 2- and 3-station modes (all modes except 15)
331  else if (bits == 3) {
332  if (dTheta <= -4)
333  dTheta_ = 0;
334  else if (dTheta == -3)
335  dTheta_ = 1;
336  else if (dTheta == -2)
337  dTheta_ = 2;
338  else if (dTheta == -1)
339  dTheta_ = 3;
340  else if (dTheta == 0)
341  dTheta_ = 4;
342  else if (dTheta == +1)
343  dTheta_ = 5;
344  else if (dTheta == +2)
345  dTheta_ = 6;
346  else
347  dTheta_ = 7;
348  } // End conditional: if (bits == 3)
349 
350  emtf_assert(dTheta_ >= 0 && dTheta_ < pow(2, bits));
351  return (dTheta_);
352 } // End function: int PtAssignmentEngineAux2017::getdTheta()
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define emtf_assert(expr)
Definition: DebugTools.h:18
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ getNLBdPhi()

int PtAssignmentEngineAux2017::getNLBdPhi ( int  dPhi,
int  bits = 7,
int  max = 512 
) const

Definition at line 26 of file PtAssignmentEngineAux2017.cc.

References funct::abs(), ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::bits, HLT_2023v12_cff::dPhi, dPhiNLBMap_4bit_256Max, dPhiNLBMap_5bit_256Max, dPhiNLBMap_7bit_512Max, emtf_assert, and SiStripPI::max.

Referenced by calcDeltaPhis().

26  {
27  emtf_assert((bits == 4 && max == 256) || (bits == 5 && max == 256) || (bits == 7 && max == 512));
28 
29  int dPhi_ = max;
30  int sign_ = 1;
31  if (dPhi < 0)
32  sign_ = -1;
33  dPhi = sign_ * dPhi;
34 
35  if (max == 256) {
36  if (bits == 4) {
37  dPhi_ = dPhiNLBMap_4bit_256Max[(1 << bits) - 1];
38  for (int edge = 0; edge < (1 << bits) - 1; edge++) {
39  if (dPhiNLBMap_4bit_256Max[edge] <= dPhi && dPhiNLBMap_4bit_256Max[edge + 1] > dPhi) {
40  dPhi_ = dPhiNLBMap_4bit_256Max[edge];
41  break;
42  }
43  }
44  } // End conditional: if (bits == 4)
45  if (bits == 5) {
46  dPhi_ = dPhiNLBMap_5bit_256Max[(1 << bits) - 1];
47  for (int edge = 0; edge < (1 << bits) - 1; edge++) {
48  if (dPhiNLBMap_5bit_256Max[edge] <= dPhi && dPhiNLBMap_5bit_256Max[edge + 1] > dPhi) {
49  dPhi_ = dPhiNLBMap_5bit_256Max[edge];
50  break;
51  }
52  }
53  } // End conditional: if (bits == 5)
54  } // End conditional: if (max == 256)
55 
56  else if (max == 512) {
57  if (bits == 7) {
58  dPhi_ = dPhiNLBMap_7bit_512Max[(1 << bits) - 1];
59  for (int edge = 0; edge < (1 << bits) - 1; edge++) {
60  if (dPhiNLBMap_7bit_512Max[edge] <= dPhi && dPhiNLBMap_7bit_512Max[edge + 1] > dPhi) {
61  dPhi_ = dPhiNLBMap_7bit_512Max[edge];
62  break;
63  }
64  }
65  } // End conditional: if (bits == 7)
66  } // End conditional: else if (max == 512)
67 
68  emtf_assert(abs(sign_) == 1 && dPhi_ >= 0 && dPhi_ < max);
69  return (sign_ * dPhi_);
70 } // End function: int PtAssignmentEngineAux2017::getNLBdPhi()
static const int dPhiNLBMap_7bit_512Max[128]
static const int dPhiNLBMap_5bit_256Max[32]
static const int dPhiNLBMap_4bit_256Max[16]
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define emtf_assert(expr)
Definition: DebugTools.h:18

◆ getNLBdPhiBin()

int PtAssignmentEngineAux2017::getNLBdPhiBin ( int  dPhi,
int  bits = 7,
int  max = 512 
) const

Definition at line 72 of file PtAssignmentEngineAux2017.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::bits, HLT_2023v12_cff::dPhi, dPhiNLBMap_4bit_256Max, dPhiNLBMap_5bit_256Max, dPhiNLBMap_7bit_512Max, emtf_assert, SiStripPI::max, and funct::pow().

Referenced by PtAssignmentEngine2017::calculate_address().

72  {
73  emtf_assert((bits == 4 && max == 256) || (bits == 5 && max == 256) || (bits == 7 && max == 512));
74 
75  int dPhiBin_ = (1 << bits) - 1;
76  int sign_ = 1;
77  if (dPhi < 0)
78  sign_ = -1;
79  dPhi = sign_ * dPhi;
80 
81  if (max == 256) {
82  if (bits == 4) {
83  for (int edge = 0; edge < (1 << bits) - 1; edge++) {
84  if (dPhiNLBMap_4bit_256Max[edge] <= dPhi && dPhiNLBMap_4bit_256Max[edge + 1] > dPhi) {
85  dPhiBin_ = edge;
86  break;
87  }
88  }
89  } // End conditional: if (bits == 4)
90  if (bits == 5) {
91  for (int edge = 0; edge < (1 << bits) - 1; edge++) {
92  if (dPhiNLBMap_5bit_256Max[edge] <= dPhi && dPhiNLBMap_5bit_256Max[edge + 1] > dPhi) {
93  dPhiBin_ = edge;
94  break;
95  }
96  }
97  } // End conditional: if (bits == 5)
98  } // End conditional: if (max == 256)
99 
100  else if (max == 512) {
101  if (bits == 7) {
102  for (int edge = 0; edge < (1 << bits) - 1; edge++) {
103  if (dPhiNLBMap_7bit_512Max[edge] <= dPhi && dPhiNLBMap_7bit_512Max[edge + 1] > dPhi) {
104  dPhiBin_ = edge;
105  break;
106  }
107  }
108  } // End conditional: if (bits == 7)
109  } // End conditional: else if (max == 512)
110 
111  emtf_assert(dPhiBin_ >= 0 && dPhiBin_ < pow(2, bits));
112  return (dPhiBin_);
113 } // End function: int PtAssignmentEngineAux2017::getNLBdPhiBin()
static const int dPhiNLBMap_7bit_512Max[128]
static const int dPhiNLBMap_5bit_256Max[32]
static const int dPhiNLBMap_4bit_256Max[16]
#define emtf_assert(expr)
Definition: DebugTools.h:18
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ getTheta()

int PtAssignmentEngineAux2017::getTheta ( int  theta,
int  ring2,
int  bits = 5 
) const

Definition at line 411 of file PtAssignmentEngineAux2017.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::bits, emtf_assert, SiStripPI::max, SiStripPI::min, funct::pow(), and theta().

Referenced by calcTrackTheta(), and PtAssignmentEngine2017::calculate_address().

411  {
412  emtf_assert(theta >= 5 && theta < 128 && (st1_ring2 == 0 || st1_ring2 == 1) && (bits == 4 || bits == 5));
413 
414  int theta_ = -99;
415 
416  // For use in mode 15
417  if (bits == 4) {
418  if (st1_ring2 == 0) {
419  // Should rarely fail ... should change to using ME1 for track theta - AWB 05.06.17
420  if (theta > 52) {
421  // std::cout << "\n\n*** Bizzare case of mode 15 track with ME1/1 LCT and track theta = " << theta << std::endl;
422  }
423  theta_ = (std::min(std::max(theta, 5), 52) - 5) / 6;
424  } else if (st1_ring2 == 1) {
425  // Should rarely fail ... should change to using ME1 for track theta - AWB 05.06.17
426  if (theta < 46 || theta > 87) {
427  // std::cout << "\n\n*** Bizzare case of mode 15 track with ME1/2 LCT and track theta = " << theta << std::endl;
428  }
429  theta_ = ((std::min(std::max(theta, 46), 87) - 46) / 7) + 8;
430  }
431  } // End conditional: if (bits == 4)
432 
433  // For use in all 2- and 3-station modes (all modes except 15)
434  else if (bits == 5) {
435  if (st1_ring2 == 0) {
436  theta_ = (std::max(theta, 1) - 1) / 4;
437  } else if (st1_ring2 == 1) {
438  theta_ = ((std::min(theta, 104) - 1) / 4) + 6;
439  }
440  } // End conditional: else if (bits == 5)
441 
442  emtf_assert(theta_ >= 0 && ((bits == 4 && theta_ <= 13) || (bits == 5 && theta_ < pow(2, bits))));
443  return (theta_);
444 } // End function: int PtAssignmentEngineAux2017::getTheta()
#define emtf_assert(expr)
Definition: DebugTools.h:18
Geom::Theta< T > theta() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ unpack2bRPC()

void PtAssignmentEngineAux2017::unpack2bRPC ( int  rpc_2b,
int &  rpcA,
int &  rpcB,
int &  rpcC 
) const

Definition at line 508 of file PtAssignmentEngineAux2017.cc.

References emtf_assert.

Referenced by PtAssignmentEngine2017::calculate_pt_xml().

508  {
509  emtf_assert(rpc_2b >= 0 && rpc_2b < 4);
510 
511  rpcA = 0;
512  rpcB = 0;
513  rpcC = 0;
514 
515  if (rpc_2b == 0)
516  rpcA = 1;
517  else if (rpc_2b == 1)
518  rpcC = 1;
519  else if (rpc_2b == 2)
520  rpcB = 1;
521 
522 } // End function: int PtAssignmentEngineAux2017::unpack2bRPC()
#define emtf_assert(expr)
Definition: DebugTools.h:18

◆ unpack8bMode15()

void PtAssignmentEngineAux2017::unpack8bMode15 ( int  mode15_8b,
int &  theta,
int &  st1_ring2,
int  endcap,
int  sPhiAB,
int &  clctA,
int &  rpcA,
int &  rpcB,
int &  rpcC,
int &  rpcD 
) const

Definition at line 586 of file PtAssignmentEngineAux2017.cc.

References funct::abs(), emtf_assert, makeMuonMisalignmentScenario::endcap, funct::pow(), and theta().

Referenced by PtAssignmentEngine2017::calculate_pt_xml().

595  {
596  // std::cout << "Inside unpack8bMode15, mode15_8b = " << mode15_8b << ", theta = " << theta
597  // << ", st1_ring2 = " << st1_ring2 << ", endcap = " << endcap << ", sPhiAB = " << sPhiAB << ", clctA = " << clctA
598  // << ", rpcA = " << rpcA << ", rpcB = " << rpcB << ", rpcC = " << rpcC << ", rpcD = " << rpcD << std::endl;
599 
600  emtf_assert(mode15_8b >= 0 && mode15_8b < pow(2, 8));
601  emtf_assert(abs(endcap) == 1 && abs(sPhiAB) == 1);
602 
603  rpcA = 0;
604  rpcB = 0;
605  rpcC = 0;
606  rpcD = 0;
607 
608  if (mode15_8b >= 64)
609  st1_ring2 = 1;
610  else
611  st1_ring2 = 0;
612 
613  int rpc_clct, rpc_word, clctA_2b, nRPC = -1;
614 
615  if (st1_ring2) {
616  rpc_clct = (mode15_8b % 32);
617  theta = (mode15_8b - 64 - rpc_clct) / 32;
618  theta += 8;
619 
620  if (rpc_clct < 4)
621  clctA_2b = 0;
622  else
623  clctA_2b = (rpc_clct % 4);
624  rpc_word = rpc_clct - clctA_2b;
625 
626  // if (clctA_2b != 0) clctA = unpackCLCT(clctA_2b, endcap, sPhiAB, 2);
627  clctA = clctA_2b;
628 
629  switch (rpc_word) {
630  case 0:
631  nRPC = 2;
632  rpcA = 1;
633  rpcB = 1;
634  break;
635  case 1:
636  nRPC = 2;
637  rpcA = 1;
638  rpcC = 1;
639  break;
640  case 2:
641  nRPC = 2;
642  rpcA = 1;
643  rpcD = 1;
644  break;
645  case 3:
646  nRPC = 1;
647  rpcA = 1;
648  break;
649  case 4:
650  nRPC = 2;
651  rpcD = 1;
652  rpcB = 1;
653  break;
654  case 8:
655  nRPC = 2;
656  rpcD = 1;
657  rpcC = 1;
658  break;
659  case 12:
660  nRPC = 2;
661  rpcB = 1;
662  rpcC = 1;
663  break;
664  case 16:
665  nRPC = 1;
666  rpcD = 1;
667  break;
668  case 20:
669  nRPC = 1;
670  rpcB = 1;
671  break;
672  case 24:
673  nRPC = 1;
674  rpcC = 1;
675  break;
676  case 28:
677  nRPC = 0;
678  break;
679  default:
680  break;
681  }
682  } // End conditional: if (st1_ring2)
683  else {
684  rpc_clct = (mode15_8b % 16);
685  theta = (mode15_8b - rpc_clct) / 16;
686  clctA_2b = (rpc_clct % 4);
687  rpc_word = (rpc_clct - clctA_2b) / 4;
688 
689  // if (clctA_2b != 0) clctA = unpackCLCT(clctA_2b, endcap, sPhiAB, 2);
690  clctA = clctA_2b;
691 
692  switch (rpc_word) {
693  case 0:
694  nRPC = 1;
695  theta += 4;
696  rpcD = 1;
697  break;
698  case 1:
699  nRPC = 1;
700  theta += 4;
701  rpcC = 1;
702  break;
703  case 2:
704  nRPC = 0;
705  theta += 4;
706  break;
707  case 3:
708  nRPC = 0;
709  break;
710  default:
711  break;
712  }
713  }
714 
715  // std::cout << " * Output theta = " << theta << ", st1_ring2 = " << st1_ring2 << ", clctA = " << clctA
716  // << ", rpcA = " << rpcA << ", rpcB = " << rpcB << ", rpcC = " << rpcC << ", rpcD = " << rpcD << std::endl;
717 
718  emtf_assert(nRPC >= 0);
719 
720 } // End function: void PtAssignmentEngineAux2017::unpack8bMode15()
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define emtf_assert(expr)
Definition: DebugTools.h:18
Geom::Theta< T > theta() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ unpackCLCT()

int PtAssignmentEngineAux2017::unpackCLCT ( int  clct,
int  endcap,
int  dPhiSign,
int  bits 
) const

Definition at line 247 of file PtAssignmentEngineAux2017.cc.

References funct::abs(), ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::bits, emtf_assert, makeMuonMisalignmentScenario::endcap, and funct::pow().

247  {
248  // std::cout << "Inside unpackCLCT: clct = " << clct << ", endcap = " << endcap
249  // << ", dPhiSign = " << dPhiSign << ", bits = " << bits << std::endl;
250 
251  emtf_assert(bits == 2 || bits == 3);
252  emtf_assert(clct >= 0 && clct < pow(2, bits));
253  emtf_assert(abs(dPhiSign) == 1);
254 
255  // Convention here: endcap == +/-1, dPhiSign = +/-1.
256  int clct_ = -1;
257  int sign_ = -1 * endcap * dPhiSign; // CLCT bend is with dPhi in ME-, opposite in ME+
258 
259  if (bits == 2) {
260  switch (clct) {
261  case 1:
262  clct_ = 10;
263  break;
264  case 2:
265  clct_ = (sign_ > 0 ? 8 : 9);
266  break;
267  case 3:
268  clct_ = (sign_ > 0 ? 4 : 5);
269  break;
270  case 0:
271  clct_ = 0;
272  break;
273  default:
274  break;
275  }
276  } else if (bits == 3) {
277  switch (clct) {
278  case 4:
279  clct_ = 10;
280  break;
281  case 5:
282  clct_ = (sign_ > 0 ? 8 : 9);
283  break;
284  case 3:
285  clct_ = (sign_ > 0 ? 9 : 8);
286  break;
287  case 6:
288  clct_ = (sign_ > 0 ? 6 : 7);
289  break;
290  case 2:
291  clct_ = (sign_ > 0 ? 7 : 6);
292  break;
293  case 7:
294  clct_ = (sign_ > 0 ? 4 : 5);
295  break;
296  case 1:
297  clct_ = (sign_ > 0 ? 5 : 4);
298  break;
299  case 0:
300  clct_ = 0;
301  break;
302  default:
303  break;
304  }
305  }
306 
307  // std::cout << " * Output clct_ = " << clct_ << std::endl;
308 
309  emtf_assert(clct_ >= 0 && clct_ <= 10);
310  return clct_;
311 } // End function: int PtAssignmentEngineAux2017::unpackCLCT()
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define emtf_assert(expr)
Definition: DebugTools.h:18
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ unpackdTheta()

int PtAssignmentEngineAux2017::unpackdTheta ( int  dTheta,
int  bits 
) const

Definition at line 354 of file PtAssignmentEngineAux2017.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::bits, and emtf_assert.

354  {
355  emtf_assert(bits == 2 || bits == 3);
356 
357  int dTheta_ = -99;
358 
359  if (bits == 2) { // For use in mode 15
360  switch (dTheta) {
361  case 2:
362  dTheta_ = 0;
363  break;
364  case 1:
365  dTheta_ = -2;
366  break;
367  case 0:
368  dTheta_ = -3;
369  break;
370  case 3:
371  dTheta_ = 3;
372  break;
373  default:
374  break;
375  }
376  } else if (bits == 3) { // For use in all 2- and 3-station modes (all modes except 15)
377  switch (dTheta) {
378  case 0:
379  dTheta_ = -4;
380  break;
381  case 1:
382  dTheta_ = -3;
383  break;
384  case 2:
385  dTheta_ = -2;
386  break;
387  case 3:
388  dTheta_ = -1;
389  break;
390  case 4:
391  dTheta_ = 0;
392  break;
393  case 5:
394  dTheta_ = 1;
395  break;
396  case 6:
397  dTheta_ = 2;
398  break;
399  case 7:
400  dTheta_ = 3;
401  break;
402  default:
403  break;
404  }
405  }
406 
407  emtf_assert(dTheta_ >= -4 && dTheta_ <= 3);
408  return (dTheta_);
409 } // End function: int PtAssignmentEngineAux2017::unpackdTheta(int dTheta, int bits)
#define emtf_assert(expr)
Definition: DebugTools.h:18

◆ unpackSt1Ring2()

int PtAssignmentEngineAux2017::unpackSt1Ring2 ( int  theta,
int  bits 
) const

Definition at line 473 of file PtAssignmentEngineAux2017.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::bits, emtf_assert, funct::pow(), and theta().

Referenced by PtAssignmentEngine2017::calculate_pt_xml().

473  {
474  emtf_assert(bits == 4 || bits == 5);
475  emtf_assert(theta >= 0 && theta < pow(2, bits));
476 
477  // For use in mode 15
478  if (bits == 4) {
479  if (theta < 6)
480  return 0;
481  else
482  return 1;
483  } else {
484  if (theta < 15)
485  return 0;
486  else
487  return 1;
488  }
489 
490 } // End function: void PtAssignmentEngineAux2017::unpackSt1Ring2()
#define emtf_assert(expr)
Definition: DebugTools.h:18
Geom::Theta< T > theta() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ unpackTheta()

void PtAssignmentEngineAux2017::unpackTheta ( int &  theta,
int &  st1_ring2,
int  bits 
) const

Definition at line 446 of file PtAssignmentEngineAux2017.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::bits, emtf_assert, funct::pow(), and theta().

446  {
447  emtf_assert(bits == 4 || bits == 5);
448  emtf_assert(theta >= 0 && theta < pow(2, bits));
449 
450  // For use in mode 15
451  if (bits == 4) {
452  if (theta < 8) {
453  st1_ring2 = 0;
454  theta = (theta * 6) + 5;
455  } else {
456  st1_ring2 = 1;
457  theta = ((theta - 8) * 7) + 46;
458  }
459  } else if (bits == 5) {
460  if (theta < 15) {
461  st1_ring2 = 0;
462  theta = (theta * 4) + 1;
463  } else {
464  st1_ring2 = 1;
465  theta = ((theta - 6) * 4) + 1;
466  }
467  }
468 
469  emtf_assert(theta >= 5 && theta <= 104);
470 
471 } // End function: void PtAssignmentEngineAux2017::unpackTheta()
#define emtf_assert(expr)
Definition: DebugTools.h:18
Geom::Theta< T > theta() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29