CMS 3D CMS Logo

L1TTwinMuxAlgorithm.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1TwinMuxAlgortithm
4 //
5 // L1TwinMuxAlgortithm
6 //
7 //
8 // Author :
9 // G. Flouris U Ioannina Feb. 2015
10 // modifications: G Karathanasis
11 //--------------------------------------------------
12 
13 #include <iostream>
14 #include <iomanip>
15 #include <iterator>
16 
29 
30 using namespace std;
31 
32 
35 
36 
38  const L1TTwinMuxParamsRcd& tmParamsRcd = c.get<L1TTwinMuxParamsRcd>();
39  tmParamsRcd.get(tmParamsHandle);
40  const L1TTwinMuxParams& tmParams = *tmParamsHandle.product();
41  bool onlyRPC = tmParams.get_UseOnlyRPC();
42  bool onlyDT = tmParams.get_UseOnlyDT();
43  bool useLowQDT = tmParams.get_UseLowQDT();
44  bool correctBX = tmParams.get_CorrectDTBxwRPC();
45  bool verbose = tmParams.get_Verbose();
46 
47 
48 
50  auto alignedDTs=std::make_shared<AlignTrackSegments>(*inphiDigis);
51  alignedDTs->run(c);
52  L1MuDTChambPhContainer phiDigis = alignedDTs->getDTContainer();
53  //if only DTs are required without bx correction
54  //return the aligned track segments
55  if(onlyDT && !correctBX && !useLowQDT) {
56  m_tm_phi_output = phiDigis;
57  return;
58  }
60  auto rpcHitCl=std::make_shared<RPCHitCleaner>(*rpcDigis);
61  rpcHitCl->run(c);
62  RPCDigiCollection rpcDigisCleaned = rpcHitCl->getRPCCollection();
63 
65  auto dt_from_rpc= std::make_shared<RPCtoDTTranslator>(rpcDigisCleaned);
66  dt_from_rpc->run(c);
67  L1MuDTChambPhContainer rpcPhiDigis = dt_from_rpc->getDTContainer(); //Primitves used for RPC->DT (only station 1 and 2)
68  L1MuDTChambPhContainer rpcHitsPhiDigis = dt_from_rpc->getDTRPCHitsContainer(); //Primitves used for bx correction
69 
71  auto dtlowq= std::make_shared<DTLowQMatching>(&phiDigis, rpcHitsPhiDigis);
72  dtlowq->run(c);
73 
74  if(onlyDT && !correctBX && useLowQDT) {
75  m_tm_phi_output = phiDigis;
76  if(verbose){
77  IOPrinter ioPrinter;
78  cout<<"======DT========"<<endl;
79  ioPrinter.run(inphiDigis, m_tm_phi_output, rpcDigis, c);
80  cout<<"======RPC========"<<endl;
81  ioPrinter.run(&rpcHitsPhiDigis, m_tm_phi_output, &rpcDigisCleaned, c);
82  cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
83  }
84 
85  return;
86  }
87 
88 
90 // DTRPCBxCorrection *rpc_dt_bx = new DTRPCBxCorrection(phiDigis,rpcHitsPhiDigis);
91  auto rpc_dt_bx=std::make_shared<DTRPCBxCorrection>(phiDigis,rpcHitsPhiDigis);
92  rpc_dt_bx->run(c);
93 
94  L1MuDTChambPhContainer phiDigiscp = rpc_dt_bx->getDTContainer();
95 
97  std::vector<L1MuDTChambPhDigi> l1ttma_out;
98 
99  int bx=0, wheel=0, sector=0, station=1;
100 
101  for(bx=-3; bx<=3; bx++){
102  for (wheel=-2;wheel<=2; wheel++ ){
103  for (sector=0;sector<12; sector++ ){
104  for (station=1; station<=4; station++){
105 
106  L1MuDTChambPhDigi const* dtts1 = phiDigiscp.chPhiSegm1(wheel,station,sector,bx);
107  L1MuDTChambPhDigi const* dtts2 = phiDigiscp.chPhiSegm2(wheel,station,sector,bx);
108  L1MuDTChambPhDigi const* rpcts1 = rpcPhiDigis.chPhiSegm1(wheel,station,sector,bx);
109 
110  if(!onlyRPC) {
111  if(!dtts1 && !dtts2 && !rpcts1) continue;
112  if(dtts1 && dtts1->code()!=7) {
113  l1ttma_out.push_back(*dtts1);
114  }
115  if(dtts2 && dtts2->code()!=7) {
116  l1ttma_out.push_back(*dtts2);
117  }
118  if(!onlyDT){
119  if(!dtts1 && !dtts2 && rpcts1 && station<=2 ) {
120  l1ttma_out.emplace_back(rpcts1->bxNum() , rpcts1->whNum(), rpcts1->scNum(), rpcts1->stNum(),rpcts1->phi(), rpcts1->phiB(), rpcts1->code(), rpcts1->Ts2Tag(), rpcts1->BxCnt(),2);
121  }
122  }
123  }
124 
125  else if(onlyRPC){
126  if( rpcts1 && station<=2 ) {
127  l1ttma_out.emplace_back(rpcts1->bxNum() , rpcts1->whNum(), rpcts1->scNum(), rpcts1->stNum(),rpcts1->phi(), rpcts1->phiB(), rpcts1->code(), rpcts1->Ts2Tag(), rpcts1->BxCnt(),2);
128  }
129  }
130 
131  }
132  }
133  }
134  }
135 
136 m_tm_phi_output.setContainer(l1ttma_out);
137 
138  if(verbose){
139  IOPrinter ioPrinter;
140  cout<<"======DT========"<<endl;
141  ioPrinter.run(inphiDigis, m_tm_phi_output, rpcDigis, c);
142  cout<<"======RPC========"<<endl;
143  ioPrinter.run(&rpcHitsPhiDigis, m_tm_phi_output, &rpcDigisCleaned, c);
144  cout<<"+++++++++++++++++++++++++++++++++++++++++++++++++"<<endl;
145  }
146 
147 }
int get_Verbose() const
L1MuDTChambPhDigi const * chPhiSegm1(int wheel, int stat, int sect, int bx) const
L1MuDTChambPhDigi const * chPhiSegm2(int wheel, int stat, int sect, int bx) const
void run(edm::Handle< L1MuDTChambPhContainer >, const L1MuDTChambPhContainer &, edm::Handle< RPCDigiCollection >, const edm::EventSetup &)
Definition: IOPrinter.cc:17
void run(edm::Handle< L1MuDTChambPhContainer > phiDigis, edm::Handle< L1MuDTChambThContainer > thetaDigis, edm::Handle< RPCDigiCollection > rpcDigis, const edm::EventSetup &c)
void get(HolderT &iHolder) const
int get_UseLowQDT() const
const T & get() const
Definition: EventSetup.h:55
int get_UseOnlyDT() const
int get_UseOnlyRPC() const
int get_CorrectDTBxwRPC() const