CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
RPCConeBuilder Class Reference
Inheritance diagram for RPCConeBuilder:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Types

using ReturnType = std::unique_ptr< L1RPCConeBuilder >
 

Public Member Functions

ReturnType produce (const L1RPCConeBuilderRcd &)
 
 RPCConeBuilder (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
template<typename Record >
void updateFromMayConsumes (unsigned int iIndex, const Record &iRecord)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Private Member Functions

std::pair< int, int > areConnected (RPCStripsRing::TIdToRindMap::iterator ref, RPCStripsRing::TIdToRindMap::iterator other, L1RPCConeDefinition const *)
 
void buildCones (RPCGeometry const *, L1RPCConeDefinition const *, RPCStripsRing::TIdToRindMap &)
 
void buildConnections (L1RPCConeDefinition const *, RPCStripsRing::TIdToRindMap &)
 

Private Attributes

edm::ESGetToken< L1RPCConeDefinition, L1RPCConeDefinitionRcdm_l1RPCConeDefinitionToken
 
edm::ESGetToken< RPCGeometry, MuonGeometryRecordm_rpcGeometryToken
 
int m_towerBeg
 
int m_towerEnd
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy >>>
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 39 of file RPCConeBuilder.cc.

Member Typedef Documentation

using RPCConeBuilder::ReturnType = std::unique_ptr<L1RPCConeBuilder>

Definition at line 43 of file RPCConeBuilder.cc.

Constructor & Destructor Documentation

RPCConeBuilder::RPCConeBuilder ( const edm::ParameterSet iConfig)

Definition at line 66 of file RPCConeBuilder.cc.

References m_l1RPCConeDefinitionToken, m_rpcGeometryToken, and edm::ESProducer::setWhatProduced().

67  : m_towerBeg(iConfig.getParameter<int>("towerBeg")), m_towerEnd(iConfig.getParameter<int>("towerEnd")) {
68  setWhatProduced(this).setConsumes(m_rpcGeometryToken).setConsumes(m_l1RPCConeDefinitionToken);
69 }
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > m_rpcGeometryToken
edm::ESGetToken< L1RPCConeDefinition, L1RPCConeDefinitionRcd > m_l1RPCConeDefinitionToken

Member Function Documentation

std::pair< int, int > RPCConeBuilder::areConnected ( RPCStripsRing::TIdToRindMap::iterator  ref,
RPCStripsRing::TIdToRindMap::iterator  other,
L1RPCConeDefinition const *  l1RPCConeDefinition 
)
private

In the pair that is returned, the first element is the logplane number for this connection (if not connected returns -1) and the second element is lpSize.

Definition at line 181 of file RPCConeBuilder.cc.

References funct::abs(), DEFINE_FWK_EVENTSETUP_MODULE, Exception, L1RPCConeDefinition::getLPSizeVec(), L1RPCConeDefinition::getRingToLPVec(), and L1RPCConeDefinition::getRingToTowerVec().

Referenced by buildConnections().

183  {
184  int logplane = -1;
185 
186  // Do not connect rolls lying on the oposite side of detector
187  if (ref->second.getEtaPartition() * other->second.getEtaPartition() < 0)
188  return std::make_pair(-1, 0);
189 
190  int refTowerCnt = 0;
191  int index = -1;
192  int refTower = -1;
193 
194  for (auto const& itRef : l1RPCConeDefinition->getRingToTowerVec()) {
195  if (itRef.m_etaPart != std::abs(ref->second.getEtaPartition()) ||
196  itRef.m_hwPlane != std::abs(ref->second.getHwPlane() - 1) // -1?
197  ) {
198  continue;
199  }
200 
201  ++refTowerCnt;
202  refTower = itRef.m_tower;
203 
204  for (auto const& itOther : l1RPCConeDefinition->getRingToTowerVec()) {
205  if (itOther.m_etaPart != std::abs(other->second.getEtaPartition()) ||
206  itOther.m_hwPlane != std::abs(other->second.getHwPlane() - 1) // -1?
207  ) {
208  continue;
209  }
210 
211  if (itOther.m_tower == refTower) {
212  index = itOther.m_index;
213  }
214  }
215  }
216 
217  if (refTowerCnt > 1) {
218  throw cms::Exception("RPCConeBuilder") << " Reference(?) ring " << ref->first << " "
219  << "wants to be connected to " << refTowerCnt << " towers \n";
220  }
221 
222  if (refTowerCnt == 0) {
223  throw cms::Exception("RPCConeBuilder") << " Reference(?) ring " << ref->first << " "
224  << " is not connected anywhere \n";
225  }
226 
227  int lpSize = 0;
228  if (index != -1) {
229  for (auto const& it : l1RPCConeDefinition->getRingToLPVec()) {
230  if (it.m_etaPart != std::abs(other->second.getEtaPartition()) ||
231  it.m_hwPlane != std::abs(other->second.getHwPlane() - 1) || it.m_index != index) {
232  continue;
233  }
234  logplane = it.m_LP;
235  }
236 
237  for (auto const& it : l1RPCConeDefinition->getLPSizeVec()) {
238  if (it.m_tower != std::abs(refTower) || it.m_LP != logplane - 1) {
239  continue;
240  }
241  lpSize = it.m_size;
242  }
243 
244  //FIXME
245  if (lpSize == -1) {
246  //throw cms::Exception("getLogStrip") << " lpSize==-1\n";
247  }
248  }
249  return std::make_pair(logplane, lpSize);
250 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void RPCConeBuilder::buildCones ( RPCGeometry const *  rpcGeom,
L1RPCConeDefinition const *  l1RPCConeDefinition,
RPCStripsRing::TIdToRindMap ringsMap 
)
private

Definition at line 93 of file RPCConeBuilder.cc.

References buildConnections(), watchdog::const, RPCGeometry::dets(), Exception, newFWLiteAna::found, RPCStripsRing::getRingId(), crabWrapper::key, and Validation_hcalonly_cfi::sign.

Referenced by produce().

95  {
96  // fetch geometrical data
97  auto uncompressedCons = std::make_shared<L1RPCConeBuilder::TConMap>();
98 
99  int rolls = 0;
100  for (auto const& it : rpcGeom->dets()) {
101  RPCRoll const* roll = dynamic_cast<RPCRoll const*>(it);
102  if (roll == nullptr) {
103  continue;
104  }
105 
106  ++rolls;
107 
108  int ringId = RPCStripsRing::getRingId(roll);
109  auto found = ringsMap.find(ringId);
110  if (found == ringsMap.end()) {
111  ringsMap[ringId] = RPCStripsRing(roll, uncompressedCons);
112  } else {
113  found->second.addRoll(roll);
114  }
115  }
116 
117  // filtermixed strips, fill gaps with virtual strips
118  for (auto& it : ringsMap) {
119  it.second.filterOverlapingChambers();
120  it.second.fillWithVirtualStrips();
121  }
122 
123  // Xcheck, if rings are symettrical
124  for (auto& it : ringsMap) {
125  int key = it.first;
126  int sign = key / 100 - (key / 1000) * 10;
127 
128  if (sign == 0) {
129  key += 100;
130  } else {
131  key -= 100;
132  }
133 
134  if (key != 2000) { // Hey 2100 has no counterring
135  if (it.second.size() != ringsMap[key].size()) {
136  throw cms::Exception("RPCInternal") << " Size differs for ring " << key << " +- 100 \n";
137  }
138  }
139  }
140  buildConnections(l1RPCConeDefinition, ringsMap);
141 }
void buildConnections(L1RPCConeDefinition const *, RPCStripsRing::TIdToRindMap &)
void RPCConeBuilder::buildConnections ( L1RPCConeDefinition const *  l1RPCConeDefinition,
RPCStripsRing::TIdToRindMap ringsMap 
)
private

Definition at line 143 of file RPCConeBuilder.cc.

References areConnected(), Exception, RPCStripsRing::TOtherConnStruct::m_it, RPCStripsRing::TOtherConnStruct::m_logplane, and RPCStripsRing::TOtherConnStruct::m_logplaneSize.

Referenced by buildCones().

144  {
145  RPCStripsRing::TIdToRindMap::iterator itRef = ringsMap.begin();
146  for (; itRef != ringsMap.end(); ++itRef) { // iterate over reference rings
147 
148  RPCStripsRing::TOtherConnStructVec ringsToConnect;
149 
150  if (!itRef->second.isReferenceRing())
151  continue; // iterate over reference rings
152 
153  RPCStripsRing::TIdToRindMap::iterator itOther = ringsMap.begin();
154  for (; itOther != ringsMap.end(); ++itOther) { // iterate over nonreference rings
155 
156  if (itOther->second.isReferenceRing())
157  continue; // iterate over nonreference rings
158 
159  std::pair<int, int> pr = areConnected(itRef, itOther, l1RPCConeDefinition);
160  if (pr.first != -1) {
161  RPCStripsRing::TOtherConnStruct newOtherConn;
162  newOtherConn.m_it = itOther;
163  newOtherConn.m_logplane = pr.first;
164  newOtherConn.m_logplaneSize = pr.second;
165  ringsToConnect.push_back(newOtherConn);
166  }
167  } // OtherRings iteration ends
168 
169  std::pair<int, int> prRef = areConnected(itRef, itRef, l1RPCConeDefinition);
170  if (prRef.first == -1) {
171  throw cms::Exception("RPCConfig") << " Cannot determine logplane for reference ring " << itRef->first << "\n ";
172  }
173 
174  itRef->second.createRefConnections(ringsToConnect, prRef.first, prRef.second);
175 
176  } // RefRings iteration ends
177 }
std::vector< TOtherConnStruct > TOtherConnStructVec
Definition: RPCStripsRing.h:48
TIdToRindMap::iterator m_it
Definition: RPCStripsRing.h:45
std::pair< int, int > areConnected(RPCStripsRing::TIdToRindMap::iterator ref, RPCStripsRing::TIdToRindMap::iterator other, L1RPCConeDefinition const *)
RPCConeBuilder::ReturnType RPCConeBuilder::produce ( const L1RPCConeBuilderRcd iRecord)

Definition at line 72 of file RPCConeBuilder.cc.

References buildCones(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), m_l1RPCConeDefinitionToken, m_rpcGeometryToken, m_towerBeg, and m_towerEnd.

72  {
73  auto pL1RPCConeBuilder = std::make_unique<L1RPCConeBuilder>();
74 
75  pL1RPCConeBuilder->setFirstTower(m_towerBeg);
76  pL1RPCConeBuilder->setLastTower(m_towerEnd);
77 
79 
80  buildCones(&iRecord.get(m_rpcGeometryToken), &iRecord.get(m_l1RPCConeDefinitionToken), ringsMap);
81 
82  // Compress all connections. Since members of this class are shared
83  // pointers this call will compress all data
84  ringsMap.begin()->second.compressConnections();
85 
86  pL1RPCConeBuilder->setConeConnectionMap(ringsMap.begin()->second.getConnectionsMap());
87 
88  pL1RPCConeBuilder->setCompressedConeConnectionMap(ringsMap.begin()->second.getCompressedConnectionsMap());
89 
90  return pL1RPCConeBuilder;
91 }
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > m_rpcGeometryToken
std::map< int, RPCStripsRing > TIdToRindMap
Definition: RPCStripsRing.h:39
void buildCones(RPCGeometry const *, L1RPCConeDefinition const *, RPCStripsRing::TIdToRindMap &)
edm::ESGetToken< L1RPCConeDefinition, L1RPCConeDefinitionRcd > m_l1RPCConeDefinitionToken

Member Data Documentation

edm::ESGetToken<L1RPCConeDefinition, L1RPCConeDefinitionRcd> RPCConeBuilder::m_l1RPCConeDefinitionToken
private

Definition at line 61 of file RPCConeBuilder.cc.

Referenced by produce(), and RPCConeBuilder().

edm::ESGetToken<RPCGeometry, MuonGeometryRecord> RPCConeBuilder::m_rpcGeometryToken
private

Definition at line 60 of file RPCConeBuilder.cc.

Referenced by produce(), and RPCConeBuilder().

int RPCConeBuilder::m_towerBeg
private

Definition at line 62 of file RPCConeBuilder.cc.

Referenced by produce().

int RPCConeBuilder::m_towerEnd
private

Definition at line 63 of file RPCConeBuilder.cc.

Referenced by produce().