CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DataFormats/L1CSCTrackFinder/src/L1TrackId.cc

Go to the documentation of this file.
00001 #include <DataFormats/L1CSCTrackFinder/interface/L1TrackId.h>
00002 
00003 namespace csc
00004 {
00005   L1TrackId::L1TrackId()
00006   {}
00007 
00008   L1TrackId::L1TrackId(const unsigned& side, const unsigned& sector)
00009   {    
00011     id_ = CSCDetId(side, 2, 1, 
00012                    CSCTriggerNumbering::chamberFromTriggerLabels(sector, 0, 2, 1),
00013                    0);
00014                    
00015   }
00016 
00017   L1TrackId::L1TrackId(const csc::L1TrackId& id)
00018   {
00019     m_rank = id.m_rank;
00020     m_mode = id.m_mode;
00021     m_erase = id.m_erase;
00022     m_overlap = id.m_overlap;
00023     id_ = id.id_;
00024     //stubs = id.stubs;  // add stubs back later
00025   }
00026 
00027   const csc::L1TrackId& L1TrackId::operator=(const csc::L1TrackId& rhs)
00028   {
00029     if(&rhs != this)
00030       {
00031         m_rank = rhs.m_rank;
00032         m_mode = rhs.m_mode;
00033         m_erase = rhs.m_erase;
00034         m_overlap = rhs.m_overlap;
00035         id_ = rhs.id_;
00036         //stubs = rhs.stubs;
00037       }
00038     return *this;
00039   }
00040 
00041   bool L1TrackId::sharesHit(const csc::L1TrackId& a_id) const
00042   {
00043     return false; // finish later
00044   }
00045 
00046   void L1TrackId::setOverlap(const unsigned& rank)
00047   {
00048     if (  (rank == 7)  || (rank == 8)  || 
00049           (rank == 9)  || (rank == 12) || (rank == 15)  ||
00050           (rank == 19) || (rank == 20) || 
00051           (rank == 24) || (rank == 25) || 
00052           (rank == 29) || (rank == 30) || 
00053           (rank == 32) || (rank == 34) || (rank == 36) ) {
00054       m_overlap = true;
00055     }
00056     else m_overlap = false;
00057   }
00058 
00059   void L1TrackId::setRank(const unsigned& rank)
00060   {
00061     if (rank<(1<<kRankBitWidth)) // rank >= 0, since rank is unsigned
00062       {
00063         m_rank = rank;
00064         setOverlap(rank);
00065       }
00066     else 
00067       {
00068         m_rank = 0;
00069       }
00070   }
00071 
00072 
00073   // Helper function to determine which 2 segments from overlap region
00074   // track participate in 2-stn Pt assignment, and what mode to use,
00075   // based on track rank
00076   // four modes in this order: B1-E1, B1-E2, B2-E1, B2-E2
00077   // Let's include only mode 2, 4 tracks (7-27-00)
00078   void L1TrackId::overlapMode(const unsigned& rank, int& mode, int& stnA, int& stnB)
00079   {
00080     switch (rank) 
00081       {
00082       case 7:
00083         stnA = 2; stnB = 1;
00084         mode = 4;
00085         break;
00086       case 8:
00087         stnA = 3; stnB = 2;
00088         mode = 4;
00089         break;
00090       case 9:
00091         stnA = 2; stnB = 1;
00092         mode = 2;
00093         break;
00094       case 12:
00095         stnA = 2; stnB = 1;
00096         mode = 2;
00097         break;
00098       case 15:
00099         stnA = 2; stnB = 1;
00100         mode = 2;
00101         break;
00102       case 19:
00103         stnA = 3; stnB = 2;
00104         mode = 2;
00105         break;
00106       case 20:
00107         stnA = 2; stnB = 1;
00108         mode = 2;
00109         break;
00110       case 24:
00111         stnA = 3; stnB = 2;
00112         mode = 2;
00113         break;
00114       case 25:
00115         stnA = 2; stnB = 1;
00116         mode = 2;
00117         break;
00118       case 29:
00119         stnA = 3; stnB = 2;
00120         mode = 2;
00121         break;
00122       case 30:
00123         stnA = 2; stnB = 1;
00124         mode = 2;
00125         break;
00126       case 32:
00127         stnA = 3; stnB = 2;
00128         mode = 2;
00129         break;
00130       case 34:
00131         stnA = 3; stnB = 2;
00132         mode = 2;
00133         break;
00134       case 36:
00135         stnA = 3; stnB = 2;
00136         mode = 2;
00137         break;
00138       default:
00139         // standard case for CSC tracks
00140         stnA = 1; stnB = 2;
00141         mode = 0;
00142       }
00143   }
00144 
00145   unsigned L1TrackId::encodeLUTMode(const unsigned& rank) const
00146   {
00147     int mode;
00148     switch (rank) 
00149       {
00150       case 0:
00151         mode = 0;
00152         break;
00153       case 1:
00154         mode = 10;
00155         break;
00156       case 2:
00157         mode = 9;
00158         break;
00159       case 3:
00160         mode = 8;
00161         break;
00162       case 4:
00163         mode = 5;
00164         break;
00165       case 5:
00166         mode = 7;
00167         break;
00168       case 6:
00169         mode = 6;
00170         break;
00171       case 7:
00172         mode = 15;
00173         break;
00174       case 8:
00175         mode = 13;
00176         break;
00177       case 9:
00178         mode = 14;
00179         break;
00180       case 10:
00181         mode = 7;
00182         break;
00183       case 11:
00184         mode = 6;
00185         break;
00186       case 12:
00187         mode = 14;
00188         break;
00189       case 13:
00190         mode = 7;
00191         break;
00192       case 14:
00193         mode = 6;
00194         break;
00195       case 15:
00196         mode = 14;
00197         break;
00198       case 16:
00199         mode = 4;
00200         break;
00201       case 17:
00202         mode = 3;
00203         break;
00204       case 18:
00205         mode = 2;
00206         break;
00207       case 19:
00208         mode = 12;
00209         break;
00210       case 20:
00211         mode = 11;
00212         break;
00213       case 21:
00214         mode = 4;
00215         break;
00216       case 22:
00217         mode = 3;
00218         break;
00219       case 23:
00220         mode = 2;
00221         break;
00222       case 24:
00223         mode = 12;
00224         break;
00225       case 25:
00226         mode = 11;
00227         break;
00228       case 26:
00229         mode = 4;
00230         break;
00231       case 27:
00232         mode = 3;
00233         break;
00234       case 28:
00235         mode = 2;
00236         break;
00237       case 29:
00238         mode = 12;
00239         break;
00240       case 30:
00241         mode = 11;
00242         break;
00243       case 31:
00244         mode = 2;
00245         break;
00246       case 32:
00247         mode = 11;
00248         break;
00249       case 33:
00250         mode = 2;
00251         break;
00252       case 34:
00253         mode = 11;
00254         break;
00255       case 35:
00256         mode = 2;
00257         break;
00258       case 36:
00259         mode = 11;
00260         break;
00261       default:
00262         mode = 0;
00263       }
00264     return mode;
00265   }
00266 
00267   bool L1TrackId::hasME1(const unsigned& rank) const 
00268   {
00269     bool me = false;
00270     switch (rank) 
00271       {
00272       case 5: 
00273       case 6:
00274       case 10:
00275       case 11:          
00276       case 12:
00277       case 13:
00278       case 14:
00279       case 16:
00280       case 17:
00281       case 18:
00282       case 21:          
00283       case 22:
00284       case 23:
00285       case 26:
00286       case 27:
00287       case 28:
00288       case 31:
00289       case 33:
00290       case 35:
00291         me = true;
00292         break;
00293       default:
00294         me = false;
00295       }
00296     return me;
00297   }
00298 
00299   bool L1TrackId::hasME2(const unsigned& rank) const 
00300   {
00301     bool me = false;
00302     switch (rank) 
00303       {
00304       case 2: 
00305       case 3:
00306       case 4:
00307       case 6:          
00308       case 7:
00309       case 8:
00310       case 9:
00311       case 11:
00312       case 12:
00313       case 14:
00314       case 15:          
00315       case 17:
00316       case 18:
00317       case 19:
00318       case 20:
00319       case 22:
00320       case 23:
00321       case 24:
00322       case 25:
00323       case 27:
00324       case 28:
00325       case 29:
00326       case 30:
00327       case 31:
00328       case 32:
00329       case 33:
00330       case 34:
00331       case 35:
00332       case 36:
00333         me = true;
00334         break;
00335       default:
00336         me = false;
00337       }
00338     return me;
00339   }
00340 
00341   bool L1TrackId::hasME3(const unsigned& rank) const 
00342   {
00343     bool me = false;
00344     switch (rank) 
00345       {
00346       case 1:
00347       case 3:
00348       case 4:
00349       case 5:
00350       case 10:
00351       case 13:
00352       case 16:
00353       case 18:
00354       case 21:
00355       case 23:
00356       case 26:
00357       case 28:
00358       case 31:
00359       case 33:
00360       case 35:
00361         me = true;
00362         break;
00363       default:
00364         me = false;
00365       }
00366     return me;
00367   }
00368 
00369   bool L1TrackId::hasME4(const unsigned& rank) const 
00370   {
00371     bool me = false;
00372     switch (rank) 
00373       {
00374       case 1: 
00375       case 2:
00376       case 4:
00377       case 16:
00378       case 17:
00379       case 21: 
00380       case 22:
00381       case 26:
00382       case 27:
00383       case 31:
00384       case 33:
00385       case 35:
00386         me = true;
00387         break;
00388       default:
00389         me = false;
00390       }
00391     return me;
00392   }
00393   
00394   bool L1TrackId::hasMB1(const unsigned& rank) const 
00395   {
00396     bool mb = false;
00397     switch (rank) 
00398       {
00399       case 9:
00400       case 12:
00401       case 15:
00402       case 19:
00403       case 20:
00404       case 24:
00405       case 25:
00406       case 29:
00407       case 30:
00408       case 32:
00409       case 34:
00410       case 36:
00411         mb = true;
00412         break;
00413       default:
00414         mb = false;
00415       }
00416     return mb;
00417   }
00418 
00419 }