CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
LMFDefFabric Class Reference

#include <LMFDefFabric.h>

Inheritance diagram for LMFDefFabric:
IDBObject

Public Member Functions

void debug ()
 
void dump ()
 
LMFColor getColor (std::string name) const
 
LMFColor getColor (int color_index) const
 
LMFColor getColorFromID (int color_id) const
 
int getColorID (std::string name) const
 
int getColorID (int color_index) const
 
std::list< LMFColorgetColors () const
 
LMFRunTag getRunTag (std::string tag, int version) const
 
LMFRunTag getRunTagFromID (int runTag_id) const
 
int getRunTagID (std::string tag, int version) const
 
std::list< LMFRunTaggetRunTags () const
 
std::list< LMFTrigTypegetTriggerTypes () const
 
LMFTrigType getTrigType (std::string sname) const
 
LMFTrigType getTrigTypeFromID (int trigType_id) const
 
int getTrigTypeID (std::string sname) const
 
void initialize () noexcept(false)
 
 LMFDefFabric ()
 
 LMFDefFabric (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
 LMFDefFabric (EcalDBConnection *c)
 
void noDebug ()
 
 ~LMFDefFabric () override
 
- Public Member Functions inherited from IDBObject
oracle::occi::Connection * getConn () const
 
oracle::occi::Environment * getEnv () const
 
void setConnection (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
virtual ~IDBObject ()
 

Protected Attributes

bool _debug
 
std::list< LMFColor_lmfColors
 
std::list< LMFCorrVers_lmfCorrVersions
 
std::list< LMFPrimVers_lmfPrimVersions
 
std::list< LMFRunTag_lmfRunTags
 
std::list< LMFSeqVers_lmfSeqVersions
 
std::list< LMFTrigType_lmfTrigTypes
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS =1024
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const noexcept(false)
 

Detailed Description

Definition at line 25 of file LMFDefFabric.h.

Constructor & Destructor Documentation

LMFDefFabric::LMFDefFabric ( )

Definition at line 10 of file LMFDefFabric.cc.

References noDebug().

10  {
11  noDebug();
12 }
void noDebug()
Definition: LMFDefFabric.cc:34
LMFDefFabric::LMFDefFabric ( oracle::occi::Environment *  env,
oracle::occi::Connection *  conn 
)

Definition at line 14 of file LMFDefFabric.cc.

References initialize(), noDebug(), and IDBObject::setConnection().

15  {
16  noDebug();
17  setConnection(env, conn);
18  initialize();
19 }
void initialize() noexcept(false)
void noDebug()
Definition: LMFDefFabric.cc:34
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
LMFDefFabric::LMFDefFabric ( EcalDBConnection c)

Definition at line 21 of file LMFDefFabric.cc.

References EcalDBConnection::getConn(), EcalDBConnection::getEnv(), initialize(), noDebug(), and IDBObject::setConnection().

21  {
22  noDebug();
23  setConnection(c->getEnv(), c->getConn());
24  initialize();
25 }
void initialize() noexcept(false)
void noDebug()
Definition: LMFDefFabric.cc:34
oracle::occi::Environment * getEnv() const
oracle::occi::Connection * getConn() const
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
LMFDefFabric::~LMFDefFabric ( )
override

Definition at line 27 of file LMFDefFabric.cc.

27  {
28 }

Member Function Documentation

void LMFDefFabric::debug ( )

Definition at line 30 of file LMFDefFabric.cc.

References _debug.

Referenced by LMFRunIOV::operator=().

30  {
31  _debug = true;
32 }
void LMFDefFabric::dump ( void  )

Definition at line 247 of file LMFDefFabric.cc.

References _lmfColors, _lmfCorrVersions, _lmfPrimVersions, _lmfRunTags, _lmfSeqVersions, _lmfTrigTypes, gather_cfg::cout, SiPixelPhase1TrackClustersV_cfi::e3, and vertexPlots::e4.

Referenced by LMFRunIOV::dump().

247  {
248  std::cout << "========= Fabric dump @ address " << this << " ============"
249  << std::endl;
250  std::list<LMFColor>::const_iterator i1 = _lmfColors.begin();
251  std::list<LMFTrigType>::const_iterator i2 = _lmfTrigTypes.begin();
252  std::list<LMFRunTag>::const_iterator i3 = _lmfRunTags.begin();
253  std::list<LMFPrimVers>::const_iterator i4 = _lmfPrimVersions.begin();
254  std::list<LMFSeqVers>::const_iterator i5 = _lmfSeqVersions.begin();
255  std::list<LMFCorrVers>::const_iterator i6 = _lmfCorrVersions.begin();
256  std::list<LMFColor>::const_iterator e1 = _lmfColors.end();
257  std::list<LMFTrigType>::const_iterator e2 = _lmfTrigTypes.end();
258  std::list<LMFRunTag>::const_iterator e3 = _lmfRunTags.end();
259  std::list<LMFPrimVers>::const_iterator e4 = _lmfPrimVersions.end();
260  std::list<LMFSeqVers>::const_iterator e5 = _lmfSeqVersions.end();
261  std::list<LMFCorrVers>::const_iterator e6 = _lmfCorrVersions.end();
262  std::cout << "=== Colors" << std::endl;
263  while (i1 != e1) {
264  i1++->dump();
265  }
266  std::cout << "=== Trigger Types" << std::endl;
267  while (i2 != e2) {
268  i2++->dump();
269  }
270  std::cout << "=== Run Tags" << std::endl;
271  while (i3 != e3) {
272  i3++->dump();
273  }
274  std::cout << "=== Prim. Vers." << std::endl;
275  while (i4 != e4) {
276  i4++->dump();
277  }
278  std::cout << "=== Seq. Vers." << std::endl;
279  while (i5 != e5) {
280  i5++->dump();
281  }
282  std::cout << "=== Corr. Vers." << std::endl;
283  while (i6 != e6) {
284  i6++->dump();
285  }
286 }
std::list< LMFPrimVers > _lmfPrimVersions
Definition: LMFDefFabric.h:62
std::list< LMFTrigType > _lmfTrigTypes
Definition: LMFDefFabric.h:60
std::list< LMFSeqVers > _lmfSeqVersions
Definition: LMFDefFabric.h:63
std::list< LMFCorrVers > _lmfCorrVersions
Definition: LMFDefFabric.h:64
std::list< LMFColor > _lmfColors
Definition: LMFDefFabric.h:59
std::list< LMFRunTag > _lmfRunTags
Definition: LMFDefFabric.h:61
LMFColor LMFDefFabric::getColor ( std::string  name) const

Definition at line 50 of file LMFDefFabric.cc.

References _lmfColors, MillePedeFileConverter_cfg::e, mps_fire::i, heppy_loop::loop, and dataset::name.

Referenced by getColorID().

50  {
51  std::list<LMFColor>::const_iterator i = _lmfColors.begin();
52  std::list<LMFColor>::const_iterator e = _lmfColors.end();
53  LMFColor ret;
54  bool loop = true;
55  while ((loop) && (i != e)) {
56  if (i->getShortName() == name) {
57  ret = *i;
58  loop = false;
59  }
60  i++;
61  }
62  return ret;
63 }
std::list< LMFColor > _lmfColors
Definition: LMFDefFabric.h:59
LMFColor LMFDefFabric::getColor ( int  color_index) const

Definition at line 80 of file LMFDefFabric.cc.

References _lmfColors, MillePedeFileConverter_cfg::e, mps_fire::i, and heppy_loop::loop.

80  {
81  std::list<LMFColor>::const_iterator i = _lmfColors.begin();
82  std::list<LMFColor>::const_iterator e = _lmfColors.end();
83  LMFColor ret;
84  bool loop = true;
85  while ((loop) && (i != e)) {
86  if (i->getColorIndex() == index) {
87  ret = *i;
88  loop = false;
89  }
90  i++;
91  }
92  return ret;
93 }
std::list< LMFColor > _lmfColors
Definition: LMFDefFabric.h:59
LMFColor LMFDefFabric::getColorFromID ( int  color_id) const

Definition at line 65 of file LMFDefFabric.cc.

References _lmfColors, MillePedeFileConverter_cfg::e, mps_fire::i, triggerObjects_cff::id, and heppy_loop::loop.

65  {
66  std::list<LMFColor>::const_iterator i = _lmfColors.begin();
67  std::list<LMFColor>::const_iterator e = _lmfColors.end();
68  LMFColor ret;
69  bool loop = true;
70  while ((loop) && (i != e)) {
71  if (i->getID() == id) {
72  ret = *i;
73  loop = false;
74  }
75  i++;
76  }
77  return ret;
78 }
std::list< LMFColor > _lmfColors
Definition: LMFDefFabric.h:59
int LMFDefFabric::getColorID ( std::string  name) const

Definition at line 95 of file LMFDefFabric.cc.

References getColor(), and LMFUnique::getID().

Referenced by LMFRunIOV::setColor(), and LMFRunIOV::setColorIndex().

95  {
96  return getColor(sname).getID();
97 }
int getID() const
Definition: LMFUnique.h:52
LMFColor getColor(std::string name) const
Definition: LMFDefFabric.cc:50
int LMFDefFabric::getColorID ( int  color_index) const

Definition at line 99 of file LMFDefFabric.cc.

References getColor(), and LMFUnique::getID().

99  {
100  return getColor(index).getID();
101 }
int getID() const
Definition: LMFUnique.h:52
LMFColor getColor(std::string name) const
Definition: LMFDefFabric.cc:50
std::list< LMFColor > LMFDefFabric::getColors ( ) const

Definition at line 38 of file LMFDefFabric.cc.

References _lmfColors.

38  {
39  return _lmfColors;
40 }
std::list< LMFColor > _lmfColors
Definition: LMFDefFabric.h:59
LMFRunTag LMFDefFabric::getRunTag ( std::string  tag,
int  version 
) const

Definition at line 137 of file LMFDefFabric.cc.

References _lmfRunTags, MillePedeFileConverter_cfg::e, mps_fire::i, heppy_loop::loop, and jets_cff::version.

Referenced by getRunTagID().

137  {
138  std::list<LMFRunTag>::const_iterator i = _lmfRunTags.begin();
139  std::list<LMFRunTag>::const_iterator e = _lmfRunTags.end();
140  LMFRunTag rt;
141  bool loop = true;
142  while ((loop) && (i != e)) {
143  if ((i->getGeneralTag()) == tag && (i->getVersion() == version)) {
144  rt = *i;
145  }
146  i++;
147  }
148  return rt;
149 }
std::list< LMFRunTag > _lmfRunTags
Definition: LMFDefFabric.h:61
LMFRunTag LMFDefFabric::getRunTagFromID ( int  runTag_id) const

Definition at line 151 of file LMFDefFabric.cc.

References _lmfRunTags, MillePedeFileConverter_cfg::e, mps_fire::i, triggerObjects_cff::id, and heppy_loop::loop.

151  {
152  std::list<LMFRunTag>::const_iterator i = _lmfRunTags.begin();
153  std::list<LMFRunTag>::const_iterator e = _lmfRunTags.end();
154  LMFRunTag rt;
155  bool loop = true;
156  while ((loop) && (i != e)) {
157  if (i->getID() == id) {
158  rt = *i;
159  }
160  i++;
161  }
162  return rt;
163 }
std::list< LMFRunTag > _lmfRunTags
Definition: LMFDefFabric.h:61
int LMFDefFabric::getRunTagID ( std::string  tag,
int  version 
) const

Definition at line 165 of file LMFDefFabric.cc.

References LMFUnique::getID(), and getRunTag().

165  {
166  return getRunTag(tag, version).getID();
167 }
LMFRunTag getRunTag(std::string tag, int version) const
int getID() const
Definition: LMFUnique.h:52
std::list< LMFRunTag > LMFDefFabric::getRunTags ( ) const

Definition at line 46 of file LMFDefFabric.cc.

References _lmfRunTags.

46  {
47  return _lmfRunTags;
48 }
std::list< LMFRunTag > _lmfRunTags
Definition: LMFDefFabric.h:61
std::list< LMFTrigType > LMFDefFabric::getTriggerTypes ( ) const

Definition at line 42 of file LMFDefFabric.cc.

References _lmfTrigTypes.

42  {
43  return _lmfTrigTypes;
44 }
std::list< LMFTrigType > _lmfTrigTypes
Definition: LMFDefFabric.h:60
LMFTrigType LMFDefFabric::getTrigType ( std::string  sname) const

Definition at line 107 of file LMFDefFabric.cc.

References _lmfTrigTypes, MillePedeFileConverter_cfg::e, mps_fire::i, heppy_loop::loop, lumiContext::sname, and groupFilesInBlocks::tt.

Referenced by getTrigTypeID().

107  {
108  std::list<LMFTrigType>::const_iterator i = _lmfTrigTypes.begin();
109  std::list<LMFTrigType>::const_iterator e = _lmfTrigTypes.end();
110  LMFTrigType tt;
111  bool loop = true;
112  while ((loop) && (i != e)) {
113  if (i->getShortName() == sname) {
114  tt = *i;
115  loop = false;
116  }
117  i++;
118  }
119  return tt;
120 }
std::list< LMFTrigType > _lmfTrigTypes
Definition: LMFDefFabric.h:60
LMFTrigType LMFDefFabric::getTrigTypeFromID ( int  trigType_id) const

Definition at line 122 of file LMFDefFabric.cc.

References _lmfTrigTypes, MillePedeFileConverter_cfg::e, mps_fire::i, triggerObjects_cff::id, heppy_loop::loop, and groupFilesInBlocks::tt.

122  {
123  std::list<LMFTrigType>::const_iterator i = _lmfTrigTypes.begin();
124  std::list<LMFTrigType>::const_iterator e = _lmfTrigTypes.end();
125  LMFTrigType tt;
126  bool loop = true;
127  while ((loop) && (i != e)) {
128  if (i->getID() == id) {
129  tt = *i;
130  loop = false;
131  }
132  i++;
133  }
134  return tt;
135 }
std::list< LMFTrigType > _lmfTrigTypes
Definition: LMFDefFabric.h:60
int LMFDefFabric::getTrigTypeID ( std::string  sname) const

Definition at line 103 of file LMFDefFabric.cc.

References LMFUnique::getID(), and getTrigType().

Referenced by LMFRunIOV::setTriggerType().

103  {
104  return getTrigType(sname).getID();
105 }
int getID() const
Definition: LMFUnique.h:52
LMFTrigType getTrigType(std::string sname) const
void LMFDefFabric::initialize ( void  )
noexcept

Definition at line 169 of file LMFDefFabric.cc.

References _lmfColors, _lmfCorrVersions, _lmfPrimVersions, _lmfRunTags, _lmfSeqVersions, _lmfTrigTypes, EnergyCorrector::c, MillePedeFileConverter_cfg::e, LMFUnique::fetchAll(), mps_fire::i, IDBObject::m_conn, and IDBObject::m_env.

Referenced by LMFDefFabric().

170  {
171  _lmfColors.clear();
172  _lmfTrigTypes.clear();
173  _lmfRunTags.clear();
174  _lmfPrimVersions.clear();
175  _lmfSeqVersions.clear();
176  _lmfCorrVersions.clear();
177  if ((m_env != nullptr) && (m_conn != nullptr)) {
178  boost::ptr_list<LMFUnique> listOfObjects;
179  boost::ptr_list<LMFUnique>::const_iterator i;
180  boost::ptr_list<LMFUnique>::const_iterator e;
181  listOfObjects = LMFColor(m_env, m_conn).fetchAll();
182  i = listOfObjects.begin();
183  e = listOfObjects.end();
184  while (i != e) {
185  LMFColor *c = (LMFColor*)&(*i);
186  _lmfColors.push_back(*c);
187  i++;
188  }
189  listOfObjects.clear();
190  listOfObjects = LMFTrigType(m_env, m_conn).fetchAll();
191  i = listOfObjects.begin();
192  e = listOfObjects.end();
193  while (i != e) {
194  LMFTrigType *c = (LMFTrigType*)&(*i);
195  _lmfTrigTypes.push_back(*c);
196  i++;
197  }
198  listOfObjects.clear();
199  listOfObjects = LMFRunTag(m_env, m_conn).fetchAll();
200  i = listOfObjects.begin();
201  e = listOfObjects.end();
202  while (i != e) {
203  LMFRunTag *c = (LMFRunTag*)&(*i);
204  _lmfRunTags.push_back(*c);
205  i++;
206  }
207  listOfObjects.clear();
208  listOfObjects = LMFPrimVers(m_env, m_conn).fetchAll();
209  i = listOfObjects.begin();
210  e = listOfObjects.end();
211  while (i != e) {
212  LMFPrimVers *c = (LMFPrimVers*)&(*i);
213  _lmfPrimVersions.push_back(*c);
214  i++;
215  }
216  listOfObjects.clear();
217  listOfObjects = LMFCorrVers(m_env, m_conn).fetchAll();
218  i = listOfObjects.begin();
219  e = listOfObjects.end();
220  while (i != e) {
221  LMFCorrVers *c = (LMFCorrVers*)&(*i);
222  _lmfCorrVersions.push_back(*c);
223  i++;
224  }
225  listOfObjects.clear();
226  listOfObjects = LMFSeqVers(m_env, m_conn).fetchAll();
227  i = listOfObjects.begin();
228  e = listOfObjects.end();
229  while (i != e) {
230  LMFSeqVers *c = (LMFSeqVers*)&(*i);
231  _lmfSeqVersions.push_back(*c);
232  i++;
233  }
234  listOfObjects.clear();
235  _lmfColors.sort();
236  _lmfTrigTypes.sort();
237  _lmfRunTags.sort();
238  _lmfPrimVersions.sort();
239  _lmfSeqVersions.sort();
240  _lmfCorrVersions.sort();
241  } else {
242  throw(std::runtime_error("LMFDefFabric: cannot initialize since connection not"
243  "set"));
244  }
245 }
virtual boost::ptr_list< LMFUnique > fetchAll() const noexcept(false)
Definition: LMFUnique.cc:64
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::list< LMFPrimVers > _lmfPrimVersions
Definition: LMFDefFabric.h:62
std::list< LMFTrigType > _lmfTrigTypes
Definition: LMFDefFabric.h:60
std::list< LMFSeqVers > _lmfSeqVersions
Definition: LMFDefFabric.h:63
std::list< LMFCorrVers > _lmfCorrVersions
Definition: LMFDefFabric.h:64
std::list< LMFColor > _lmfColors
Definition: LMFDefFabric.h:59
std::list< LMFRunTag > _lmfRunTags
Definition: LMFDefFabric.h:61
void LMFDefFabric::noDebug ( )

Definition at line 34 of file LMFDefFabric.cc.

References _debug.

Referenced by LMFDefFabric().

34  {
35  _debug = false;
36 }

Member Data Documentation

bool LMFDefFabric::_debug
protected
std::list<LMFColor> LMFDefFabric::_lmfColors
protected

Definition at line 59 of file LMFDefFabric.h.

Referenced by dump(), getColor(), getColorFromID(), getColors(), and initialize().

std::list<LMFCorrVers> LMFDefFabric::_lmfCorrVersions
protected

Definition at line 64 of file LMFDefFabric.h.

Referenced by dump(), and initialize().

std::list<LMFPrimVers> LMFDefFabric::_lmfPrimVersions
protected

Definition at line 62 of file LMFDefFabric.h.

Referenced by dump(), and initialize().

std::list<LMFRunTag> LMFDefFabric::_lmfRunTags
protected

Definition at line 61 of file LMFDefFabric.h.

Referenced by dump(), getRunTag(), getRunTagFromID(), getRunTags(), and initialize().

std::list<LMFSeqVers> LMFDefFabric::_lmfSeqVersions
protected

Definition at line 63 of file LMFDefFabric.h.

Referenced by dump(), and initialize().

std::list<LMFTrigType> LMFDefFabric::_lmfTrigTypes
protected

Definition at line 60 of file LMFDefFabric.h.

Referenced by dump(), getTriggerTypes(), getTrigType(), getTrigTypeFromID(), and initialize().