CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  // std::copy_if(rollDigis.second.first, rollDigis.second.second, std::back_inserter(digisCopy), [](const RPCDigi & aDigi){return (aDigi.bx()==0);} );
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  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<155<<" roll "<<roll<<" cluster: firstStrip "<<cluster.firstStrip<<" lastStrip "<<cluster.lastStrip<<" halfStrip "<<cluster.halfStrip()<<std::endl;
118  addRPCstub(muonStubsInLayers, roll, cluster, iProcessor, procTyp);
119  }
120  }
121 }
122 
125 MuonStubMakerBase::MuonStubMakerBase(const ProcConfigurationBase* procConf) : config(procConf), rpcClusterization() {}
126 
130  const edm::EventSetup& es,
134 }
140 
142  for (auto& digiToStubsConverter : digiToStubsConverters)
143  digiToStubsConverter->loadDigis(event);
144 }
145 
147  MuonStubPtrs2D& muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo) {
148  //LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << ":" << __LINE__ << " iProcessor " << iProcessor << " preocType "
149  // << procTyp << std::endl;
150 
151  for (auto& digiToStubsConverter : digiToStubsConverters)
152  digiToStubsConverter->makeStubs(muonStubsInLayers, iProcessor, procTyp, bxFrom, bxTo);
153 }
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
muonGeometryTokens({esConsumes< RPCGeometry, MuonGeometryRecord, edm::Transition::BeginRun >(), esConsumes< CSCGeometry, MuonGeometryRecord, edm::Transition::BeginRun >(), esConsumes< DTGeometry, MuonGeometryRecord, edm::Transition::BeginRun >()})
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
void loadAndFilterDigis(const edm::Event &event)
MuonStubMakerBase(const ProcConfigurationBase *procConf)
void makeStubs(MuonStubPtrs2D &muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo) override
const ProcConfigurationBase * config
virtual unsigned int getRpcMaxClusterCnt() const
virtual void addDTphiDigi(MuonStubPtrs2D &muonStubsInLayers, const L1MuDTChambPhDigi &digi, const L1MuDTChambThContainer *dtThDigis, unsigned int iProcessor, l1t::tftype procTyp)=0
edm::EDGetTokenT< L1MuDTChambPhContainer > inputTokenDtPh
virtual std::vector< RpcCluster > getClusters(const RPCDetId &roll, std::vector< RPCDigi > &digis) const
N.B. digis are sorted inside the function.
void makeStubs(MuonStubPtrs2D &muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo) override
virtual bool getRpcDropAllClustersIfMoreThanMax() const
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)
virtual void addDTetaStubs(MuonStubPtrs2D &muonStubsInLayers, const L1MuDTChambThDigi &thetaDigi, unsigned int iProcessor, l1t::tftype procTyp)=0
std::vector< MuonStubPtrs1D > MuonStubPtrs2D
Definition: MuonStub.h:66
std::vector< std::unique_ptr< DigiToStubsConverterBase > > digiToStubsConverters
const ProcConfigurationBase * config
T const * product() const
Definition: Handle.h:70
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 bool acceptDigi(const DTChamberId &dTChamberId, unsigned int iProcessor, l1t::tftype procType)
tuple config
parse the configuration file
virtual int cscLctCentralBx() const
edm::Handle< L1MuDTChambPhContainer > dtPhDigis
RpcClusterization rpcClusterization
edm::Handle< CSCCorrelatedLCTDigiCollection > cscDigis
void configure(int maxClusterSize, int maxClusterCnt, bool dropAllClustersIfMoreThanMax)
virtual unsigned int getRpcMaxClusterSize() const