CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
DTCCBConfig Class Reference

#include <DTCCBConfig.h>

Public Types

typedef
ccb_config_map::const_iterator 
ccb_config_iterator
 
typedef std::vector< std::pair
< DTCCBId, std::vector< int > > > 
ccb_config_map
 
typedef std::vector< std::pair
< DTCCBId, int >
>::const_iterator 
const_iterator
 Access methods to data. More...
 

Public Member Functions

int appendConfigKey (int wheelId, int stationId, int sectorId, const std::vector< int > &confKey)
 
int appendConfigKey (const DTChamberId &id, const std::vector< int > &confKey)
 
const_iterator begin () const
 
void clear ()
 reset content More...
 
int configKey (int wheelId, int stationId, int sectorId, std::vector< int > &confKey) const
 
int configKey (const DTChamberId &id, std::vector< int > &confKey) const
 
ccb_config_map configKeyMap () const
 
 DTCCBConfig ()
 
 DTCCBConfig (const std::string &version)
 
const_iterator end () const
 
std::vector< DTConfigKeyfullKey () const
 
void initialize ()
 
int setConfigKey (int wheelId, int stationId, int sectorId, const std::vector< int > &confKey)
 
int setConfigKey (const DTChamberId &id, const std::vector< int > &confKey)
 
void setFullKey (const std::vector< DTConfigKey > &)
 
void setStamp (int s)
 
int stamp () const
 
const std::string & version () const
 access version More...
 
std::string & version ()
 
virtual ~DTCCBConfig ()
 

Private Member Functions

 DTCCBConfig (DTCCBConfig const &)
 
DTCCBConfigoperator= (DTCCBConfig const &)
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

std::vector< std::pair
< DTCCBId, int > > 
dataList
 
std::string dataVersion
 
edm::ConstRespectingPtr
< DTBufferTreeUniquePtr
dBuf
 
std::vector< DTConfigKeyfullConfigKey
 
int timeStamp
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Description: Class to hold configuration identifier for chambers

Author
Paolo Ronchese INFN Padova

Definition at line 69 of file DTCCBConfig.h.

Member Typedef Documentation

typedef ccb_config_map::const_iterator DTCCBConfig::ccb_config_iterator

Definition at line 87 of file DTCCBConfig.h.

typedef std::vector< std::pair< DTCCBId,std::vector<int> > > DTCCBConfig::ccb_config_map

Definition at line 86 of file DTCCBConfig.h.

typedef std::vector< std::pair<DTCCBId,int> >::const_iterator DTCCBConfig::const_iterator

Access methods to data.

Definition at line 117 of file DTCCBConfig.h.

Constructor & Destructor Documentation

DTCCBConfig::DTCCBConfig ( )

Definition at line 30 of file DTCCBConfig.cc.

References dataList.

30  :
31  timeStamp(0),
32  dataVersion( " " ),
34  dataList.reserve( 1000 );
35 }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:131
std::string dataVersion
Definition: DTCCBConfig.h:129
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:133
DTCCBConfig::DTCCBConfig ( const std::string &  version)

Definition at line 38 of file DTCCBConfig.cc.

References dataList.

38  :
39  timeStamp(0),
42  dataList.reserve( 1000 );
43 }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:131
const std::string & version() const
access version
Definition: DTCCBConfig.cc:152
std::string dataVersion
Definition: DTCCBConfig.h:129
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:133
DTCCBConfig::~DTCCBConfig ( )
virtual

Definition at line 62 of file DTCCBConfig.cc.

62  {
63 }
DTCCBConfig::DTCCBConfig ( DTCCBConfig const &  )
private

Member Function Documentation

int DTCCBConfig::appendConfigKey ( int  wheelId,
int  stationId,
int  sectorId,
const std::vector< int > &  confKey 
)

Definition at line 238 of file DTCCBConfig.cc.

References dataList, dBuf, DTBufferTree< Key, Content >::find(), DTBufferTree< Key, Content >::insert(), getDQMSummary::iter, relval_steps::key, and DTCCBId::stationId.

Referenced by appendConfigKey(), DTUserKeyedConfigHandler::getNewObjects(), and DTKeyedConfigHandler::getNewObjects().

241  {
242 
243  std::vector<int> chanKey { wheelId, stationId, sectorId };
244 
245  DTCCBId ccbId;
246  ccbId. wheelId = wheelId;
247  ccbId.stationId = stationId;
248  ccbId. sectorId = sectorId;
249  std::vector<int>::const_iterator iter = confKey.begin();
250  std::vector<int>::const_iterator iend = confKey.end();
251  int key;
252 
253  std::vector<int>* confPtr;
254  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), confPtr );
255 
256  if ( searchStatus ) {
257  std::unique_ptr<std::vector<int> > newVector(new std::vector<int>);
258  confPtr = newVector.get();
259  dBuf->insert( chanKey.begin(),
260  chanKey.end(), std::move(newVector) );
261  }
262 
263  while ( iter != iend ) {
264  key = *iter++;
265  dataList.push_back( std::pair<DTCCBId,int>( ccbId, key ) );
266  confPtr->push_back( key );
267  }
268 
269  if ( !searchStatus ) {
270  return -1;
271  }
272  else {
273  return 0;
274  }
275 
276 }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:131
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
int stationId
Definition: DTCCBConfig.h:46
int insert(ElementKey fKey, ElementKey lKey, Content cont)
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:133
int DTCCBConfig::appendConfigKey ( const DTChamberId id,
const std::vector< int > &  confKey 
)

Definition at line 278 of file DTCCBConfig.cc.

References appendConfigKey(), and relativeConstraints::station.

279  {
280  return appendConfigKey( id.wheel(),
281  id.station(),
282  id.sector(),
283  confKey );
284 }
int appendConfigKey(int wheelId, int stationId, int sectorId, const std::vector< int > &confKey)
Definition: DTCCBConfig.cc:238
DTCCBConfig::const_iterator DTCCBConfig::begin ( void  ) const

Definition at line 286 of file DTCCBConfig.cc.

References dataList.

Referenced by configKeyMap(), DTUserKeyedConfigHandler::getNewObjects(), and DTKeyedConfigHandler::getNewObjects().

286  {
287  return dataList.begin();
288 }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:131
void DTCCBConfig::clear ( void  )
int DTCCBConfig::configKey ( int  wheelId,
int  stationId,
int  sectorId,
std::vector< int > &  confKey 
) const

Definition at line 87 of file DTCCBConfig.cc.

References dBuf, and DTBufferTree< Key, Content >::find().

Referenced by configKey().

90  {
91 
92  confKey.clear();
93 
94  std::vector<int> chanKey { wheelId, stationId, sectorId };
95  std::vector<int> const* confPtr;
96  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), confPtr );
97  if ( !searchStatus ) confKey = *confPtr;
98 
99  return searchStatus;
100 }
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:133
int DTCCBConfig::configKey ( const DTChamberId id,
std::vector< int > &  confKey 
) const

Definition at line 103 of file DTCCBConfig.cc.

References configKey(), and relativeConstraints::station.

104  {
105  return configKey( id.wheel(),
106  id.station(),
107  id.sector(),
108  confKey );
109 }
int configKey(int wheelId, int stationId, int sectorId, std::vector< int > &confKey) const
Definition: DTCCBConfig.cc:87
DTCCBConfig::ccb_config_map DTCCBConfig::configKeyMap ( ) const

Definition at line 113 of file DTCCBConfig.cc.

References begin(), end(), and DTCCBId::stationId.

113  {
114 
115  ccb_config_map keyList;
116  std::vector< std::pair<DTCCBId,int>* > tempList;
117  const_iterator d_iter = begin();
118  const_iterator d_iend = end();
119  while ( d_iter != d_iend ) tempList.push_back(
120  new std::pair<DTCCBId,int>( *d_iter++ ) );
121  std::vector< std::pair<DTCCBId,int>* >::iterator t_iter = tempList.begin();
122  std::vector< std::pair<DTCCBId,int>* >::iterator t_iend = tempList.end();
123  while ( t_iter != t_iend ) {
124  std::pair<DTCCBId,int>* ptr = *t_iter++;
125  if ( ptr == 0 ) continue;
126  DTCCBId& ccbId = ptr->first;
127  std::vector<int> cfgKeys;
128  cfgKeys.push_back( ptr->second );
129  std::vector< std::pair<DTCCBId,int>* >::iterator n_iter( t_iter );
130  while( n_iter != t_iend ) {
131  std::pair<DTCCBId,int>*& pck = *n_iter++;
132  if ( pck == 0 ) continue;
133  DTCCBId& chkId = pck->first;
134  if ( ( chkId. wheelId == ccbId. wheelId ) &&
135  ( chkId.stationId == ccbId.stationId ) &&
136  ( chkId. sectorId == ccbId. sectorId ) ) {
137  cfgKeys.push_back( pck->second );
138  delete pck;
139  pck = 0;
140  }
141  }
142  keyList.push_back( std::pair< DTCCBId,std::vector<int> >( ccbId,
143  cfgKeys ) );
144  delete ptr;
145  }
146  return keyList;
147 
148 }
const_iterator end() const
Definition: DTCCBConfig.cc:291
std::vector< std::pair< DTCCBId, int > >::const_iterator const_iterator
Access methods to data.
Definition: DTCCBConfig.h:117
int stationId
Definition: DTCCBConfig.h:46
std::vector< std::pair< DTCCBId, std::vector< int > > > ccb_config_map
Definition: DTCCBConfig.h:86
const_iterator begin() const
Definition: DTCCBConfig.cc:286
DTCCBConfig::const_iterator DTCCBConfig::end ( void  ) const

Definition at line 291 of file DTCCBConfig.cc.

References dataList.

Referenced by configKeyMap(), Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), DTUserKeyedConfigHandler::getNewObjects(), and DTKeyedConfigHandler::getNewObjects().

291  {
292  return dataList.end();
293 }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:131
std::vector< DTConfigKey > DTCCBConfig::fullKey ( ) const

Definition at line 77 of file DTCCBConfig.cc.

References fullConfigKey.

77  {
78  return fullConfigKey;
79 }
std::vector< DTConfigKey > fullConfigKey
Definition: DTCCBConfig.h:130
void DTCCBConfig::initialize ( )

Definition at line 295 of file DTCCBConfig.cc.

References DTBufferTree< Key, Content >::clear(), dataList, dBuf, DTBufferTree< Key, Content >::find(), DTBufferTree< Key, Content >::insert(), getDQMSummary::iter, and DTCCBId::stationId.

Referenced by clear().

295  {
296 
297  dBuf->clear();
298 
299  const_iterator iter = dataList.begin();
300  const_iterator iend = dataList.end();
301  std::vector<int> chanKey;
302  chanKey.reserve(3);
303  while ( iter != iend ) {
304 
305  const DTCCBId& chan = iter->first;
306 
307  chanKey.clear();
308  chanKey.push_back( chan. wheelId );
309  chanKey.push_back( chan.stationId );
310  chanKey.push_back( chan. sectorId );
311  std::vector<int>* ccbConfPtr;
312  int searchStatus = dBuf->find( chanKey.begin(),
313  chanKey.end(), ccbConfPtr );
314 
315  if ( searchStatus ) {
316  std::unique_ptr<std::vector<int> > newVector(new std::vector<int>);
317  ccbConfPtr = newVector.get();
318  dBuf->insert( chanKey.begin(), chanKey.end(), std::move(newVector) );
319  }
320  ccbConfPtr->push_back( iter->second );
321 
322  iter++;
323 
324  }
325 }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:131
std::vector< std::pair< DTCCBId, int > >::const_iterator const_iterator
Access methods to data.
Definition: DTCCBConfig.h:117
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
int stationId
Definition: DTCCBConfig.h:46
int insert(ElementKey fKey, ElementKey lKey, Content cont)
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:133
DTCCBConfig& DTCCBConfig::operator= ( DTCCBConfig const &  )
private
template<class Archive >
void DTCCBConfig::serialize ( Archive &  ar,
const unsigned int  version 
)
private
int DTCCBConfig::setConfigKey ( int  wheelId,
int  stationId,
int  sectorId,
const std::vector< int > &  confKey 
)

Definition at line 179 of file DTCCBConfig.cc.

References dataList, dBuf, DTBufferTree< Key, Content >::find(), DTBufferTree< Key, Content >::insert(), getDQMSummary::iter, and DTCCBId::stationId.

Referenced by setConfigKey().

182  {
183 
184  std::vector<int> chanKey { wheelId, stationId, sectorId };
185 
186  std::vector<int>* confPtr;
187  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), confPtr );
188 
189  if ( !searchStatus ) {
190  std::vector< std::pair<DTCCBId,int> > tempList;
191  const_iterator iter = dataList.begin();
192  const_iterator iend = dataList.end();
193  while ( iter != iend ) {
194  const DTCCBId& ccbId( iter->first );
195  if ( ( ccbId. wheelId != wheelId ) ||
196  ( ccbId.stationId != stationId ) ||
197  ( ccbId. sectorId != sectorId ) ) tempList.push_back( *iter );
198  ++iter;
199  }
200  dataList = tempList;
201  DTCCBId ccbId;
202  ccbId. wheelId = wheelId;
203  ccbId.stationId = stationId;
204  ccbId. sectorId = sectorId;
205  std::vector<int>::const_iterator cfgIter = confKey.begin();
206  std::vector<int>::const_iterator cfgIend = confKey.end();
207  while ( cfgIter != cfgIend ) dataList.push_back( std::pair<DTCCBId,int>(
208  ccbId, *cfgIter++ ) );
209  *confPtr = confKey;
210  return -1;
211  }
212  else {
213  dBuf->insert( chanKey.begin(),
214  chanKey.end(), std::unique_ptr<std::vector<int> >(new std::vector<int>( confKey ) ) );
215  DTCCBId ccbId;
216  ccbId. wheelId = wheelId;
217  ccbId.stationId = stationId;
218  ccbId. sectorId = sectorId;
219  std::vector<int>::const_iterator cfgIter = confKey.begin();
220  std::vector<int>::const_iterator cfgIend = confKey.end();
221  while ( cfgIter != cfgIend ) dataList.push_back( std::pair<DTCCBId,int>(
222  ccbId, *cfgIter++ ) );
223  return 0;
224  }
225 
226 }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:131
std::vector< std::pair< DTCCBId, int > >::const_iterator const_iterator
Access methods to data.
Definition: DTCCBConfig.h:117
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
int stationId
Definition: DTCCBConfig.h:46
int insert(ElementKey fKey, ElementKey lKey, Content cont)
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:133
int DTCCBConfig::setConfigKey ( const DTChamberId id,
const std::vector< int > &  confKey 
)

Definition at line 229 of file DTCCBConfig.cc.

References setConfigKey(), and relativeConstraints::station.

230  {
231  return setConfigKey( id.wheel(),
232  id.station(),
233  id.sector(),
234  confKey );
235 }
int setConfigKey(int wheelId, int stationId, int sectorId, const std::vector< int > &confKey)
Definition: DTCCBConfig.cc:179
void DTCCBConfig::setFullKey ( const std::vector< DTConfigKey > &  key)

Definition at line 169 of file DTCCBConfig.cc.

References fullConfigKey, and relval_steps::key.

Referenced by DTKeyedConfigHandler::getNewObjects(), and DTUserKeyedConfigHandler::getNewObjects().

169  {
170  fullConfigKey = key;
171 }
std::vector< DTConfigKey > fullConfigKey
Definition: DTCCBConfig.h:130
void DTCCBConfig::setStamp ( int  s)

Definition at line 174 of file DTCCBConfig.cc.

References alignCSCRings::s, and timeStamp.

Referenced by DTKeyedConfigHandler::getNewObjects(), and DTUserKeyedConfigHandler::getNewObjects().

174  {
175  timeStamp = s;
176 }
int DTCCBConfig::stamp ( ) const

Definition at line 82 of file DTCCBConfig.cc.

References timeStamp.

82  {
83  return timeStamp;
84 }
const std::string & DTCCBConfig::version ( ) const

access version

Definition at line 152 of file DTCCBConfig.cc.

References dataVersion.

152  {
153  return dataVersion;
154 }
std::string dataVersion
Definition: DTCCBConfig.h:129
std::string & DTCCBConfig::version ( )

Definition at line 157 of file DTCCBConfig.cc.

References dataVersion.

157  {
158  return dataVersion;
159 }
std::string dataVersion
Definition: DTCCBConfig.h:129

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 135 of file DTCCBConfig.h.

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 135 of file DTCCBConfig.h.

Member Data Documentation

std::vector< std::pair<DTCCBId,int> > DTCCBConfig::dataList
private

Definition at line 131 of file DTCCBConfig.h.

Referenced by appendConfigKey(), begin(), clear(), DTCCBConfig(), end(), initialize(), and setConfigKey().

std::string DTCCBConfig::dataVersion
private

Definition at line 129 of file DTCCBConfig.h.

Referenced by version().

edm::ConstRespectingPtr<DTBufferTreeUniquePtr> DTCCBConfig::dBuf
private

Definition at line 133 of file DTCCBConfig.h.

Referenced by appendConfigKey(), configKey(), initialize(), and setConfigKey().

std::vector<DTConfigKey> DTCCBConfig::fullConfigKey
private

Definition at line 130 of file DTCCBConfig.h.

Referenced by fullKey(), and setFullKey().

int DTCCBConfig::timeStamp
private

Definition at line 128 of file DTCCBConfig.h.

Referenced by setStamp(), and stamp().