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  MuonStubPtrs2D& muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo) {
24  if (!dtPhDigis)
25  return;
26 
27  for (const auto& digiIt : *dtPhDigis->getContainer()) {
28  DTChamberId detid(digiIt.whNum(), digiIt.stNum(), digiIt.scNum() + 1);
29 
31  if (!acceptDigi(detid, iProcessor, procTyp))
32  continue;
33 
34  if (digiIt.bxNum() >= bxFrom && digiIt.bxNum() <= bxTo)
35  addDTphiDigi(muonStubsInLayers, digiIt, dtThDigis.product(), iProcessor, procTyp);
36  }
37 
38  if (!mergePhiAndTheta) {
39  for (auto& thetaDigi : (*(dtThDigis->getContainer()))) {
40  if (thetaDigi.bxNum() >= bxFrom && thetaDigi.bxNum() <= bxTo) {
41  addDTetaStubs(muonStubsInLayers, thetaDigi, iProcessor, procTyp);
42  }
43  }
44  }
45  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" iProcessor "<<iProcessor<<std::endl;
46 }
49 
51  MuonStubPtrs2D& muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo) {
52  if (!cscDigis)
53  return;
54 
55  auto chamber = cscDigis->begin();
56  auto chend = cscDigis->end();
57  for (; chamber != chend; ++chamber) {
58  unsigned int rawid = (*chamber).first;
60  CSCDetId csc(rawid);
61  if (!acceptDigi(csc, iProcessor, procTyp))
62  continue;
63 
64  auto digi = (*chamber).second.first;
65  auto dend = (*chamber).second.second;
66  for (; digi != dend; ++digi) {
68  int digiBx = digi->getBX() - config->cscLctCentralBx();
69 
70  if (digiBx >= bxFrom && digiBx <= bxTo)
71  addCSCstubs(muonStubsInLayers, rawid, *digi, iProcessor, procTyp);
72  }
73  }
74 }
75 
77  MuonStubPtrs2D& muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo) {
78  if (!rpcDigis)
79  return;
80  //LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << ":" << __LINE__ <<" RPC HITS, processor : " << iProcessor<<" "<<std::endl;
81 
82  const RPCDigiCollection& rpcDigiCollection = *rpcDigis;
83  for (auto rollDigis : rpcDigiCollection) {
84  RPCDetId roll = rollDigis.first;
85 
86  //debug
87  //if(roll.region() != 0 && abs(roll.station()) >= 3 && roll.ring() == 1 )
88  /* {
89  //iRPC
90  for (auto pDigi=rollDigis.second.first; pDigi != rollDigis.second.second; pDigi++) {
91  LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" roll "<<roll
92  <<" strip "<<pDigi->strip()
93  <<" hasX "<<pDigi->hasX()<<" coordinateX "<<pDigi->coordinateX()<<" hasY "<<pDigi->hasY()<<" coordinateY "<<pDigi->coordinateY()
94  <<" bx "<<pDigi->bx()<<" time "<<pDigi->time()<<" irpc"<<std::endl;
95  }
96  //continue;
97  }*/
98 
99  //LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << ":" << __LINE__ <<" roll "<<roll<<" "<<std::endl;
100 
101  if (!acceptDigi(roll, iProcessor, procTyp))
102  continue;
103 
105  // 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; }
106  std::vector<RPCDigi> digisCopy;
107 
108  for (auto pDigi = rollDigis.second.first; pDigi != rollDigis.second.second; pDigi++) {
109  if (pDigi->bx() >= bxFrom && pDigi->bx() <= bxTo) {
110  digisCopy.push_back(*pDigi);
111  }
112  }
113 
114  std::vector<RpcCluster> clusters = rpcClusterization->getClusters(roll, digisCopy);
115 
116  for (auto& cluster : clusters) {
117  addRPCstub(muonStubsInLayers, roll, cluster, iProcessor, procTyp);
118  }
119  }
120 
121  //removing the RPC stubs that were mark as dropped in the RpcDigiToStubsConverterOmtf::addRPCstub
122  //10 is the first RPC layer
123  for (unsigned int iLayer = 10; iLayer < muonStubsInLayers.size(); iLayer++) {
124  for (unsigned int iInput = 0; iInput < muonStubsInLayers[iLayer].size(); iInput++) {
125  if (muonStubsInLayers[iLayer][iInput] && muonStubsInLayers[iLayer][iInput]->type == MuonStub::RPC_DROPPED) {
126  LogTrace("l1tOmtfEventPrint") << "RpcDigiToStubsConverter::makeStubs "
127  << " iProcessor " << iProcessor << " procTyp " << procTyp
128  << " dropping a stub iLayer " << iLayer << " iInput "
129  << *(muonStubsInLayers[iLayer][iInput]) << std::endl;
130  muonStubsInLayers[iLayer][iInput].reset();
131  }
132  }
133  }
134 }
135 
138 MuonStubMakerBase::MuonStubMakerBase(const ProcConfigurationBase* procConf) : config(procConf), rpcClusterization() {}
139 
143  const edm::EventSetup& es,
144  const MuonGeometryTokens& muonGeometryTokens) {
146  config->getRpcMaxClusterSize(), config->getRpcMaxClusterCnt(), config->getRpcDropAllClustersIfMoreThanMax());
147 }
153 
155  for (auto& digiToStubsConverter : digiToStubsConverters)
156  digiToStubsConverter->loadDigis(event);
157 }
158 
160  MuonStubPtrs2D& muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo) {
161  //LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << ":" << __LINE__ << " iProcessor " << iProcessor << " preocType "
162  // << procTyp << std::endl;
163 
164  for (auto& digiToStubsConverter : digiToStubsConverters)
165  digiToStubsConverter->makeStubs(muonStubsInLayers, iProcessor, procTyp, bxFrom, bxTo);
166 }
virtual bool acceptDigi(const CSCDetId &cscDetId, unsigned int iProcessor, l1t::tftype procType)
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
T const * product() const
Definition: Handle.h:70
virtual bool acceptDigi(const RPCDetId &rpcDetId, unsigned int iProcessor, l1t::tftype procType)
void buildInputForProcessor(MuonStubPtrs2D &muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom=0, int bxTo=0)
Method translating trigger digis into input matrix with global phi coordinates, fills the muonStubsIn...
edm::Handle< L1MuDTChambThContainer > dtThDigis
Definition: config.py:1
void loadAndFilterDigis(const edm::Event &event)
std::vector< MuonStubPtrs1D > MuonStubPtrs2D
Definition: MuonStub.h:67
MuonStubMakerBase(const ProcConfigurationBase *procConf)
#define LogTrace(id)
void makeStubs(MuonStubPtrs2D &muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo) override
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
void makeStubs(MuonStubPtrs2D &muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo) override
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)
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
void makeStubs(MuonStubPtrs2D &muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo) override
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