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 (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 &)=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

typedef ccb_config_map::const_iterator DTCCBConfig::ccb_config_iterator

Definition at line 72 of file DTCCBConfig.h.

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

Definition at line 71 of file DTCCBConfig.h.

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::DTCCBConfig ( )

Definition at line 29 of file DTCCBConfig.cc.

References dataList.

29 : timeStamp(0), dataVersion(" "), dBuf(new DTBufferTreeUniquePtr) { dataList.reserve(1000); }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:105
std::string dataVersion
Definition: DTCCBConfig.h:103
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:107
DTCCBConfig::DTCCBConfig ( const std::string &  version)

Definition at line 31 of file DTCCBConfig.cc.

References dataList.

33  dataList.reserve(1000);
34 }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:105
const std::string & version() const
access version
Definition: DTCCBConfig.cc:107
std::string dataVersion
Definition: DTCCBConfig.h:103
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:107
DTCCBConfig::~DTCCBConfig ( )
virtual

Definition at line 43 of file DTCCBConfig.cc.

43 {}
DTCCBConfig::DTCCBConfig ( DTCCBConfig const &  )
privatedelete

Member Function Documentation

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

Definition at line 166 of file DTCCBConfig.cc.

References crabWrapper::key, eostools::move(), DTCCBId::sectorId, DTCCBId::stationId, and DTCCBId::wheelId.

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

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 }
int wheelId
Definition: DTCCBConfig.h:42
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:105
int sectorId
Definition: DTCCBConfig.h:44
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
int stationId
Definition: DTCCBConfig.h:43
int insert(ElementKey fKey, ElementKey lKey, Content cont)
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:107
def move(src, dest)
Definition: eostools.py:511
int DTCCBConfig::appendConfigKey ( const DTChamberId id,
const std::vector< int > &  confKey 
)

Definition at line 199 of file DTCCBConfig.cc.

References relativeConstraints::station, and makeMuonMisalignmentScenario::wheel.

199  {
200  return appendConfigKey(id.wheel(), id.station(), id.sector(), confKey);
201 }
int appendConfigKey(int wheelId, int stationId, int sectorId, const std::vector< int > &confKey)
Definition: DTCCBConfig.cc:166
DTCCBConfig::const_iterator DTCCBConfig::begin ( void  ) const

Definition at line 203 of file DTCCBConfig.cc.

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

203 { return dataList.begin(); }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:105
void DTCCBConfig::clear ( void  )
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 }
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:107
int DTCCBConfig::configKey ( const DTChamberId id,
std::vector< int > &  confKey 
) const

Definition at line 68 of file DTCCBConfig.cc.

References relativeConstraints::station, and makeMuonMisalignmentScenario::wheel.

68  {
69  return configKey(id.wheel(), id.station(), id.sector(), confKey);
70 }
int configKey(int wheelId, int stationId, int sectorId, std::vector< int > &confKey) const
Definition: DTCCBConfig.cc:56
DTCCBConfig::ccb_config_map DTCCBConfig::configKeyMap ( ) const

Definition at line 72 of file DTCCBConfig.cc.

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

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 }
std::vector< std::pair< DTCCBId, std::vector< int > > > ccb_config_map
Definition: DTCCBConfig.h:71
int wheelId
Definition: DTCCBConfig.h:42
const_iterator end() const
Definition: DTCCBConfig.cc:205
int sectorId
Definition: DTCCBConfig.h:44
std::vector< std::pair< DTCCBId, int > >::const_iterator const_iterator
Access methods to data.
Definition: DTCCBConfig.h:92
int stationId
Definition: DTCCBConfig.h:43
const_iterator begin() const
Definition: DTCCBConfig.cc:203
DTCCBConfig::const_iterator DTCCBConfig::end ( void  ) const

Definition at line 205 of file DTCCBConfig.cc.

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

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

Definition at line 52 of file DTCCBConfig.cc.

52 { return fullConfigKey; }
std::vector< DTConfigKey > fullConfigKey
Definition: DTCCBConfig.h:104
void DTCCBConfig::initialize ( )

Definition at line 207 of file DTCCBConfig.cc.

References officialStyle::chan, eostools::move(), DTCCBId::sectorId, DTCCBId::stationId, and DTCCBId::wheelId.

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 }
int wheelId
Definition: DTCCBConfig.h:42
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:105
int sectorId
Definition: DTCCBConfig.h:44
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
std::vector< std::pair< DTCCBId, int > >::const_iterator const_iterator
Access methods to data.
Definition: DTCCBConfig.h:92
int stationId
Definition: DTCCBConfig.h:43
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
int insert(ElementKey fKey, ElementKey lKey, Content cont)
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:107
def move(src, dest)
Definition: eostools.py:511
DTCCBConfig& DTCCBConfig::operator= ( DTCCBConfig const &  )
privatedelete
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 121 of file DTCCBConfig.cc.

References DTConfigKey::confKey, DTCCBId::sectorId, DTCCBId::stationId, and DTCCBId::wheelId.

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 }
int wheelId
Definition: DTCCBConfig.h:42
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:105
int sectorId
Definition: DTCCBConfig.h:44
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
std::vector< std::pair< DTCCBId, int > >::const_iterator const_iterator
Access methods to data.
Definition: DTCCBConfig.h:92
int stationId
Definition: DTCCBConfig.h:43
int insert(ElementKey fKey, ElementKey lKey, Content cont)
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:107
int DTCCBConfig::setConfigKey ( const DTChamberId id,
const std::vector< int > &  confKey 
)

Definition at line 162 of file DTCCBConfig.cc.

References relativeConstraints::station, and makeMuonMisalignmentScenario::wheel.

162  {
163  return setConfigKey(id.wheel(), id.station(), id.sector(), confKey);
164 }
int setConfigKey(int wheelId, int stationId, int sectorId, const std::vector< int > &confKey)
Definition: DTCCBConfig.cc:121
void DTCCBConfig::setFullKey ( const std::vector< DTConfigKey > &  key)

Definition at line 117 of file DTCCBConfig.cc.

References crabWrapper::key.

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

117 { fullConfigKey = key; }
std::vector< DTConfigKey > fullConfigKey
Definition: DTCCBConfig.h:104
void DTCCBConfig::setStamp ( int  s)
int DTCCBConfig::stamp ( ) const

Definition at line 54 of file DTCCBConfig.cc.

54 { return timeStamp; }
const std::string & DTCCBConfig::version ( ) const

access version

Definition at line 107 of file DTCCBConfig.cc.

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

107 { return dataVersion; }
std::string dataVersion
Definition: DTCCBConfig.h:103
std::string & DTCCBConfig::version ( )

Definition at line 109 of file DTCCBConfig.cc.

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

109 { return dataVersion; }
std::string dataVersion
Definition: DTCCBConfig.h:103

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 109 of file DTCCBConfig.h.

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

Definition at line 109 of file DTCCBConfig.h.

Member Data Documentation

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

Definition at line 105 of file DTCCBConfig.h.

Referenced by DTCCBConfig().

std::string DTCCBConfig::dataVersion
private

Definition at line 103 of file DTCCBConfig.h.

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

Definition at line 107 of file DTCCBConfig.h.

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

Definition at line 104 of file DTCCBConfig.h.

int DTCCBConfig::timeStamp
private

Definition at line 102 of file DTCCBConfig.h.