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 29 of file DTCCBConfig.cc.

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

References dataList.

◆ DTCCBConfig() [2/3]

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

Definition at line 31 of file DTCCBConfig.cc.

33  dataList.reserve(1000);
34 }

References dataList.

◆ ~DTCCBConfig()

DTCCBConfig::~DTCCBConfig ( )
virtual

Definition at line 43 of file DTCCBConfig.cc.

43 {}

◆ 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 199 of file DTCCBConfig.cc.

199  {
200  return appendConfigKey(id.wheel(), id.station(), id.sector(), confKey);
201 }

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 166 of file DTCCBConfig.cc.

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

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 203 of file DTCCBConfig.cc.

203 { return dataList.begin(); }

References dataList.

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

◆ clear()

void DTCCBConfig::clear ( void  )

reset content

Definition at line 111 of file DTCCBConfig.cc.

111  {
112  dataList.clear();
113  initialize();
114  return;
115 }

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 68 of file DTCCBConfig.cc.

68  {
69  return configKey(id.wheel(), id.station(), id.sector(), confKey);
70 }

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 56 of file DTCCBConfig.cc.

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

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

Referenced by configKey().

◆ configKeyMap()

DTCCBConfig::ccb_config_map DTCCBConfig::configKeyMap ( ) const

Definition at line 72 of file DTCCBConfig.cc.

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

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 52 of file DTCCBConfig.cc.

52 { return fullConfigKey; }

References fullConfigKey.

◆ initialize()

void DTCCBConfig::initialize ( )

Definition at line 207 of file DTCCBConfig.cc.

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

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 162 of file DTCCBConfig.cc.

162  {
163  return setConfigKey(id.wheel(), id.station(), id.sector(), confKey);
164 }

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 121 of file DTCCBConfig.cc.

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

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 54 of file DTCCBConfig.cc.

54 { return timeStamp; }

References timeStamp.

◆ version() [1/2]

std::string & DTCCBConfig::version ( )

Definition at line 109 of file DTCCBConfig.cc.

109 { 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 107 of file DTCCBConfig.cc.

107 { 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:205
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:166
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:56
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:203
DTCCBConfig::initialize
void initialize()
Definition: DTCCBConfig.cc:207
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:121
crabWrapper.key
key
Definition: crabWrapper.py:19
DTCCBConfig::version
const std::string & version() const
access version
Definition: DTCCBConfig.cc:107