CMS 3D CMS Logo

MuonStubMakerBase.cc
Go to the documentation of this file.
3 
11 
12 #include <iostream>
13 #include <iterator>
14 #include <utility>
15 
18  event.getByToken(inputTokenDtPh, dtPhDigis);
19  event.getByToken(inputTokenDtTh, dtThDigis);
20 }
21 
23  unsigned int iProcessor,
24  l1t::tftype procTyp,
25  int bxFrom,
26  int bxTo,
27  std::vector<std::unique_ptr<IOMTFEmulationObserver> >& observers) {
28  for (const auto& digiIt : *dtPhDigis->getContainer()) {
29  DTChamberId detid(digiIt.whNum(), digiIt.stNum(), digiIt.scNum() + 1);
30 
32  if (!acceptDigi(detid, iProcessor, procTyp))
33  continue;
34 
35  if (digiIt.bxNum() >= bxFrom && digiIt.bxNum() <= bxTo)
36  addDTphiDigi(muonStubsInLayers, digiIt, dtThDigis.product(), iProcessor, procTyp);
37  }
38 
39  if (!mergePhiAndTheta) {
40  for (auto& thetaDigi : (*(dtThDigis->getContainer()))) {
41  if (thetaDigi.bxNum() >= bxFrom && thetaDigi.bxNum() <= bxTo) {
42  addDTetaStubs(muonStubsInLayers, thetaDigi, iProcessor, procTyp);
43  }
44  }
45  }
46  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" iProcessor "<<iProcessor<<std::endl;
47 }
50 
52  unsigned int iProcessor,
53  l1t::tftype procTyp,
54  int bxFrom,
55  int bxTo,
56  std::vector<std::unique_ptr<IOMTFEmulationObserver> >& observers) {
57  auto chamber = cscDigis->begin();
58  auto chend = cscDigis->end();
59  for (; chamber != chend; ++chamber) {
60  unsigned int rawid = (*chamber).first;
62  CSCDetId csc(rawid);
63  if (!acceptDigi(csc, iProcessor, procTyp))
64  continue;
65 
66  auto digi = (*chamber).second.first;
67  auto dend = (*chamber).second.second;
68  for (; digi != dend; ++digi) {
70  int digiBx = digi->getBX() - config->cscLctCentralBx();
71 
72  if (digiBx >= bxFrom && digiBx <= bxTo)
73  addCSCstubs(muonStubsInLayers, rawid, *digi, iProcessor, procTyp);
74  }
75  }
76 }
77 
79  unsigned int iProcessor,
80  l1t::tftype procTyp,
81  int bxFrom,
82  int bxTo,
83  std::vector<std::unique_ptr<IOMTFEmulationObserver> >& observers) {
84  //LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << ":" << __LINE__ <<" RPC HITS, processor : " << iProcessor<<" "<<std::endl;
85 
86  const RPCDigiCollection& rpcDigiCollection = *rpcDigis;
87  for (auto rollDigis : rpcDigiCollection) {
88  RPCDetId roll = rollDigis.first;
89 
90  //debug
91  //if(roll.region() != 0 && abs(roll.station()) >= 3 && roll.ring() == 1 )
92  /* {
93  //iRPC
94  for (auto pDigi=rollDigis.second.first; pDigi != rollDigis.second.second; pDigi++) {
95  LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" roll "<<roll
96  <<" strip "<<pDigi->strip()
97  <<" hasX "<<pDigi->hasX()<<" coordinateX "<<pDigi->coordinateX()<<" hasY "<<pDigi->hasY()<<" coordinateY "<<pDigi->coordinateY()
98  <<" bx "<<pDigi->bx()<<" time "<<pDigi->time()<<" irpc"<<std::endl;
99  }
100  //continue;
101  }*/
102 
103  //LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << ":" << __LINE__ <<" roll "<<roll<<" "<<std::endl;
104 
105  if (!acceptDigi(roll, iProcessor, procTyp))
106  continue;
107 
109  // for (auto tdigi = rollDigis.second.first; tdigi != rollDigis.second.second; tdigi++) { std::cout << "RPC DIGIS: " << roll.rawId()<< " "<<roll<<" digi: " << tdigi->strip() <<" bx: " << tdigi->bx() << std::endl; }
110  std::vector<RPCDigi> digisCopy;
111 
112  for (auto pDigi = rollDigis.second.first; pDigi != rollDigis.second.second; pDigi++) {
113  if (pDigi->bx() >= bxFrom && pDigi->bx() <= bxTo) {
114  digisCopy.push_back(*pDigi);
115  }
116  }
117 
118  std::vector<RpcCluster> clusters = rpcClusterization->getClusters(roll, digisCopy);
119 
120  for (auto& cluster : clusters) {
121  addRPCstub(muonStubsInLayers, roll, cluster, iProcessor, procTyp);
122  }
123  }
124 
125  //removing the RPC stubs that were mark as dropped in the RpcDigiToStubsConverterOmtf::addRPCstub
126  //10 is the first RPC layer
127  for (unsigned int iLayer = 10; iLayer < muonStubsInLayers.size(); iLayer++) {
128  for (unsigned int iInput = 0; iInput < muonStubsInLayers[iLayer].size(); iInput++) {
129  if (muonStubsInLayers[iLayer][iInput] && muonStubsInLayers[iLayer][iInput]->type == MuonStub::RPC_DROPPED) {
130  LogTrace("l1tOmtfEventPrint") << "RpcDigiToStubsConverter::makeStubs "
131  << " iProcessor " << iProcessor << " procTyp " << procTyp
132  << " dropping a stub iLayer " << iLayer << " iInput "
133  << *(muonStubsInLayers[iLayer][iInput]) << std::endl;
134  muonStubsInLayers[iLayer][iInput].reset();
135  }
136  }
137  }
138 }
139 
142 MuonStubMakerBase::MuonStubMakerBase(const ProcConfigurationBase* procConf) : config(procConf), rpcClusterization() {}
143 
147  const edm::EventSetup& es,
148  const MuonGeometryTokens& muonGeometryTokens) {
150  config->getRpcMaxClusterSize(), config->getRpcMaxClusterCnt(), config->getRpcDropAllClustersIfMoreThanMax());
151 }
157 
159  for (auto& digiToStubsConverter : digiToStubsConverters)
160  digiToStubsConverter->loadDigis(event);
161 }
162 
164  unsigned int iProcessor,
165  l1t::tftype procTyp,
166  int bxFrom,
167  int bxTo,
168  std::vector<std::unique_ptr<IOMTFEmulationObserver> >& observers) {
169  //LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << ":" << __LINE__ << " iProcessor " << iProcessor << " preocType "
170  // << procTyp << std::endl;
171 
172  for (auto& digiToStubsConverter : digiToStubsConverters)
173  digiToStubsConverter->makeStubs(muonStubsInLayers, iProcessor, procTyp, bxFrom, bxTo, observers);
174 }
virtual bool acceptDigi(const CSCDetId &cscDetId, unsigned int iProcessor, l1t::tftype procType)
void buildInputForProcessor(MuonStubPtrs2D &muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo, std::vector< std::unique_ptr< IOMTFEmulationObserver > > &observers)
Method translating trigger digis into input matrix with global phi coordinates, fills the muonStubsIn...
virtual void addCSCstubs(MuonStubPtrs2D &muonStubsInLayers, unsigned int rawid, const CSCCorrelatedLCTDigi &digi, unsigned int iProcessor, l1t::tftype procTyp)=0
void loadDigis(const edm::Event &event) override
void makeStubs(MuonStubPtrs2D &muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo, std::vector< std::unique_ptr< IOMTFEmulationObserver > > &observers) override
void makeStubs(MuonStubPtrs2D &muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo, std::vector< std::unique_ptr< IOMTFEmulationObserver > > &observers) override
T const * product() const
Definition: Handle.h:70
virtual bool acceptDigi(const RPCDetId &rpcDetId, unsigned int iProcessor, l1t::tftype procType)
edm::Handle< L1MuDTChambThContainer > dtThDigis
Definition: config.py:1
void loadAndFilterDigis(const edm::Event &event)
std::vector< MuonStubPtrs1D > MuonStubPtrs2D
Definition: MuonStub.h:69
MuonStubMakerBase(const ProcConfigurationBase *procConf)
#define LogTrace(id)
The_Container const * getContainer() const
virtual void addDTphiDigi(MuonStubPtrs2D &muonStubsInLayers, const L1MuDTChambPhDigi &digi, const L1MuDTChambThContainer *dtThDigis, unsigned int iProcessor, l1t::tftype procTyp)=0
edm::EDGetTokenT< L1MuDTChambPhContainer > inputTokenDtPh
const RpcClusterization * rpcClusterization
edm::EDGetTokenT< L1MuDTChambThContainer > inputTokenDtTh
edm::Handle< RPCDigiCollection > rpcDigis
virtual void initialize(const edm::ParameterSet &edmCfg, const edm::EventSetup &es, const MuonGeometryTokens &muonGeometryTokens)
void makeStubs(MuonStubPtrs2D &muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo, std::vector< std::unique_ptr< IOMTFEmulationObserver > > &observers) override
Definition: L1Track.h:19
virtual void addDTetaStubs(MuonStubPtrs2D &muonStubsInLayers, const L1MuDTChambThDigi &thetaDigi, unsigned int iProcessor, l1t::tftype procTyp)=0
std::vector< std::unique_ptr< DigiToStubsConverterBase > > digiToStubsConverters
Phi_Container const * getContainer() const
virtual void addRPCstub(MuonStubPtrs2D &muonStubsInLayers, const RPCDetId &roll, const RpcCluster &cluster, unsigned int iProcessor, l1t::tftype procTyp)=0
virtual std::vector< RpcCluster > getClusters(const RPCDetId &roll, std::vector< RPCDigi > &digis) const
N.B. digis are sorted inside the function.
virtual bool acceptDigi(const DTChamberId &dTChamberId, unsigned int iProcessor, l1t::tftype procType)
edm::Handle< L1MuDTChambPhContainer > dtPhDigis
RpcClusterization rpcClusterization
edm::Handle< CSCCorrelatedLCTDigiCollection > cscDigis
void configure(int maxClusterSize, int maxClusterCnt, bool dropAllClustersIfMoreThanMax)
Definition: event.py:1