CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
RPCConeBuilder Class Reference

#include <L1Trigger/RPCTriggerConfig/src/RPCConeBuilder.cc>

Inheritance diagram for RPCConeBuilder:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Types

using ReturnType = std::unique_ptr< L1RPCConeBuilder >
 
- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 

Public Member Functions

ReturnType produce (const L1RPCConeBuilderRcd &)
 
 RPCConeBuilder (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
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

int m_towerBeg
 
int m_towerEnd
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::ESProducer
 ESProducer (const ESProducer &)=delete
 
ESProducer const & operator= (const ESProducer &)=delete
 
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 >
ESConsumesCollector 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 eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 

Detailed Description

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

Usage: <usage>

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

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

Definition at line 32 of file RPCConeBuilder.h.

Member Typedef Documentation

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

Definition at line 37 of file RPCConeBuilder.h.

Constructor & Destructor Documentation

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

Definition at line 31 of file RPCConeBuilder.cc.

References edm::ESProducer::setWhatProduced().

31  :
32  m_towerBeg(iConfig.getParameter<int>("towerBeg")),
33  m_towerEnd(iConfig.getParameter<int>("towerEnd"))
34 {
35  setWhatProduced(this);
36 }
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:116

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 161 of file RPCConeBuilder.cc.

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

Referenced by buildConnections().

163  {
164 
165  int logplane = -1;
166 
167  // Do not connect rolls lying on the oposite side of detector
168  if ( ref->second.getEtaPartition()*other->second.getEtaPartition()<0 )
169  return std::make_pair(-1,0);
170 
171  int refTowerCnt = 0;
172  int index = -1;
173  int refTower = -1;
174 
175  for (auto const& itRef : l1RPCConeDefinition->getRingToTowerVec()) {
176 
177  if ( itRef.m_etaPart != std::abs(ref->second.getEtaPartition())
178  || itRef.m_hwPlane != std::abs(ref->second.getHwPlane()-1) // -1?
179  ) {
180  continue;
181  }
182 
183  ++refTowerCnt;
184  refTower = itRef.m_tower;
185 
186  for (auto const& itOther : l1RPCConeDefinition->getRingToTowerVec()) {
187 
188  if ( itOther.m_etaPart != std::abs(other->second.getEtaPartition())
189  || itOther.m_hwPlane != std::abs(other->second.getHwPlane()-1) // -1?
190  ) {
191  continue;
192  }
193 
194  if (itOther.m_tower == refTower) {
195  index = itOther.m_index;
196  }
197  }
198  }
199 
200  if (refTowerCnt > 1) {
201  throw cms::Exception("RPCConeBuilder") << " Reference(?) ring "
202  << ref->first << " "
203  << "wants to be connected to " << refTowerCnt << " towers \n";
204  }
205 
206  if (refTowerCnt == 0) {
207  throw cms::Exception("RPCConeBuilder") << " Reference(?) ring "
208  << ref->first << " "
209  << " is not connected anywhere \n";
210  }
211 
212  int lpSize = 0;
213  if (index != -1) {
214 
215  for (auto const& it : l1RPCConeDefinition->getRingToLPVec()) {
216  if (it.m_etaPart != std::abs(other->second.getEtaPartition())
217  || it.m_hwPlane != std::abs(other->second.getHwPlane()-1)
218  || it.m_index != index) {
219  continue;
220  }
221  logplane = it.m_LP;
222  }
223 
224  for (auto const& it : l1RPCConeDefinition->getLPSizeVec()) {
225  if (it.m_tower != std::abs(refTower) || it.m_LP != logplane-1) {
226  continue;
227  }
228  lpSize = it.m_size;
229  }
230 
231  //FIXME
232  if (lpSize==-1) {
233  //throw cms::Exception("getLogStrip") << " lpSize==-1\n";
234  }
235  }
236  return std::make_pair(logplane, lpSize);
237 }
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 69 of file RPCConeBuilder.cc.

References buildConnections(), RPCGeometry::dets(), Exception, RPCStripsRing::getRingId(), crabWrapper::key, nullptr, and Validation_hcalonly_cfi::sign.

Referenced by produce().

71  {
72 
73  // fetch geometrical data
74  auto uncompressedCons = std::make_shared<L1RPCConeBuilder::TConMap>();
75 
76  int rolls = 0;
77  for (auto const& it : rpcGeom->dets()) {
78 
79  if ( dynamic_cast< RPCRoll const * >( it ) == nullptr ) {
80  continue;
81  }
82 
83  ++rolls;
84  RPCRoll const* roll = dynamic_cast< RPCRoll const*>( it );
85 
86  int ringId = RPCStripsRing::getRingId(roll);
87  if ( ringsMap.find(ringId) == ringsMap.end() ) {
88  ringsMap[ringId] = RPCStripsRing(roll, uncompressedCons);
89  } else {
90  ringsMap[ringId].addRoll(roll);
91  }
92  }
93 
94  // filtermixed strips, fill gaps with virtual strips
95  for (auto& it : ringsMap) {
96 
97  it.second.filterOverlapingChambers();
98  it.second.fillWithVirtualStrips();
99  }
100 
101  // Xcheck, if rings are symettrical
102  for (auto& it : ringsMap) {
103  int key = it.first;
104  int sign = key/100 - (key/1000)*10;
105 
106  if (sign == 0) {
107  key += 100;
108  } else {
109  key -= 100;
110  }
111 
112  if (key != 2000){// Hey 2100 has no counterring
113  if (it.second.size() != ringsMap[key].size())
114  {
115  throw cms::Exception("RPCInternal") << " Size differs for ring " << key << " +- 100 \n";
116  }
117  }
118  }
119  buildConnections(l1RPCConeDefinition, ringsMap);
120 }
#define nullptr
void buildConnections(L1RPCConeDefinition const *, RPCStripsRing::TIdToRindMap &)
void RPCConeBuilder::buildConnections ( L1RPCConeDefinition const *  l1RPCConeDefinition,
RPCStripsRing::TIdToRindMap ringsMap 
)
private

Definition at line 122 of file RPCConeBuilder.cc.

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

Referenced by buildCones().

123  {
124 
125  RPCStripsRing::TIdToRindMap::iterator itRef = ringsMap.begin();
126  for (;itRef != ringsMap.end(); ++itRef){ // iterate over reference rings
127 
128  RPCStripsRing::TOtherConnStructVec ringsToConnect;
129 
130  if (!itRef->second.isReferenceRing()) continue; // iterate over reference rings
131 
132  RPCStripsRing::TIdToRindMap::iterator itOther = ringsMap.begin();
133  for (;itOther != ringsMap.end(); ++itOther){ // iterate over nonreference rings
134 
135  if (itOther->second.isReferenceRing()) continue; // iterate over nonreference rings
136 
137  std::pair<int,int> pr = areConnected(itRef, itOther, l1RPCConeDefinition);
138  if ( pr.first != -1 ) {
139  RPCStripsRing::TOtherConnStruct newOtherConn;
140  newOtherConn.m_it = itOther;
141  newOtherConn.m_logplane = pr.first;
142  newOtherConn.m_logplaneSize = pr.second;
143  ringsToConnect.push_back(newOtherConn);
144  }
145  } // OtherRings iteration ends
146 
147  std::pair<int,int> prRef = areConnected(itRef, itRef, l1RPCConeDefinition);
148  if (prRef.first == -1){
149  throw cms::Exception("RPCConfig") << " Cannot determine logplane for reference ring "
150  << itRef->first << "\n ";
151  }
152 
153  itRef->second.createRefConnections(ringsToConnect, prRef.first, prRef.second);
154 
155  } // RefRings iteration ends
156 }
std::vector< TOtherConnStruct > TOtherConnStructVec
Definition: RPCStripsRing.h:53
TIdToRindMap::iterator m_it
Definition: RPCStripsRing.h:50
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 40 of file RPCConeBuilder.cc.

References buildCones(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), m_towerBeg, m_towerEnd, and edm::ESHandle< T >::product().

41 {
42  auto pL1RPCConeBuilder = std::make_unique<L1RPCConeBuilder>();
43 
44  pL1RPCConeBuilder->setFirstTower(m_towerBeg);
45  pL1RPCConeBuilder->setLastTower(m_towerEnd);
46 
47  edm::ESHandle<RPCGeometry> rpcGeometry;
48  iRecord.getRecord<MuonGeometryRecord>().get(rpcGeometry);
49 
50  edm::ESHandle<L1RPCConeDefinition> l1RPCConeDefinition;
51  iRecord.getRecord<L1RPCConeDefinitionRcd>().get(l1RPCConeDefinition);
52 
54 
55  buildCones(rpcGeometry.product(), l1RPCConeDefinition.product(), ringsMap);
56 
57  // Compress all connections. Since members of this class are shared
58  // pointers this call will compress all data
59  ringsMap.begin()->second.compressConnections();
60 
61  pL1RPCConeBuilder->setConeConnectionMap(ringsMap.begin()->second.getConnectionsMap());
62 
63  pL1RPCConeBuilder->setCompressedConeConnectionMap(
64  ringsMap.begin()->second.getCompressedConnectionsMap());
65 
66  return pL1RPCConeBuilder;
67 }
std::map< int, RPCStripsRing > TIdToRindMap
Definition: RPCStripsRing.h:43
void buildCones(RPCGeometry const *, L1RPCConeDefinition const *, RPCStripsRing::TIdToRindMap &)
T const * product() const
Definition: ESHandle.h:84

Member Data Documentation

int RPCConeBuilder::m_towerBeg
private

Definition at line 58 of file RPCConeBuilder.h.

Referenced by produce().

int RPCConeBuilder::m_towerEnd
private

Definition at line 59 of file RPCConeBuilder.h.

Referenced by produce().