CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
l1t::EmtfPtAssignment Class Reference

#include <PtAssignment.h>

Public Member Functions

unsigned long calculateAddress (L1TMuon::InternalTrack track, const edm::EventSetup &es, int mode)
 
float calculatePt (unsigned long Address)
 
 EmtfPtAssignment (const char *tree_dir="L1Trigger/L1TMuon/data/emtf_luts/v_16_02_21/ModeVariables/trees")
 

Private Attributes

std::vector< int > allowedModes_
 
L1TForest forest_ [16]
 

Detailed Description

Definition at line 13 of file PtAssignment.h.

Constructor & Destructor Documentation

EmtfPtAssignment::EmtfPtAssignment ( const char *  tree_dir = "L1Trigger/L1TMuon/data/emtf_luts/v_16_02_21/ModeVariables/trees")

Definition at line 21 of file PtAssignment.cc.

21  :
22  allowedModes_({3,5,9,6,10,12,7,11,13,14,15}){
std::vector< int > allowedModes_
Definition: PtAssignment.h:22

Member Function Documentation

unsigned long EmtfPtAssignment::calculateAddress ( L1TMuon::InternalTrack  track,
const edm::EventSetup es,
int  mode 
)

Mode Variables ////

Definition at line 868 of file PtAssignment.cc.

References funct::abs(), gather_cfg::cout, ztail::d, L1TMuon::InternalTrack::deltas, eta, EnergyCorrector::etas, edm::EventSetup::get(), getCLCT(), getdTheta(), getEta(), getEtaInt(), getNLBdPhi(), getNLBdPhiBin(), L1TMuon::InternalTrack::getStubs(), glc, i, dqm-mbProfile::log, L1TMuon::InternalTrack::phis, alignCSCRings::s, findQualityFiles::size, funct::tan(), L1TMuon::InternalTrack::theta, L1TMuon::InternalTrack::thetas, GeomDet::toGlobal(), reco::tau::disc::TrackEta(), x(), and PV3DBase< T, PVType, FrameType >::z().

868  {
869  edm::ESHandle<CSCGeometry> cscGeometry;
870  es.get<MuonGeometryRecord>().get(cscGeometry);
871 
872  bool verbose = false;
873  bool doComp = true;
874 
878 
879  // Unused variables
880  /* int ModeVariables[13][6]; */
881  /* int ModeBits[13][6]; */
882  /* for (int i=0;i<13;i++) { */
883  /* for (int j=0;j<6;j++) { */
884  /* if (whichScheme == 3) { */
885  /* ModeVariables[i][j] = ModeVariables_Scheme3[i][j]; */
886  /* } */
887  /* } */
888  /* } */
889 
890  // Unused variable
891  /* const char *dir=""; */
892  /* if (whichScheme == 3) */
893  /* dir = dirSchemeC; */
894 
895  int dphi[6] = {-999,-999,-999,-999,-999,-999}, deta[6] = {-999,-999,-999,-999,-999,-999};
896  int clct[4] = {-999,-999,-999,-999}, cscid[4] = {-999,-999,-999,-999};
897  int phis[4] = {-999,-999,-999,-999}, etas[4] = {-999,-999,-999,-999}, mode_inv = 0;;
898  int FR[4] = {-999,-999,-999,-999};
899 
900  float theta_angle = ((track.theta)*0.2874016 + 8.5)*(3.14159265359/180);
901  float eta = (-1)*log(tan(theta_angle/2));
902 
903  const TriggerPrimitiveStationMap stubs = track.getStubs();
904 
905  //track.print(cout);
906 
907  if(verbose) cout<<"Track eta = "<<eta<<" and has hits in stations ";//
908 
909  int x=0; //12
910  for(unsigned int s=8;s<12;s++){
911  if((stubs.find(s)->second).size() == 1){
912 
913 
914  if(verbose) cout<< "s= " << s << " " << endl;
915  //etas[s-8] = (fabs((stubs.find(s)->second)[0]->getCMSGlobalEta()) + 0.9)/(0.0125);
916  etas[s-8] = track.thetas[x];
917  if(verbose) cout<< "eta= " << etas[s-8] << " " << endl;
918  phis[s-8] = track.phis[x];//(stubs.find(s)->second)[0]->getCMSGlobalPhi();//
919  if(verbose) cout<< "phi= " << phis[s-8] << " " << endl;
920  clct[s-8] = (stubs.find(s)->second)[0].getPattern();
921  if(verbose) cout<< "clct= " << clct[s-8] << " " << endl;
922  cscid[s-8] = (stubs.find(s)->second)[0].Id();
923  if(verbose) cout<< "cscid= " << cscid[s-8] << " " << endl;
924 
925  if(verbose) cout<< s << " " << (stubs.find(s)->second)[0].detId<CSCDetId>().station()<<" " << phis[s-8] << endl;;
926 
927  const CSCChamber* layer = cscGeometry->chamber((stubs.find(s)->second)[0].detId<CSCDetId>());
928  LocalPoint llc(0.,0.,0.);
929  GlobalPoint glc = layer->toGlobal(llc);
930 
931 
932  int FR_ = 0;
933  int coord[5] = {586,686,815,924,1013};
934  for(int i=0;i<5;i++){
935 
936  if((fabs(glc.z()) < (coord[i] + 7)) && (fabs(glc.z()) > (coord[i] - 7)))
937  FR_ = 1;
938 
939  FR[s-8] = FR_;
940 
941  }
942 
943  x++;
944  }
945  }
946 
947  mode_inv = 0;
948  if(mode & 1)
949  mode_inv |= 8;
950  if(mode & 2)
951  mode_inv |= 4;
952  if(mode & 4)
953  mode_inv |= 2;
954  if(mode & 8)
955  mode_inv |= 1;
956 
957  if(verbose) cout << "\n Mode = " << mode << ", inverted mode = " << mode_inv << endl;
958 
962 
963  for(int d=0;d<6;d++){
964  dphi[d] = track.deltas[0][d];
965  deta[d] = track.deltas[1][d];
966  }
967 
968  if(phis[0] > 0 && phis[1] > 0){ // 1 - 2
969  dphi[0] = phis[1] - phis[0];
970  deta[0] = etas[1] - etas[0];
971  }
972  if(phis[0] > 0 && phis[2] > 0){ // 1 - 3
973  dphi[1] = phis[2] - phis[0];
974  deta[1] = etas[2] - etas[0];
975  }
976  if(phis[0] > 0 && phis[3] > 0){ // 1 - 4
977  dphi[2] = phis[3] - phis[0];
978  deta[2] = etas[3] - etas[0];
979  }
980  if(phis[1] > 0 && phis[2] > 0){ // 2 - 3
981  dphi[3] = phis[2] - phis[1];
982  deta[3] = etas[2] - etas[1];
983  }
984  if(phis[1] > 0 && phis[3] > 0){ // 2 - 4
985  dphi[4] = phis[3] - phis[1];
986  deta[4] = etas[3] - etas[1];
987  }
988  if(phis[2] > 0 && phis[3] > 0){ // 3 - 4
989  dphi[5] = phis[3] - phis[2];
990  deta[5] = etas[3] - etas[2];
991  }
992 
993 
994  if(verbose){
995  if (mode_inv==3) // 1-2
996  {
997  float dPhi12__ = fabs(dphi[0]);
998  float eta__ = getEta(eta, 5);
999  float clct1__ = getCLCT(clct[0]);
1000  float clct2__ = getCLCT(clct[1]);
1001 
1002  cout << endl;
1003  cout << "Inverted mode 3 Track " << endl;
1004  cout << setw(10) << "dPhi12: " << dphi[0] << setw(10) << dPhi12__ << endl;
1005  cout << setw(10) << "CLCT1: " << clct[0] << setw(10) << clct1__ << endl;
1006  cout << setw(10) << "CLCT2: " << clct[1] << setw(10) << clct2__ << endl;
1007  cout << setw(10) << "eta : " << eta << setw(10) << eta__ << endl;
1008  }
1009  if (mode_inv==5) // 1-3
1010  {
1011  float dPhi13__ = fabs(dphi[1]);
1012  float eta__ = getEta(eta, 5);
1013  float clct1__ = getCLCT(clct[0]);
1014  float clct3__ = getCLCT(clct[2]);
1015 
1016  cout << endl;
1017  cout << "Inverted mode 5 Track " << endl;
1018  cout << setw(10) << "dPhi13: " << dphi[1] << setw(10) << dPhi13__ << endl;
1019  cout << setw(10) << "CLCT1: " << clct[0] << setw(10) << clct1__ << endl;
1020  cout << setw(10) << "CLCT3: " << clct[2] << setw(10) << clct3__ << endl;
1021  cout << setw(10) << "eta : " << eta << setw(10) << eta__ << endl;
1022  }
1023  if (mode_inv==9) // 1-4
1024  {
1025  float dPhi14__ = fabs(dphi[2]);
1026  float eta__ = getEta(eta, 5);
1027  float clct1__ = getCLCT(clct[0]);
1028  float clct4__ = getCLCT(clct[3]);
1029 
1030  cout << endl;
1031  cout << "Inverted mode 9 Track " << endl;
1032  cout << setw(10) << "dPhi14: " << dphi[2] << setw(10) << dPhi14__ << endl;
1033  cout << setw(10) << "CLCT1: " << clct[0] << setw(10) << clct1__ << endl;
1034  cout << setw(10) << "CLCT4: " << clct[3] << setw(10) << clct4__ << endl;
1035  cout << setw(10) << "eta : " << eta << setw(10) << eta__ << endl;
1036  }
1037  if (mode_inv==6) // 2-3
1038  {
1039  float dPhi23__ = fabs(dphi[3]);
1040  float eta__ = getEta(eta, 5);
1041  float clct2__ = getCLCT(clct[1]);
1042  float clct3__ = getCLCT(clct[2]);
1043 
1044  cout << endl;
1045  cout << "Inverted mode 9 Track " << endl;
1046  cout << setw(10) << "dPhi23: " << dphi[3] << setw(10) << dPhi23__ << endl;
1047  cout << setw(10) << "CLCT2: " << clct[1] << setw(10) << clct2__ << endl;
1048  cout << setw(10) << "CLCT3: " << clct[2] << setw(10) << clct3__ << endl;
1049  cout << setw(10) << "eta : " << eta << setw(10) << eta__ << endl;
1050  }
1051  if (mode_inv==10) // 2-4
1052  {
1053  float dPhi24__ = fabs(dphi[4]);
1054  float eta__ = getEta(eta, 5);
1055  float clct2__ = getCLCT(clct[1]);
1056  float clct4__ = getCLCT(clct[3]);
1057 
1058  cout << endl;
1059  cout << "Inverted mode 10 Track " << endl;
1060  cout << setw(10) << "dPhi24: " << dphi[4] << setw(10) << dPhi24__ << endl;
1061  cout << setw(10) << "CLCT2: " << clct[1] << setw(10) << clct2__ << endl;
1062  cout << setw(10) << "CLCT4: " << clct[3] << setw(10) << clct4__ << endl;
1063  cout << setw(10) << "eta : " << eta << setw(10) << eta__ << endl;
1064  }
1065  if (mode_inv==12) // 3-4
1066  {
1067  float dPhi34__ = fabs(dphi[5]);
1068  float eta__ = getEta(eta, 5);
1069  float clct3__ = getCLCT(clct[2]);
1070  float clct4__ = getCLCT(clct[3]);
1071 
1072  cout << endl;
1073  cout << "Inverted mode 12 Track " << endl;
1074  cout << setw(10) << "dPhi34: " << dphi[5] << setw(10) << dPhi34__ << endl;
1075  cout << setw(10) << "CLCT3: " << clct[2] << setw(10) << clct3__ << endl;
1076  cout << setw(10) << "CLCT4: " << clct[3] << setw(10) << clct4__ << endl;
1077  cout << setw(10) << "eta : " << eta << setw(10) << eta__ << endl;
1078  }
1079 
1080  if (mode_inv==7) // 1-2-3
1081  {
1082  float dPhi12__ = getNLBdPhi(dphi[0],7, 512);
1083  float dPhi23__ = getNLBdPhi(dphi[3],5, 256);
1084  float eta__ = getEta(eta, 5);
1085  float clct1__ = getCLCT(clct[0]);
1086  cout << endl;
1087  cout << "Inverted mode 7 Track " << endl;
1088  cout << setw(10) << "dPhi12: " << dphi[0] << setw(10) << dPhi12__ << endl;
1089  cout << setw(10) << "dPhi23: " << dphi[3] << setw(10) << dPhi23__ << endl;
1090  cout << setw(10) << "CLCT1: " << clct[0] << setw(10) << clct1__ << endl;
1091  cout << setw(10) << "eta : " << eta << setw(10) << eta__ << endl;
1092  }
1093  if (mode_inv==11) // 1-2-4
1094  {
1095  float dPhi12__ = getNLBdPhi(dphi[0],7, 512);
1096  float dPhi24__ = getNLBdPhi(dphi[4],5, 256);
1097  float eta__ = getEta(eta, 5);
1098  float clct1__ = getCLCT(clct[0]);
1099  cout << endl;
1100  cout << "Inverted mode 11 Track " << endl;
1101  cout << setw(10) << "dPhi12: " << dphi[0] << setw(10) << dPhi12__ << endl;
1102  cout << setw(10) << "dPhi24: " << dphi[4] << setw(10) << dPhi24__ << endl;
1103  cout << setw(10) << "CLCT1: " << clct[0] << setw(10) << clct1__ << endl;
1104  cout << setw(10) << "eta : " << eta << setw(10) << eta__ << endl;
1105  }
1106  if (mode_inv==13) // 1-3-4
1107  {
1108  float dPhi13__ = getNLBdPhi(dphi[1],7, 512);
1109  float dPhi34__ = getNLBdPhi(dphi[5],5, 256);
1110  float eta__ = getEta(eta, 5);
1111  float clct1__ = getCLCT(clct[0]);
1112  cout << endl;
1113  cout << "Inverted mode 13 Track " << endl;
1114  cout << setw(10) << "dPhi13: " << dphi[1] << setw(10) << dPhi13__ << endl;
1115  cout << setw(10) << "dPhi34: " << dphi[5] << setw(10) << dPhi34__ << endl;
1116  cout << setw(10) << "CLCT1: " << clct[0] << setw(10) << clct1__ << endl;
1117  cout << setw(10) << "eta : " << eta << setw(10) << eta__ << endl;
1118  }
1119  if (mode_inv==14) // 2-3-4
1120  {
1121  float dPhi23__ = getNLBdPhi(dphi[3],7, 512);
1122  float dPhi34__ = getNLBdPhi(dphi[5],5, 256);
1123  float eta__ = getEta(eta, 5);
1124  float clct2__ = getCLCT(clct[1]);
1125  cout << endl;
1126  cout << "Inverted mode 14 Track " << endl;
1127  cout << setw(10) << "dPhi23: " << dphi[3] << setw(10) << dPhi23__ << endl;
1128  cout << setw(10) << "dPhi34: " << dphi[5] << setw(10) << dPhi34__ << endl;
1129  cout << setw(10) << "CLCT2: " << clct[1] << setw(10) << clct2__ << endl;
1130  cout << setw(10) << "eta : " << eta << setw(10) << eta__ << endl;
1131  }
1132  if (mode_inv==15) //1-2-3-4
1133  {
1134  float dPhi12__ = getNLBdPhi(dphi[0],7, 512);
1135  float dPhi23__ = getNLBdPhi(dphi[3],5, 256);
1136  float dPhi34__ = getNLBdPhi(dphi[5],6, 256);
1137  float eta__ = getEta(eta, 5);
1138 
1139  cout << endl;
1140  cout << "Inverted mode 15 Track " << endl;
1141  cout << setw(10) << "dPhi12: " << dphi[0] << setw(10) << dPhi12__ << endl;
1142  cout << setw(10) << "dPhi23: " << dphi[3] << setw(10) << dPhi23__ << endl;
1143  cout << setw(10) << "dPhi34: " << dphi[5] << setw(10) << dPhi34__ << endl;
1144  cout << setw(10) << "eta : " << eta << setw(10) << eta__ << endl;
1145  }
1146  }
1147 
1148  float dPhi12 = dphi[0];
1149  float dPhi13 = dphi[1];
1150  float dPhi14 = dphi[2];
1151  float dPhi23 = dphi[3];
1152  float dPhi24 = dphi[4];
1153  float dPhi34 = dphi[5];
1154  float dTheta12 = deta[0];
1155  float dTheta13 = deta[1];
1156  float dTheta14 = deta[2];
1157  float dTheta23 = deta[3];
1158  float dTheta24 = deta[4];
1159  float dTheta34 = deta[5];
1160  float TrackEta = eta;
1161  float CLCT1 = clct[0];
1162  float CLCT2 = clct[1];
1163  float CLCT3 = clct[2];
1164  float CLCT4 = clct[3];
1165  float FR1 = FR[0];
1166  float FR2 = FR[1];
1167  float FR3 = FR[2];
1168  float FR4 = FR[3];
1169 
1170  unsigned long Address = 0x0;
1171 
1172  if (doComp && mode_inv==3)
1173  {
1174 
1175  int dPhi12Sign = 1;
1176  if (dPhi12<0) dPhi12Sign = -1;
1177  // Unused variables
1178  /* int CLCT1Sign = 1; */
1179  /* int CLCT2Sign = 1; */
1180  /* if (CLCT1<0) CLCT1Sign = -1; */
1181  /* if (CLCT2<0) CLCT2Sign = -1; */
1182 
1183  // Make Pt LUT Address
1184  int dPhi12_ = fabs(dPhi12);
1185  int sign12_ = dPhi12Sign > 0 ? 1 : 0;
1186  int dTheta12_ = getdTheta(dTheta12);
1187  int CLCT1_ = getCLCT(CLCT1);
1188  int CLCT1Sign_ = CLCT1_ > 0 ? 1 : 0;
1189  CLCT1_ = abs(CLCT1_);
1190  int CLCT2_ = getCLCT(CLCT2);
1191  int CLCT2Sign_ = CLCT2_ > 0 ? 1 : 0;
1192  CLCT2_ = abs(CLCT2_);
1193  int FR1_ = FR1;
1194  int FR2_ = FR2;
1195  int eta_ = getEtaInt(TrackEta, 5);
1196  int Mode_ = mode_inv;
1197 
1198  Address += ( dPhi12_ & ((1<<9)-1)) << (0);
1199  Address += ( sign12_ & ((1<<1)-1)) << (0+9);
1200  Address += ( dTheta12_ & ((1<<3)-1)) << (0+9+1);
1201  Address += ( CLCT1_ & ((1<<2)-1)) << (0+9+1+3);
1202  Address += ( CLCT1Sign_ & ((1<<1)-1)) << (0+9+1+3+2);
1203  Address += ( CLCT2_ & ((1<<2)-1)) << (0+9+1+3+2+1);
1204  Address += ( CLCT2Sign_ & ((1<<1)-1)) << (0+9+1+3+2+1+2);
1205  Address += ( FR1_ & ((1<<1)-1)) << (0+9+1+3+2+1+2+1);
1206  Address += ( FR2_ & ((1<<1)-1)) << (0+9+1+3+2+1+2+1+1);
1207  Address += ( eta_ & ((1<<5)-1)) << (0+9+1+3+2+1+2+1+1+1);
1208  Address += ( Mode_ & ((1<<4)-1)) << (0+9+1+3+2+1+2+1+1+1+5);
1209  }
1210 
1211  if (doComp && mode_inv==5)
1212  {
1213  // signed full precision dPhi12
1214  int dPhi13Sign = 1;
1215  // Unused variables
1216  // int CLCT1Sign = 1;
1217  // int CLCT3Sign = 1;
1218 
1219  if (dPhi13<0) dPhi13Sign = -1;
1220  // if (CLCT1<0) CLCT1Sign = -1;
1221  // if (CLCT3<0) CLCT3Sign = -1;
1222 
1223  // Make Pt LUT Address
1224  int dPhi13_ = fabs(dPhi13);
1225  int sign13_ = dPhi13Sign > 0 ? 1 : 0;
1226  int dTheta13_ = getdTheta(dTheta13);
1227  int CLCT1_ = getCLCT(CLCT1);
1228  int CLCT1Sign_ = CLCT1_ > 0 ? 1 : 0;
1229  CLCT1_ = abs(CLCT1_);
1230  int CLCT3_ = getCLCT(CLCT3);
1231  int CLCT3Sign_ = CLCT3_ > 0 ? 1 : 0;
1232  CLCT3_ = abs(CLCT3_);
1233  int FR1_ = FR1;
1234  int FR3_ = FR3;
1235  int eta_ = getEtaInt(TrackEta, 5);
1236  int Mode_ = mode_inv;
1237 
1238  Address += ( dPhi13_ & ((1<<9)-1)) << (0);
1239  Address += ( sign13_ & ((1<<1)-1)) << (0+9);
1240  Address += ( dTheta13_ & ((1<<3)-1)) << (0+9+1);
1241  Address += ( CLCT1_ & ((1<<2)-1)) << (0+9+1+3);
1242  Address += ( CLCT1Sign_ & ((1<<1)-1)) << (0+9+1+3+2);
1243  Address += ( CLCT3_ & ((1<<2)-1)) << (0+9+1+3+2+1);
1244  Address += ( CLCT3Sign_ & ((1<<1)-1)) << (0+9+1+3+2+1+2);
1245  Address += ( FR1_ & ((1<<1)-1)) << (0+9+1+3+2+1+2+1);
1246  Address += ( FR3_ & ((1<<1)-1)) << (0+9+1+3+2+1+2+1+1);
1247  Address += ( eta_ & ((1<<5)-1)) << (0+9+1+3+2+1+2+1+1+1);
1248  Address += ( Mode_ & ((1<<4)-1)) << (0+9+1+3+2+1+2+1+1+1+5);
1249  }
1250 
1251  if (doComp && mode_inv==9)
1252  {
1253  // signed full precision dPhi12
1254  int dPhi14Sign = 1;
1255  // Unused variables
1256  // int dEta14Sign = 1;
1257  // int CLCT1Sign = 1;
1258  // int CLCT4Sign = 1;
1259 
1260  if (dPhi14<0) dPhi14Sign = -1;
1261  // if (CLCT1<0) CLCT1Sign = -1;
1262  // if (CLCT4<0) CLCT4Sign = -1;
1263 
1264  // Make Pt LUT Address
1265  int dPhi14_ = fabs(dPhi14);
1266  int sign14_ = dPhi14Sign > 0 ? 1 : 0;
1267  int dTheta14_ = getdTheta(dTheta14);
1268  int CLCT1_ = getCLCT(CLCT1);
1269  int CLCT1Sign_ = CLCT1_ > 0 ? 1 : 0;
1270  CLCT1_ = abs(CLCT1_);
1271  int CLCT4_ = getCLCT(CLCT4);
1272  int CLCT4Sign_ = CLCT4_ > 0 ? 1 : 0;
1273  CLCT4_ = abs(CLCT4_);
1274  int FR1_ = FR1;
1275  int FR4_ = FR4;
1276  int eta_ = getEtaInt(TrackEta, 5);
1277  int Mode_ = mode_inv;
1278 
1279  Address += ( dPhi14_ & ((1<<9)-1)) << (0);
1280  Address += ( sign14_ & ((1<<1)-1)) << (0+9);
1281  Address += ( dTheta14_ & ((1<<3)-1)) << (0+9+1);
1282  Address += ( CLCT1_ & ((1<<2)-1)) << (0+9+1+3);
1283  Address += ( CLCT1Sign_ & ((1<<1)-1)) << (0+9+1+3+2);
1284  Address += ( CLCT4_ & ((1<<2)-1)) << (0+9+1+3+2+1);
1285  Address += ( CLCT4Sign_ & ((1<<1)-1)) << (0+9+1+3+2+1+2);
1286  Address += ( FR1_ & ((1<<1)-1)) << (0+9+1+3+2+1+2+1);
1287  Address += ( FR4_ & ((1<<1)-1)) << (0+9+1+3+2+1+2+1+1);
1288  Address += ( eta_ & ((1<<5)-1)) << (0+9+1+3+2+1+2+1+1+1);
1289  Address += ( Mode_ & ((1<<4)-1)) << (0+9+1+3+2+1+2+1+1+1+5);
1290  }
1291  if (doComp && mode_inv==6) // 2-3
1292  {
1293  // signed full precision dPhi12
1294  int dPhi23Sign = 1;
1295  // Unused variables
1296  // int CLCT2Sign = 1;
1297  // int CLCT3Sign = 1;
1298 
1299  if (dPhi23<0) dPhi23Sign = -1;
1300  // if (CLCT2<0) CLCT2Sign = -1;
1301  // if (CLCT3<0) CLCT3Sign = -1;
1302 
1303  // Make Pt LUT Address
1304  int dPhi23_ = fabs(dPhi23);
1305  int sign23_ = dPhi23Sign > 0 ? 1 : 0;
1306  int dTheta23_ = getdTheta(dTheta23);
1307  int CLCT2_ = getCLCT(CLCT2);
1308  int CLCT2Sign_ = CLCT2_ > 0 ? 1 : 0;
1309  CLCT2_ = abs(CLCT2_);
1310  int CLCT3_ = getCLCT(CLCT3);
1311  int CLCT3Sign_ = CLCT3_ > 0 ? 1 : 0;
1312  CLCT3_ = abs(CLCT3_);
1313  int FR2_ = FR2;
1314  int FR3_ = FR3;
1315  int eta_ = getEtaInt(TrackEta, 5);
1316  int Mode_ = mode_inv;
1317 
1318  Address += ( dPhi23_ & ((1<<9)-1)) << (0);
1319  Address += ( sign23_ & ((1<<1)-1)) << (0+9);
1320  Address += ( dTheta23_ & ((1<<3)-1)) << (0+9+1);
1321  Address += ( CLCT2_ & ((1<<2)-1)) << (0+9+1+3);
1322  Address += ( CLCT2Sign_ & ((1<<1)-1)) << (0+9+1+3+2);
1323  Address += ( CLCT3_ & ((1<<2)-1)) << (0+9+1+3+2+1);
1324  Address += ( CLCT3Sign_ & ((1<<1)-1)) << (0+9+1+3+2+1+2);
1325  Address += ( FR2_ & ((1<<1)-1)) << (0+9+1+3+2+1+2+1);
1326  Address += ( FR3_ & ((1<<1)-1)) << (0+9+1+3+2+1+2+1+1);
1327  Address += ( eta_ & ((1<<5)-1)) << (0+9+1+3+2+1+2+1+1+1);
1328  Address += ( Mode_ & ((1<<4)-1)) << (0+9+1+3+2+1+2+1+1+1+5);
1329  }
1330  if (doComp && mode_inv==10) // 2-4
1331  {
1332  // signed full precision dPhi12
1333  int dPhi24Sign = 1;
1334  // Unused variables
1335  // int CLCT2Sign = 1;
1336  // int CLCT4Sign = 1;
1337 
1338  if (dPhi24<0) dPhi24Sign = -1;
1339  // if (CLCT2<0) CLCT2Sign = -1;
1340  // if (CLCT4<0) CLCT4Sign = -1;
1341 
1342  // Make Pt LUT Address
1343  int dPhi24_ = fabs(dPhi24);
1344  int sign24_ = dPhi24Sign > 0 ? 1 : 0;
1345  int dTheta24_ = getdTheta(dTheta24);
1346  int CLCT2_ = getCLCT(CLCT2);
1347  int CLCT2Sign_ = CLCT2_ > 0 ? 1 : 0;
1348  CLCT2_ = abs(CLCT2_);
1349  int CLCT4_ = getCLCT(CLCT4);
1350  int CLCT4Sign_ = CLCT4_ > 0 ? 1 : 0;
1351  CLCT4_ = abs(CLCT4_);
1352  int FR2_ = FR2;
1353  int FR4_ = FR4;
1354  int eta_ = getEtaInt(TrackEta, 5);
1355  int Mode_ = mode_inv;
1356 
1357  Address += ( dPhi24_ & ((1<<9)-1)) << (0);
1358  Address += ( sign24_ & ((1<<1)-1)) << (0+9);
1359  Address += ( dTheta24_ & ((1<<3)-1)) << (0+9+1);
1360  Address += ( CLCT2_ & ((1<<2)-1)) << (0+9+1+3);
1361  Address += ( CLCT2Sign_ & ((1<<1)-1)) << (0+9+1+3+2);
1362  Address += ( CLCT4_ & ((1<<2)-1)) << (0+9+1+3+2+1);
1363  Address += ( CLCT4Sign_ & ((1<<1)-1)) << (0+9+1+3+2+1+2);
1364  Address += ( FR2_ & ((1<<1)-1)) << (0+9+1+3+2+1+2+1);
1365  Address += ( FR4_ & ((1<<1)-1)) << (0+9+1+3+2+1+2+1+1);
1366  Address += ( eta_ & ((1<<5)-1)) << (0+9+1+3+2+1+2+1+1+1);
1367  Address += ( Mode_ & ((1<<4)-1)) << (0+9+1+3+2+1+2+1+1+1+5);
1368  }
1369  if (doComp && mode_inv==12) // 3-4
1370  {
1371  int dPhi34Sign = 1;
1372  // Unused variables
1373  // int CLCT3Sign = 1;
1374  // int CLCT4Sign = 1;
1375 
1376  if (dPhi34<0) dPhi34Sign = -1;
1377  // if (CLCT3<0) CLCT3Sign = -1;
1378  // if (CLCT4<0) CLCT4Sign = -1;
1379 
1380  // Make Pt LUT Address
1381  int dPhi34_ = fabs(dPhi34);
1382  int sign34_ = dPhi34Sign > 0 ? 1 : 0;
1383  int dTheta34_ = getdTheta(dTheta34);
1384  int CLCT3_ = getCLCT(CLCT3);
1385  int CLCT3Sign_ = CLCT3_ > 0 ? 1 : 0;
1386  CLCT3_ = abs(CLCT3_);
1387  int CLCT4_ = getCLCT(CLCT4);
1388  int CLCT4Sign_ = CLCT4_ > 0 ? 1 : 0;
1389  CLCT4_ = abs(CLCT4_);
1390  int FR3_ = FR3;
1391  int FR4_ = FR4;
1392  int eta_ = getEtaInt(TrackEta, 5);
1393  int Mode_ = mode_inv;
1394 
1395  Address += ( dPhi34_ & ((1<<9)-1)) << (0);
1396  Address += ( sign34_ & ((1<<1)-1)) << (0+9);
1397  Address += ( dTheta34_ & ((1<<3)-1)) << (0+9+1);
1398  Address += ( CLCT3_ & ((1<<2)-1)) << (0+9+1+3);
1399  Address += ( CLCT3Sign_ & ((1<<1)-1)) << (0+9+1+3+2);
1400  Address += ( CLCT4_ & ((1<<2)-1)) << (0+9+1+3+2+1);
1401  Address += ( CLCT4Sign_ & ((1<<1)-1)) << (0+9+1+3+2+1+2);
1402  Address += ( FR3_ & ((1<<1)-1)) << (0+9+1+3+2+1+2+1);
1403  Address += ( FR4_ & ((1<<1)-1)) << (0+9+1+3+2+1+2+1+1);
1404  Address += ( eta_ & ((1<<5)-1)) << (0+9+1+3+2+1+2+1+1+1);
1405  Address += ( Mode_ & ((1<<4)-1)) << (0+9+1+3+2+1+2+1+1+1+5);
1406  }
1407 
1408  if (doComp && mode_inv==7) // 1-2-3
1409  {
1410  int dPhi12Sign = 1;
1411  int dPhi23Sign = 1;
1412  // Unused variables
1413  // int dPhi34Sign = 1;
1414  // int CLCT1Sign = 1;
1415 
1416  if (dPhi12<0) dPhi12Sign = -1;
1417  if (dPhi23<0) dPhi23Sign = -1;
1418  // if (dPhi34<0) dPhi34Sign = -1;
1419  // if (CLCT1<0) CLCT1Sign = -1;
1420 
1421  // Make Pt LUT Address
1422  int dPhi12_ = getNLBdPhiBin(dPhi12, 7, 512);
1423  int dPhi23_ = getNLBdPhiBin(dPhi23, 5, 256);
1424  int sign12_ = dPhi12Sign > 0 ? 1 : 0;
1425  int sign23_ = dPhi23Sign > 0 ? 1 : 0;
1426  int dTheta13_ = getdTheta(dTheta13);
1427  int CLCT1_ = getCLCT(CLCT1);
1428  int CLCT1Sign_ = CLCT1_ > 0 ? 1 : 0;
1429  CLCT1_ = abs(CLCT1_);
1430  int FR1_ = FR1;
1431  int eta_ = getEtaInt(TrackEta, 5);
1432  int Mode_ = mode_inv;
1433 
1434  Address += ( dPhi12_ & ((1<<7)-1)) << (0);
1435  Address += ( dPhi23_ & ((1<<5)-1)) << (0+7);
1436  Address += ( sign12_ & ((1<<1)-1)) << (0+7+5);
1437  Address += ( sign23_ & ((1<<1)-1)) << (0+7+5+1);
1438  Address += ( dTheta13_ & ((1<<3)-1)) << (0+7+5+1+1);
1439  Address += ( CLCT1_ & ((1<<2)-1)) << (0+7+5+1+1+3);
1440  Address += ( CLCT1Sign_ & ((1<<1)-1)) << (0+7+5+1+1+3+2);
1441  Address += ( FR1_ & ((1<<1)-1)) << (0+7+5+1+1+3+2+1);
1442  Address += ( eta_ & ((1<<5)-1)) << (0+7+5+1+1+3+2+1+1);
1443  Address += ( Mode_ & ((1<<4)-1)) << (0+7+5+1+1+3+2+1+1+5);
1444  }
1445 
1446  if (doComp && mode_inv==11)
1447  {
1448  int dPhi12Sign = 1;
1449  int dPhi24Sign = 1;
1450  // Unused variable
1451  // int CLCT1Sign = 1;
1452 
1453  if (dPhi12<0) dPhi12Sign = -1;
1454  if (dPhi24<0) dPhi24Sign = -1;
1455  // if (CLCT1<0) CLCT1Sign = -1;
1456 
1457  // Make Pt LUT Address
1458  int dPhi12_ = getNLBdPhiBin(dPhi12, 7, 512);
1459  int dPhi24_ = getNLBdPhiBin(dPhi24, 5, 256);
1460  int sign12_ = dPhi12Sign > 0 ? 1 : 0;
1461  int sign24_ = dPhi24Sign > 0 ? 1 : 0;
1462  int dTheta14_ = getdTheta(dTheta14);
1463  int CLCT1_ = getCLCT(CLCT1);
1464  int CLCT1Sign_ = CLCT1_ > 0 ? 1 : 0;
1465  CLCT1_ = abs(CLCT1_);
1466  int FR1_ = FR1;
1467  int eta_ = getEtaInt(TrackEta, 5);
1468  int Mode_ = mode_inv;
1469 
1470  Address += ( dPhi12_ & ((1<<7)-1)) << (0);
1471  Address += ( dPhi24_ & ((1<<5)-1)) << (0+7);
1472  Address += ( sign12_ & ((1<<1)-1)) << (0+7+5);
1473  Address += ( sign24_ & ((1<<1)-1)) << (0+7+5+1);
1474  Address += ( dTheta14_ & ((1<<3)-1)) << (0+7+5+1+1);
1475  Address += ( CLCT1_ & ((1<<2)-1)) << (0+7+5+1+1+3);
1476  Address += ( CLCT1Sign_ & ((1<<1)-1)) << (0+7+5+1+1+3+2);
1477  Address += ( FR1_ & ((1<<1)-1)) << (0+7+5+1+1+3+2+1);
1478  Address += ( eta_ & ((1<<5)-1)) << (0+7+5+1+1+3+2+1+1);
1479  Address += ( Mode_ & ((1<<4)-1)) << (0+7+5+1+1+3+2+1+1+5);
1480  }
1481  if (doComp && mode_inv==13) // 1-3-4
1482  {
1483  int dPhi13Sign = 1;
1484  int dPhi34Sign = 1;
1485  // Unused variable
1486  // int CLCT1Sign = 1;
1487 
1488  if (dPhi13<0) dPhi13Sign = -1;
1489  if (dPhi34<0) dPhi34Sign = -1;
1490  // if (CLCT1<0) CLCT1Sign = -1;
1491 
1492  // Make Pt LUT Address
1493  int dPhi13_ = getNLBdPhiBin(dPhi13, 7, 512);
1494  int dPhi34_ = getNLBdPhiBin(dPhi34, 5, 256);
1495  int sign13_ = dPhi13Sign > 0 ? 1 : 0;
1496  int sign34_ = dPhi34Sign > 0 ? 1 : 0;
1497  int dTheta14_ = getdTheta(dTheta14);
1498  int CLCT1_ = getCLCT(CLCT1);
1499  int CLCT1Sign_ = CLCT1_ > 0 ? 1 : 0;
1500  CLCT1_ = abs(CLCT1_);
1501  int FR1_ = FR1;
1502  int eta_ = getEtaInt(TrackEta, 5);
1503  int Mode_ = mode_inv;
1504 
1505  Address += ( dPhi13_ & ((1<<7)-1)) << (0);
1506  Address += ( dPhi34_ & ((1<<5)-1)) << (0+7);
1507  Address += ( sign13_ & ((1<<1)-1)) << (0+7+5);
1508  Address += ( sign34_ & ((1<<1)-1)) << (0+7+5+1);
1509  Address += ( dTheta14_ & ((1<<3)-1)) << (0+7+5+1+1);
1510  Address += ( CLCT1_ & ((1<<2)-1)) << (0+7+5+1+1+3);
1511  Address += ( CLCT1Sign_ & ((1<<1)-1)) << (0+7+5+1+1+3+2);
1512  Address += ( FR1_ & ((1<<1)-1)) << (0+7+5+1+1+3+2+1);
1513  Address += ( eta_ & ((1<<5)-1)) << (0+7+5+1+1+3+2+1+1);
1514  Address += ( Mode_ & ((1<<4)-1)) << (0+7+5+1+1+3+2+1+1+5);
1515  }
1516 
1517  if (doComp && mode_inv==14) // 2-3-4
1518  {
1519  int dPhi23Sign = 1;
1520  int dPhi34Sign = 1;
1521  // Unused variables
1522  // int dEta24Sign = 1;
1523  // int CLCT2Sign = 1;
1524 
1525  if (dPhi23<0) dPhi23Sign = -1;
1526  if (dPhi34<0) dPhi34Sign = -1;
1527  // if (CLCT2<0) CLCT2Sign = -1;
1528 
1529  // Make Pt LUT Address
1530  int dPhi23_ = getNLBdPhiBin(dPhi23, 7, 512);
1531  int dPhi34_ = getNLBdPhiBin(dPhi34, 6, 256);
1532  int sign23_ = dPhi23Sign > 0 ? 1 : 0;
1533  int sign34_ = dPhi34Sign > 0 ? 1 : 0;
1534  int dTheta24_ = getdTheta(dTheta24);
1535  int CLCT2_ = getCLCT(CLCT2);
1536  int CLCT2Sign_ = CLCT2_ > 0 ? 1 : 0;
1537  CLCT2_ = abs(CLCT2_);
1538  int eta_ = getEtaInt(TrackEta, 5);
1539  int Mode_ = mode_inv;
1540 
1541  Address += ( dPhi23_ & ((1<<7)-1)) << (0);
1542  Address += ( dPhi34_ & ((1<<6)-1)) << (0+7);
1543  Address += ( sign23_ & ((1<<1)-1)) << (0+7+6);
1544  Address += ( sign34_ & ((1<<1)-1)) << (0+7+6+1);
1545  Address += ( dTheta24_ & ((1<<3)-1)) << (0+7+6+1+1);
1546  Address += ( CLCT2_ & ((1<<2)-1)) << (0+7+6+1+1+3);
1547  Address += ( CLCT2Sign_ & ((1<<1)-1)) << (0+7+6+1+1+3+2);
1548  Address += ( eta_ & ((1<<5)-1)) << (0+7+6+1+1+3+2+1);
1549  Address += ( Mode_ & ((1<<4)-1)) << (0+7+6+1+1+3+2+1+5);
1550  }
1551 
1552  if (doComp && mode_inv==15) // 1-2-3-4
1553  {
1554  int dPhi12Sign = 1;
1555  int dPhi23Sign = 1;
1556  int dPhi34Sign = 1;
1557 
1558  if (dPhi12<0) dPhi12Sign = -1;
1559  if (dPhi23<0) dPhi23Sign = -1;
1560  if (dPhi34<0) dPhi34Sign = -1;
1561 
1562  dPhi23Sign *= dPhi12Sign;
1563  dPhi34Sign *= dPhi12Sign;
1564  dPhi12Sign = 1;
1565 
1566  // Make Pt LUT Address
1567  int dPhi12_ = getNLBdPhiBin(dPhi12, 7, 512);
1568  int dPhi23_ = getNLBdPhiBin(dPhi23, 5, 256);
1569  int dPhi34_ = getNLBdPhiBin(dPhi34, 6, 256);
1570  int sign23_ = dPhi23Sign > 0 ? 1 : 0;
1571  int sign34_ = dPhi34Sign > 0 ? 1 : 0;
1572  int FR1_ = FR1;
1573  int eta_ = getEtaInt(TrackEta, 5);
1574  int Mode_ = mode_inv;
1575 
1576  Address += ( dPhi12_ & ((1<<7)-1)) << 0;
1577  Address += ( dPhi23_ & ((1<<5)-1)) << (0+7);
1578  Address += ( dPhi34_ & ((1<<6)-1)) << (0+7+5);
1579  Address += ( sign23_ & ((1<<1)-1)) << (0+7+5+6);
1580  Address += ( sign34_ & ((1<<1)-1)) << (0+7+5+6+1);
1581  Address += ( FR1_ & ((1<<1)-1)) << (0+7+5+6+1+1);
1582  Address += ( eta_ & ((1<<5)-1)) << (0+7+5+6+1+1+1);
1583  Address += ( Mode_ & ((1<<4)-1)) << (0+7+5+6+1+1+1+5);
1584  }
1585 
1586  return Address;
1587 }
int i
Definition: DBlmapReader.cc:9
const TriggerPrimitiveStationMap & getStubs() const
static int getEtaInt(float eta, int bits=5)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
static float getEta(float eta, int bits=5)
std::vector< int > thetas
tuple d
Definition: ztail.py:151
static float getCLCT(float clct)
T z() const
Definition: PV3DBase.h:64
static float getdTheta(float dTheta)
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static float getNLBdPhi(float dPhi, int bits, int max=512)
std::vector< std::vector< int > > deltas
globcontrol glc
Definition: vlib.cc:6
std::vector< int > phis
static int getNLBdPhiBin(float dPhi, int bits, int max=512)
const T & get() const
Definition: EventSetup.h:56
tuple cout
Definition: gather_cfg.py:145
std::map< unsigned, TriggerPrimitiveCollection > TriggerPrimitiveStationMap
tuple size
Write out results.
float EmtfPtAssignment::calculatePt ( unsigned long  Address)

Definition at line 435 of file PtAssignment.cc.

References funct::abs(), gather_cfg::cout, TauDecayModes::dec, eta, EnergyCorrector::etas, event(), f, forest_, getdPhiFromBin(), getEtafromBin(), i, j, L1TForest::predictEvent(), findQualityFiles::size, and reco::tau::disc::TrackEta().

436 {
437  bool verbose = false;
438  int ModeVariables[13][6];
439 
440  //FIXME: use pointer to avoid a copy:
441  for (int i=0;i<13;i++) {
442  for (int j=0;j<6;j++) {
443  ModeVariables[i][j] = ModeVariables_Scheme3[i][j];
444  }
445  }
446 
447  int dphi[6] = {-999,-999,-999,-999,-999,-999}, deta[6] = {-999,-999,-999,-999,-999,-999};
448  int clct[4] = {-999,-999,-999,-999}, cscid[4] = {-999,-999,-999,-999};
449  int phis[4] = {-999,-999,-999,-999}, etas[4] = {-999,-999,-999,-999}, mode_inv = 0;;
450  int FR[4] = {-999,-999,-999,-999};
451  float eta =0 ;
452 
453  float dPhi12 = dphi[0];
454  float dPhi13 = dphi[1];
455  float dPhi14 = dphi[2];
456  float dPhi23 = dphi[3];
457  float dPhi24 = dphi[4];
458  float dPhi34 = dphi[5];
459  float dTheta12 = deta[0];
460  float dTheta13 = deta[1];
461  float dTheta14 = deta[2];
462  float dTheta23 = deta[3];
463  float dTheta24 = deta[4];
464  float dTheta34 = deta[5];
465  float TrackEta = 0;
466  float CLCT1 = clct[0];
467  float CLCT2 = clct[1];
468  float CLCT3 = clct[2];
469  float CLCT4 = clct[3];
470  float FR1 = FR[0];
471  float FR2 = FR[1];
472  float FR3 = FR[2];
473  float FR4 = FR[3];
474 
475  mode_inv = (Address >> (30-4)) & ((1<<4)-1);
476 
477  // Decode the Pt LUT Address
478  //unsigned long Address = 0x0;
479 
480  if (verbose) cout << "PtAssignment:getPt: decoding, inverted mode = " << mode_inv << endl;
481 
482  if (mode_inv == 3) // 1-2
483  {
484 
485  int dPhi12_ = (Address >> (0)) & ((1<<9)-1);
486  float sign12 = (Address >> (0+9)) & ((1<<1)-1);
487  dTheta12 = (Address >> (0+9+1)) & ((1<<3)-1);
488  CLCT1 = (Address >> (0+9+1+3)) & ((1<<2)-1);
489  float CLCT1Sign= (Address >> (0+9+1+3+2)) & ((1<<1)-1);
490  CLCT2 = (Address >> (0+9+1+3+2+1)) & ((1<<2)-1);
491  float CLCT2Sign= (Address >> (0+9+1+3+2+1+2)) & ((1<<1)-1);
492  FR1 = (Address >> (0+9+1+3+2+1+2+1)) & ((1<<1)-1);
493  FR2 = (Address >> (0+9+1+3+2+1+2+1+1)) & ((1<<1)-1);
494  int TrackEta_ = (Address >> (0+9+1+3+2+1+2+1+1+1)) & ((1<<5)-1);
495 
496  dPhi12 = dPhi12_;
497  TrackEta = getEtafromBin( TrackEta_, 5);
498 
499  if (sign12 == 0) dPhi12 = -1*dPhi12;
500  if (CLCT1Sign == 0) CLCT1 = -1*CLCT1;
501  if (CLCT2Sign == 0) CLCT2 = -1*CLCT2;
502 
503  if (verbose) cout << "PtAssignment:getPt: decoding, Addess = 0x" << hex << Address << endl;
504  if (verbose) cout << "PtAssignment:getPt: decoding, dPhi12 = " << dec << dPhi12_ << endl;
505 
506  }
507 
508  if (mode_inv == 5) // 1-3
509  {
510 
511  int dPhi13_ = (Address >> (0)) & ((1<<9)-1);
512  float sign13 = (Address >> (0+9)) & ((1<<1)-1);
513  dTheta13 = (Address >> (0+9+1)) & ((1<<3)-1);
514  CLCT1 = (Address >> (0+9+1+3)) & ((1<<2)-1);
515  float CLCT1Sign= (Address >> (0+9+1+3+2)) & ((1<<1)-1);
516  CLCT3 = (Address >> (0+9+1+3+2+1)) & ((1<<2)-1);
517  float CLCT3Sign= (Address >> (0+9+1+3+2+1+2)) & ((1<<1)-1);
518  FR1 = (Address >> (0+9+1+3+2+1+2+1)) & ((1<<1)-1);
519  FR3 = (Address >> (0+9+1+3+2+1+2+1+1)) & ((1<<1)-1);
520  int TrackEta_ = (Address >> (0+9+1+3+2+1+2+1+1+1)) & ((1<<5)-1);
521 
522  dPhi13 = dPhi13_;
523  TrackEta = getEtafromBin( TrackEta_, 5);
524 
525  if (sign13 == 0) dPhi13 = -1*dPhi13;
526  if (CLCT1Sign == 0) CLCT1 = -1*CLCT1;
527  if (CLCT3Sign == 0) CLCT3 = -1*CLCT3;
528  }
529 
530  if (mode_inv == 9) // 1-4
531  {
532 
533  int dPhi14_ = (Address >> (0)) & ((1<<9)-1);
534  float sign14 = (Address >> (0+9)) & ((1<<1)-1);
535  dTheta14 = (Address >> (0+9+1)) & ((1<<3)-1);
536  CLCT1 = (Address >> (0+9+1+3)) & ((1<<2)-1);
537  float CLCT1Sign= (Address >> (0+9+1+3+2)) & ((1<<1)-1);
538  CLCT4 = (Address >> (0+9+1+3+2+1)) & ((1<<2)-1);
539  float CLCT4Sign= (Address >> (0+9+1+3+2+1+2)) & ((1<<1)-1);
540  FR1 = (Address >> (0+9+1+3+2+1+2+1)) & ((1<<1)-1);
541  FR4 = (Address >> (0+9+1+3+2+1+2+1+1)) & ((1<<1)-1);
542  int TrackEta_ = (Address >> (0+9+1+3+2+1+2+1+1+1)) & ((1<<5)-1);
543 
544  dPhi14 = dPhi14_;
545  TrackEta = getEtafromBin( TrackEta_, 5);
546 
547  if (sign14 == 0) dPhi14 = -1*dPhi14;
548  if (CLCT1Sign == 0) CLCT1 = -1*CLCT1;
549  if (CLCT4Sign == 0) CLCT4 = -1*CLCT4;
550  }
551 
552  if (mode_inv == 6) // 2-3
553  {
554 
555  int dPhi23_ = (Address >> (0)) & ((1<<9)-1);
556  float sign23 = (Address >> (0+9)) & ((1<<1)-1);
557  dTheta23 = (Address >> (0+9+1)) & ((1<<3)-1);
558  CLCT2 = (Address >> (0+9+1+3)) & ((1<<2)-1);
559  float CLCT2Sign= (Address >> (0+9+1+3+2)) & ((1<<1)-1);
560  CLCT3 = (Address >> (0+9+1+3+2+1)) & ((1<<2)-1);
561  float CLCT3Sign= (Address >> (0+9+1+3+2+1+2)) & ((1<<1)-1);
562  FR2 = (Address >> (0+9+1+3+2+1+2+1)) & ((1<<1)-1);
563  FR3 = (Address >> (0+9+1+3+2+1+2+1+1)) & ((1<<1)-1);
564  int TrackEta_ = (Address >> (0+9+1+3+2+1+2+1+1+1)) & ((1<<5)-1);
565 
566  dPhi23 = dPhi23_;
567  TrackEta = getEtafromBin( TrackEta_, 5);
568 
569  if (sign23 == 0) dPhi23 = -1*dPhi23;
570  if (CLCT2Sign == 0) CLCT2 = -1*CLCT2;
571  if (CLCT3Sign == 0) CLCT3 = -1*CLCT3;
572  }
573  if (mode_inv == 10) // 2-4
574  {
575 
576  int dPhi24_ = (Address >> (0)) & ((1<<9)-1);
577  float sign24 = (Address >> (0+9)) & ((1<<1)-1);
578  dTheta24 = (Address >> (0+9+1)) & ((1<<3)-1);
579  CLCT2 = (Address >> (0+9+1+3)) & ((1<<2)-1);
580  float CLCT2Sign= (Address >> (0+9+1+3+2)) & ((1<<1)-1);
581  CLCT4 = (Address >> (0+9+1+3+2+1)) & ((1<<2)-1);
582  float CLCT4Sign= (Address >> (0+9+1+3+2+1+2)) & ((1<<1)-1);
583  FR2 = (Address >> (0+9+1+3+2+1+2+1)) & ((1<<1)-1);
584  FR4 = (Address >> (0+9+1+3+2+1+2+1+1)) & ((1<<1)-1);
585  int TrackEta_ = (Address >> (0+9+1+3+2+1+2+1+1+1)) & ((1<<5)-1);
586 
587  dPhi24 = dPhi24_;
588  TrackEta = getEtafromBin( TrackEta_, 5);
589 
590  if (sign24 == 0) dPhi24 = -1*dPhi24;
591  if (CLCT2Sign == 0) CLCT2 = -1*CLCT2;
592  if (CLCT4Sign == 0) CLCT4 = -1*CLCT4;
593  }
594  if (mode_inv == 12) // 3-4
595  {
596 
597  int dPhi34_ = (Address >> (0)) & ((1<<9)-1);
598  float sign34 = (Address >> (0+9)) & ((1<<1)-1);
599  dTheta34 = (Address >> (0+9+1)) & ((1<<3)-1);
600  CLCT3 = (Address >> (0+9+1+3)) & ((1<<2)-1);
601  float CLCT3Sign= (Address >> (0+9+1+3+2)) & ((1<<1)-1);
602  CLCT4 = (Address >> (0+9+1+3+2+1)) & ((1<<2)-1);
603  float CLCT4Sign= (Address >> (0+9+1+3+2+1+2)) & ((1<<1)-1);
604  FR3 = (Address >> (0+9+1+3+2+1+2+1)) & ((1<<1)-1);
605  FR4 = (Address >> (0+9+1+3+2+1+2+1+1)) & ((1<<1)-1);
606  int TrackEta_ = (Address >> (0+9+1+3+2+1+2+1+1+1)) & ((1<<5)-1);
607 
608  dPhi34 = dPhi34_;
609  TrackEta = getEtafromBin( TrackEta_, 5);
610 
611  if (sign34 == 0) dPhi34 = -1*dPhi34;
612  if (CLCT3Sign == 0) CLCT3 = -1*CLCT3;
613  if (CLCT4Sign == 0) CLCT4 = -1*CLCT4;
614  }
615  if (mode_inv == 7) //1-2-3
616  {
617  int dPhi12_ = (Address >> (0)) & ((1<<7)-1);
618  int dPhi23_ = (Address >> (0+7)) & ((1<<5)-1);
619  float sign12 = (Address >> (0+7+5)) & ((1<<1)-1);
620  float sign23 = (Address >> (0+7+5+1)) & ((1<<1)-1);
621  dTheta13 = (Address >> (0+7+5+1+1)) & ((1<<3)-1);
622  CLCT1 = (Address >> (0+7+5+1+1+3)) & ((1<<2)-1);
623  float CLCT1Sign= (Address >> (0+7+5+1+1+3+2)) & ((1<<1)-1);
624  FR1 = (Address >> (0+7+5+1+1+3+2+1)) & ((1<<1)-1);
625  int TrackEta_ = (Address >> (0+7+5+1+1+3+2+1+1)) & ((1<<5)-1);
626 
627  dPhi12 = getdPhiFromBin( dPhi12_, 7, 512 );
628  dPhi23 = getdPhiFromBin( dPhi23_, 5, 256 );
629 
630  //cout << "getPt: dPhi12: " << dPhi12_ << " " << dPhi12 << endl;
631  // cout << "getPt: dPhi23: " << dPhi23_ << " " << dPhi23 << endl;
632 
633  TrackEta = getEtafromBin( TrackEta_, 5);
634 
635  if (sign12 == 0) dPhi12 = -1*dPhi12;
636  if (sign23 == 0) dPhi23 = -1*dPhi23;
637  if (CLCT1Sign == 0) CLCT1 = -1*CLCT1;
638  }
639  if (mode_inv == 11) // 1-2-4
640  {
641  int dPhi12_ = (Address >> (0)) & ((1<<7)-1);
642  int dPhi24_ = (Address >> (0+7)) & ((1<<5)-1);
643  float sign12 = (Address >> (0+7+5)) & ((1<<1)-1);
644  float sign24 = (Address >> (0+7+5+1)) & ((1<<1)-1);
645  dTheta14 = (Address >> (0+7+5+1+1)) & ((1<<3)-1);
646  CLCT1 = (Address >> (0+7+5+1+1+3)) & ((1<<2)-1);
647  float CLCT1Sign= (Address >> (0+7+5+1+1+3+2)) & ((1<<1)-1);
648  FR1 = (Address >> (0+7+5+1+1+3+2+1)) & ((1<<1)-1);
649  int TrackEta_ = (Address >> (0+7+5+1+1+3+2+1+1)) & ((1<<5)-1);
650 
651  dPhi12 = getdPhiFromBin( dPhi12_, 7, 512 );
652  dPhi24 = getdPhiFromBin( dPhi24_, 5, 256 );
653  TrackEta = getEtafromBin( TrackEta_, 5);
654 
655  if (sign12 == 0) dPhi12 = -1*dPhi12;
656  if (sign24 == 0) dPhi24 = -1*dPhi24;
657  if (CLCT1Sign == 0) CLCT1 = -1*CLCT1;
658  }
659  if (mode_inv == 13) // 1-3-4
660  {
661  int dPhi13_ = (Address >> (0)) & ((1<<7)-1);
662  int dPhi34_ = (Address >> (0+7)) & ((1<<5)-1);
663  float sign13 = (Address >> (0+7+5)) & ((1<<1)-1);
664  float sign34 = (Address >> (0+7+5+1)) & ((1<<1)-1);
665  dTheta14 = (Address >> (0+7+5+1+1)) & ((1<<3)-1);
666  CLCT1 = (Address >> (0+7+5+1+1+3)) & ((1<<2)-1);
667  float CLCT1Sign= (Address >> (0+7+5+1+1+3+2)) & ((1<<1)-1);
668  FR1 = (Address >> (0+7+5+1+1+3+2+1)) & ((1<<1)-1);
669  int TrackEta_ = (Address >> (0+7+5+1+1+3+2+1+1)) & ((1<<5)-1);
670 
671  dPhi13 = getdPhiFromBin( dPhi13_, 7, 512 );
672  dPhi34 = getdPhiFromBin( dPhi34_, 5, 256 );
673  TrackEta = getEtafromBin( TrackEta_, 5);
674 
675  if (sign13 == 0) dPhi13 = -1*dPhi13;
676  if (sign34 == 0) dPhi34 = -1*dPhi34;
677  if (CLCT1Sign == 0) CLCT1 = -1*CLCT1;
678  }
679  if (mode_inv == 14) // 2-3-4
680  {
681  int dPhi23_ = (Address >> (0)) & ((1<<7)-1);
682  int dPhi34_ = (Address >> (0+7)) & ((1<<6)-1);
683  float sign23 = (Address >> (0+7+6)) & ((1<<1)-1);
684  float sign34 = (Address >> (0+7+6+1)) & ((1<<1)-1);
685  dTheta24 = (Address >> (0+7+6+1+1)) & ((1<<3)-1);
686  CLCT2 = (Address >> (0+7+6+1+1+3)) & ((1<<2)-1);
687  float CLCT2Sign= (Address >> (0+7+6+1+1+3+2)) & ((1<<1)-1);
688  int TrackEta_ = (Address >> (0+7+6+1+1+3+2+1)) & ((1<<5)-1);
689 
690  dPhi23 = getdPhiFromBin( dPhi23_, 7, 512 );
691  dPhi34 = getdPhiFromBin( dPhi34_, 6, 256 );
692  TrackEta = getEtafromBin( TrackEta_, 5);
693 
694  if (sign23 == 0) dPhi23 = -1*dPhi23;
695  if (sign34 == 0) dPhi34 = -1*dPhi34;
696  if (CLCT2Sign == 0) CLCT2 = -1*CLCT2;
697  }
698  if (mode_inv == 15)
699  {
700  int dPhi12_ = (Address >> (0)) & ((1<<7)-1);
701  int dPhi23_ = (Address >> (0+7)) & ((1<<5)-1);
702  int dPhi34_ = (Address >> (0+7+5)) & ((1<<6)-1);
703  int sign23 = (Address >> (0+7+5+6)) & ((1<<1)-1);
704  int sign34 = (Address >> (0+7+5+6+1)) & ((1<<1)-1);
705  FR1 = (Address >> (0+7+5+6+1+1)) & ((1<<1)-1);
706  int TrackEta_ = (Address >> (0+7+5+6+1+1+1)) & ((1<<5)-1);
707 
708  dPhi12 = getdPhiFromBin( dPhi12_, 7, 512 );
709  dPhi23 = getdPhiFromBin( dPhi23_, 5, 256 );
710  dPhi34 = getdPhiFromBin( dPhi34_, 6, 256 );
711  TrackEta = getEtafromBin( TrackEta_, 5 );
712 
713  if (sign23 == 0) dPhi23 = -1*dPhi23;
714  if (sign34 == 0) dPhi34 = -1*dPhi34;
715 
716  bool era_3 = true;
717  // First fix to recover high pT muons with 3 hits in a line and one displaced hit - AWB 28.07.16
718  // Done by re-writing a few addresses in the original LUT, according to the following logic
719  // Implemented in FW 26.07.16, as of run 2774278 / fill 5119
720  if (era_3) {
721  bool st2_off = false;
722  bool st3_off = false;
723  bool st4_off = false;
724 
725  int dPhi13 = dPhi12 + dPhi23;
726  int dPhi14 = dPhi13 + dPhi34;
727  int dPhi24 = dPhi23 + dPhi34;
728 
729  int sum_st1 = abs( dPhi12 + dPhi13 + dPhi14);
730  int sum_st2 = abs(-dPhi12 + dPhi23 + dPhi24);
731  int sum_st3 = abs(-dPhi13 - dPhi23 + dPhi34);
732  int sum_st4 = abs(-dPhi14 - dPhi24 - dPhi34);
733 
734  if (sum_st2 > sum_st1 && sum_st2 > sum_st3 && sum_st2 > sum_st4) st2_off = true;
735  if (sum_st3 > sum_st1 && sum_st3 > sum_st2 && sum_st3 > sum_st4) st3_off = true;
736  if (sum_st4 > sum_st1 && sum_st4 > sum_st2 && sum_st4 > sum_st3) st4_off = true;
737 
738  if ( st2_off && ( abs(dPhi12) > 9 || abs(dPhi23) > 9 || abs(dPhi24) > 9 ) &&
739  abs(dPhi13) < 10 && abs(dPhi14) < 10 && abs(dPhi34) < 10 ) {
740  dPhi12 = ceil(dPhi13 / 2); dPhi23 = floor(dPhi13 / 2); }
741  if ( st3_off && ( abs(dPhi13) > 9 || abs(dPhi23) > 9 || abs(dPhi34) > 9 ) &&
742  abs(dPhi12) < 10 && abs(dPhi14) < 10 && abs(dPhi24) < 10 ) {
743  dPhi23 = ceil(dPhi24 / 2); dPhi34 = floor(dPhi24 / 2); }
744  if ( st4_off && ( abs(dPhi14) > 9 || abs(dPhi24) > 9 || abs(dPhi34) > 9 ) &&
745  abs(dPhi12) < 10 && abs(dPhi13) < 10 && abs(dPhi23) < 10 ) {
746  if ( abs(dPhi13) < abs(dPhi23) ) dPhi34 = dPhi13;
747  else dPhi34 = dPhi23; }
748  } // End if (era_3)
749  } // End if (mode_inv == 15)
750 
751 
752  if(verbose){
753  if (mode_inv == 15) // 1-2-3-4
754  cout << "Inverted mode 15: " << hex << Address << " " << dec << dPhi12 << " " << dPhi23 << " " << dPhi34 << " " << " " << FR1 << " " << TrackEta << " " << dec << endl;
755  if (mode_inv == 14) // 2-3-4
756  cout << "Inverted mode 14: " << hex << Address << " " << dec << dPhi23 << " " << dPhi34 << " " << " " << " " << TrackEta << " " << dec << endl;
757  if (mode_inv == 13) // 1-3-4
758  cout << "Inverted mode 13: " << hex << Address << " " << dec << dPhi13 << " " << dPhi34 << " " << " " << FR1 << " " << TrackEta << " " << dec << endl;
759  if (mode_inv == 11) // 1-2-4
760  cout << "Inverted mode 11: " << hex << Address << " " << dec << dPhi12 << " " << dPhi24 << " " << " " << FR1 << " " << TrackEta << " " << dec << endl;
761  if (mode_inv == 7)
762  cout << "Inverted mode 7: " << hex << Address << " " << dec << dPhi12 << " " << dPhi23 << " " << " " << FR1 << " " << TrackEta << " " << dec << endl;
763  if (mode_inv == 3)
764  cout << "Inverted mode 3: " << hex << Address << " " << dec << dPhi12 << " " << " " << FR1 << " " << TrackEta << " " << dec << endl;
765  }
766 
767  // now use rebinned values
768  dphi[0] = dPhi12;
769  dphi[1] = dPhi13;
770  dphi[2] = dPhi14;
771  dphi[3] = dPhi23;
772  dphi[4] = dPhi24;
773  dphi[5] = dPhi34;
774  deta[0] = dTheta12;
775  deta[1] = dTheta13;
776  deta[2] = dTheta14;
777  deta[3] = dTheta23;
778  deta[4] = dTheta24;
779  deta[5] = dTheta34;
780  eta = TrackEta;
781  clct[0] = CLCT1;
782  clct[1] = CLCT2;
783  clct[2] = CLCT3;
784  clct[3] = CLCT4;
785  FR[0] = FR1;
786  FR[1] = FR2;
787  FR[2] = FR3;
788  FR[3] = FR4;
789 
790 
791  if(verbose){
792  for(int f=0;f<4;f++){
793  cout<<"\nphis["<<f<<"] = "<<phis[f]<<" and etas = "<<etas[f]<<endl;
794  cout<<"\nclct["<<f<<"] = "<<clct[f]<<" and cscid = "<<cscid[f]<<endl;
795  }
796 
797  for(int u=0;u<6;u++)
798  cout<<"\ndphi["<<u<<"] = "<<dphi[u]<<" and deta = "<<deta[u]<<endl;
799  }
800 
801  float MpT = -1;//final pT to return
802 
803 
807 
808  int size[13] = {5,0,5,5,5,0,5,5,5,5,5,4,4};
809  int Variables[24] = {dphi[0], dphi[1], dphi[2], dphi[3], dphi[4], dphi[5], deta[0], deta[1], deta[2], deta[3], deta[4], deta[5],
810  clct[0], clct[1], clct[2], clct[3], cscid[0], cscid[1], cscid[2], cscid[3], FR[0], FR[1], FR[2], FR[3]};
811 
812 
813 
817  //float gpt = -1;
818 
819  int goodMode = false;
820  int allowedModes[11] = {3,5,9,6,10,12,7,11,13,14,15};
821  for (int i=0;i<11;i++)
822  if (allowedModes[i] == mode_inv)
823  {
824  goodMode = true;
825  break;
826  }
827 
828  if (goodMode)
829  for(int i=3;i<16;i++){
830 
831  if(i != mode_inv)
832  continue;
833 
834  vector<Double_t> Data;
835  Data.push_back(1.0);
836  Data.push_back(eta);
837  for(int y=0;y<size[mode_inv-3];y++){
838  Data.push_back(Variables[ModeVariables[mode_inv-3][y]]);
839  if(verbose) cout<<"Generalized Variables "<<y<<" "<<Variables[ModeVariables[mode_inv-3][y]]<<"\n";
840  }
841 
842  if(verbose){
843  cout<<"Data.size() = "<<Data.size()<<"\n";
844  for(int i=0;i<5;i++)
845  cout<<"Data["<<i<<"] = "<<Data[i]<<"\n";
846  }
847 
848  Event *event = new Event();
849  event->data = Data;
850 
851  forest_[mode_inv].predictEvent(event,64);
852  float OpT = event->predictedValue;
853  MpT = 1/OpT;
854 
855  delete event;
856 
857  if (MpT<0.0) MpT = 1.0;
858  if (MpT>200.0) MpT = 200.0;
859 
860  }
861 
862 
863  return MpT;
864 }
int i
Definition: DBlmapReader.cc:9
static float getdPhiFromBin(int dPhiBin, int bits, int max=512)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
double f[11][100]
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
L1TForest forest_[16]
Definition: PtAssignment.h:23
static float getEtafromBin(int etaBin, int bits=5)
void predictEvent(Event *e, unsigned int trees)
Definition: Forest.cc:449
tuple cout
Definition: gather_cfg.py:145
tuple size
Write out results.

Member Data Documentation

std::vector<int> l1t::EmtfPtAssignment::allowedModes_
private

Definition at line 22 of file PtAssignment.h.

L1TForest l1t::EmtfPtAssignment::forest_[16]
private

Definition at line 23 of file PtAssignment.h.

Referenced by calculatePt().