CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
DBlmapReader Class Reference

#include <DBlmapReader.h>

Public Member Functions

 DBlmapReader ()
 
VectorLMAPGetLMAP (int version)
 
void lrTestFunction (void)
 
void PrintEMAPfromLMAP (FILE *emap, VectorLMAP *lmapHBEFO)
 
void PrintLMAP (FILE *HBEFmap, FILE *HOmap, VectorLMAP *lmapHBEFO)
 

Detailed Description

Definition at line 80 of file DBlmapReader.h.

Constructor & Destructor Documentation

DBlmapReader::DBlmapReader ( )
inline

Definition at line 82 of file DBlmapReader.h.

82 { };

Member Function Documentation

VectorLMAP * DBlmapReader::GetLMAP ( int  version = 30)

Definition at line 19 of file DBlmapReader.cc.

References convertSQLitetoXML_cfg::connect, gather_cfg::cout, EcalCondDB::db, alignCSCRings::e, getInt(), o2o::query, sstemp, and AlCaHLTBitMon_QueryRunRegistry::string.

19  {
20  HCALConfigDB * db = new HCALConfigDB();
21  const std::string _accessor = "occi://CMS_HCL_PRTTYPE_HCAL_READER@anyhost/int2r?PASSWORD=HCAL_Reader_88,LHWM_VERSION=22";
22  db -> connect( _accessor );
23 
24  oracle::occi::Connection * myConn = db -> getConnection();
25 
26  int CHAcount = 0;
27  VectorLMAP* lmapHBEFO = new VectorLMAP();
28 
29  sstemp.str("");
30  sstemp<<"'"<<LMversion<<"'";
31  std::string verstring = sstemp.str();
32  sstemp.str("");
33 
34  try {
35  Statement* stmt = myConn -> createStatement();
36 
37  std::string query = (" SELECT C.VERSION, ");
38  query += " H.SIDE, H.ETA, H.PHI, ";
39  query += " H.DELTA_PHI, H.DEPTH, H.SUBDETECTOR, H.RBX, H.WEDGE, ";
40  query += " H.SECTOR, H.RM_SLOT, H.HPD_PIXEL, H.QIE_SLOT, H.ADC, ";
41  query += " H.RM_FIBER, H.FIBER_CHANNEL, H.LETTER_CODE, H.CRATE, H.HTR_SLOT, ";
42  query += " H.HTR_FPGA, H.HTR_FIBER, H.DCC_SL, H.SPIGOT, H.DCC_SLOT, ";
43  query += " H.SLB_SITE, H.SLB_CHANNEL, H.SLB_CHANNEL2, H.SLB_CABLE, H.RCT_CRATE, ";
44  query += " H.RCT_CARD, H.RCT_CONNECTOR, H.RCT_NAME, H.FED_ID ";
45  query += " FROM CMS_HCL_HCAL_CONDITION_OWNER.HCAL_HARDWARE_LOGICAL_MAPS_V3 H inner join ";
46  query += " CMS_HCL_CORE_CONDITION_OWNER.COND_DATA_SETS C ";
47  query += " on C.CONDITION_DATA_SET_ID=H.CONDITION_DATA_SET_ID ";
48  query += " inner join CMS_HCL_CORE_CONDITION_OWNER.KINDS_OF_CONDITIONS K ";
49  query += " on K.KIND_OF_CONDITION_ID=C.KIND_OF_CONDITION_ID ";
50  query += " where C.IS_RECORD_DELETED='F' and K.IS_RECORD_DELETED='F' ";
51  query += " and K.NAME='HCAL hardware logical channel maps v3' ";
52  query += " and C.VERSION=";
53  query += verstring;
54 
55  //SELECT
56  ResultSet *rs = stmt->executeQuery(query.c_str());
57 
58  while (rs->next() && CHAcount < 10000) {
59 
60  lmapHBEFO -> versionC . push_back( rs -> getInt(1) );
61  lmapHBEFO -> sideC . push_back( rs -> getInt(2) );
62  lmapHBEFO -> etaC . push_back( rs -> getInt(3) );
63  lmapHBEFO -> phiC . push_back( rs -> getInt(4) );
64  lmapHBEFO -> dphiC . push_back( rs -> getInt(5) );
65 
66  lmapHBEFO -> depthC . push_back( rs -> getInt(6) );
67  lmapHBEFO -> detC . push_back( rs -> getString(7) );
68  lmapHBEFO -> rbxC . push_back( rs -> getString(8) );
69  lmapHBEFO -> wedgeC . push_back( rs -> getInt(9) );
70  lmapHBEFO -> sectorC . push_back( rs -> getInt(10) );
71 
72  lmapHBEFO -> rmC . push_back( rs -> getInt(11) );
73  lmapHBEFO -> pixelC . push_back( rs -> getInt(12) );
74  lmapHBEFO -> qieC . push_back( rs -> getInt(13) );
75  lmapHBEFO -> adcC . push_back( rs -> getInt(14) );
76  lmapHBEFO -> rm_fiC . push_back( rs -> getInt(15) );
77 
78  lmapHBEFO -> fi_chC . push_back( rs -> getInt(16) );
79  lmapHBEFO -> let_codeC . push_back( rs -> getString(17) );
80  lmapHBEFO -> crateC . push_back( rs -> getInt(18) );
81  lmapHBEFO -> htrC . push_back( rs -> getInt(19) );
82  lmapHBEFO -> fpgaC . push_back( rs -> getString(20) );
83 
84  lmapHBEFO -> htr_fiC . push_back( rs -> getInt(21) );
85  lmapHBEFO -> dcc_slC . push_back( rs -> getInt(22) );
86  lmapHBEFO -> spigoC . push_back( rs -> getInt(23) );
87  lmapHBEFO -> dccC . push_back( rs -> getInt(24) );
88  lmapHBEFO -> slbC . push_back( rs -> getInt(25) );
89 
90  lmapHBEFO -> slbinC . push_back( rs -> getString(26) );
91  lmapHBEFO -> slbin2C . push_back( rs -> getString(27) );
92  lmapHBEFO -> slnamC . push_back( rs -> getString(28) );
93  lmapHBEFO -> rctcraC . push_back( rs -> getInt(29) );
94  lmapHBEFO -> rctcarC . push_back( rs -> getInt(30) );
95 
96  lmapHBEFO -> rctconC . push_back( rs -> getInt(31) );
97  lmapHBEFO -> rctnamC . push_back( rs -> getString(32) );
98  lmapHBEFO -> fedidC . push_back( rs -> getInt(33) );
99 
100  lmapHBEFO -> orderC . push_back( CHAcount );
101 
102  CHAcount++;
103  }
104  //Always terminate statement
105  myConn -> terminateStatement(stmt);
106  }
107  catch (SQLException& e) {
108  std::cout<<"Couldn't get statement"<<std::endl;
109  }
110  db -> disconnect();
111 
112  return lmapHBEFO;
113 }
tuple db
Definition: EcalCondDB.py:151
int getInt(ResultSet *rset, int ipar)
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
Gather config data from online DB.
Definition: HCALConfigDB.h:21
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
tuple query
Definition: o2o.py:269
tuple cout
Definition: gather_cfg.py:145
stringstream sstemp
Definition: DBlmapReader.cc:11
void DBlmapReader::lrTestFunction ( void  )

Definition at line 13 of file DBlmapReader.cc.

References gather_cfg::cout.

13  {
14 
15  std::cout<<"Hello"<<std::endl;
16  return;
17 }
tuple cout
Definition: gather_cfg.py:145
void DBlmapReader::PrintEMAPfromLMAP ( FILE *  emap,
VectorLMAP lmapHBEFO 
)

Definition at line 142 of file DBlmapReader.cc.

References i, VectorLMAP::orderC, printEMAProw(), SortByGeometry(), and SortByHardware().

142  {
143 
144  int CHAcount = lmapHBEFO->orderC.size();
145 
146  lmapHBEFO = SortByHardware(lmapHBEFO);
147  for (i = 0; i < CHAcount; i++){
148  if (lmapHBEFO ->detC[lmapHBEFO -> orderC[i]] != "HO") printEMAProw(i, emap, lmapHBEFO);
149  }
150 
151  lmapHBEFO = SortByGeometry(lmapHBEFO);
152  for (i = 0; i < CHAcount; i++){
153  if (lmapHBEFO -> detC[lmapHBEFO -> orderC[i]] == "HO") printEMAProw(i, emap, lmapHBEFO);
154  }
155 
156  return;
157 }
VectorLMAP * SortByGeometry(VectorLMAP *lmapHBEFO)
int i
Definition: DBlmapReader.cc:9
void printEMAProw(int channel, FILE *emap, VectorLMAP *lmap)
std::vector< int > orderC
Definition: DBlmapReader.h:68
VectorLMAP * SortByHardware(VectorLMAP *lmapHBEFO)
void DBlmapReader::PrintLMAP ( FILE *  HBEFmap,
FILE *  HOmap,
VectorLMAP lmapHBEFO 
)

Definition at line 115 of file DBlmapReader.cc.

References gather_cfg::cout, i, VectorLMAP::orderC, printHBHEHF(), printHO(), SortByGeometry(), and SortByHardware().

115  {
116 
117  int CHAcount = lmapHBEFO->orderC.size();
118 
119  lmapHBEFO = SortByHardware(lmapHBEFO);
120  for (i = 0; i < CHAcount; i++){
121  if (lmapHBEFO -> orderC[i] >= CHAcount){
122  std::cout<<"Bad order vector";
123  break;
124  }
125 
126  if (lmapHBEFO -> detC[lmapHBEFO -> orderC[i]] != "HO") printHBHEHF(i, HBEFmap, lmapHBEFO);
127  }
128 
129  lmapHBEFO = SortByGeometry(lmapHBEFO);
130  for (i = 0; i < CHAcount; i++){
131  if (lmapHBEFO -> orderC[i] >= CHAcount){
132  std::cout<<"Bad order vector";
133  break;
134  }
135  if (lmapHBEFO -> detC[lmapHBEFO -> orderC[i]] == "HO") printHO(i, HOmap, lmapHBEFO);
136  }
137 
138  std::cout<<CHAcount<<std::endl;
139  return;
140 }
VectorLMAP * SortByGeometry(VectorLMAP *lmapHBEFO)
int i
Definition: DBlmapReader.cc:9
void printHO(int channel, FILE *HOmap, VectorLMAP *lmap)
void printHBHEHF(int channel, FILE *HBEFmap, VectorLMAP *lmap)
std::vector< int > orderC
Definition: DBlmapReader.h:68
VectorLMAP * SortByHardware(VectorLMAP *lmapHBEFO)
tuple cout
Definition: gather_cfg.py:145