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