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 (DTCCBConfig const &)=delete
 
 DTCCBConfig (const std::string &version)
 
const_iterator end () const
 
std::vector< DTConfigKeyfullKey () const
 
void initialize ()
 
DTCCBConfigoperator= (DTCCBConfig const &)=delete
 
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

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 74 of file DTCCBConfig.h.

◆ ccb_config_map

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

Definition at line 73 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 94 of file DTCCBConfig.h.

Constructor & Destructor Documentation

◆ DTCCBConfig() [1/3]

DTCCBConfig::DTCCBConfig ( )

Definition at line 31 of file DTCCBConfig.cc.

References dataList.

31 : timeStamp(0), dataVersion(" "), dBuf(new DTBufferTreeUniquePtr) { dataList.reserve(1000); }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:104
std::string dataVersion
Definition: DTCCBConfig.h:102
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:106

◆ DTCCBConfig() [2/3]

DTCCBConfig::DTCCBConfig ( DTCCBConfig const &  )
delete

◆ DTCCBConfig() [3/3]

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

Definition at line 33 of file DTCCBConfig.cc.

References dataList.

35  dataList.reserve(1000);
36 }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:104
const std::string & version() const
access version
Definition: DTCCBConfig.cc:109
std::string dataVersion
Definition: DTCCBConfig.h:102
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:106

◆ ~DTCCBConfig()

DTCCBConfig::~DTCCBConfig ( )
virtual

Definition at line 45 of file DTCCBConfig.cc.

45 {}

Member Function Documentation

◆ appendConfigKey() [1/2]

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

Definition at line 168 of file DTCCBConfig.cc.

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

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

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 }
int wheelId
Definition: DTCCBConfig.h:42
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:104
int sectorId
Definition: DTCCBConfig.h:44
int stationId
Definition: DTCCBConfig.h:43
key
prepare the HTCondor submission files and eventually submit them
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
int insert(ElementKey fKey, ElementKey lKey, Content cont)
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:106
def move(src, dest)
Definition: eostools.py:511

◆ appendConfigKey() [2/2]

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

Definition at line 201 of file DTCCBConfig.cc.

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

201  {
202  return appendConfigKey(id.wheel(), id.station(), id.sector(), confKey);
203 }
int appendConfigKey(int wheelId, int stationId, int sectorId, const std::vector< int > &confKey)
Definition: DTCCBConfig.cc:168

◆ begin()

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

Definition at line 205 of file DTCCBConfig.cc.

References dataList.

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

205 { return dataList.begin(); }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:104

◆ clear()

void DTCCBConfig::clear ( void  )

reset content

Definition at line 113 of file DTCCBConfig.cc.

References dataList, and initialize().

113  {
114  dataList.clear();
115  initialize();
116  return;
117 }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:104
void initialize()
Definition: DTCCBConfig.cc:209

◆ configKey() [1/2]

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

Definition at line 58 of file DTCCBConfig.cc.

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

Referenced by configKey().

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 }
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:106

◆ configKey() [2/2]

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

Definition at line 70 of file DTCCBConfig.cc.

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

70  {
71  return configKey(id.wheel(), id.station(), id.sector(), confKey);
72 }
int configKey(int wheelId, int stationId, int sectorId, std::vector< int > &confKey) const
Definition: DTCCBConfig.cc:58

◆ configKeyMap()

DTCCBConfig::ccb_config_map DTCCBConfig::configKeyMap ( ) const

Definition at line 74 of file DTCCBConfig.cc.

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

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

◆ end()

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

Definition at line 207 of file DTCCBConfig.cc.

References dataList.

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

207 { return dataList.end(); }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:104

◆ fullKey()

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

Definition at line 54 of file DTCCBConfig.cc.

References fullConfigKey.

54 { return fullConfigKey; }
std::vector< DTConfigKey > fullConfigKey
Definition: DTCCBConfig.h:103

◆ initialize()

void DTCCBConfig::initialize ( )

Definition at line 209 of file DTCCBConfig.cc.

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

Referenced by clear().

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 }
std::vector< std::pair< DTCCBId, int > > dataList
Definition: DTCCBConfig.h:104
std::vector< std::pair< DTCCBId, int > >::const_iterator const_iterator
Access methods to data.
Definition: DTCCBConfig.h:94
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
int insert(ElementKey fKey, ElementKey lKey, Content cont)
edm::ConstRespectingPtr< DTBufferTreeUniquePtr > dBuf
Definition: DTCCBConfig.h:106
def move(src, dest)
Definition: eostools.py:511

◆ operator=()

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

◆ serialize()

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

◆ setConfigKey() [1/2]

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

Definition at line 123 of file DTCCBConfig.cc.

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

Referenced by setConfigKey().

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

◆ setConfigKey() [2/2]

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

Definition at line 164 of file DTCCBConfig.cc.

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

164  {
165  return setConfigKey(id.wheel(), id.station(), id.sector(), confKey);
166 }
int setConfigKey(int wheelId, int stationId, int sectorId, const std::vector< int > &confKey)
Definition: DTCCBConfig.cc:123

◆ setFullKey()

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

Definition at line 119 of file DTCCBConfig.cc.

References fullConfigKey, and submitPVResolutionJobs::key.

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

119 { fullConfigKey = key; }
std::vector< DTConfigKey > fullConfigKey
Definition: DTCCBConfig.h:103
key
prepare the HTCondor submission files and eventually submit them

◆ setStamp()

void DTCCBConfig::setStamp ( int  s)

◆ stamp()

int DTCCBConfig::stamp ( ) const

Definition at line 56 of file DTCCBConfig.cc.

References timeStamp.

56 { return timeStamp; }

◆ version() [1/2]

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

access version

Definition at line 109 of file DTCCBConfig.cc.

References dataVersion.

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

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

◆ version() [2/2]

std::string & DTCCBConfig::version ( )

Definition at line 111 of file DTCCBConfig.cc.

References dataVersion.

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

111 { return dataVersion; }
std::string dataVersion
Definition: DTCCBConfig.h:102

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 108 of file DTCCBConfig.h.

◆ cond::serialization::access

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

Definition at line 108 of file DTCCBConfig.h.

Member Data Documentation

◆ dataList

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

Definition at line 104 of file DTCCBConfig.h.

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

◆ dataVersion

std::string DTCCBConfig::dataVersion
private

Definition at line 102 of file DTCCBConfig.h.

Referenced by version().

◆ dBuf

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

Definition at line 106 of file DTCCBConfig.h.

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

◆ fullConfigKey

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

Definition at line 103 of file DTCCBConfig.h.

Referenced by fullKey(), and setFullKey().

◆ timeStamp

int DTCCBConfig::timeStamp
private

Definition at line 101 of file DTCCBConfig.h.

Referenced by setStamp(), and stamp().