Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 //-------------------------------------------------
0002 //
0003 //   Class: AlignTrackSegments
0004 //
0005 //   AlignTrackSegments
0006 //
0007 //
0008 //   Author :
0009 //   G. Flouris               U Ioannina    Mar. 2015
0010 //modifications:              GKarathanasis U Athens
0011 //--------------------------------------------------
0012 #include <iostream>
0013 #include <iomanip>
0014 #include <iterator>
0015 #include <memory>
0016 #include "L1Trigger/L1TTwinMux/interface/AlignTrackSegments.h"
0017 
0018 using namespace std;
0019 
0020 AlignTrackSegments::AlignTrackSegments(L1MuDTChambPhContainer inm_phiDigis)
0021     : m_phiDigis(inm_phiDigis){
0022           //   m_phiDigis = inm_phiDigis;
0023       };
0024 
0025 void AlignTrackSegments::run() {
0026   std::vector<L1MuDTChambPhDigi> l1ttma_out;
0027 
0028   for (int bx = -3; bx <= 3; bx++) {
0029     for (int wheel = -3; wheel <= 3; wheel++) {
0030       for (int sector = 0; sector < 12; sector++) {
0031         for (int station = 1; station <= 4; station++) {
0032           ///chPhiSegm1 reads the first ts from bx
0033           L1MuDTChambPhDigi const* ts1 = m_phiDigis.chPhiSegm1(wheel, station, sector, bx);
0034           ///chPhiSegm2 reads the second ts from bx-1
0035           L1MuDTChambPhDigi const* ts2 = m_phiDigis.chPhiSegm2(wheel, station, sector, bx);
0036           ///Code = 7 NULL primitive
0037           if (ts1 != nullptr && ts1->code() != 7) {
0038             l1ttma_out.emplace_back(bx,
0039                                     ts1->whNum(),
0040                                     ts1->scNum(),
0041                                     ts1->stNum(),
0042                                     ts1->phi(),
0043                                     ts1->phiB(),
0044                                     ts1->code(),
0045                                     ts1->Ts2Tag(),
0046                                     ts1->BxCnt(),
0047                                     0);
0048           }
0049           if ((ts1 == nullptr || ts1->code() == 7) && ts2 && ts2->code() != 7) {
0050             l1ttma_out.emplace_back(ts2->bxNum(),
0051                                     ts2->whNum(),
0052                                     ts2->scNum(),
0053                                     ts2->stNum(),
0054                                     ts2->phi(),
0055                                     ts2->phiB(),
0056                                     ts2->code(),
0057                                     ts2->Ts2Tag(),
0058                                     ts2->BxCnt(),
0059                                     0);
0060           }
0061           ///if the second ts (bx-1) co-exist with ts1 shift it to the correct bx
0062           if (ts1 != nullptr && ts1->code() != 7 && ts2 && ts2->code() != 7) {
0063             l1ttma_out.emplace_back(ts2->bxNum() - ts2->Ts2Tag(),
0064                                     ts2->whNum(),
0065                                     ts2->scNum(),
0066                                     ts2->stNum(),
0067                                     ts2->phi(),
0068                                     ts2->phiB(),
0069                                     ts2->code(),
0070                                     ts2->Ts2Tag(),
0071                                     ts2->BxCnt(),
0072                                     0);
0073           }
0074         }
0075       }
0076     }
0077   }
0078 
0079   m_dt_tsshifted.setContainer(l1ttma_out);
0080 }