CMS 3D CMS Logo

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

#include <CSCMap1.h>

Public Member Functions

void chamber (int chamberid, CSCMapItem::MapItem *item)
 
void cratedmb (int crate, int dmb, CSCMapItem::MapItem *item)
 
 cscmap1 () noexcept(false)
 
void ruiddu (int rui, int ddu_input, CSCMapItem::MapItem *item)
 
 ~cscmap1 () noexcept(false)
 

Private Attributes

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

Detailed Description

Definition at line 9 of file CSCMap1.h.

Constructor & Destructor Documentation

◆ cscmap1()

cscmap1::cscmap1 ( )
noexcept

Constructor for cscmap1

Definition at line 8 of file CSCMap1.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, "cms_orcoff_prod");
19  std::cout << "Connection to mapping DB is done." << std::endl;
20 } // end of constructor cscmap1 ()
assert(be >=bs)
oracle::occi::Connection * con
Definition: CSCMap1.h:12
oracle::occi::Environment * env
Definition: CSCMap1.h:11

◆ ~cscmap1()

cscmap1::~cscmap1 ( )
noexcept

Destructor for cscmap1

Destructor for cscmap1.

Definition at line 25 of file CSCMap1.cc.

References con, and env.

25  {
26  env->terminateConnection(con);
27  oracle::occi::Environment::terminateEnvironment(env);
28 } // end of ~cscmap1 ()
oracle::occi::Connection * con
Definition: CSCMap1.h:12
oracle::occi::Environment * env
Definition: CSCMap1.h:11

Member Function Documentation

◆ chamber()

void cscmap1::chamber ( int  chamberid,
CSCMapItem::MapItem item 
)

Definition at line 30 of file CSCMap1.cc.

References con, makeMuonMisalignmentScenario::endcap, B2GTnPMonitor_cfi::item, mergeAndRegister::rest, relativeConstraints::ring, and relativeConstraints::station.

Referenced by cratedmb(), geometryXMLparser.CSCAlignable::index(), and ruiddu().

30  {
31  oracle::occi::Statement *stmt = con->createStatement();
32 
33  stmt->setSQL(
34  "begin cms_emu_cern.cscmap.chamberid_crate(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, "
35  ":16, :17, :18, :19, :20); end;");
36 
37  stmt->setInt(1, chamberid);
38  stmt->registerOutParam(2, oracle::occi::OCCISTRING, 10);
39  stmt->registerOutParam(3, oracle::occi::OCCIINT);
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  stmt->registerOutParam(9, oracle::occi::OCCIINT);
46  stmt->registerOutParam(10, oracle::occi::OCCISTRING, 10);
47  stmt->registerOutParam(11, oracle::occi::OCCIINT);
48  stmt->registerOutParam(12, oracle::occi::OCCIINT);
49  stmt->registerOutParam(13, oracle::occi::OCCIINT);
50  stmt->registerOutParam(14, oracle::occi::OCCIINT);
51  stmt->registerOutParam(15, oracle::occi::OCCIINT);
52  stmt->registerOutParam(16, oracle::occi::OCCIINT);
53  stmt->registerOutParam(17, oracle::occi::OCCIINT);
54  stmt->registerOutParam(18, oracle::occi::OCCIINT);
55  stmt->registerOutParam(19, oracle::occi::OCCIINT);
56  stmt->registerOutParam(20, oracle::occi::OCCIINT);
57 
58  stmt->execute(); //execute procedure
59 
60  item->chamberLabel = stmt->getString(10);
61  item->chamberId = chamberid;
62  int chamber = chamberid / 10 % 100;
63  int rest = (chamberid - chamber * 10) / 1000;
64  int ring = rest % 10;
65  rest = (rest - ring) / 10;
66  int station = rest % 10;
67  int endcap = (rest - station) / 10;
68  item->endcap = endcap;
69  item->station = station;
70  item->ring = ring;
71  item->chamber = chamber;
72  item->cscIndex = stmt->getInt(13);
73  item->layerIndex = stmt->getInt(14);
74  item->stripIndex = stmt->getInt(15);
75  item->anodeIndex = stmt->getInt(16);
76  item->strips = stmt->getInt(11);
77  item->anodes = stmt->getInt(12);
78  item->crateLabel = stmt->getString(2);
79  item->crateid = stmt->getInt(3);
80  item->sector = stmt->getInt(8);
81  item->trig_sector = stmt->getInt(9);
82  item->dmb = stmt->getInt(5);
83  item->cscid = stmt->getInt(7);
84 
85  stmt->setSQL(
86  "begin cms_emu_cern.ddumap.chamberid_ddu(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, "
87  ":17, :18, :19); end;");
88 
89  stmt->setInt(1, chamberid);
90  stmt->registerOutParam(2, oracle::occi::OCCIINT);
91  stmt->registerOutParam(3, oracle::occi::OCCIINT);
92  stmt->registerOutParam(4, oracle::occi::OCCIINT);
93  stmt->registerOutParam(5, oracle::occi::OCCIINT);
94  stmt->registerOutParam(6, oracle::occi::OCCISTRING, 10);
95  stmt->registerOutParam(7, oracle::occi::OCCIINT);
96  stmt->registerOutParam(8, oracle::occi::OCCIINT);
97  stmt->registerOutParam(9, oracle::occi::OCCIINT);
98  stmt->registerOutParam(10, oracle::occi::OCCISTRING, 10);
99  stmt->registerOutParam(11, oracle::occi::OCCIINT);
100  stmt->registerOutParam(12, oracle::occi::OCCISTRING, 10);
101  stmt->registerOutParam(13, oracle::occi::OCCIINT);
102  stmt->registerOutParam(14, oracle::occi::OCCISTRING, 10);
103  stmt->registerOutParam(15, oracle::occi::OCCIINT);
104  stmt->registerOutParam(16, oracle::occi::OCCIINT);
105  stmt->registerOutParam(17, oracle::occi::OCCIINT);
106  stmt->registerOutParam(18, oracle::occi::OCCIINT);
107  stmt->registerOutParam(19, oracle::occi::OCCIINT);
108 
109  stmt->execute(); //execute procedure
110 
111  item->ddu = stmt->getInt(2);
112  item->ddu_input = stmt->getInt(5);
113  item->slink = stmt->getInt(7);
114 
115  item->fed_crate = stmt->getInt(3);
116  item->ddu_slot = stmt->getInt(4);
117  item->dcc_fifo = stmt->getString(6);
118  item->fiber_crate = stmt->getInt(8);
119  item->fiber_pos = stmt->getInt(9);
120  item->fiber_socket = stmt->getString(10);
121 
122  con->terminateStatement(stmt);
123 } //end of chamber
void chamber(int chamberid, CSCMapItem::MapItem *item)
Definition: CSCMap1.cc:30
oracle::occi::Connection * con
Definition: CSCMap1.h:12

◆ cratedmb()

void cscmap1::cratedmb ( int  crate,
int  dmb,
CSCMapItem::MapItem item 
)

Definition at line 125 of file CSCMap1.cc.

References chamber(), con, FCDTask_cfi::crate, makeMuonMisalignmentScenario::endcap, B2GTnPMonitor_cfi::item, mergeAndRegister::rest, relativeConstraints::ring, and relativeConstraints::station.

125  {
126  oracle::occi::Statement *stmt = con->createStatement();
127 
128  stmt->setSQL(
129  "begin cms_emu_cern.cscmap.crateid_chamber(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, "
130  ":16, :17); end;");
131 
132  stmt->setInt(1, crate);
133  stmt->setInt(2, dmb);
134  stmt->registerOutParam(3, oracle::occi::OCCISTRING, 10);
135  stmt->registerOutParam(4, oracle::occi::OCCIINT);
136  stmt->registerOutParam(5, oracle::occi::OCCIINT);
137  stmt->registerOutParam(6, oracle::occi::OCCIINT);
138  stmt->registerOutParam(7, oracle::occi::OCCIINT);
139  stmt->registerOutParam(8, oracle::occi::OCCIINT);
140  stmt->registerOutParam(9, oracle::occi::OCCIINT);
141  stmt->registerOutParam(10, oracle::occi::OCCIINT);
142  stmt->registerOutParam(11, oracle::occi::OCCISTRING, 10);
143  stmt->registerOutParam(12, oracle::occi::OCCIINT);
144  stmt->registerOutParam(13, oracle::occi::OCCIINT);
145  stmt->registerOutParam(14, oracle::occi::OCCIINT);
146  stmt->registerOutParam(15, oracle::occi::OCCIINT);
147  stmt->registerOutParam(16, oracle::occi::OCCIINT);
148  stmt->registerOutParam(17, oracle::occi::OCCIINT);
149 
150  stmt->execute(); //execute procedure
151 
152  item->chamberLabel = stmt->getString(3);
153  item->chamberId = stmt->getInt(4);
154  int chamberid = item->chamberId;
155  int chamber = chamberid / 10 % 100;
156  int rest = (chamberid - chamber * 10) / 1000;
157  int ring = rest % 10;
158  rest = (rest - ring) / 10;
159  int station = rest % 10;
160  int endcap = (rest - station) / 10;
161  item->endcap = endcap;
162  item->station = station;
163  item->ring = ring;
164  item->chamber = chamber;
165  item->cscIndex = stmt->getInt(14);
166  item->layerIndex = stmt->getInt(15);
167  item->stripIndex = stmt->getInt(16);
168  item->anodeIndex = stmt->getInt(17);
169  item->strips = stmt->getInt(12);
170  item->anodes = stmt->getInt(13);
171  item->crateLabel = stmt->getString(11);
172  item->crateid = stmt->getInt(9);
173  item->sector = stmt->getInt(7);
174  item->trig_sector = stmt->getInt(8);
175  item->dmb = dmb;
176  item->cscid = stmt->getInt(5);
177 
178  stmt->setSQL(
179  "begin cms_emu_cern.ddumap.chamberid_ddu(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, "
180  ":17, :18, :19); end;");
181 
182  stmt->setInt(1, chamberid);
183  stmt->registerOutParam(2, oracle::occi::OCCIINT);
184  stmt->registerOutParam(3, oracle::occi::OCCIINT);
185  stmt->registerOutParam(4, oracle::occi::OCCIINT);
186  stmt->registerOutParam(5, oracle::occi::OCCIINT);
187  stmt->registerOutParam(6, oracle::occi::OCCISTRING, 10);
188  stmt->registerOutParam(7, oracle::occi::OCCIINT);
189  stmt->registerOutParam(8, oracle::occi::OCCIINT);
190  stmt->registerOutParam(9, oracle::occi::OCCIINT);
191  stmt->registerOutParam(10, oracle::occi::OCCISTRING, 10);
192  stmt->registerOutParam(11, oracle::occi::OCCIINT);
193  stmt->registerOutParam(12, oracle::occi::OCCISTRING, 10);
194  stmt->registerOutParam(13, oracle::occi::OCCIINT);
195  stmt->registerOutParam(14, oracle::occi::OCCISTRING, 10);
196  stmt->registerOutParam(15, oracle::occi::OCCIINT);
197  stmt->registerOutParam(16, oracle::occi::OCCIINT);
198  stmt->registerOutParam(17, oracle::occi::OCCIINT);
199  stmt->registerOutParam(18, oracle::occi::OCCIINT);
200  stmt->registerOutParam(19, oracle::occi::OCCIINT);
201 
202  stmt->execute(); //execute procedure
203 
204  item->ddu = stmt->getInt(2);
205  item->ddu_input = stmt->getInt(5);
206  item->slink = stmt->getInt(7);
207 
208  item->fed_crate = stmt->getInt(3);
209  item->ddu_slot = stmt->getInt(4);
210  item->dcc_fifo = stmt->getString(6);
211  item->fiber_crate = stmt->getInt(8);
212  item->fiber_pos = stmt->getInt(9);
213  item->fiber_socket = stmt->getString(10);
214 
215  con->terminateStatement(stmt);
216 } //end of cratedmb
void chamber(int chamberid, CSCMapItem::MapItem *item)
Definition: CSCMap1.cc:30
oracle::occi::Connection * con
Definition: CSCMap1.h:12

◆ ruiddu()

void cscmap1::ruiddu ( int  rui,
int  ddu_input,
CSCMapItem::MapItem item 
)

Definition at line 218 of file CSCMap1.cc.

References chamber(), con, makeMuonMisalignmentScenario::endcap, B2GTnPMonitor_cfi::item, mergeAndRegister::rest, relativeConstraints::ring, and relativeConstraints::station.

218  {
219  oracle::occi::Statement *stmt = con->createStatement();
220 
221  stmt->setSQL(
222  "begin cms_emu_cern.ddumap.ddu_chamber(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, "
223  ":17, :18, :19); end;");
224 
225  stmt->setInt(1, rui);
226  stmt->setInt(2, ddu_input);
227  stmt->registerOutParam(3, oracle::occi::OCCIINT);
228  stmt->registerOutParam(4, oracle::occi::OCCIINT);
229  stmt->registerOutParam(5, oracle::occi::OCCISTRING, 10);
230  stmt->registerOutParam(6, oracle::occi::OCCIINT);
231  stmt->registerOutParam(7, oracle::occi::OCCIINT);
232  stmt->registerOutParam(8, oracle::occi::OCCIINT);
233  stmt->registerOutParam(9, oracle::occi::OCCISTRING, 10);
234  stmt->registerOutParam(10, oracle::occi::OCCIINT);
235  stmt->registerOutParam(11, oracle::occi::OCCISTRING, 10);
236  stmt->registerOutParam(12, oracle::occi::OCCIINT);
237  stmt->registerOutParam(13, oracle::occi::OCCISTRING, 10);
238  stmt->registerOutParam(14, oracle::occi::OCCIINT);
239  stmt->registerOutParam(15, oracle::occi::OCCIINT);
240  stmt->registerOutParam(16, oracle::occi::OCCIINT);
241  stmt->registerOutParam(17, oracle::occi::OCCIINT);
242  stmt->registerOutParam(18, oracle::occi::OCCIINT);
243  stmt->registerOutParam(19, oracle::occi::OCCIINT);
244 
245  stmt->execute(); //execute procedure
246 
247  item->ddu = rui;
248  item->ddu_input = ddu_input;
249  item->slink = stmt->getInt(6);
250 
251  item->fed_crate = stmt->getInt(3);
252  item->ddu_slot = stmt->getInt(4);
253  item->dcc_fifo = stmt->getString(5);
254  item->fiber_crate = stmt->getInt(7);
255  item->fiber_pos = stmt->getInt(8);
256  item->fiber_socket = stmt->getString(9);
257  int chamberid = stmt->getInt(14);
258 
259  stmt->setSQL(
260  "begin cms_emu_cern.cscmap.chamberid_crate(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, "
261  ":16, :17, :18, :19, :20); end;");
262 
263  stmt->setInt(1, chamberid);
264  stmt->registerOutParam(2, oracle::occi::OCCISTRING, 10);
265  stmt->registerOutParam(3, oracle::occi::OCCIINT);
266  stmt->registerOutParam(4, oracle::occi::OCCIINT);
267  stmt->registerOutParam(5, oracle::occi::OCCIINT);
268  stmt->registerOutParam(6, oracle::occi::OCCIINT);
269  stmt->registerOutParam(7, oracle::occi::OCCIINT);
270  stmt->registerOutParam(8, oracle::occi::OCCIINT);
271  stmt->registerOutParam(9, oracle::occi::OCCIINT);
272  stmt->registerOutParam(10, oracle::occi::OCCISTRING, 10);
273  stmt->registerOutParam(11, oracle::occi::OCCIINT);
274  stmt->registerOutParam(12, oracle::occi::OCCIINT);
275  stmt->registerOutParam(13, oracle::occi::OCCIINT);
276  stmt->registerOutParam(14, oracle::occi::OCCIINT);
277  stmt->registerOutParam(15, oracle::occi::OCCIINT);
278  stmt->registerOutParam(16, oracle::occi::OCCIINT);
279  stmt->registerOutParam(17, oracle::occi::OCCIINT);
280  stmt->registerOutParam(18, oracle::occi::OCCIINT);
281  stmt->registerOutParam(19, oracle::occi::OCCIINT);
282  stmt->registerOutParam(20, oracle::occi::OCCIINT);
283 
284  stmt->execute(); //execute procedure
285 
286  item->chamberLabel = stmt->getString(10);
287  item->chamberId = chamberid;
288  int chamber = chamberid / 10 % 100;
289  int rest = (chamberid - chamber * 10) / 1000;
290  int ring = rest % 10;
291  rest = (rest - ring) / 10;
292  int station = rest % 10;
293  int endcap = (rest - station) / 10;
294  item->endcap = endcap;
295  item->station = station;
296  item->ring = ring;
297  item->chamber = chamber;
298  item->cscIndex = stmt->getInt(13);
299  item->layerIndex = stmt->getInt(14);
300  item->stripIndex = stmt->getInt(15);
301  item->anodeIndex = stmt->getInt(16);
302  item->strips = stmt->getInt(11);
303  item->anodes = stmt->getInt(12);
304  item->crateLabel = stmt->getString(2);
305  item->crateid = stmt->getInt(3);
306  item->sector = stmt->getInt(8);
307  item->trig_sector = stmt->getInt(9);
308  item->dmb = stmt->getInt(5);
309  item->cscid = stmt->getInt(7);
310 
311  stmt->execute(); //execute procedure
312 
313  con->terminateStatement(stmt);
314 } //end of ruiddu
void chamber(int chamberid, CSCMapItem::MapItem *item)
Definition: CSCMap1.cc:30
oracle::occi::Connection * con
Definition: CSCMap1.h:12

Member Data Documentation

◆ con

oracle::occi::Connection* cscmap1::con
private

Definition at line 12 of file CSCMap1.h.

Referenced by chamber(), cratedmb(), cscmap1(), ruiddu(), and ~cscmap1().

◆ env

oracle::occi::Environment* cscmap1::env
private

Definition at line 11 of file CSCMap1.h.

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