00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <L1Trigger/CSCTrackFinder/interface/CSCTFPtLUT.h>
00012 #include <DataFormats/L1CSCTrackFinder/interface/CSCTFConstants.h>
00013 #include <FWCore/MessageLogger/interface/MessageLogger.h>
00014 #include <fstream>
00015
00016 ptdat* CSCTFPtLUT::pt_lut = NULL;
00017 bool CSCTFPtLUT::lut_read_in = false;
00018
00019
00020
00021
00023 #include "CondFormats/L1TObjects/interface/L1MuCSCPtLut.h"
00024 #include "CondFormats/DataRecord/interface/L1MuCSCPtLutRcd.h"
00025 #include "FWCore/Framework/interface/ESHandle.h"
00026 #include <L1Trigger/CSCTrackFinder/interface/CSCTFPtLUT.h>
00027
00028 #include "CondFormats/L1TObjects/interface/L1MuTriggerScales.h"
00029 #include "CondFormats/DataRecord/interface/L1MuTriggerScalesRcd.h"
00030 #include "CondFormats/L1TObjects/interface/L1MuTriggerPtScale.h"
00031 #include "CondFormats/DataRecord/interface/L1MuTriggerPtScaleRcd.h"
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 const int CSCTFPtLUT::dPhiNLBMap_5bit[32] =
00053 { 0 , 1 , 2 , 4 , 5 , 7 , 9 , 11 , 13 , 15 , 18 , 21 , 24 , 28 , 32 , 37 , 41 , 47 , 53 , 60 , 67 , 75 , 84 , 94 , 105 , 117 , 131 , 145 , 162 , 180 , 200 , 222};
00054
00055
00056
00057 const int CSCTFPtLUT::dPhiNLBMap_7bit[128] =
00058 { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 8 , 9 , 10 , 11 , 12 , 14 , 15 , 16 , 17 , 19 , 20 , 21 , 23 , 24 , 26 , 27 , 29 , 30 , 32 , 33 , 35 , 37 , 38 , 40 , 42 , 44 , 45 , 47 , 49 , 51 , 53 , 55 , 57 , 59 , 61 , 63 , 65 , 67 , 70 , 72 , 74 , 77 , 79 , 81 , 84 , 86 , 89 , 92 , 94 , 97 , 100 , 103 , 105 , 108 , 111 , 114 , 117 , 121 , 124 , 127 , 130 , 134 , 137 , 141 , 144 , 148 , 151 , 155 , 159 , 163 , 167 , 171 , 175 , 179 , 183 , 188 , 192 , 197 , 201 , 206 , 210 , 215 , 220 , 225 , 230 , 235 , 241 , 246 , 251 , 257 , 263 , 268 , 274 , 280 , 286 , 292 , 299 , 305 , 312 , 318 , 325 , 332 , 339 , 346 , 353 , 361 , 368 , 376 , 383 , 391 , 399 , 408 , 416 , 425 , 433 , 442 , 451 , 460 , 469 , 479 , 489 };
00059
00060
00061
00062 const int CSCTFPtLUT::dPhiNLBMap_8bit[256] =
00063 { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 35 , 36 , 37 , 38 , 39 , 40 , 42 , 43 , 44 , 45 , 46 , 48 , 49 , 50 , 51 , 53 , 54 , 55 , 56 , 58 , 59 , 60 , 61 , 63 , 64 , 65 , 67 , 68 , 69 , 70 , 72 , 73 , 74 , 76 , 77 , 79 , 80 , 81 , 83 , 84 , 85 , 87 , 88 , 90 , 91 , 92 , 94 , 95 , 97 , 98 , 100 , 101 , 103 , 104 , 105 , 107 , 108 , 110 , 111 , 113 , 115 , 116 , 118 , 119 , 121 , 122 , 124 , 125 , 127 , 129 , 130 , 132 , 133 , 135 , 137 , 138 , 140 , 141 , 143 , 145 , 146 , 148 , 150 , 151 , 153 , 155 , 157 , 158 , 160 , 162 , 163 , 165 , 167 , 169 , 171 , 172 , 174 , 176 , 178 , 180 , 181 , 183 , 185 , 187 , 189 , 191 , 192 , 194 , 196 , 198 , 200 , 202 , 204 , 206 , 208 , 210 , 212 , 214 , 216 , 218 , 220 , 222 , 224 , 226 , 228 , 230 , 232 , 234 , 236 , 238 , 240 , 242 , 244 , 246 , 249 , 251 , 253 , 255 , 257 , 259 , 261 , 264 , 266 , 268 , 270 , 273 , 275 , 277 , 279 , 282 , 284 , 286 , 289 , 291 , 293 , 296 , 298 , 300 , 303 , 305 , 307 , 310 , 312 , 315 , 317 , 320 , 322 , 324 , 327 , 329 , 332 , 334 , 337 , 340 , 342 , 345 , 347 , 350 , 352 , 355 , 358 , 360 , 363 , 366 , 368 , 371 , 374 , 376 , 379 , 382 , 385 , 387 , 390 , 393 , 396 , 398 , 401 , 404 , 407 , 410 , 413 , 416 , 419 , 421 , 424 , 427 , 430 , 433 , 436 , 439 , 442 , 445 , 448 , 451 , 454 , 457 , 461 , 464 , 467 , 470 , 473 , 476 , 479 , 483 };
00064
00065
00066
00067
00068
00069
00070
00071 const int CSCTFPtLUT::dEtaCut_Low[24] = {2,2,2,7,2,1,2,7,3,3,3,7,1,1,1,1,2,2,2,2,1,1,1,1};
00072 const int CSCTFPtLUT::dEtaCut_Mid[24] = {2,2,3,7,2,2,3,7,4,4,4,7,2,2,2,2,2,2,2,2,2,2,2,2};
00073 const int CSCTFPtLUT::dEtaCut_High_A[24] = {3,3,4,7,3,2,4,7,5,5,5,7,2,2,2,2,3,3,3,3,2,2,2,2};
00074 const int CSCTFPtLUT::dEtaCut_High_B[24] = {3,3,4,7,3,3,5,7,6,6,6,7,2,2,3,3,3,3,3,3,3,3,3,2};
00075 const int CSCTFPtLUT::dEtaCut_High_C[24] = {4,4,5,7,4,3,6,7,7,7,7,7,3,3,3,3,4,4,4,4,3,3,3,3};
00076 const int CSCTFPtLUT::dEtaCut_Open[24] = {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7};
00077
00078 const int CSCTFPtLUT::getPtbyMLH = 0xFFFF;
00079
00080
00081 CSCTFPtLUT::CSCTFPtLUT(const edm::EventSetup& es)
00082 : read_pt_lut(true),
00083 isBinary(false)
00084 {
00085 pt_method = 32;
00086
00087 lowQualityFlag = 4;
00088 isBeamStartConf = true;
00089 pt_lut = new ptdat[1<<21];
00090
00091 edm::ESHandle<L1MuCSCPtLut> ptLUT;
00092 es.get<L1MuCSCPtLutRcd>().get(ptLUT);
00093 const L1MuCSCPtLut *myConfigPt_ = ptLUT.product();
00094
00095 memcpy((void*)pt_lut,(void*)myConfigPt_->lut(),(1<<21)*sizeof(ptdat));
00096
00097 lut_read_in = true;
00098
00099 edm::ESHandle< L1MuTriggerScales > scales ;
00100 es.get< L1MuTriggerScalesRcd >().get( scales ) ;
00101 trigger_scale = scales.product() ;
00102
00103 edm::ESHandle< L1MuTriggerPtScale > ptScale ;
00104 es.get< L1MuTriggerPtScaleRcd >().get( ptScale ) ;
00105 trigger_ptscale = ptScale.product() ;
00106
00107 ptMethods = CSCTFPtMethods( ptScale.product() ) ;
00108
00109 }
00111
00112 CSCTFPtLUT::CSCTFPtLUT(const edm::ParameterSet& pset,
00113 const L1MuTriggerScales* scales,
00114 const L1MuTriggerPtScale* ptScale)
00115 : trigger_scale( scales ),
00116 trigger_ptscale( ptScale ),
00117 ptMethods( ptScale ),
00118 read_pt_lut(false),
00119 isBinary(false)
00120 {
00121
00122 read_pt_lut = pset.getParameter<bool>("ReadPtLUT");
00123 if(read_pt_lut)
00124 {
00125 pt_lut_file = pset.getParameter<edm::FileInPath>("PtLUTFile");
00126
00127 isBinary = pset.getParameter<bool>("isBinary");
00128
00129 edm::LogInfo("CSCTFPtLUT::CSCTFPtLUT") << "Reading file: "
00130 << pt_lut_file.fullPath().c_str()
00131 << " isBinary?(1/0): "
00132 << isBinary;
00133 }
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164 pt_method = pset.getUntrackedParameter<unsigned>("PtMethod",32);
00165
00166
00167 lowQualityFlag = pset.getUntrackedParameter<unsigned>("LowQualityFlag",4);
00168
00169 if(read_pt_lut && !lut_read_in)
00170 {
00171 pt_lut = new ptdat[1<<21];
00172 readLUT();
00173 lut_read_in = true;
00174 }
00175
00176 isBeamStartConf = pset.getUntrackedParameter<bool>("isBeamStartConf", true);
00177
00178 }
00179
00180 ptdat CSCTFPtLUT::Pt(const ptadd& address) const
00181 {
00182 ptdat result;
00183
00184
00185
00186
00187
00188
00189
00190 result = calcPt(address);
00191 return result;
00192 }
00193
00194 ptdat CSCTFPtLUT::Pt(const unsigned& address) const
00195 {
00196 return Pt(ptadd(address));
00197 }
00198
00199 ptdat CSCTFPtLUT::Pt(const unsigned& delta_phi_12, const unsigned& delta_phi_23,
00200 const unsigned& track_eta, const unsigned& track_mode,
00201 const unsigned& track_fr, const unsigned& delta_phi_sign) const
00202 {
00203 ptadd address;
00204 address.delta_phi_12 = delta_phi_12;
00205 address.delta_phi_23 = delta_phi_23;
00206 address.track_eta = track_eta;
00207 address.track_mode = track_mode;
00208 address.track_fr = track_fr;
00209 address.delta_phi_sign = delta_phi_sign;
00210
00211 return Pt(address);
00212 }
00213
00214 ptdat CSCTFPtLUT::Pt(const unsigned& delta_phi_12, const unsigned& track_eta,
00215 const unsigned& track_mode, const unsigned& track_fr,
00216 const unsigned& delta_phi_sign) const
00217 {
00218 ptadd address;
00219 address.delta_phi_12 = ((1<<8)-1)&delta_phi_12;
00220 address.delta_phi_23 = ((1<<4)-1)&(delta_phi_12>>8);
00221 address.track_eta = track_eta;
00222 address.track_mode = track_mode;
00223 address.track_fr = track_fr;
00224 address.delta_phi_sign = delta_phi_sign;
00225
00226 return Pt(address);
00227 }
00228
00229
00230 ptdat CSCTFPtLUT::calcPt(const ptadd& address) const
00231 {
00232 ptdat result;
00233
00234 double Pi = acos(-1.);
00235 float etaR = 0, ptR_front = 0, ptR_rear = 0, dphi12R = 0, dphi23R = 0;
00236 int charge12, charge23;
00237 unsigned type, mode, eta, fr, quality, charge, absPhi12, absPhi23;
00238
00239 mode = address.track_mode;
00240
00241 int usedetaCUT = true;
00242
00243
00244
00245 int EtaCutLevel_1 = 2;
00246 int dEtaCut_1[24];
00247
00248 for (int i=0;i<24;i++)
00249 {
00250 dEtaCut_1[i] = 10;
00251 if (EtaCutLevel_1 == 1)
00252 dEtaCut_1[i] = dEtaCut_Low[i];
00253 else if (EtaCutLevel_1 == 2)
00254 dEtaCut_1[i] = dEtaCut_Mid[i];
00255 else if (EtaCutLevel_1 == 3)
00256 dEtaCut_1[i] = dEtaCut_High_A[i];
00257 else if (EtaCutLevel_1 == 4)
00258 dEtaCut_1[i] = dEtaCut_High_B[i];
00259 else if (EtaCutLevel_1 == 5)
00260 dEtaCut_1[i] = dEtaCut_High_C[i];
00261 else if (EtaCutLevel_1 == 6)
00262 dEtaCut_1[i] = dEtaCut_Open[i];
00263 }
00264
00265 int EtaCutLevel_2 = 2;
00266 int dEtaCut_2[24];
00267
00268 for (int i=0;i<24;i++)
00269 {
00270 dEtaCut_2[i] = 10;
00271 if (EtaCutLevel_2 == 1)
00272 dEtaCut_2[i] = dEtaCut_Low[i];
00273 else if (EtaCutLevel_2 == 2)
00274 dEtaCut_2[i] = dEtaCut_Mid[i];
00275 else if (EtaCutLevel_2 == 3)
00276 dEtaCut_2[i] = dEtaCut_High_A[i];
00277 else if (EtaCutLevel_2 == 4)
00278 dEtaCut_2[i] = dEtaCut_High_B[i];
00279 else if (EtaCutLevel_2 == 5)
00280 dEtaCut_2[i] = dEtaCut_High_C[i];
00281 else if (EtaCutLevel_2 == 6)
00282 dEtaCut_2[i] = dEtaCut_Open[i];
00283
00284 float scalef = 1.0;
00285 if (mode == 8 || mode == 10)
00286 dEtaCut_2[i] = scalef*dEtaCut_2[i];
00287
00288 }
00289
00290
00291
00292 eta = address.track_eta;
00293
00294 fr = address.track_fr;
00295 charge = address.delta_phi_sign;
00296 quality = trackQuality(eta, mode, fr);
00297 unsigned front_pt, rear_pt;
00298 front_pt = 0.; rear_pt = 0.;
00299 unsigned front_quality, rear_quality;
00300
00301 etaR = trigger_scale->getRegionalEtaScale(2)->getLowEdge(2*eta+1);
00302
00303 front_quality = rear_quality = quality;
00304
00305 unsigned int remerged;
00306 int iME11;
00307 int CLCT_pattern;
00308 int dEta;
00309 int index = 0;
00310 float bestLH = -999;
00311 float bestLH_front = -999.0;
00312 float bestLH_rear = -999.0;
00313
00314 int PtbyMLH = false;
00315
00316
00317 if(pt_method >= 29 && pt_method <= 33)
00318 {
00319
00320 PtbyMLH = 0x1 & (getPtbyMLH >> (int)mode);
00322
00323 if(etaR > 2.1){
00324 usedetaCUT = false;
00325 PtbyMLH = 0x0;
00326 }
00328
00329 switch(mode)
00330 {
00331 case 2:
00332 case 3:
00333 case 4:
00334 case 5:
00335
00336
00337 charge12 = 1;
00338
00339
00340 remerged = (address.delta_phi_12 | (address.delta_phi_23 << 8 ) );
00341
00342
00343 absPhi12 = ((1<<7)-1) & remerged;
00344 absPhi23 = ((1<<5)-1) & (remerged >> 7);
00345
00346
00347 absPhi12 = dPhiNLBMap_7bit[absPhi12];
00348 absPhi23 = dPhiNLBMap_5bit[absPhi23];
00349
00350 if(charge) charge23 = 1;
00351 else charge23 = -1;
00352
00353 dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00354 dphi23R = (static_cast<float>(absPhi23)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00355 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
00356
00357 ptR_front = ptMethods.Pt3Stn2012(int(mode), etaR, dphi12R, dphi23R, PtbyMLH, bestLH, 1, int(pt_method));
00358 bestLH_front = bestLH;
00359 ptR_rear = ptMethods.Pt3Stn2012(int(mode), etaR, dphi12R, dphi23R, PtbyMLH, bestLH, 0, int(pt_method));
00360 bestLH_rear = bestLH;
00361
00362 if((pt_method == 29 || pt_method == 32 || pt_method == 30 || pt_method == 31) && mode != 5 && etaR > 2.1)
00363 {
00364 float dphi12Rmin = dphi12R - Pi*10/180/3;
00365 float dphi12Rmax = dphi12R + Pi*10/180/3;
00366 float dphi23Rmin = dphi23R;
00367 float dphi23Rmax = dphi23R;
00368
00369
00370 float ptR_front_min = ptMethods.Pt3Stn2012(int(mode), etaR, dphi12Rmin, dphi23Rmin, PtbyMLH, bestLH, 1, int(pt_method));
00371 float bestLH_front_min = bestLH;
00372 float ptR_rear_min = ptMethods.Pt3Stn2012(int(mode), etaR, dphi12Rmin, dphi23Rmin, PtbyMLH, bestLH, 0, int(pt_method));
00373 float bestLH_rear_min = bestLH;
00374 float ptR_front_max = ptMethods.Pt3Stn2012(int(mode), etaR, dphi12Rmax, dphi23Rmax, PtbyMLH, bestLH, 1, int(pt_method));
00375 float bestLH_front_max = bestLH;
00376 float ptR_rear_max = ptMethods.Pt3Stn2012(int(mode), etaR, dphi12Rmax, dphi23Rmax, PtbyMLH, bestLH, 0, int(pt_method));
00377 float bestLH_rear_max = bestLH;
00378
00379 if (PtbyMLH)
00380 {
00381 float best_pt_front = ptR_front;
00382 float best_LH_front = bestLH_front;
00383 if (bestLH_front_min > best_LH_front)
00384 {
00385 best_pt_front = ptR_front_min;
00386 best_LH_front = bestLH_front_min;
00387 }
00388 if (bestLH_front_max > best_LH_front)
00389 {
00390 best_pt_front = ptR_front_max;
00391 best_LH_front = bestLH_front_max;
00392 }
00393 ptR_front = best_pt_front;
00394
00395 float best_pt_rear = ptR_rear;
00396 float best_LH_rear = bestLH_rear;
00397 if (bestLH_rear_min > best_LH_rear)
00398 {
00399 best_pt_rear = ptR_rear_min;
00400 best_LH_rear = bestLH_rear_min;
00401 }
00402 if (bestLH_rear_max > best_LH_rear)
00403 {
00404 best_pt_rear = ptR_rear_max;
00405 best_LH_rear = bestLH_rear_max;
00406 }
00407 ptR_rear = best_pt_rear;
00408 }
00409 else
00410 {
00411
00412 ptR_front = std::max(ptR_front, ptR_front_min);
00413 ptR_front = std::max(ptR_front, ptR_front_max);
00414 ptR_rear = std::max(ptR_rear, ptR_rear_min);
00415 ptR_rear = std::max(ptR_rear, ptR_rear_max);
00416 }
00417 }
00418 break;
00419 case 6:
00420 case 7:
00421 case 13:
00422
00423
00424 remerged = (address.delta_phi_12 | (address.delta_phi_23 << 8 ) );
00425
00426 absPhi12 = ((1<<8)-1) & remerged;
00427
00428 dEta = ((1<<3)-1) & (remerged >> 8);
00429
00430 CLCT_pattern = 0x1 & (remerged >> 11);
00431
00432 iME11 = int(charge);
00433 if(iME11 == 1 && etaR > 1.6) etaR = 1.55;
00434 if(iME11 == 0 && etaR < 1.6) etaR = 1.65;
00435
00436
00437 absPhi12 = ((1<<8)-1) & address.delta_phi_12;
00438
00439
00440 absPhi12 = dPhiNLBMap_8bit[absPhi12];
00441
00442
00443
00444 dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00445
00446
00447 ptR_front = ptMethods.Pt2Stn2012(int(mode), etaR, dphi12R, PtbyMLH, bestLH, 1, int(pt_method));
00448 bestLH_front = bestLH;
00449 ptR_rear = ptMethods.Pt2Stn2012(int(mode), etaR, dphi12R, PtbyMLH, bestLH, 0, int(pt_method));
00450 bestLH_rear = bestLH;
00451 if((pt_method == 29 || pt_method == 32 || pt_method == 30 || pt_method == 31) && etaR > 2.1)
00452 {
00453 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
00454 float ptR_front_min = ptMethods.Pt2Stn2012(int(mode), etaR, dphi12Rmin, PtbyMLH, bestLH, 1, int(pt_method));
00455 float bestLH_front_min = bestLH;
00456 float ptR_rear_min = ptMethods.Pt2Stn2012(int(mode), etaR, dphi12Rmin, PtbyMLH, bestLH, 0, int(pt_method));
00457 float bestLH_rear_min = bestLH;
00458
00459 if (PtbyMLH)
00460 {
00461 ptR_front = bestLH_front > bestLH_front_min ? ptR_front : ptR_front_min;
00462 ptR_rear = bestLH_rear > bestLH_rear_min ? ptR_rear : ptR_rear_min;
00463 }
00464 else
00465 {
00466
00467 ptR_front = std::max(ptR_front, ptR_front_min);
00468 ptR_rear = std::max(ptR_rear, ptR_rear_min);
00469 }
00470 }
00471
00472 if( (!CLCT_pattern) && (ptR_front > 5.)) ptR_front = 5.;
00473 if( (!CLCT_pattern) && (ptR_rear > 5.)) ptR_rear = 5.;
00474
00475
00476 index = 0;
00477 if (mode == 6) index = 0;
00478 if (mode == 7) index = 4;
00479 if (mode == 13) index = 8;
00480
00481 if (usedetaCUT)
00482 {
00483 if (fabs(etaR)>1.2 && fabs(etaR)<=1.5)
00484 if (dEta>dEtaCut_1[index+0] )
00485 {
00486 if (ptR_front > 5) ptR_front = 5;
00487 if (ptR_rear > 5) ptR_rear = 5;
00488 }
00489 if (fabs(etaR)>1.5 && fabs(etaR)<=1.65)
00490 if (dEta>dEtaCut_1[index+1])
00491 {
00492 if (ptR_front > 5) ptR_front = 5;
00493 if (ptR_rear > 5) ptR_rear = 5;
00494 }
00495
00496 if (fabs(etaR)>1.65 && fabs(etaR)<=2.1)
00497 if (dEta>dEtaCut_1[index+2] )
00498 {
00499 if (ptR_front > 5) ptR_front = 5;
00500 if (ptR_rear > 5) ptR_rear = 5;
00501 }
00502 if (fabs(etaR)>2.1)
00503 if (dEta>dEtaCut_1[index+3] )
00504 {
00505 if (ptR_front > 5) ptR_front = 5;
00506 if (ptR_rear > 5) ptR_rear = 5;
00507 }
00508 }
00509
00510 break;
00511
00512 case 8:
00513 case 9:
00514 case 10:
00515
00516
00517
00518 remerged = (address.delta_phi_12 | (address.delta_phi_23 << 8 ) );
00519
00520 absPhi12 = ((1<<9)-1) & remerged;
00521
00522 dEta = ((1<<3)-1) & (remerged >> 9);
00523
00524 dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00525
00526
00527 ptR_front = ptMethods.Pt2Stn2012(int(mode), etaR, dphi12R, PtbyMLH, bestLH, 1, int(pt_method));
00528 ptR_rear = ptMethods.Pt2Stn2012(int(mode), etaR, dphi12R, PtbyMLH, bestLH, 0, int(pt_method));
00529
00530 index = 0;
00531 if (mode == 8) index = 12;
00532 if (mode == 9) index = 16;
00533 if (mode == 10) index = 20;
00534
00535
00536
00537
00538 if (usedetaCUT)
00539 {
00540 if (fabs(etaR)>1.2 && fabs(etaR)<=1.5)
00541 if (dEta>dEtaCut_2[index+0] )
00542 {
00543 if (ptR_front > 5) ptR_front = 5;
00544 if (ptR_rear > 5) ptR_rear = 5;
00545 }
00546 if (fabs(etaR)>1.5 && fabs(etaR)<=1.65)
00547 if (dEta>dEtaCut_2[index+1])
00548 {
00549 if (ptR_front > 5) ptR_front = 5;
00550 if (ptR_rear > 5) ptR_rear = 5;
00551 }
00552
00553 if (fabs(etaR)>1.65 && fabs(etaR)<=2.1)
00554 if (dEta>dEtaCut_2[index+2] )
00555 {
00556 if (ptR_front > 5) ptR_front = 5;
00557 if (ptR_rear > 5) ptR_rear = 5;
00558 }
00559 if (fabs(etaR)>2.1)
00560 if (dEta>dEtaCut_2[index+3] )
00561 {
00562 if (ptR_front > 5) ptR_front = 5;
00563 if (ptR_rear > 5) ptR_rear = 5;
00564 }
00565 }
00566
00567 break;
00568
00569 case 11:
00570 case 12:
00571 case 14:
00572
00573
00574
00575
00576
00577
00578 charge12 = 1;
00579
00580
00581 absPhi12 = address.delta_phi_12;
00582 absPhi23 = address.delta_phi_23;
00583
00584 if(charge) charge23 = -1;
00585 else charge23 = 1;
00586
00587 dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00588 dphi23R = float(absPhi23);
00589 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
00590
00591 int mode1;
00592 mode1 = int(mode);
00593 if(fr == 1 && mode1 == 11) mode1 = 14;
00594
00595 ptR_front = ptMethods.Pt3Stn2012_DT(mode1, etaR, dphi12R, dphi23R, PtbyMLH, bestLH, int(0), int(pt_method));
00596 ptR_rear = ptMethods.Pt3Stn2012_DT(mode1, etaR, dphi12R, dphi23R, PtbyMLH, bestLH, int(0), int(pt_method));
00597
00598 break;
00599 case 15:
00600 case 1:
00601 ptR_front = trigger_ptscale->getPtScale()->getLowEdge(3);
00602 ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(3);
00603 break;
00604 default:
00605 ptR_front = trigger_ptscale->getPtScale()->getLowEdge(0);
00606 ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(0);
00607 };
00608
00609 front_pt = trigger_ptscale->getPtScale()->getPacked(ptR_front);
00610 rear_pt = trigger_ptscale->getPtScale()->getPacked(ptR_rear);
00611
00612 }
00613
00614
00615
00616 if(pt_method >= 23 && pt_method <= 28){
00617
00618
00619
00620
00621
00622 switch(mode)
00623 {
00624 case 2:
00625 case 3:
00626 case 4:
00627 case 5:
00628
00629 charge12 = 1;
00630 absPhi12 = address.delta_phi_12;
00631 absPhi23 = address.delta_phi_23;
00632
00633 if(charge) charge23 = 1;
00634 else charge23 = -1;
00635
00636 dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00637 dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00638 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
00639
00640 ptR_front = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12R, dphi23R, 1, int(pt_method));
00641 ptR_rear = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12R, dphi23R, 0, int(pt_method));
00642
00643 if((pt_method == 24 || pt_method == 26 || pt_method == 28) && mode != 5 && etaR > 2.1)
00644 {
00645 float dphi12Rmin = dphi12R - Pi*10/180/3;
00646 float dphi12Rmax = dphi12R + Pi*10/180/3;
00647 float dphi23Rmin = dphi23R;
00648 float dphi23Rmax = dphi23R;
00649
00650
00651 float ptR_front_min = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12Rmin, dphi23Rmin, 1, int(pt_method));
00652 float ptR_rear_min = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12Rmin, dphi23Rmin, 0, int(pt_method));
00653 float ptR_front_max = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12Rmax, dphi23Rmax, 1, int(pt_method));
00654 float ptR_rear_max = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12Rmax, dphi23Rmax, 0, int(pt_method));
00655
00656 ptR_front = std::max(ptR_front, ptR_front_min);
00657 ptR_front = std::max(ptR_front, ptR_front_max);
00658 ptR_rear = std::max(ptR_rear, ptR_rear_min);
00659 ptR_rear = std::max(ptR_rear, ptR_rear_max);
00660 }
00661 break;
00662 case 6:
00663 case 7:
00664 case 13:
00665 int iME11;
00666 iME11 = int(charge);
00667 if(iME11 == 1 && etaR > 1.6) etaR = 1.55;
00668 if(iME11 == 0 && etaR < 1.6) etaR = 1.65;
00669 absPhi12 = address.delta_phi_12;
00670
00671 int CLCT_pattern;
00672 CLCT_pattern = int(address.delta_phi_23);
00673 dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00674
00675
00676 ptR_front = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12R, 1, int(pt_method));
00677 ptR_rear = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12R, 0, int(pt_method));
00678 if((pt_method == 24 || pt_method == 26 || pt_method == 28) && etaR > 2.1)
00679 {
00680 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
00681 float ptR_front_min = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12Rmin, 1, int(pt_method));
00682 float ptR_rear_min = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12Rmin, 0, int(pt_method));
00683
00684 ptR_front = std::max(ptR_front, ptR_front_min);
00685 ptR_rear = std::max(ptR_rear, ptR_rear_min);
00686 }
00687 if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_front > 5.)) ptR_front = 5.;
00688 if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_rear > 5.)) ptR_rear = 5.;
00689
00690
00691 break;
00692 case 8:
00693 case 9:
00694 case 10:
00695 if(charge) absPhi12 = address.delta_phi();
00696 else
00697 {
00698 int temp_phi = address.delta_phi();
00699 absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
00700 }
00701
00702 dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00703
00704
00705 ptR_front = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12R, 1, int(pt_method));
00706 ptR_rear = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12R, 0, int(pt_method));
00707
00708 break;
00709
00710 case 11:
00711 case 12:
00712 case 14:
00713
00714
00715
00716
00717
00718 charge12 = 1;
00719 absPhi12 = address.delta_phi_12;
00720 absPhi23 = address.delta_phi_23;
00721
00722 if(charge) charge23 = -1;
00723 else charge23 = 1;
00724
00725 dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00726 dphi23R = float(absPhi23);
00727 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
00728
00729 int mode1;
00730 mode1 = int(mode);
00731 if(fr == 1 && mode1 == 11) mode1 = 14;
00732
00733 ptR_front = ptMethods.Pt3Stn2011(mode1, etaR, dphi12R, dphi23R, int(0), int(pt_method));
00734 ptR_rear = ptMethods.Pt3Stn2011(mode1, etaR, dphi12R, dphi23R, int(0), int(pt_method));
00735
00736 break;
00737 case 15:
00738 case 1:
00739 ptR_front = trigger_ptscale->getPtScale()->getLowEdge(3);
00740 ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(3);
00741 break;
00742 default:
00743 ptR_front = trigger_ptscale->getPtScale()->getLowEdge(0);
00744 ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(0);
00745 };
00746
00747 front_pt = trigger_ptscale->getPtScale()->getPacked(ptR_front);
00748 rear_pt = trigger_ptscale->getPtScale()->getPacked(ptR_rear);
00749
00750 }
00751
00752
00753
00754 if(pt_method == 21 || pt_method == 22){
00755
00756
00757
00758
00759 switch(mode)
00760 {
00761 case 2:
00762 case 3:
00763 case 4:
00764 case 5:
00765
00766 charge12 = 1;
00767 absPhi12 = address.delta_phi_12;
00768 absPhi23 = address.delta_phi_23;
00769
00770 if(charge) charge23 = 1;
00771 else charge23 = -1;
00772
00773 dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00774 dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00775 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
00776
00777 ptR_front = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12R, dphi23R, 1, int(pt_method));
00778 ptR_rear = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12R, dphi23R, 0, int(pt_method));
00779
00780 if(pt_method == 22 && mode != 5 && etaR > 2.1)
00781 {
00782 float dphi12Rmin = dphi12R - Pi*10/180/3;
00783 float dphi12Rmax = dphi12R + Pi*10/180/3;
00784 float dphi23Rmin = dphi23R;
00785 float dphi23Rmax = dphi23R;
00786
00787
00788 float ptR_front_min = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12Rmin, dphi23Rmin, 1, int(pt_method));
00789 float ptR_rear_min = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12Rmin, dphi23Rmin, 0, int(pt_method));
00790 float ptR_front_max = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12Rmax, dphi23Rmax, 1, int(pt_method));
00791 float ptR_rear_max = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12Rmax, dphi23Rmax, 0, int(pt_method));
00792
00793 ptR_front = std::max(ptR_front, ptR_front_min);
00794 ptR_front = std::max(ptR_front, ptR_front_max);
00795 ptR_rear = std::max(ptR_rear, ptR_rear_min);
00796 ptR_rear = std::max(ptR_rear, ptR_rear_max);
00797 }
00798 break;
00799 case 6:
00800 case 7:
00801 case 13:
00802 int iME11;
00803 iME11 = int(charge);
00804 absPhi12 = address.delta_phi_12;
00805
00806 int CLCT_pattern;
00807 CLCT_pattern = int(address.delta_phi_23);
00808
00809 dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00810
00811
00812 ptR_front = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12R, 1, int(pt_method), iME11);
00813 ptR_rear = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12R, 0, int(pt_method), iME11);
00814 if((pt_method == 22) && etaR > 2.1)
00815 {
00816 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
00817 float ptR_front_min = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12Rmin, 1, int(pt_method), iME11);
00818 float ptR_rear_min = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12Rmin, 0, int(pt_method), iME11);
00819
00820 ptR_front = std::max(ptR_front, ptR_front_min);
00821 ptR_rear = std::max(ptR_rear, ptR_rear_min);
00822 }
00823 if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_front > 5.)) ptR_front = 5.;
00824 if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_rear > 5.)) ptR_rear = 5.;
00825
00826 break;
00827 case 8:
00828 case 9:
00829 case 10:
00830 if(charge) absPhi12 = address.delta_phi();
00831 else
00832 {
00833 int temp_phi = address.delta_phi();
00834 absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
00835 }
00836
00837 dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00838
00839
00840 ptR_front = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12R, 1, int(pt_method), int(2));
00841 ptR_rear = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12R, 0, int(pt_method), int(2));
00842
00843 break;
00844 case 11:
00845 case 12:
00846 case 14:
00847
00848
00849
00850
00851
00852 charge12 = 1;
00853 absPhi12 = address.delta_phi_12;
00854 absPhi23 = address.delta_phi_23;
00855
00856 if(charge) charge23 = -1;
00857 else charge23 = 1;
00858
00859 dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00860 dphi23R = float(absPhi23);
00861 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
00862
00863 int mode1;
00864 mode1 = int(mode);
00865 if(fr == 1 && mode1 == 11) mode1 = 14;
00866
00867 ptR_front = ptMethods.Pt3Stn2011(mode1, etaR, dphi12R, dphi23R, int(0), int(pt_method));
00868 ptR_rear = ptMethods.Pt3Stn2011(mode1, etaR, dphi12R, dphi23R, int(0), int(pt_method));
00869
00870 break;
00871 case 15:
00872 case 1:
00873 ptR_front = trigger_ptscale->getPtScale()->getLowEdge(3);
00874 ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(3);
00875 break;
00876 default:
00877 ptR_front = trigger_ptscale->getPtScale()->getLowEdge(0);
00878 ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(0);
00879 };
00880
00881 front_pt = trigger_ptscale->getPtScale()->getPacked(ptR_front);
00882 rear_pt = trigger_ptscale->getPtScale()->getPacked(ptR_rear);
00883
00884 }
00885
00886
00887
00888 if(pt_method >= 11 && pt_method < 20){
00889
00890
00891
00892
00893 switch(mode)
00894 {
00895 case 2:
00896 case 3:
00897 case 4:
00898 case 5:
00899
00900 charge12 = 1;
00901 absPhi12 = address.delta_phi_12;
00902 absPhi23 = address.delta_phi_23;
00903
00904 if(charge) charge23 = 1;
00905 else charge23 = -1;
00906
00907 dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00908 dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00909 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
00910
00911 ptR_front = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 1, int(pt_method));
00912 ptR_rear = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 0, int(pt_method));
00913
00914 if(pt_method == 12 && mode != 5 && etaR > 2.1)
00915 {
00916 float dphi12Rmin = dphi12R - Pi*10/180/3;
00917 float dphi12Rmax = dphi12R + Pi*10/180/3;
00918 float dphi23Rmin = dphi23R;
00919 float dphi23Rmax = dphi23R;
00920 if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
00921 if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
00922 float ptR_front_min = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmin, dphi23Rmin, 1, int(pt_method));
00923 float ptR_rear_min = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmin, dphi23Rmin, 0, int(pt_method));
00924 float ptR_front_max = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmax, dphi23Rmax, 1, int(pt_method));
00925 float ptR_rear_max = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmax, dphi23Rmax, 0, int(pt_method));
00926
00927 ptR_front = std::max(ptR_front, ptR_front_min);
00928 ptR_front = std::max(ptR_front, ptR_front_max);
00929 ptR_rear = std::max(ptR_rear, ptR_rear_min);
00930 ptR_rear = std::max(ptR_rear, ptR_rear_max);
00931 }
00932 break;
00933 case 6:
00934 case 7:
00935 case 8:
00936 case 9:
00937 case 10:
00938 case 13:
00939 type = mode - 5;
00940
00941 if(charge) absPhi12 = address.delta_phi();
00942 else
00943 {
00944 int temp_phi = address.delta_phi();
00945 absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
00946 }
00947
00948 dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00949
00950
00951 ptR_front = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 1, int(pt_method));
00952 ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0, int(pt_method));
00953 if((pt_method == 12) && etaR > 2.1 && mode != 8 && mode !=9 && mode !=10)
00954 {
00955 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
00956 float ptR_front_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 1, int(pt_method));
00957 float ptR_rear_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 0, int(pt_method));
00958
00959 ptR_front = std::max(ptR_front, ptR_front_min);
00960 ptR_rear = std::max(ptR_rear, ptR_rear_min);
00961 }
00962
00963 break;
00964 case 11:
00965 case 12:
00966 case 14:
00967
00968 if(fr == 0){
00969 if(charge) absPhi12 = address.delta_phi();
00970 else
00971 {
00972 int temp_phi = address.delta_phi();
00973 absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
00974 }
00975 dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00976 ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0, int(pt_method));
00977
00978 }
00979 if(fr == 1){
00980 charge12 = 1;
00981 absPhi12 = address.delta_phi_12;
00982 absPhi23 = address.delta_phi_23;
00983
00984 if(charge) charge23 = 1;
00985 else charge23 = -1;
00986
00987 dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00988 dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
00989 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
00990
00991 ptR_front = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 1, int(pt_method));
00992
00993 if(pt_method == 12 && mode != 5 && etaR > 2.1)
00994 {
00995 float dphi12Rmin = dphi12R - Pi*10/180/3;
00996 float dphi12Rmax = dphi12R + Pi*10/180/3;
00997 float dphi23Rmin = dphi23R;
00998 float dphi23Rmax = dphi23R;
00999 if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
01000 if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
01001 float ptR_front_min = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmin, dphi23Rmin, 1, int(pt_method));
01002 float ptR_front_max = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmax, dphi23Rmax, 1, int(pt_method));
01003
01004 ptR_front = std::max(ptR_front, ptR_front_min);
01005 ptR_front = std::max(ptR_front, ptR_front_max);
01006 }
01007 }
01008
01009 break;
01010 case 15:
01011 case 1:
01012 ptR_front = trigger_ptscale->getPtScale()->getLowEdge(3);
01013 ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(3);
01014 break;
01015 default:
01016 ptR_front = trigger_ptscale->getPtScale()->getLowEdge(0);
01017 ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(0);
01018 };
01019
01020 front_pt = trigger_ptscale->getPtScale()->getPacked(ptR_front);
01021 rear_pt = trigger_ptscale->getPtScale()->getPacked(ptR_rear);
01022
01023 }
01024
01025 if(pt_method <= 5){
01026
01027
01028
01029
01030
01031 if (pt_method != 4 && pt_method !=5
01032 && (mode == 2 || mode == 3 || mode == 4) && (eta<3)) mode = 6;
01033 if (pt_method != 4 && pt_method !=5 && (mode == 5)
01034 && (eta<3)) mode = 8;
01035
01036 switch(mode)
01037 {
01038 case 2:
01039 case 3:
01040 case 4:
01041 case 5:
01042 type = mode - 1;
01043 charge12 = 1;
01044 absPhi12 = address.delta_phi_12;
01045 absPhi23 = address.delta_phi_23;
01046
01047 if(charge) charge23 = 1;
01048 else charge23 = -1;
01049
01050
01051
01052 if(pt_method == 4 || pt_method == 5)
01053 {
01054 dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
01055 dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
01056 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
01057
01058 ptR_front = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 1, int(pt_method));
01059 ptR_rear = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 0, int(pt_method));
01060
01061 if(pt_method == 5 && mode != 5 && etaR > 2.1)
01062 {
01063 float dphi12Rmin = dphi12R - Pi*10/180/3;
01064 float dphi12Rmax = dphi12R + Pi*10/180/3;
01065 float dphi23Rmin = dphi23R;
01066 float dphi23Rmax = dphi23R;
01067 if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
01068 if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
01069 float ptR_front_min = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmin, dphi23Rmin, 1, int(pt_method));
01070 float ptR_rear_min = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmin, dphi23Rmin, 0, int(pt_method));
01071 float ptR_front_max = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmax, dphi23Rmax, 1, int(pt_method));
01072 float ptR_rear_max = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmax, dphi23Rmax, 0, int(pt_method));
01073
01074 ptR_front = std::max(ptR_front, ptR_front_min);
01075 ptR_front = std::max(ptR_front, ptR_front_max);
01076 ptR_rear = std::max(ptR_rear, ptR_rear_min);
01077 ptR_rear = std::max(ptR_rear, ptR_rear_max);
01078 }
01079 }
01080 else if(pt_method == 1)
01081 {
01082 dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
01083 dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
01084 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
01085
01086 ptR_front = ptMethods.Pt3Stn(type, etaR, dphi12R, dphi23R, 1);
01087 ptR_rear = ptMethods.Pt3Stn(type, etaR, dphi12R, dphi23R, 0);
01088
01089 }
01090 else if(pt_method == 2)
01091 {
01092 if(type <= 2)
01093 {
01094 ptR_front = ptMethods.Pt3StnChiSq(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 1);
01095 ptR_rear = ptMethods.Pt3StnChiSq(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 0);
01096 }
01097 else
01098 {
01099 ptR_front = ptMethods.Pt2StnChiSq(type-2, etaR, absPhi12<<1, 1);
01100 ptR_rear = ptMethods.Pt2StnChiSq(type-2, etaR, absPhi12<<1, 0);
01101 }
01102
01103 }
01104 else
01105 {
01106
01107 if(type <= 2)
01108 {
01109 ptR_front = ptMethods.Pt3StnHybrid(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 1);
01110 ptR_rear = ptMethods.Pt3StnHybrid(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 0);
01111 }
01112 else
01113 {
01114 ptR_front = ptMethods.Pt2StnHybrid(type-2, etaR, absPhi12<<1, 1);
01115 ptR_rear = ptMethods.Pt2StnHybrid(type-2, etaR, absPhi12<<1, 0);
01116 }
01117
01118 }
01119 break;
01120 case 6:
01121 case 7:
01122 case 8:
01123 case 9:
01124 case 10:
01125 type = mode - 5;
01126
01127 if(charge) absPhi12 = address.delta_phi();
01128 else
01129 {
01130 int temp_phi = address.delta_phi();
01131 absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
01132 }
01133
01134 if(absPhi12 < (1<<9))
01135 {
01136 if(pt_method == 1 || type == 5)
01137 {
01138 dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
01139
01140 ptR_front = ptMethods.Pt2Stn(type, etaR, dphi12R, 1);
01141 ptR_rear = ptMethods.Pt2Stn(type, etaR, dphi12R, 0);
01142
01143 }
01144 else if(pt_method == 2)
01145 {
01146 ptR_front = ptMethods.Pt2StnChiSq(type-1, etaR, absPhi12, 1);
01147 ptR_rear = ptMethods.Pt2StnChiSq(type-1, etaR, absPhi12, 0);
01148 }
01149 else
01150 {
01151 ptR_front = ptMethods.Pt2StnHybrid(type-1, etaR, absPhi12, 1);
01152 ptR_rear = ptMethods.Pt2StnHybrid(type-1, etaR, absPhi12, 0);
01153 }
01154 }
01155 else
01156 {
01157 ptR_front = trigger_ptscale->getPtScale()->getLowEdge(1);
01158 ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(1);
01159 }
01160 if(pt_method == 4 || pt_method == 5)
01161 {
01162 dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
01163
01164
01165 ptR_front = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 1, int(pt_method));
01166 ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0, int(pt_method));
01167 if((pt_method == 5) && etaR > 2.1 && mode != 8 && mode !=9 && mode !=10)
01168 {
01169 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
01170 float ptR_front_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 1, int(pt_method));
01171 float ptR_rear_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 0, int(pt_method));
01172
01173 ptR_front = std::max(ptR_front, ptR_front_min);
01174 ptR_rear = std::max(ptR_rear, ptR_rear_min);
01175 }
01176 }
01177
01178 break;
01179 case 12:
01180 case 14:
01181 type = 2;
01182
01183 if(charge) absPhi12 = address.delta_phi();
01184 else
01185 {
01186 int temp_phi = address.delta_phi();
01187 absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
01188 }
01189 if(absPhi12 < (1<<9))
01190 {
01191 dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
01192 ptR_front = ptMethods.Pt2Stn(type, etaR, dphi12R, 1);
01193 ptR_rear = ptMethods.Pt2Stn(type, etaR, dphi12R, 0);
01194 }
01195 else
01196 {
01197 ptR_front = trigger_ptscale->getPtScale()->getLowEdge(1);
01198 ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(1);
01199 }
01200 if(pt_method == 4 || pt_method == 5)
01201 {
01202 dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
01203
01204 ptR_front = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 1, int(pt_method));
01205 ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0, int(pt_method));
01206
01207 if(fabs(dphi12R)<0.01 && (ptR_rear < 10 || ptR_front < 10))
01208 std::cout << "dphi12R = " << dphi12R << " ptR_rear = " << ptR_rear
01209 << " ptR_front = " << ptR_front << " etaR = " << etaR << " mode = " << mode << std::endl;
01210 }
01211 break;
01212 case 13:
01213 type = 4;
01214
01215 if(charge) absPhi12 = address.delta_phi();
01216 else
01217 {
01218 int temp_phi = address.delta_phi();
01219 absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
01220 }
01221 if(absPhi12 < (1<<9))
01222 {
01223 dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
01224 ptR_front = ptMethods.Pt2Stn(type, etaR, dphi12R, 1);
01225 ptR_rear = ptMethods.Pt2Stn(type, etaR, dphi12R, 0);
01226 }
01227 else
01228 {
01229 ptR_front = trigger_ptscale->getPtScale()->getLowEdge(1);
01230 ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(1);
01231 }
01232
01233 if(pt_method == 4 || pt_method == 5)
01234 {
01235 dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
01236
01237 ptR_front = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 1, int(pt_method));
01238 ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0, int(pt_method));
01239 if((pt_method == 5) && etaR > 2.1)
01240 {
01241 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
01242 float ptR_front_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 1, int(pt_method));
01243 float ptR_rear_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 0, int(pt_method));
01244
01245 ptR_front = std::max(ptR_front, ptR_front_min);
01246 ptR_rear = std::max(ptR_rear, ptR_rear_min);
01247 }
01248 }
01249
01250 break;
01251 case 11:
01252
01253 ptR_front = trigger_ptscale->getPtScale()->getLowEdge(5);
01254 ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(5);
01255
01256
01257 break;
01258 case 15:
01259
01260 ptR_front = trigger_ptscale->getPtScale()->getLowEdge(5);
01261 ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(5);
01262 break;
01263 case 1:
01264
01265 ptR_front = trigger_ptscale->getPtScale()->getLowEdge(5);
01266 ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(5);
01267 break;
01268 default:
01269 ptR_front = trigger_ptscale->getPtScale()->getLowEdge(0);
01270 ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(0);
01271 };
01272
01273 front_pt = trigger_ptscale->getPtScale()->getPacked(ptR_front);
01274 rear_pt = trigger_ptscale->getPtScale()->getPacked(ptR_rear);
01275
01276
01277 if(pt_method != 4 && pt_method != 5)
01278 {
01279 if ((front_pt==0 || front_pt==1) && (eta<3) && quality==1 && pt_method != 2) front_pt = 31;
01280 if ((rear_pt==0 || rear_pt==1) && (eta<3) && quality==1 && pt_method != 2) rear_pt = 31;
01281 }
01282 if(pt_method != 2 && pt_method != 4 && quality == 1)
01283 {
01284 if (front_pt < 5) front_pt = 5;
01285 if (rear_pt < 5) rear_pt = 5;
01286 }
01287
01288
01289 if(isBeamStartConf && pt_method != 2 && pt_method != 4 && pt_method !=5) {
01290 if(quality == 3 && mode == 5) {
01291
01292 if (front_pt < 5) front_pt = 5;
01293 if (rear_pt < 5) rear_pt = 5;
01294 }
01295
01296 if(quality == 2 && mode > 7 && mode < 11) {
01297
01298 if (front_pt < 5) front_pt = 5;
01299 if (rear_pt < 5) rear_pt = 5;
01300 }
01301 }
01302
01303 }
01304
01305
01306
01307 result.front_rank = front_pt | front_quality << 5;
01308 result.rear_rank = rear_pt | rear_quality << 5;
01309
01310 result.charge_valid_front = 1;
01311 result.charge_valid_rear = 1;
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322
01323 return result;
01324 }
01325
01326
01327 unsigned CSCTFPtLUT::trackQuality(const unsigned& eta, const unsigned& mode, const unsigned& fr) const
01328 {
01329
01330 if (eta>15 || mode>15)
01331 {
01332
01333 edm::LogError("CSCTFPtLUT::trackQuality()")<<"Eta or Mode out of range in AU quality assignment";
01334 return 0;
01335 }
01336 unsigned int quality;
01337 switch (mode) {
01338 case 2:
01339 quality = 3;
01340 if(pt_method > 10 && eta < 3) quality = 1;
01341 if(pt_method == 32 && eta >= 12) quality = 2;
01342 break;
01343 case 3:
01344 case 4:
01346
01347 quality = 3;
01348 if(pt_method == 32 && eta >= 12) quality = 2;
01349 break;
01350 case 5:
01351 quality = 1;
01352 if (isBeamStartConf && eta >= 12 && pt_method < 20)
01353 quality = 3;
01354 if(pt_method == 27 || pt_method == 28 || pt_method == 29 || pt_method == 32 || pt_method == 30 || pt_method == 33) quality = 3;
01355 break;
01356 case 6:
01357 if (eta>=3)
01358 quality = 2;
01359 else
01360 quality = 1;
01361 if(pt_method == 32 && eta >= 12) quality = 1;
01362 break;
01363 case 7:
01364 quality = 2;
01365 if(pt_method > 10 && eta < 3) quality = 1;
01366 if(pt_method == 32 && eta >= 12) quality = 1;
01367 break;
01368 case 8:
01369 case 9:
01370 case 10:
01371 quality = 1;
01372 if (isBeamStartConf && eta >= 12 && pt_method < 20)
01373 quality = 2;
01374 if((pt_method == 27 || pt_method == 28 || pt_method == 30) && (eta >= 7 && eta < 9)) quality = 2;
01375 break;
01376 case 11:
01377
01378 quality = 1;
01379
01380 if(pt_method > 10 && fr == 0) quality = 2;
01381 if(pt_method > 10 && fr == 1) quality = 3;
01382 if(pt_method > 20 && fr == 0) quality = 3;
01383 break;
01384 case 12:
01385 quality = 3;
01386
01387 if(pt_method > 10 && fr == 0) quality = 2;
01388 if(pt_method > 10 && fr == 1) quality = 3;
01389 if(pt_method > 20 && fr == 0) quality = 3;
01390 break;
01391 case 13:
01392 quality = 2;
01393 if(pt_method == 32 && eta >= 12) quality = 1;
01394 break;
01395 case 14:
01396 quality = 2;
01397
01398 if(pt_method > 10 && fr == 0) quality = 2;
01399 if(pt_method > 10 && fr == 1) quality = 3;
01400 if(pt_method > 20 && fr == 0) quality = 3;
01401 break;
01402 case 15:
01403
01404 quality = 1;
01405 break;
01406
01407 case 1:
01408 quality = 1;
01409 break;
01410 default:
01411 quality = 0;
01412 break;
01413 }
01414
01415
01416
01417
01418
01419 if ( (quality == 1) && (eta >= 4) && (eta < 11)
01420 && ((lowQualityFlag&4)==0) ) quality = 0;
01421 if ( (quality == 1) && (eta < 4) && ((lowQualityFlag&1)==0)
01422 && ((lowQualityFlag&4)==0) ) quality = 0;
01423 if ( (quality == 1) && (eta >=11) && ((lowQualityFlag&2)==0)
01424 && ((lowQualityFlag&4)==0) ) quality = 0;
01425
01426 return quality;
01427
01428 }
01429
01430 void CSCTFPtLUT::readLUT()
01431 {
01432 std::ifstream PtLUT;
01433
01434 if(isBinary)
01435 {
01436 PtLUT.open(pt_lut_file.fullPath().c_str(), std::ios::binary);
01437 PtLUT.seekg(0, std::ios::end);
01438 int length = PtLUT.tellg();;
01439 if( length == (1<<CSCBitWidths::kPtAddressWidth)*sizeof(short) )
01440 {
01441 PtLUT.seekg(0, std::ios::beg);
01442 PtLUT.read(reinterpret_cast<char*>(pt_lut),length);
01443 }
01444 else
01445 {
01446 edm::LogError("CSCPtLUT") << "File " << pt_lut_file.fullPath() << " is incorrect size!\n";
01447 }
01448 PtLUT.close();
01449 }
01450 else
01451 {
01452 PtLUT.open(pt_lut_file.fullPath().c_str());
01453 unsigned i = 0;
01454 unsigned short temp = 0;
01455 while(!PtLUT.eof() && i < 1 << CSCBitWidths::kPtAddressWidth)
01456 {
01457 PtLUT >> temp;
01458 pt_lut[i++] = (*reinterpret_cast<ptdat*>(&temp));
01459 }
01460 PtLUT.close();
01461 }
01462 }
01463
01464