CMS 3D CMS Logo

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 (const DTChamberId &id, const std::vector< int > &confKey)
 
int appendConfigKey (int wheelId, int stationId, int sectorId, const std::vector< int > &confKey)
 
const_iterator begin () const
 
void clear ()
 reset content More...
 
int configKey (const DTChamberId &id, std::vector< int > &confKey) const
 
int configKey (int wheelId, int stationId, int sectorId, 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 (const DTChamberId &id, const std::vector< int > &confKey)
 
int setConfigKey (int wheelId, int stationId, int sectorId, const std::vector< int > &confKey)
 
void setFullKey (const std::vector< DTConfigKey > &)
 
void setStamp (int s)
 
int stamp () const
 
std::string & version ()
 
const std::string & version () const
 access version More...
 
virtual ~DTCCBConfig ()
 

Private Member Functions

 DTCCBConfig (DTCCBConfig const &)=delete
 
DTCCBConfigoperator= (DTCCBConfig const &)=delete
 
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< DTBufferTreeUniquePtrdBuf
 
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 60 of file DTCCBConfig.h.

Member Typedef Documentation

◆ ccb_config_iterator

typedef ccb_config_map::const_iterator DTCCBConfig::ccb_config_iterator

Definition at line 72 of file DTCCBConfig.h.

◆ ccb_config_map

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

Definition at line 71 of file DTCCBConfig.h.

◆ const_iterator

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

Access methods to data.

Definition at line 92 of file DTCCBConfig.h.

Constructor & Destructor Documentation

◆ DTCCBConfig() [1/3]

DTCCBConfig::DTCCBConfig ( )

Definition at line 31 of file DTCCBConfig.cc.

31 : timeStamp(0), dataVersion(" "), dBuf(new DTBufferTreeUniquePtr) { dataList.reserve(1000); }

References dataList.

◆ DTCCBConfig() [2/3]

DTCCBConfig::DTCCBConfig ( const std::string &  version)

Definition at line 33 of file DTCCBConfig.cc.

35  dataList.reserve(1000);
36 }

References dataList.

◆ ~DTCCBConfig()

DTCCBConfig::~DTCCBConfig ( )
virtual

Definition at line 45 of file DTCCBConfig.cc.

45 {}

◆ DTCCBConfig() [3/3]

DTCCBConfig::DTCCBConfig ( DTCCBConfig const &  )
privatedelete

Member Function Documentation

◆ appendConfigKey() [1/2]

int DTCCBConfig::appendConfigKey ( const DTChamberId id,
const std::vector< int > &  confKey 
)

Definition at line 201 of file DTCCBConfig.cc.

201  {
202  return appendConfigKey(id.wheel(), id.station(), id.sector(), confKey);
203 }

References appendConfigKey(), relativeConstraints::station, and makeMuonMisalignmentScenario::wheel.

◆ appendConfigKey() [2/2]

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

Definition at line 168 of file DTCCBConfig.cc.

168  {
169  std::vector<int> chanKey{wheelId, stationId, sectorId};
170 
171  DTCCBId ccbId;
172  ccbId.wheelId = wheelId;
173  ccbId.stationId = stationId;
174  ccbId.sectorId = sectorId;
175  std::vector<int>::const_iterator iter = confKey.begin();
176  std::vector<int>::const_iterator iend = confKey.end();
177  int key;
178 
179  std::vector<int>* confPtr;
180  int searchStatus = dBuf->find(chanKey.begin(), chanKey.end(), confPtr);
181 
182  if (searchStatus) {
183  std::unique_ptr<std::vector<int> > newVector(new std::vector<int>);
184  confPtr = newVector.get();
185  dBuf->insert(chanKey.begin(), chanKey.end(), std::move(newVector));
186  }
187 
188  while (iter != iend) {
189  key = *iter++;
190  dataList.push_back(std::pair<DTCCBId, int>(ccbId, key));
191  confPtr->push_back(key);
192  }
193 
194  if (!searchStatus) {
195  return -1;
196  } else {
197  return 0;
198  }
199 }

References dataList, dBuf, DTBufferTree< Key, Content >::find(), DTBufferTree< Key, Content >::insert(), crabWrapper::key, eostools::move(), DTCCBId::sectorId, DTCCBId::stationId, and DTCCBId::wheelId.

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

◆ begin()

DTCCBConfig::const_iterator DTCCBConfig::begin ( void  ) const

Definition at line 205 of file DTCCBConfig.cc.

205 { return dataList.begin(); }

References dataList.

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

◆ clear()

void DTCCBConfig::clear ( void  )

reset content

Definition at line 113 of file DTCCBConfig.cc.

113  {
114  dataList.clear();
115  initialize();
116  return;
117 }

References dataList, and initialize().

Referenced by BeautifulSoup.Tag::setString().

◆ configKey() [1/2]

int DTCCBConfig::configKey ( const DTChamberId id,
std::vector< int > &  confKey 
) const

Definition at line 70 of file DTCCBConfig.cc.

70  {
71  return configKey(id.wheel(), id.station(), id.sector(), confKey);
72 }

References configKey(), relativeConstraints::station, and makeMuonMisalignmentScenario::wheel.

◆ configKey() [2/2]

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

Definition at line 58 of file DTCCBConfig.cc.

58  {
59  confKey.clear();
60 
61  std::vector<int> chanKey{wheelId, stationId, sectorId};
62  std::vector<int> const* confPtr;
63  int searchStatus = dBuf->find(chanKey.begin(), chanKey.end(), confPtr);
64  if (!searchStatus)
65  confKey = *confPtr;
66 
67  return searchStatus;
68 }

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

Referenced by configKey().

◆ configKeyMap()

DTCCBConfig::ccb_config_map DTCCBConfig::configKeyMap ( ) const

Definition at line 74 of file DTCCBConfig.cc.

74  {
75  ccb_config_map keyList;
76  std::vector<std::pair<DTCCBId, int>*> tempList;
77  const_iterator d_iter = begin();
78  const_iterator d_iend = end();
79  while (d_iter != d_iend)
80  tempList.push_back(new std::pair<DTCCBId, int>(*d_iter++));
81  std::vector<std::pair<DTCCBId, int>*>::iterator t_iter = tempList.begin();
82  std::vector<std::pair<DTCCBId, int>*>::iterator t_iend = tempList.end();
83  while (t_iter != t_iend) {
84  std::pair<DTCCBId, int>* ptr = *t_iter++;
85  if (ptr == nullptr)
86  continue;
87  DTCCBId& ccbId = ptr->first;
88  std::vector<int> cfgKeys;
89  cfgKeys.push_back(ptr->second);
90  std::vector<std::pair<DTCCBId, int>*>::iterator n_iter(t_iter);
91  while (n_iter != t_iend) {
92  std::pair<DTCCBId, int>*& pck = *n_iter++;
93  if (pck == nullptr)
94  continue;
95  DTCCBId& chkId = pck->first;
96  if ((chkId.wheelId == ccbId.wheelId) && (chkId.stationId == ccbId.stationId) &&
97  (chkId.sectorId == ccbId.sectorId)) {
98  cfgKeys.push_back(pck->second);
99  delete pck;
100  pck = nullptr;
101  }
102  }
103  keyList.push_back(std::pair<DTCCBId, std::vector<int> >(ccbId, cfgKeys));
104  delete ptr;
105  }
106  return keyList;
107 }

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

◆ end()

DTCCBConfig::const_iterator DTCCBConfig::end ( void  ) const

◆ fullKey()

std::vector< DTConfigKey > DTCCBConfig::fullKey ( ) const

Definition at line 54 of file DTCCBConfig.cc.

54 { return fullConfigKey; }

References fullConfigKey.

◆ initialize()

void DTCCBConfig::initialize ( )

Definition at line 209 of file DTCCBConfig.cc.

209  {
210  dBuf->clear();
211 
212  const_iterator iter = dataList.begin();
213  const_iterator iend = dataList.end();
214  std::vector<int> chanKey;
215  chanKey.reserve(3);
216  while (iter != iend) {
217  const DTCCBId& chan = iter->first;
218 
219  chanKey.clear();
220  chanKey.push_back(chan.wheelId);
221  chanKey.push_back(chan.stationId);
222  chanKey.push_back(chan.sectorId);
223  std::vector<int>* ccbConfPtr;
224  int searchStatus = dBuf->find(chanKey.begin(), chanKey.end(), ccbConfPtr);
225 
226  if (searchStatus) {
227  std::unique_ptr<std::vector<int> > newVector(new std::vector<int>);
228  ccbConfPtr = newVector.get();
229  dBuf->insert(chanKey.begin(), chanKey.end(), std::move(newVector));
230  }
231  ccbConfPtr->push_back(iter->second);
232 
233  iter++;
234  }
235 }

References officialStyle::chan, DTBufferTree< Key, Content >::clear(), dataList, dBuf, DTBufferTree< Key, Content >::find(), DTBufferTree< Key, Content >::insert(), and eostools::move().

Referenced by clear().

◆ operator=()

DTCCBConfig& DTCCBConfig::operator= ( DTCCBConfig const &  )
privatedelete

◆ serialize()

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

◆ setConfigKey() [1/2]

int DTCCBConfig::setConfigKey ( const DTChamberId id,
const std::vector< int > &  confKey 
)

Definition at line 164 of file DTCCBConfig.cc.

164  {
165  return setConfigKey(id.wheel(), id.station(), id.sector(), confKey);
166 }

References setConfigKey(), relativeConstraints::station, and makeMuonMisalignmentScenario::wheel.

◆ setConfigKey() [2/2]

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

Definition at line 123 of file DTCCBConfig.cc.

123  {
124  std::vector<int> chanKey{wheelId, stationId, sectorId};
125 
126  std::vector<int>* confPtr;
127  int searchStatus = dBuf->find(chanKey.begin(), chanKey.end(), confPtr);
128 
129  if (!searchStatus) {
130  std::vector<std::pair<DTCCBId, int> > tempList;
131  const_iterator iter = dataList.begin();
132  const_iterator iend = dataList.end();
133  while (iter != iend) {
134  const DTCCBId& ccbId(iter->first);
135  if ((ccbId.wheelId != wheelId) || (ccbId.stationId != stationId) || (ccbId.sectorId != sectorId))
136  tempList.push_back(*iter);
137  ++iter;
138  }
139  dataList = tempList;
140  DTCCBId ccbId;
141  ccbId.wheelId = wheelId;
142  ccbId.stationId = stationId;
143  ccbId.sectorId = sectorId;
144  std::vector<int>::const_iterator cfgIter = confKey.begin();
145  std::vector<int>::const_iterator cfgIend = confKey.end();
146  while (cfgIter != cfgIend)
147  dataList.push_back(std::pair<DTCCBId, int>(ccbId, *cfgIter++));
148  *confPtr = confKey;
149  return -1;
150  } else {
151  dBuf->insert(chanKey.begin(), chanKey.end(), std::make_unique<std::vector<int> >(confKey));
152  DTCCBId ccbId;
153  ccbId.wheelId = wheelId;
154  ccbId.stationId = stationId;
155  ccbId.sectorId = sectorId;
156  std::vector<int>::const_iterator cfgIter = confKey.begin();
157  std::vector<int>::const_iterator cfgIend = confKey.end();
158  while (cfgIter != cfgIend)
159  dataList.push_back(std::pair<DTCCBId, int>(ccbId, *cfgIter++));
160  return 0;
161  }
162 }

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

Referenced by setConfigKey().

◆ setFullKey()

void DTCCBConfig::setFullKey ( const std::vector< DTConfigKey > &  key)

◆ setStamp()

void DTCCBConfig::setStamp ( int  s)

◆ stamp()

int DTCCBConfig::stamp ( ) const

Definition at line 56 of file DTCCBConfig.cc.

56 { return timeStamp; }

References timeStamp.

◆ version() [1/2]

std::string & DTCCBConfig::version ( )

Definition at line 111 of file DTCCBConfig.cc.

111 { return dataVersion; }

References dataVersion.

Referenced by validation.Sample::datasetpattern(), and validation.Sample::filename().

◆ version() [2/2]

const std::string & DTCCBConfig::version ( ) const

access version

Definition at line 109 of file DTCCBConfig.cc.

109 { return dataVersion; }

References dataVersion.

Referenced by validation.Sample::datasetpattern(), and validation.Sample::filename().

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 109 of file DTCCBConfig.h.

◆ cond::serialization::access

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

Definition at line 109 of file DTCCBConfig.h.

Member Data Documentation

◆ dataList

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

Definition at line 105 of file DTCCBConfig.h.

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

◆ dataVersion

std::string DTCCBConfig::dataVersion
private

Definition at line 103 of file DTCCBConfig.h.

Referenced by version().

◆ dBuf

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

Definition at line 107 of file DTCCBConfig.h.

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

◆ fullConfigKey

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

Definition at line 104 of file DTCCBConfig.h.

Referenced by fullKey(), and setFullKey().

◆ timeStamp

int DTCCBConfig::timeStamp
private

Definition at line 102 of file DTCCBConfig.h.

Referenced by setStamp(), and stamp().

DTCCBConfig::end
const_iterator end() const
Definition: DTCCBConfig.cc:207
DTCCBConfig::ccb_config_map
std::vector< std::pair< DTCCBId, std::vector< int > > > ccb_config_map
Definition: DTCCBConfig.h:71
DTCCBId
Definition: DTCCBConfig.h:37
DTCCBConfig::appendConfigKey
int appendConfigKey(int wheelId, int stationId, int sectorId, const std::vector< int > &confKey)
Definition: DTCCBConfig.cc:168
relativeConstraints.station
station
Definition: relativeConstraints.py:67
DTBufferTree::clear
void clear()
DTCCBConfig::fullConfigKey
std::vector< DTConfigKey > fullConfigKey
Definition: DTCCBConfig.h:104
DTCCBConfig::dataList
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:105
DTCCBId::wheelId
int wheelId
Definition: DTCCBConfig.h:42
DTCCBConfig::timeStamp
int timeStamp
Definition: DTCCBConfig.h:102
DTCCBConfig::const_iterator
std::vector< std::pair< DTCCBId, int > >::const_iterator const_iterator
Access methods to data.
Definition: DTCCBConfig.h:92
alignCSCRings.s
s
Definition: alignCSCRings.py:92
DTBufferTree::insert
int insert(ElementKey fKey, ElementKey lKey, Content cont)
DTBufferTreeUniquePtr
Definition: DTBufferTree.h:78
DTCCBId::stationId
int stationId
Definition: DTCCBConfig.h:43
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
DTCCBId::sectorId
int sectorId
Definition: DTCCBConfig.h:44
DTCCBConfig::dataVersion
std::string dataVersion
Definition: DTCCBConfig.h:103
DTCCBConfig::configKey
int configKey(int wheelId, int stationId, int sectorId, std::vector< int > &confKey) const
Definition: DTCCBConfig.cc:58
eostools.move
def move(src, dest)
Definition: eostools.py:511
officialStyle.chan
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi....
Definition: officialStyle.py:106
DTCCBConfig::begin
const_iterator begin() const
Definition: DTCCBConfig.cc:205
DTCCBConfig::initialize
void initialize()
Definition: DTCCBConfig.cc:209
DTCCBConfig::dBuf
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:107
DTBufferTree::find
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
DTCCBConfig::setConfigKey
int setConfigKey(int wheelId, int stationId, int sectorId, const std::vector< int > &confKey)
Definition: DTCCBConfig.cc:123
crabWrapper.key
key
Definition: crabWrapper.py:19
DTCCBConfig::version
const std::string & version() const
access version
Definition: DTCCBConfig.cc:109