CMS 3D CMS Logo

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 22 of file PtAssignment.cc.

References allowedModes_, forest_, mps_fire::i, and L1TForest::loadL1TForestFromXML().

22  :
23  allowedModes_({3,5,9,6,10,12,7,11,13,14,15}){
24 
25  for (unsigned i=0;i<allowedModes_.size();i++){
26  int mode_inv = allowedModes_[i];
27  stringstream ss;
28  ss << tree_dir << "/" << mode_inv;
29  forest_[mode_inv].loadL1TForestFromXML(ss.str().c_str(),64);
30  }
31 }
std::vector< int > allowedModes_
Definition: PtAssignment.h:22
void loadL1TForestFromXML(const char *directory, unsigned int numTrees)
Definition: Forest.cc:489
L1TForest forest_[16]
Definition: PtAssignment.h:23

Member Function Documentation

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

Mode Variables ////

Definition at line 869 of file PtAssignment.cc.

References funct::abs(), CSCGeometry::chamber(), gather_cfg::cout, edmIntegrityCheck::d, L1TMuon::InternalTrack::deltas, PVValHelper::eta, EnergyCorrector::etas, edm::EventSetup::get(), getCLCT(), getdTheta(), getEta(), getEtaInt(), getNLBdPhi(), getNLBdPhiBin(), L1TMuon::InternalTrack::getStubs(), glc, mps_fire::i, cmsBatch::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().

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

Definition at line 436 of file PtAssignment.cc.

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

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

Member Data Documentation

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

Definition at line 22 of file PtAssignment.h.

Referenced by EmtfPtAssignment().

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

Definition at line 23 of file PtAssignment.h.

Referenced by calculatePt(), and EmtfPtAssignment().