CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cscmap Class Reference

#include <CSCMap.h>

Public Member Functions

void chamber_crate (std::string chamber_id, int *crate, int *dmb, int *sector, int *chamber_num, int *crate0, int *first_strip_index, int *strips_per_layer, int *chamber_index)
 
void crate0_chamber (int crate0, int dmb, std::string *chamber_id, int *chamber_num, int *sector, int *first_strip_index, int *strips_per_layer, int *chamber_index)
 
void crate_chamber (int crate, int dmb, std::string *chamber_id, int *chamber_num, int *sector, int *first_strip_index, int *strips_per_layer, int *chamber_index)
 
 cscmap () noexcept(false)
 
 ~cscmap () noexcept(false)
 

Private Attributes

oracle::occi::Connection * con
 
oracle::occi::Environment * env
 

Detailed Description

Definition at line 8 of file CSCMap.h.

Constructor & Destructor Documentation

◆ cscmap()

cscmap::cscmap ( )
noexcept

Constructor for cscmap

Definition at line 7 of file CSCMap.cc.

7  {
8  std::string db_user;
9  std::string db_pass;
10  env = oracle::occi::Environment::createEnvironment(oracle::occi::Environment::DEFAULT);
11  char *c_user = std::getenv("CSCMAP_AUTH_USER");
12  char *c_pass = std::getenv("CSCMAP_AUTH_PASSWORD");
13  db_user = std::string(c_user);
14  db_pass = std::string(c_pass);
15  con = env->createConnection(db_user, db_pass, "devdb");
16  std::cout << "Connection to mapping DB is done." << std::endl;
17 } // end of constructor cscmap ()

References con, gather_cfg::cout, SiStripPI::DEFAULT, env, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~cscmap()

cscmap::~cscmap ( )
noexcept

Destructor for cscmap

Destructor for cscmap.

Definition at line 21 of file CSCMap.cc.

21  {
22  env->terminateConnection(con);
23  oracle::occi::Environment::terminateEnvironment(env);
24 } // end of ~cscmap ()

References con, and env.

Member Function Documentation

◆ chamber_crate()

void cscmap::chamber_crate ( std::string  chamber_id,
int *  crate,
int *  dmb,
int *  sector,
int *  chamber_num,
int *  crate0,
int *  first_strip_index,
int *  strips_per_layer,
int *  chamber_index 
)

Definition at line 90 of file CSCMap.cc.

98  {
99  oracle::occi::Statement *stmt = con->createStatement();
100  stmt->setSQL("begin cscmap.crate0_proc(:1, :2, :3, :4, :5, :6, :7, :8, :9); end;");
101 
102  stmt->setString(1, chamber_id);
103  stmt->registerOutParam(2, oracle::occi::OCCIINT);
104  stmt->registerOutParam(3, oracle::occi::OCCIINT);
105  stmt->registerOutParam(4, oracle::occi::OCCIINT);
106  stmt->registerOutParam(5, oracle::occi::OCCIINT);
107  stmt->registerOutParam(6, oracle::occi::OCCIINT);
108  stmt->registerOutParam(7, oracle::occi::OCCIINT);
109  stmt->registerOutParam(8, oracle::occi::OCCIINT);
110  stmt->registerOutParam(9, oracle::occi::OCCIINT);
111 
112  stmt->execute(); //execute procedure
113 
114  *crate0 = stmt->getInt(2);
115  *crate = stmt->getInt(3);
116  *dmb = stmt->getInt(4);
117  *sector = stmt->getInt(5);
118  *chamber_num = stmt->getInt(6);
119  *chamber_index = stmt->getInt(7);
120  *first_strip_index = stmt->getInt(8);
121  *strips_per_layer = stmt->getInt(9);
122 
123  con->terminateStatement(stmt);
124 } //end of crate_chamber

References con.

◆ crate0_chamber()

void cscmap::crate0_chamber ( int  crate0,
int  dmb,
std::string *  chamber_id,
int *  chamber_num,
int *  sector,
int *  first_strip_index,
int *  strips_per_layer,
int *  chamber_index 
)

Definition at line 26 of file CSCMap.cc.

33  {
34  oracle::occi::Statement *stmt = con->createStatement();
35  stmt->setSQL("begin cscmap.chamber0(:1, :2, :3, :4, :5, :6, :7, :8); end;");
36 
37  stmt->setInt(1, crate0);
38  stmt->setInt(2, dmb);
39  stmt->registerOutParam(3, oracle::occi::OCCISTRING, 10);
40  stmt->registerOutParam(4, oracle::occi::OCCIINT);
41  stmt->registerOutParam(5, oracle::occi::OCCIINT);
42  stmt->registerOutParam(6, oracle::occi::OCCIINT);
43  stmt->registerOutParam(7, oracle::occi::OCCIINT);
44  stmt->registerOutParam(8, oracle::occi::OCCIINT);
45 
46  stmt->execute(); //execute procedure
47 
48  *chamber_id = stmt->getString(3);
49  *chamber_num = stmt->getInt(4);
50  *chamber_index = stmt->getInt(5);
51  *first_strip_index = stmt->getInt(6);
52  *strips_per_layer = stmt->getInt(7);
53  *sector = stmt->getInt(8);
54 
55  con->terminateStatement(stmt);
56 } //end of crate0_chamber

References con.

◆ crate_chamber()

void cscmap::crate_chamber ( int  crate,
int  dmb,
std::string *  chamber_id,
int *  chamber_num,
int *  sector,
int *  first_strip_index,
int *  strips_per_layer,
int *  chamber_index 
)

Definition at line 58 of file CSCMap.cc.

65  {
66  oracle::occi::Statement *stmt = con->createStatement();
67  stmt->setSQL("begin cscmap.chamber(:1, :2, :3, :4, :5, :6, :7, :8); end;");
68 
69  stmt->setInt(1, crate);
70  stmt->setInt(2, dmb);
71  stmt->registerOutParam(3, oracle::occi::OCCISTRING, 10);
72  stmt->registerOutParam(4, oracle::occi::OCCIINT);
73  stmt->registerOutParam(5, oracle::occi::OCCIINT);
74  stmt->registerOutParam(6, oracle::occi::OCCIINT);
75  stmt->registerOutParam(7, oracle::occi::OCCIINT);
76  stmt->registerOutParam(8, oracle::occi::OCCIINT);
77 
78  stmt->execute(); //execute procedure
79 
80  *chamber_id = stmt->getString(3);
81  *chamber_num = stmt->getInt(4);
82  *chamber_index = stmt->getInt(5);
83  *first_strip_index = stmt->getInt(6);
84  *strips_per_layer = stmt->getInt(7);
85  *sector = stmt->getInt(8);
86 
87  con->terminateStatement(stmt);
88 } //end of crate_chamber

References con.

Member Data Documentation

◆ con

oracle::occi::Connection* cscmap::con
private

Definition at line 11 of file CSCMap.h.

Referenced by chamber_crate(), crate0_chamber(), crate_chamber(), cscmap(), and ~cscmap().

◆ env

oracle::occi::Environment* cscmap::env
private

Definition at line 10 of file CSCMap.h.

Referenced by cscmap(), and ~cscmap().

SiStripPI::DEFAULT
Definition: SiStripPayloadInspectorHelper.h:786
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cscmap::con
oracle::occi::Connection * con
Definition: CSCMap.h:11
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cscmap::env
oracle::occi::Environment * env
Definition: CSCMap.h:10