Various manipulations with QIE and QIE ADC.
More...
#include <HcalQIEManager.h>
|
static std::vector< std::string > | splitString (const std::string &fLine) |
|
Various manipulations with QIE and QIE ADC.
- Author
- Gena Kukartsev
Definition at line 41 of file HcalQIEManager.h.
◆ HcalQIEManager()
HcalQIEManager::HcalQIEManager |
( |
void |
| ) |
|
◆ ~HcalQIEManager()
HcalQIEManager::~HcalQIEManager |
( |
void |
| ) |
|
◆ generateQieTable()
int HcalQIEManager::generateQieTable |
( |
std::string |
db_file, |
|
|
std::string |
old_file, |
|
|
std::string |
output_file |
|
) |
| |
Definition at line 211 of file HcalQIEManager.cc.
218 std::cout <<
"Creating the output file for bad channels: " << badchan_file <<
"... ";
220 bad_file.open(badchan_file.c_str());
228 int goodChannels = 0;
230 std::cout <<
"old size: " << _old.size() << std::endl;
231 std::cout <<
"new size: " << _new.size() << std::endl;
232 for (std::map<HcalChannelId, HcalQIECaps>::const_iterator
line = _old.begin();
line != _old.end();
line++) {
235 bool badchannel =
false;
236 if (_new.find(theId) == _new.end()) {
239 the_caps = &_old[theId];
242 the_caps = &_new[theId];
253 for (
int j = 0;
j != 32;
j++) {
254 double _x = the_caps->
caps[
j];
255 sprintf(
buffer,
" %8.5f", _x);
262 bad_file << std::endl;
265 std::cout << goodChannels <<
" " << badChannels <<
" " << goodChannels + badChannels << std::endl;
References edmScanValgrind::buffer, HcalQIECaps::caps, gather_cfg::cout, HcalChannelId::depth, LEDCalibrationChannels::depth, HcalChannelId::eta, PVValHelper::eta, dqmiolumiharvest::j, mps_splice::line, DeadROCCounter::out_file, electronStore::output_file, phi, HcalChannelId::phi, AlCaHLTBitMon_QueryRunRegistry::string, and HcalChannelId::subdetector.
◆ getHfQieTable()
int HcalQIEManager::getHfQieTable |
( |
std::string |
input_file, |
|
|
std::string |
output_file |
|
) |
| |
Definition at line 278 of file HcalQIEManager.cc.
285 std::map<std::string, std::vector<int> > _qie;
286 std::ifstream
infile(input_file.c_str());
289 std::cout <<
"File is open" << std::endl;
291 std::cout <<
"Table legend: " << std::endl <<
buf << std::endl;
294 if (_line.size() != 17) {
295 cout <<
"Table line is malformed, not clear what to do... exiting." << std::endl;
299 std::vector<int> _barcodes;
300 for (
int i = 0;
i != 12;
i++) {
302 sscanf(_line[
i + 5].c_str(),
"%d", &_code);
303 _barcodes.push_back(_code);
305 _qie.insert(std::pair<
std::string, std::vector<int> >(_rbx, _barcodes));
312 "occi://CMS_HCL_PRTTYPE_HCAL_READER@anyhost/int2r?PASSWORD=HCAL_Reader_88,LHWM_VERSION=22";
313 db->connect(_accessor);
314 oracle::occi::Connection* _connection =
db->getConnection();
315 std::cout <<
"Preparing to request the HF channels from LMAP in the database..." << std::endl;
317 std::cout <<
"Preparing the query..." << std::endl;
318 Statement* stmt = _connection->createStatement();
320 std::cout <<
"Preparing the query... done" << std::endl;
322 query.append(
"select\n");
323 query.append(
"lmap.side*lmap.eta, lmap.phi, lmap.depth, lmap.subdetector,\n");
324 query.append(
"lmap.rbx, lmap.rm_slot, lmap.qie_slot, lmap.adc\n");
325 query.append(
"from cms_hcl_hcal_condition_owner.hcal_hardware_logical_maps_v3 lmap\n");
326 query.append(
"inner join cms_hcl_core_condition_owner.cond_data_sets cds\n");
327 query.append(
"on cds.condition_data_set_id=lmap.condition_data_set_id\n");
328 query.append(
"where cds.version='30'\n");
329 query.append(
"and lmap.subdetector='HF'\n");
330 query.append(
"order by lmap.rbx, lmap.rm_slot, lmap.qie_slot, lmap.adc\n");
333 std::cout <<
"Executing the query..." << std::endl;
335 ResultSet* rs = stmt->executeQuery(
query);
336 std::cout <<
"Executing the query... done" << std::endl;
338 std::cout <<
"Processing the query results..." << std::endl;
344 int rm_slot, qie_slot,
adc, qie_barcode;
346 _id.
eta = rs->getInt(1);
347 _id.
phi = rs->getInt(2);
348 _id.
depth = rs->getInt(3);
350 rbx = rs->getString(5);
351 rm_slot = rs->getInt(6);
352 qie_slot = rs->getInt(7);
354 qie_barcode = _qie[rbx][(rm_slot - 1) * 4 + qie_slot - 1];
360 Statement* stmt2 = _connection->createStatement();
362 query2.append(
"select\n");
364 "vadcs.cap0_range0_offset,vadcs.cap0_range1_offset,vadcs.cap0_range2_offset,vadcs.cap0_range3_offset,\n");
366 "vadcs.cap1_range0_offset,vadcs.cap1_range1_offset,vadcs.cap1_range2_offset,vadcs.cap1_range3_offset,\n");
368 "vadcs.cap2_range0_offset,vadcs.cap2_range1_offset,vadcs.cap2_range2_offset,vadcs.cap2_range3_offset,\n");
370 "vadcs.cap3_range0_offset,vadcs.cap3_range1_offset,vadcs.cap3_range2_offset,vadcs.cap3_range3_offset,\n");
372 "vadcs.cap0_range0_slope,vadcs.cap0_range1_slope,vadcs.cap0_range2_slope,vadcs.cap0_range3_slope,\n");
374 "vadcs.cap1_range0_slope,vadcs.cap1_range1_slope,vadcs.cap1_range2_slope,vadcs.cap1_range3_slope,\n");
376 "vadcs.cap2_range0_slope,vadcs.cap2_range1_slope,vadcs.cap2_range2_slope,vadcs.cap2_range3_slope,\n");
378 "vadcs.cap3_range0_slope,vadcs.cap3_range1_slope,vadcs.cap3_range2_slope,vadcs.cap3_range3_slope\n");
379 query2.append(
"from CMS_HCL_HCAL_CONDITION_OWNER.V_QIECARD_ADC_NORMMODE vadcs\n");
380 query2.append(
"where substr(vadcs.name_label,14,6)='%d'\n");
381 query2.append(
"and substr(vadcs.name_label,21,1)='%d'\n");
382 query2.append(
"order by version desc,record_id desc, condition_data_set_id desc\n");
383 char query2_fixed[5000];
384 sprintf(query2_fixed, query2.c_str(), qie_barcode,
adc);
391 ResultSet* rs2 = stmt2->executeQuery(query2_fixed);
398 for (
int j = 0;
j != 32;
j++) {
399 _caps.
caps[
j] = rs2->getDouble(
j + 1);
406 for (
int j = 0;
j != 32;
j++) {
407 double _x = _caps.
caps[
j];
408 sprintf(
buffer,
" %8.5f", _x);
417 _connection->terminateStatement(stmt2);
419 }
catch (SQLException&
e) {
420 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
425 _connection->terminateStatement(stmt);
428 std::cout <<
"Query line count: " << _lines.getCount() << std::endl;
429 }
catch (SQLException&
e) {
430 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
References ecalMGPA::adc(), visDQMUpload::buf, edmScanValgrind::buffer, HcalQIECaps::caps, RooGKCounter::count(), gather_cfg::cout, dqmiodatasetharvest::db, HcalChannelId::depth, MillePedeFileConverter_cfg::e, HcalChannelId::eta, RooGKCounter::getCount(), mps_fire::i, timingPdfMaker::infile, dqmiolumiharvest::j, DeadROCCounter::out_file, electronStore::output_file, HcalChannelId::phi, contentValuesFiles::query, splitString(), AlCaHLTBitMon_QueryRunRegistry::string, HcalChannelId::subdetector, and toolbox::toString().
◆ getQIETableFromFile()
Definition at line 54 of file HcalQIEManager.cc.
55 std::map<HcalChannelId, HcalQIECaps>* result_sup =
new std::map<HcalChannelId, HcalQIECaps>;
56 std::map<HcalChannelId, HcalQIECaps>&
result = (*result_sup);
58 ifstream
infile(_filename.c_str());
67 sscanf(_line[0].c_str(),
"%d", &_id.
eta);
68 sscanf(_line[1].c_str(),
"%d", &_id.
phi);
69 sscanf(_line[2].c_str(),
"%d", &_id.
depth);
73 int _columns = _line.size();
74 for (
int i = 4;
i != _columns;
i++) {
75 sscanf(_line[
i].c_str(),
"%lf", &_adc.
caps[
i - 4]);
85 result.insert(std::pair<HcalChannelId, HcalQIECaps>(_id, _adc));
References visDQMUpload::buf, HcalQIECaps::caps, gather_cfg::cout, HcalChannelId::depth, HcalChannelId::eta, mps_fire::i, timingPdfMaker::infile, HcalChannelId::phi, mps_fire::result, splitString(), AlCaHLTBitMon_QueryRunRegistry::string, and HcalChannelId::subdetector.
◆ getTableFromDb()
void HcalQIEManager::getTableFromDb |
( |
std::string |
query_file, |
|
|
std::string |
output_file |
|
) |
| |
Definition at line 116 of file HcalQIEManager.cc.
124 "occi://CMS_HCL_PRTTYPE_HCAL_READER@anyhost/int2r?PASSWORD=HCAL_Reader_88,LHWM_VERSION=22";
125 db->connect(_accessor);
127 oracle::occi::Connection* _connection =
db->getConnection();
129 std::cout <<
"Preparing to request the QIE table from the database..." << std::endl;
132 for (
int _rm = 1; _rm != 5; _rm++) {
133 for (
int _qie = 1; _qie != 4; _qie++) {
135 cout <<
"Preparing the query..." << std::endl;
136 Statement* stmt = _connection->createStatement();
140 std::cout <<
" Unable to open file with query!" << std::endl;
142 std::cout <<
"Query file opened successfully: " << query_file << std::endl;
144 while (getline(inFile,
buf)) {
149 char query_fixed[50000];
150 sprintf(query_fixed,
query.c_str(), _rm, _rm, _qie, _qie);
152 cout <<
"Preparing the query... done" << std::endl;
155 cout <<
"Executing the query..." << std::endl;
157 ResultSet* rs = stmt->executeQuery(query_fixed);
158 cout <<
"Executing the query... done" << std::endl;
160 cout <<
"Processing the query results..." << std::endl;
168 _id.
eta = rs->getInt(1);
169 _id.
phi = rs->getInt(2);
170 _id.
depth = rs->getInt(3);
172 for (
int j = 0;
j != 32;
j++) {
173 _caps.
caps[
j] = rs->getDouble(
j + 5);
181 for (
int j = 0;
j != 32;
j++) {
182 double _x = _caps.
caps[
j];
183 sprintf(
buffer,
" %8.5f", _x);
192 _connection->terminateStatement(stmt);
195 cout <<
"Query line count: " << _lines.getCount() << std::endl;
196 }
catch (SQLException&
e) {
197 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
References visDQMUpload::buf, edmScanValgrind::buffer, HcalQIECaps::caps, RooGKCounter::count(), gather_cfg::cout, dqmiodatasetharvest::db, HcalChannelId::depth, MillePedeFileConverter_cfg::e, HcalChannelId::eta, RooGKCounter::getCount(), recoMuon::in, dqmiolumiharvest::j, DeadROCCounter::out_file, electronStore::output_file, HcalChannelId::phi, contentValuesFiles::query, AlCaHLTBitMon_QueryRunRegistry::string, HcalChannelId::subdetector, and toolbox::toString().
◆ splitString()
std::vector< std::string > HcalQIEManager::splitString |
( |
const std::string & |
fLine | ) |
|
|
static |