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 8 of file CSCMap.cc.

References cms::cuda::assert(), con, gather_cfg::cout, copyBadStrip_cfg::db_user, SiStripPI::DEFAULT, env, and AlCaHLTBitMon_QueryRunRegistry::string.

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

◆ ~cscmap()

cscmap::~cscmap ( )
noexcept

Destructor for cscmap

Destructor for cscmap.

Definition at line 24 of file CSCMap.cc.

References con, and env.

24  {
25  env->terminateConnection(con);
26  oracle::occi::Environment::terminateEnvironment(env);
27 } // end of ~cscmap ()
oracle::occi::Environment * env
Definition: CSCMap.h:10
oracle::occi::Connection * con
Definition: CSCMap.h:11

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 93 of file CSCMap.cc.

References con, FCDTask_cfi::crate, and nano_mu_digi_cff::sector.

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

◆ 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 29 of file CSCMap.cc.

References con, and nano_mu_digi_cff::sector.

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

◆ 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 61 of file CSCMap.cc.

References con, FCDTask_cfi::crate, and nano_mu_digi_cff::sector.

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

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().