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