Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:48

0001 
0002 #include "CondFormats/L1TObjects/interface/L1MuTriggerScales.h"
0003 #include "CondFormats/DataRecord/interface/L1MuTriggerScalesRcd.h"
0004 #include "CondFormats/DataRecord/interface/L1MuTriggerPtScaleRcd.h"
0005 #include "FWCore/Framework/interface/ESHandle.h"
0006 
0007 #include "L1Trigger/CSCTrackFinder/test/src/TFTrack.h"
0008 #include "iostream"
0009 namespace csctf_analysis
0010 {
0011   TFTrack::TFTrack():Track() {}
0012   TFTrack::TFTrack(const L1MuRegionalCand& track):Track()
0013   {
0014     
0015   const float ptscale[33] = { 
0016     -1.,   0.0,   1.5,   2.0,   2.5,   3.0,   3.5,   4.0,
0017     4.5,   5.0,   6.0,   7.0,   8.0,  10.0,  12.0,  14.0,  
0018     16.0,  18.0,  20.0,  25.0,  30.0,  35.0,  40.0,  45.0, 
0019     50.0,  60.0,  70.0,  80.0,  90.0, 100.0, 120.0, 140.0, 1.E6 };
0020 
0021     Phi = (2.5*( track.phi_packed() ))*(M_PI)/180 + 0.0218;
0022     Eta = 0.9 + 0.05*( track.eta_packed() ) +0.025;
0023     PhiPacked = track.phi_packed();
0024     EtaPacked = track.eta_packed();
0025     PtPacked = track.pt_packed();
0026     Pt = ptscale[PtPacked];
0027     Quality = track.quality_packed();
0028     Bx = track.bx();
0029     Halo = track.finehalo_packed();
0030     ChargePacked = track.charge_packed();
0031     if (ChargePacked==1)
0032         Charge=-1;
0033     else 
0034         Charge=1;
0035     Rank = -1;
0036     Mode = -1;
0037     FR = -1;
0038     LUTAddress = -1;
0039    
0040   }
0041   TFTrack::TFTrack(const L1CSCTrack& track, 
0042         const edm::EventSetup& iSetup ):Track()
0043   {
0044 
0045   const float ptscale[33] = { 
0046     -1.,   0.0,   1.5,   2.0,   2.5,   3.0,   3.5,   4.0,
0047     4.5,   5.0,   6.0,   7.0,   8.0,  10.0,  12.0,  14.0,  
0048     16.0,  18.0,  20.0,  25.0,  30.0,  35.0,  40.0,  45.0, 
0049     50.0,  60.0,  70.0,  80.0,  90.0, 100.0, 120.0, 140.0, 1.E6 };
0050 
0051     //unsigned int endcap = track.first.endcap();//get the encap
0052     unsigned int sector = track.first.sector();// get sector
0053     Rank = track.first.rank();// get rank
0054 
0055     unsigned int quality_packed;
0056     unsigned int rank=Rank;
0057     unsigned int pt_packed;
0058     
0059     track.first.decodeRank(rank,pt_packed,quality_packed); //get the pt and gaulity packed
0060     Quality=quality_packed;
0061     PtPacked=pt_packed;
0062     Pt = ptscale[PtPacked]; 
0063 
0064     edm::ESHandle< L1MuTriggerScales > scales;//get structures for scales (phi and eta
0065     iSetup.get< L1MuTriggerScalesRcd >().get(scales); // get scales from EventSetup
0066 
0067     const L1MuTriggerScales  *ts;// the trigger scales 
0068     ts = scales.product();
0069     
0070     unsigned gbl_phi = track.first.localPhi() + ((sector - 1)*24) + 6;
0071     if(gbl_phi > 143) gbl_phi -= 143;
0072     float phi = ts->getPhiScale()->getLowEdge( gbl_phi&0xff );
0073 
0074     Mode =  track.first.mode();
0075 
0076     // To throw an error if the newer fixed L1Track::mode() isn't implemented
0077     int AddressEta = track.first.addressEta();
0078 
0079     Phi = phi;
0080     PhiPacked = track.first.localPhi();
0081 
0082     unsigned eta_sign = (track.first.endcap() == 1 ? 0 : 1);
0083     Eta = ts->getRegionalEtaScale(2)->
0084     getCenter( ((track.first.eta_packed()) | (eta_sign<<5)) & 0x3f );
0085     EtaPacked = track.first.eta_packed();
0086 
0087     Bx = track.first.bx();
0088     Halo = track.first.finehalo_packed();
0089     ChargePacked = track.first.charge_packed();
0090     if (ChargePacked==1)
0091         Charge=-1;
0092     else 
0093         Charge=1;
0094 
0095     LUTAddress = track.first.ptLUTAddress();
0096     FR = (track.first.ptLUTAddress() >> 21 ) & 0x1;
0097 
0098 /*
0099     Phi = (2.5*( track.phi_packed() ))*(M_PI)/180 + 0.0218;
0100     Eta = 0.9 + 0.05*( track.eta_packed() ) +0.025;
0101     PtPacked = track.pt_packed();
0102     Pt = ptscale[PtPacked];
0103     Quality = track.quality_packed();
0104     Bx = track.bx();
0105     Halo = track.finehalo_packed();
0106     ChargePacked = track.charge_packed();
0107     if (ChargePacked==1)
0108         Charge=-1;
0109     else 
0110         Charge=1;
0111 */
0112 
0113   }
0114   
0115   TFTrack::TFTrack(L1MuGMTExtendedCand track):Track()
0116     {
0117 
0118         
0119         Eta = track.etaValue();
0120         Phi = track.phiValue();
0121         Pt = track.ptValue();
0122         
0123         
0124         isEndcap1 = true;
0125         if(EtaPacked<0){isEndcap1 = false;}
0126         
0127          
0128                 EtaPacked = -1;
0129                 PhiPacked = -1;
0130                 ChargePacked = -1;
0131                 Bx = -1;
0132                 Charge = 0;
0133                 Halo = -1;
0134                 Mode = -1;
0135                 Rank = -1;
0136                 FR = -1;
0137                 LUTAddress = -1;
0138         Quality =track.quality();
0139   
0140     }
0141 
0142 /*  
0143 double TFTrack::distanceTo(RefTrack reftrack)
0144   {
0145     double newR;
0146     newR = (getPt()-reftrack->getPt())*
0147         (getEta()-reftrack->getEta())*
0148         (getPhi()-reftrack->getPhi());
0149     return newR;
0150   }
0151 */
0152 
0153   void TFTrack::print()
0154   {
0155     std::cout << "TFTrack Info" << std::endl;
0156     std::cout << "  Pt: "<< getPt()<< std::endl;
0157     std::cout << "  Phi: "<< getPhi()<< std::endl;
0158     std::cout << "  Eta: "<< getEta()<< std::endl;
0159     std::cout << "  Mode: "<< getMode()<< std::endl;
0160     std::cout << "  EtaPacked: "<< getEtaPacked()<< std::endl;
0161     std::cout << "  PhiPacked: "<< getPhiPacked()<< std::endl;
0162     std::cout << "  PtPacked: "<< getPtPacked()<< std::endl;
0163     std::cout << "  Rank: "<< getRank()<< std::endl;
0164     std::cout << "  FR: "<< getFR()<< std::endl;
0165     std::cout << "  LUTAddress: "<< getLUTAddress()<< std::endl;
0166   }
0167 }