Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-28 03:10:06

0001 //-------------------------------------------------
0002 //
0003 //   Class: DTLowQMatching
0004 //
0005 //   DTLowQMatching
0006 //
0007 //
0008 //   Author :
0009 //   G. Flouris               U Ioannina    Nov. 2016
0010 //   modifications: GKarathanasis  UAthens
0011 //--------------------------------------------------
0012 #include <iostream>
0013 #include <iomanip>
0014 #include <iterator>
0015 
0016 #include "L1Trigger/L1TTwinMux/interface/DTLowQMatching.h"
0017 #include "L1Trigger/L1TTwinMux/interface/DTRPCBxCorrection.h"
0018 #include "L1Trigger/L1TTwinMux/interface/L1MuTMChambPhContainer.h"
0019 
0020 using namespace std;
0021 
0022 DTLowQMatching::DTLowQMatching(L1MuDTChambPhContainer const* inphiDTDigis, L1MuDTChambPhContainer const& inphiRPCDigis)
0023     : m_phiDTDigis(inphiDTDigis),
0024       m_phiRPCDigis(inphiRPCDigis){
0025           // m_phiDTDigis=inphiDTDigis;
0026           // m_phiRPCDigis=inphiRPCDigis;
0027       };
0028 
0029 void DTLowQMatching::run(const L1TTwinMuxParams& tmParams) {
0030   m_DphiWindow = tmParams.get_DphiWindowBxShift();
0031 
0032   Matching(0);
0033   Matching(1);
0034 }
0035 
0036 void DTLowQMatching::Matching(int track_seg) {
0037   L1MuDTChambPhDigi* dtts = nullptr;
0038   L1MuDTChambPhDigi* rpcts1 = nullptr;
0039   L1MuTMChambPhContainer m_phiRPCDigis_tm;
0040   const std::vector<L1MuDTChambPhDigi>* phiChambVector;
0041   phiChambVector = m_phiRPCDigis.getContainer();
0042   m_phiRPCDigis_tm.setContainer(*phiChambVector);
0043 
0044   L1MuTMChambPhContainer m_phiDTDigis_tm;
0045   const std::vector<L1MuDTChambPhDigi>* phiChambVectorDT;
0046   phiChambVectorDT = m_phiDTDigis->getContainer();
0047   m_phiDTDigis_tm.setContainer(*phiChambVectorDT);
0048 
0049   int bx = 0, wheel = 0, sector = 0, station = 1;
0050   //cout<<"LowQ Matching  "<<track_seg<<endl;
0051   for (wheel = -2; wheel <= 2; wheel++) {
0052     for (sector = 0; sector < 12; sector++) {
0053       for (station = 1; station <= 4; station++) {
0054         for (bx = -3; bx <= 3; bx++) {
0055           int matched = 0;
0056           for (int rpcbx = bx - 1; rpcbx <= bx + 1; rpcbx++) {
0057             dtts = nullptr;
0058             rpcts1 = nullptr;
0059             dtts = m_phiDTDigis_tm.chPhiSegm(wheel, station, sector, bx, track_seg);
0060             if (!dtts || dtts->code() >= 2)
0061               continue;
0062             int nhits = 0;
0063             nhits = DTRPCBxCorrection::nRPCHits(m_phiRPCDigis, rpcbx, wheel, sector, station);
0064             for (int hit = 0; hit < nhits; hit++) {
0065               rpcts1 = m_phiRPCDigis_tm.chPhiSegm(wheel, station, sector, rpcbx, hit);
0066               //If DT primitives with q<2 match with rpc hits do nothing else
0067               //'remove' the primitive by setting is quality to 7
0068               if (rpcts1 && DTRPCBxCorrection::deltaPhi(dtts->phi(), rpcts1->phi()) < m_DphiWindow) {
0069                 matched++;
0070                 continue;
0071               }
0072             }
0073           }                                                //end of rpc bx
0074           if (matched == 0 && dtts && dtts->code() < 2) {  //dtts->setCode(7);
0075             // int bx=dtts->bxNum(); cout<<bx<<endl;
0076             L1MuDTChambPhDigi dtts2(dtts->bxNum(),
0077                                     dtts->whNum(),
0078                                     dtts->scNum(),
0079                                     dtts->stNum(),
0080                                     dtts->phi(),
0081                                     dtts->phiB(),
0082                                     7,
0083                                     dtts->Ts2Tag(),
0084                                     dtts->BxCnt(),
0085                                     dtts->RpcBit());
0086             *dtts = dtts2;
0087           }
0088         }  //end of dt bx
0089       }    //end of station
0090     }      //end of sc
0091   }        //end of wheel
0092 }