CMS 3D CMS Logo

LMFDefFabric.cc
Go to the documentation of this file.
7 
8 #include <iostream>
9 
11 
12 LMFDefFabric::LMFDefFabric(oracle::occi::Environment *env, oracle::occi::Connection *conn) {
13  noDebug();
15  initialize();
16 }
17 
19  noDebug();
20  setConnection(c->getEnv(), c->getConn());
21  initialize();
22 }
23 
25 
26 void LMFDefFabric::debug() { _debug = true; }
27 
28 void LMFDefFabric::noDebug() { _debug = false; }
29 
30 std::list<LMFColor> LMFDefFabric::getColors() const { return _lmfColors; }
31 
32 std::list<LMFTrigType> LMFDefFabric::getTriggerTypes() const { return _lmfTrigTypes; }
33 
34 std::list<LMFRunTag> LMFDefFabric::getRunTags() const { return _lmfRunTags; }
35 
37  std::list<LMFColor>::const_iterator i = _lmfColors.begin();
38  std::list<LMFColor>::const_iterator e = _lmfColors.end();
39  LMFColor ret;
40  bool loop = true;
41  while ((loop) && (i != e)) {
42  if (i->getShortName() == name) {
43  ret = *i;
44  loop = false;
45  }
46  i++;
47  }
48  return ret;
49 }
50 
52  std::list<LMFColor>::const_iterator i = _lmfColors.begin();
53  std::list<LMFColor>::const_iterator e = _lmfColors.end();
54  LMFColor ret;
55  bool loop = true;
56  while ((loop) && (i != e)) {
57  if (i->getID() == id) {
58  ret = *i;
59  loop = false;
60  }
61  i++;
62  }
63  return ret;
64 }
65 
67  std::list<LMFColor>::const_iterator i = _lmfColors.begin();
68  std::list<LMFColor>::const_iterator e = _lmfColors.end();
69  LMFColor ret;
70  bool loop = true;
71  while ((loop) && (i != e)) {
72  if (i->getColorIndex() == index) {
73  ret = *i;
74  loop = false;
75  }
76  i++;
77  }
78  return ret;
79 }
80 
81 int LMFDefFabric::getColorID(std::string sname) const { return getColor(sname).getID(); }
82 
83 int LMFDefFabric::getColorID(int index) const { return getColor(index).getID(); }
84 
85 int LMFDefFabric::getTrigTypeID(std::string sname) const { return getTrigType(sname).getID(); }
86 
88  std::list<LMFTrigType>::const_iterator i = _lmfTrigTypes.begin();
89  std::list<LMFTrigType>::const_iterator e = _lmfTrigTypes.end();
91  bool loop = true;
92  while ((loop) && (i != e)) {
93  if (i->getShortName() == sname) {
94  tt = *i;
95  loop = false;
96  }
97  i++;
98  }
99  return tt;
100 }
101 
103  std::list<LMFTrigType>::const_iterator i = _lmfTrigTypes.begin();
104  std::list<LMFTrigType>::const_iterator e = _lmfTrigTypes.end();
105  LMFTrigType tt;
106  bool loop = true;
107  while ((loop) && (i != e)) {
108  if (i->getID() == id) {
109  tt = *i;
110  loop = false;
111  }
112  i++;
113  }
114  return tt;
115 }
116 
118  std::list<LMFRunTag>::const_iterator i = _lmfRunTags.begin();
119  std::list<LMFRunTag>::const_iterator e = _lmfRunTags.end();
120  LMFRunTag rt;
121  bool loop = true;
122  while ((loop) && (i != e)) {
123  if ((i->getGeneralTag()) == tag && (i->getVersion() == version)) {
124  rt = *i;
125  }
126  i++;
127  }
128  return rt;
129 }
130 
132  std::list<LMFRunTag>::const_iterator i = _lmfRunTags.begin();
133  std::list<LMFRunTag>::const_iterator e = _lmfRunTags.end();
134  LMFRunTag rt;
135  bool loop = true;
136  while ((loop) && (i != e)) {
137  if (i->getID() == id) {
138  rt = *i;
139  }
140  i++;
141  }
142  return rt;
143 }
144 
146 
147 template <typename T, typename U>
148 inline T &unique_static_cast(U &i) {
149  return *(static_cast<T *>(i.get()));
150 }
151 
152 void LMFDefFabric::initialize() noexcept(false) {
153  _lmfColors.clear();
154  _lmfTrigTypes.clear();
155  _lmfRunTags.clear();
156  _lmfPrimVersions.clear();
157  _lmfSeqVersions.clear();
158  _lmfCorrVersions.clear();
159  if ((m_env != nullptr) && (m_conn != nullptr)) {
160  auto listOfObjects = LMFColor(m_env, m_conn).fetchAll();
161  auto i = listOfObjects.begin();
162  auto e = listOfObjects.end();
163 
164  while (i != e) {
165  const LMFColor &c = unique_static_cast<const LMFColor>(*i);
166  _lmfColors.push_back(c);
167  i++;
168  }
169  listOfObjects.clear();
170  listOfObjects = LMFTrigType(m_env, m_conn).fetchAll();
171  i = listOfObjects.begin();
172  e = listOfObjects.end();
173  while (i != e) {
174  const LMFTrigType &c = unique_static_cast<const LMFTrigType>(*i);
175  _lmfTrigTypes.push_back(c);
176  i++;
177  }
178  listOfObjects.clear();
179  listOfObjects = LMFRunTag(m_env, m_conn).fetchAll();
180  i = listOfObjects.begin();
181  e = listOfObjects.end();
182  while (i != e) {
183  const LMFRunTag &c = unique_static_cast<const LMFRunTag>(*i);
184  _lmfRunTags.push_back(c);
185  i++;
186  }
187  listOfObjects.clear();
188  listOfObjects = LMFPrimVers(m_env, m_conn).fetchAll();
189  i = listOfObjects.begin();
190  e = listOfObjects.end();
191  while (i != e) {
192  const LMFPrimVers &c = unique_static_cast<const LMFPrimVers>(*i);
193  _lmfPrimVersions.push_back(c);
194  i++;
195  }
196  listOfObjects.clear();
197  listOfObjects = LMFCorrVers(m_env, m_conn).fetchAll();
198  i = listOfObjects.begin();
199  e = listOfObjects.end();
200  while (i != e) {
201  const LMFCorrVers &c = unique_static_cast<const LMFCorrVers>(*i);
202  _lmfCorrVersions.push_back(c);
203  i++;
204  }
205  listOfObjects.clear();
206  listOfObjects = LMFSeqVers(m_env, m_conn).fetchAll();
207  i = listOfObjects.begin();
208  e = listOfObjects.end();
209  while (i != e) {
210  const LMFSeqVers &c = unique_static_cast<const LMFSeqVers>(*i);
211  _lmfSeqVersions.push_back(c);
212  i++;
213  }
214  listOfObjects.clear();
215  _lmfColors.sort();
216  _lmfTrigTypes.sort();
217  _lmfRunTags.sort();
218  _lmfPrimVersions.sort();
219  _lmfSeqVersions.sort();
220  _lmfCorrVersions.sort();
221  } else {
222  throw(
223  std::runtime_error("LMFDefFabric: cannot initialize since connection not"
224  "set"));
225  }
226 }
227 
229  std::cout << "========= Fabric dump @ address " << this << " ============" << std::endl;
230  std::list<LMFColor>::const_iterator i1 = _lmfColors.begin();
231  std::list<LMFTrigType>::const_iterator i2 = _lmfTrigTypes.begin();
232  std::list<LMFRunTag>::const_iterator i3 = _lmfRunTags.begin();
233  std::list<LMFPrimVers>::const_iterator i4 = _lmfPrimVersions.begin();
234  std::list<LMFSeqVers>::const_iterator i5 = _lmfSeqVersions.begin();
235  std::list<LMFCorrVers>::const_iterator i6 = _lmfCorrVersions.begin();
236  std::list<LMFColor>::const_iterator e1 = _lmfColors.end();
237  std::list<LMFTrigType>::const_iterator e2 = _lmfTrigTypes.end();
238  std::list<LMFRunTag>::const_iterator e3 = _lmfRunTags.end();
239  std::list<LMFPrimVers>::const_iterator e4 = _lmfPrimVersions.end();
240  std::list<LMFSeqVers>::const_iterator e5 = _lmfSeqVersions.end();
241  std::list<LMFCorrVers>::const_iterator e6 = _lmfCorrVersions.end();
242  std::cout << "=== Colors" << std::endl;
243  while (i1 != e1) {
244  i1++->dump();
245  }
246  std::cout << "=== Trigger Types" << std::endl;
247  while (i2 != e2) {
248  i2++->dump();
249  }
250  std::cout << "=== Run Tags" << std::endl;
251  while (i3 != e3) {
252  i3++->dump();
253  }
254  std::cout << "=== Prim. Vers." << std::endl;
255  while (i4 != e4) {
256  i4++->dump();
257  }
258  std::cout << "=== Seq. Vers." << std::endl;
259  while (i5 != e5) {
260  i5++->dump();
261  }
262  std::cout << "=== Corr. Vers." << std::endl;
263  while (i6 != e6) {
264  i6++->dump();
265  }
266 }
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:373
LMFCorrVers
Definition: LMFCorrVers.h:17
LMFTrigType
Definition: LMFTrigType.h:10
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
testProducerWithPsetDescEmpty_cfi.i3
i3
Definition: testProducerWithPsetDescEmpty_cfi.py:47
mps_fire.i
i
Definition: mps_fire.py:428
LMFTrigType.h
funct::false
false
Definition: Factorize.h:29
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
LMFRunTag
Definition: LMFRunTag.h:16
gather_cfg.cout
cout
Definition: gather_cfg.py:144
hcal_runs.rt
rt
Definition: hcal_runs.py:76
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition: testProducerWithPsetDescEmpty_cfi.py:45
LMFDefFabric::getRunTag
LMFRunTag getRunTag(std::string tag, int version) const
Definition: LMFDefFabric.cc:117
LMFDefFabric::getColors
std::list< LMFColor > getColors() const
Definition: LMFDefFabric.cc:30
SiStripCommissioningClient_cfg.conn
conn
Definition: SiStripCommissioningClient_cfg.py:5
LMFColor
Definition: LMFColor.h:12
LMFDefFabric::getTrigTypeID
int getTrigTypeID(std::string sname) const
Definition: LMFDefFabric.cc:85
LMFDefFabric::getRunTags
std::list< LMFRunTag > getRunTags() const
Definition: LMFDefFabric.cc:34
LMFDefFabric::getTrigTypeFromID
LMFTrigType getTrigTypeFromID(int trigType_id) const
Definition: LMFDefFabric.cc:102
LMFDefFabric::getColorID
int getColorID(std::string name) const
Definition: LMFDefFabric.cc:81
LMFDefFabric::_lmfCorrVersions
std::list< LMFCorrVers > _lmfCorrVersions
Definition: LMFDefFabric.h:62
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
LMFPrimVers
Definition: LMFPrimVers.h:22
LMFDefFabric::getTrigType
LMFTrigType getTrigType(std::string sname) const
Definition: LMFDefFabric.cc:87
LMFSeqVers
Definition: LMFSeqVers.h:17
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
LMFDefFabric::initialize
void initialize() noexcept(false)
Definition: LMFDefFabric.cc:152
unique_static_cast
T & unique_static_cast(U &i)
Definition: LMFDefFabric.cc:148
LMFSeqVers.h
LMFDefFabric::_lmfColors
std::list< LMFColor > _lmfColors
Definition: LMFDefFabric.h:57
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
web.browse_db.env
env
Definition: browse_db.py:18
LMFDefFabric::getColor
LMFColor getColor(std::string name) const
Definition: LMFDefFabric.cc:36
LMFRunTag.h
LMFDefFabric::_lmfPrimVersions
std::list< LMFPrimVers > _lmfPrimVersions
Definition: LMFDefFabric.h:60
heppy_loop.loop
loop
Definition: heppy_loop.py:28
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
LMFColor.h
LMFDefFabric::getRunTagFromID
LMFRunTag getRunTagFromID(int runTag_id) const
Definition: LMFDefFabric.cc:131
LMFDefFabric::debug
void debug()
Definition: LMFDefFabric.cc:26
SiPixelPhase1Clusters_cfi.e3
e3
Definition: SiPixelPhase1Clusters_cfi.py:9
LMFDefFabric::_lmfSeqVersions
std::list< LMFSeqVers > _lmfSeqVersions
Definition: LMFDefFabric.h:61
LMFUnique::fetchAll
virtual std::list< std::unique_ptr< LMFUnique > > fetchAll() const noexcept(false)
Definition: LMFUnique.cc:61
LMFDefFabric.h
LMFUnique::getID
int getID() const
Definition: LMFUnique.h:58
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
LMFDefFabric::_lmfTrigTypes
std::list< LMFTrigType > _lmfTrigTypes
Definition: LMFDefFabric.h:58
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
T
long double T
Definition: Basic3DVectorLD.h:48
LMFDefFabric::dump
void dump()
Definition: LMFDefFabric.cc:228
LMFDefFabric::_debug
bool _debug
Definition: LMFDefFabric.h:55
LMFPrimVers.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
LMFDefFabric::LMFDefFabric
LMFDefFabric()
Definition: LMFDefFabric.cc:10
LMFDefFabric::getColorFromID
LMFColor getColorFromID(int color_id) const
Definition: LMFDefFabric.cc:51
LMFDefFabric::getTriggerTypes
std::list< LMFTrigType > getTriggerTypes() const
Definition: LMFDefFabric.cc:32
LMFDefFabric::_lmfRunTags
std::list< LMFRunTag > _lmfRunTags
Definition: LMFDefFabric.h:59
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
LMFDefFabric::getRunTagID
int getRunTagID(std::string tag, int version) const
Definition: LMFDefFabric.cc:145
LMFDefFabric::~LMFDefFabric
~LMFDefFabric() override
Definition: LMFDefFabric.cc:24
vertexPlots.e4
e4
Definition: vertexPlots.py:64
LMFDefFabric::noDebug
void noDebug()
Definition: LMFDefFabric.cc:28
EcalDBConnection
Definition: EcalDBConnection.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37