Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:37:03

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), m_phiRPCDigis(inphiRPCDigis) {}
0024 
0025 void DTLowQMatching::run(const L1TTwinMuxParams& tmParams) {
0026   m_DphiWindow = tmParams.get_DphiWindowBxShift();
0027 
0028   Matching(0);
0029   Matching(1);
0030 }
0031 
0032 void DTLowQMatching::Matching(int track_seg) {
0033   L1MuDTChambPhDigi* dtts = nullptr;
0034   L1MuDTChambPhDigi* rpcts1 = nullptr;
0035   L1MuTMChambPhContainer m_phiRPCDigis_tm;
0036   const std::vector<L1MuDTChambPhDigi>* phiChambVector;
0037   phiChambVector = m_phiRPCDigis.getContainer();
0038   m_phiRPCDigis_tm.setContainer(*phiChambVector);
0039 
0040   L1MuTMChambPhContainer m_phiDTDigis_tm;
0041   const std::vector<L1MuDTChambPhDigi>* phiChambVectorDT;
0042   phiChambVectorDT = m_phiDTDigis->getContainer();
0043   m_phiDTDigis_tm.setContainer(*phiChambVectorDT);
0044 
0045   int bx = 0, wheel = 0, sector = 0, station = 1;
0046   //cout<<"LowQ Matching  "<<track_seg<<endl;
0047   for (wheel = -2; wheel <= 2; wheel++) {
0048     for (sector = 0; sector < 12; sector++) {
0049       for (station = 1; station <= 4; station++) {
0050         for (bx = -3; bx <= 3; bx++) {
0051           int matched = 0;
0052           for (int rpcbx = bx - 1; rpcbx <= bx + 1; rpcbx++) {
0053             dtts = nullptr;
0054             rpcts1 = nullptr;
0055             dtts = m_phiDTDigis_tm.chPhiSegm(wheel, station, sector, bx, track_seg);
0056             if (!dtts || dtts->code() >= 2)
0057               continue;
0058             int nhits = 0;
0059             nhits = DTRPCBxCorrection::nRPCHits(m_phiRPCDigis, rpcbx, wheel, sector, station);
0060             for (int hit = 0; hit < nhits; hit++) {
0061               rpcts1 = m_phiRPCDigis_tm.chPhiSegm(wheel, station, sector, rpcbx, hit);
0062               //If DT primitives with q<2 match with rpc hits do nothing else
0063               //'remove' the primitive by setting is quality to 7
0064               if (rpcts1 && DTRPCBxCorrection::deltaPhi(dtts->phi(), rpcts1->phi()) < m_DphiWindow) {
0065                 matched++;
0066                 continue;
0067               }
0068             }
0069           }  //end of rpc bx
0070           if (matched == 0 && dtts && dtts->code() < 2) {  //dtts->setCode(7);
0071             // int bx=dtts->bxNum(); cout<<bx<<endl;
0072             L1MuDTChambPhDigi dtts2(dtts->bxNum(),
0073                                     dtts->whNum(),
0074                                     dtts->scNum(),
0075                                     dtts->stNum(),
0076                                     dtts->phi(),
0077                                     dtts->phiB(),
0078                                     7,
0079                                     dtts->Ts2Tag(),
0080                                     dtts->BxCnt(),
0081                                     dtts->RpcBit());
0082             *dtts = dtts2;
0083           }
0084         }  //end of dt bx
0085       }  //end of station
0086     }  //end of sc
0087   }  //end of wheel
0088 }