21 #include "toolbox/string.h"
31 std::istringstream iss(s);
32 return !(iss >>
f >>
t).
fail();
43 if (rs->getString(1).find(
"HcalDetId")!=std::string::npos){
50 else if (rs->getString(1).find(
"HcalCalibDetId")!=std::string::npos){
57 else if (rs->getString(1).find(
"HcalTrigTowerDetId")!=std::string::npos){
62 else if (rs->getString(1).find(
"HcalZDCDetId")!=std::string::npos){
68 else if (rs->getString(1).find(
"HcalCastorDetId")!=std::string::npos){
80 const int fSubversion,
85 if (!fObject)
return false;
88 oracle::occi::Statement* stmt = connection->createStatement(fQuery);
89 stmt->setString(1,fTag);
91 stmt->setInt(2,fIOVBegin);
96 for (
int _i=1; _i!=12; _i++) rs->setMaxColumnSize(_i,128);
99 _row.setMessage(
"HCAL channels processed: ");
100 _row.setPrintCount(
true);
101 _row.setNewLine(
true);
111 _unit = rs->getInt(12);
112 float cap0 = rs->getFloat(13);
113 float cap1 = rs->getFloat(14);
114 float cap2 = rs->getFloat(15);
115 float cap3 = rs->getFloat(16);
116 float variance0 = rs->getFloat(17);
117 float variance1 = rs->getFloat(18);
118 float variance2 = rs->getFloat(19);
119 float variance3 = rs->getFloat(20);
127 HcalPedestal * fCondObject =
new HcalPedestal(
id.rawId(), cap0, cap1, cap2, cap3, variance0, variance1, variance2, variance3);
132 connection->terminateStatement(stmt);
136 bool unit_is_adc =
false;
137 if (_unit!=0) unit_is_adc =
true;
146 const int fSubversion,
151 if (!fObject)
return false;
154 oracle::occi::Statement* stmt = connection->createStatement(fQuery);
155 stmt->setString(1,fTag);
156 stmt->setInt(2,fIOVBegin);
160 rs->setMaxColumnSize(1,128);
161 rs->setMaxColumnSize(2,128);
162 rs->setMaxColumnSize(3,128);
163 rs->setMaxColumnSize(4,128);
164 rs->setMaxColumnSize(5,128);
165 rs->setMaxColumnSize(6,128);
166 rs->setMaxColumnSize(7,128);
167 rs->setMaxColumnSize(8,128);
168 rs->setMaxColumnSize(9,128);
169 rs->setMaxColumnSize(10,128);
170 rs->setMaxColumnSize(11,128);
173 _row.setMessage(
"HCAL channels processed: ");
174 _row.setPrintCount(
true);
175 _row.setNewLine(
true);
185 _unit = rs->getInt(12);
186 float covariance_00 = rs->getFloat(13);
187 float covariance_01 = rs->getFloat(14);
188 float covariance_02 = rs->getFloat(15);
189 float covariance_03 = rs->getFloat(16);
190 float covariance_10 = rs->getFloat(17);
191 float covariance_11 = rs->getFloat(18);
192 float covariance_12 = rs->getFloat(19);
193 float covariance_13 = rs->getFloat(20);
194 float covariance_20 = rs->getFloat(21);
195 float covariance_21 = rs->getFloat(22);
196 float covariance_22 = rs->getFloat(23);
197 float covariance_23 = rs->getFloat(24);
198 float covariance_30 = rs->getFloat(25);
199 float covariance_31 = rs->getFloat(26);
200 float covariance_32 = rs->getFloat(27);
201 float covariance_33 = rs->getFloat(28);
203 fCondObject->
setSigma(0,0,covariance_00);
204 fCondObject->
setSigma(0,1,covariance_01);
205 fCondObject->
setSigma(0,2,covariance_02);
206 fCondObject->
setSigma(0,3,covariance_03);
207 fCondObject->
setSigma(1,0,covariance_10);
208 fCondObject->
setSigma(1,1,covariance_11);
209 fCondObject->
setSigma(1,2,covariance_12);
210 fCondObject->
setSigma(1,3,covariance_13);
211 fCondObject->
setSigma(2,0,covariance_20);
212 fCondObject->
setSigma(2,1,covariance_21);
213 fCondObject->
setSigma(2,2,covariance_22);
214 fCondObject->
setSigma(2,3,covariance_23);
215 fCondObject->
setSigma(3,0,covariance_30);
216 fCondObject->
setSigma(3,1,covariance_31);
217 fCondObject->
setSigma(3,2,covariance_32);
218 fCondObject->
setSigma(3,3,covariance_33);
223 connection->terminateStatement(stmt);
227 bool unit_is_adc =
false;
228 if (_unit!=0) unit_is_adc =
true;
237 const int fSubversion,
242 if (!fObject)
return false;
244 oracle::occi::Statement* stmt = connection->createStatement(fQuery);
245 stmt->setString(1,fTag);
246 stmt->setInt(2,fIOVBegin);
251 for (
int _i=1; _i!=12; _i++) rs->setMaxColumnSize(_i,128);
254 _row.setMessage(
"HCAL channels processed: ");
255 _row.setPrintCount(
true);
256 _row.setNewLine(
true);
266 float cap0 = rs->getFloat(12);
267 float cap1 = rs->getFloat(13);
268 float cap2 = rs->getFloat(14);
269 float cap3 = rs->getFloat(15);
281 connection->terminateStatement(stmt);
292 const int fSubversion,
297 if (!fObject)
return false;
299 oracle::occi::Statement* stmt = connection->createStatement(fQuery);
300 stmt->setString(1,fTag);
301 stmt->setInt(2,fIOVBegin);
306 for (
int _i=1; _i!=12; _i++) rs->setMaxColumnSize(_i,128);
309 _row.setMessage(
"HCAL channels processed: ");
310 _row.setPrintCount(
true);
311 _row.setNewLine(
true);
321 float cap0 = rs->getFloat(12);
322 float cap1 = rs->getFloat(13);
323 float cap2 = rs->getFloat(14);
324 float cap3 = rs->getFloat(15);
336 connection->terminateStatement(stmt);
347 const int fSubversion,
352 if (!fObject)
return false;
354 oracle::occi::Statement* stmt = connection->createStatement(fQuery);
355 stmt->setString(1,fTag);
356 stmt->setInt(2,fIOVBegin);
360 rs->setMaxColumnSize(1,128);
361 rs->setMaxColumnSize(2,128);
362 rs->setMaxColumnSize(3,128);
363 rs->setMaxColumnSize(4,128);
364 rs->setMaxColumnSize(5,128);
365 rs->setMaxColumnSize(6,128);
366 rs->setMaxColumnSize(7,128);
367 rs->setMaxColumnSize(8,128);
368 rs->setMaxColumnSize(9,128);
369 rs->setMaxColumnSize(10,128);
370 rs->setMaxColumnSize(11,128);
373 _row.setMessage(
"HCAL channels processed: ");
374 _row.setPrintCount(
true);
375 _row.setNewLine(
true);
387 for (
int _i=0; _i!=32; _i++) items[_i] = rs->getFloat(_i+12);
389 for (
unsigned capid = 0; capid < 4; capid++) {
390 for (
unsigned range = 0; range < 4; range++) {
391 fCondObject->
setSlope (capid, range, items[capid*4+range]);
394 for (
unsigned capid = 0; capid < 4; capid++) {
395 for (
unsigned range = 0; range < 4; range++) {
396 fCondObject->
setOffset (capid, range, items[16+capid*4+range]);
403 connection->terminateStatement(stmt);
414 const int fSubversion,
418 std::cerr <<
"NOT IMPLEMENTED!" << std::endl;
426 const int fSubversion,
431 if (!fObject)
return false;
433 oracle::occi::Statement* stmt = connection->createStatement(fQuery);
434 stmt->setString(1,fTag);
435 stmt->setInt(2,fIOVBegin);
440 for (
int _i=1; _i!=20; _i++) rs->setMaxColumnSize(_i,128);
443 _row.setMessage(
"HCAL channels processed: ");
444 _row.setPrintCount(
true);
445 _row.setNewLine(
true);
456 int crate = rs->getInt(13);
457 int slot = rs->getInt(14);
458 int dcc = rs->getInt(16);
459 int spigot = rs->getInt(17);
462 if (tb.find(
"b")!=std::string::npos) top = 0;
464 if (_obj_name.find(
"HcalTrigTowerDetId")!=std::string::npos){
465 int slbCh = rs->getInt(19);
466 int slb = rs->getInt(18);
470 int fiberCh = rs->getInt(19);
471 int fiber = rs->getInt(18);
473 fCondObject->
setHTR(crate,slot,top);
475 if (_obj_name.find(
"HcalTrigTowerDetId")!=std::string::npos){
478 else if (_obj_name.find(
"HcalDetId")!=std::string::npos ||
479 _obj_name.find(
"HcalCalibDetId")!=std::string::npos ||
480 _obj_name.find(
"HcalZDCDetId")!=std::string::npos){
484 edm::LogWarning(
"Format Error") <<
"HcalElectronicsMap-> Unknown subdetector: "
485 << _obj_name << std::endl;
490 connection->terminateStatement(stmt);
502 const int fSubversion,
506 std::cout <<
" +++++=====> HcalDbOmds::getObject" << std::endl;
509 if (!fObject)
return false;
511 oracle::occi::Statement* stmt = connection->createStatement(fQuery);
512 stmt->setString(1,fTag);
513 stmt->setInt(2,fIOVBegin);
518 for (
int _i=1; _i!=12; _i++) rs->setMaxColumnSize(_i,128);
521 _row.setMessage(
"HCAL channels processed: ");
522 _row.setPrintCount(
true);
523 _row.setNewLine(
true);
533 int value = rs->getInt(12);
545 connection->terminateStatement(stmt);
556 const int fSubversion,
561 if (!fObject)
return false;
563 oracle::occi::Statement* stmt = connection->createStatement(fQuery);
564 stmt->setString(1,fTag);
565 stmt->setInt(2,fIOVBegin);
570 for (
int _i=1; _i!=12; _i++) rs->setMaxColumnSize(_i,128);
573 _row.setMessage(
"HCAL channels processed: ");
574 _row.setPrintCount(
true);
575 _row.setNewLine(
true);
585 float value = rs->getFloat(12);
597 connection->terminateStatement(stmt);
608 const int fSubversion,
613 if (!fObject)
return false;
615 oracle::occi::Statement* stmt = connection->createStatement(fQuery);
616 stmt->setString(1,fTag);
617 stmt->setInt(2,fIOVBegin);
622 for (
int _i=1; _i!=12; _i++) rs->setMaxColumnSize(_i,128);
625 _row.setMessage(
"HCAL channels processed: ");
626 _row.setPrintCount(
true);
627 _row.setNewLine(
true);
637 int zs = rs->getInt(12);
649 connection->terminateStatement(stmt);
660 const int fSubversion,
665 if (!fObject)
return false;
669 oracle::occi::Statement* stmt = connection->createStatement(fQuery);
670 stmt->setString(1,fTag);
671 stmt->setInt(2,fIOVBegin);
675 rs->setMaxColumnSize(1,128);
676 rs->setMaxColumnSize(2,128);
677 rs->setMaxColumnSize(3,128);
678 rs->setMaxColumnSize(4,128);
679 rs->setMaxColumnSize(5,128);
680 rs->setMaxColumnSize(6,128);
681 rs->setMaxColumnSize(7,128);
682 rs->setMaxColumnSize(8,128);
683 rs->setMaxColumnSize(9,128);
684 rs->setMaxColumnSize(10,128);
685 rs->setMaxColumnSize(11,128);
688 _row.setMessage(
"HCAL channels processed: ");
689 _row.setPrintCount(
true);
690 _row.setNewLine(
true);
709 float average_pedestal = rs->getFloat(12);
710 float response_corrected_gain = rs->getFloat(13);
711 int flag = rs->getInt(14);
713 if (metadata_name.find(
"lut_tag")!=std::string::npos){
714 _tag = rs->getString(16);
716 else if (metadata_name.find(
"algo_name")!=std::string::npos){
717 _algo = rs->getString(16);
724 connection->terminateStatement(stmt);
736 const int fSubversion,
741 if (!fObject)
return false;
743 oracle::occi::Statement* stmt = connection->createStatement(fQuery);
744 stmt->setString(1,fTag);
746 stmt->setInt(2,fIOVBegin);
751 for (
int _i=1; _i!=12; _i++) rs->setMaxColumnSize(_i,128);
754 _row.setMessage(
"HCAL channels processed: ");
755 _row.setPrintCount(
true);
756 _row.setNewLine(
true);
766 float value = rs->getFloat(12);
778 connection->terminateStatement(stmt);
789 const int fSubversion,
794 if (!fObject)
return false;
796 oracle::occi::Statement* stmt = connection->createStatement(fQuery);
797 stmt->setString(1,fTag);
799 stmt->setInt(2,fIOVBegin);
804 for (
int _i=1; _i!=12; _i++) rs->setMaxColumnSize(_i,128);
807 _row.setMessage(
"HCAL channels processed: ");
808 _row.setPrintCount(
true);
809 _row.setNewLine(
true);
824 if (rs->getString(1).find(
"fakeobjectname")!=std::string::npos){
825 float rctlsb = rs->getFloat(12);
826 float nominal_gain = rs->getFloat(13);
833 float rcalib = rs->getFloat(12);
834 uint32_t lut_granularity = rs->getInt(13);
835 uint32_t output_lut_threshold = rs->getInt(14);
839 output_lut_threshold);
845 connection->terminateStatement(stmt);
856 const int fSubversion,
861 if (!fObject)
return false;
863 oracle::occi::Statement* stmt = connection->createStatement(fQuery);
864 stmt->setString(1,fTag);
865 stmt->setString(2,fVersion);
866 stmt->setInt(3,fSubversion);
867 stmt->setInt(4,fIOVBegin);
869 std::cout <<
"DEBUG****** IOV=" << fIOVBegin << std::endl;
874 for (
int _i=1; _i!=9; _i++) rs->setMaxColumnSize(_i,128);
877 _row.setMessage(
"HCAL DCS records: ");
878 _row.setPrintCount(
true);
879 _row.setNewLine(
true);
907 int sidering = rs->getInt(7);
908 unsigned int slice = rs->getInt(8);
909 unsigned int subchan = rs->getInt(9);
915 int LS = rs->getInt(2);
916 float val = rs->getFloat(3);
917 float upper = rs->getFloat(4);
918 float lower = rs->getFloat(5);
926 if (!(fObject->
addValue(*fCondObject))) {
928 <<
"\nwas not added to the HcalDcsValues object." << std::endl;
934 connection->terminateStatement(stmt);
950 if ( _det.find(
"HB") != std::string::npos ) result =
HcalBarrel;
951 else if ( _det.find(
"HE") != std::string::npos ) result =
HcalEndcap;
952 else if ( _det.find(
"HF") != std::string::npos ) result =
HcalForward;
953 else if ( _det.find(
"HO") != std::string::npos ) result =
HcalOuter;
963 else if ( _section.find(
"EM") != std::string::npos ) result =
HcalZDCDetId::EM;
964 else if ( _section.find(
"HAD") != std::string::npos ) result =
HcalZDCDetId::HAD;
965 else if ( _section.find(
"LUM") != std::string::npos ) result =
HcalZDCDetId::LUM;
966 else if ( _section.find(
"RPD") != std::string::npos ) result =
HcalZDCDetId::RPD;
975 switch (_dpname.at(_dpname.find(
"HVcrate_")+9)) {
996 int _side_ring = 1000;
999 switch (_dpname.at(_dpname.find(
"HVcrate_")+9)) {
1003 if (_dpname.at(_dpname.find(
"HVcrate_")+10) ==
'M') _side = -1;
1004 else if (_dpname.at(_dpname.find(
"HVcrate_")+10) ==
'P') _side = +1;
1008 if (_dpname.at(_dpname.find(
"HVcrate_")+11) ==
'M') _side = -1;
1009 else if (_dpname.at(_dpname.find(
"HVcrate_")+11) ==
'P') _side = +1;
1010 _ring = atoi(&(_dpname.at(_dpname.find(
"HVcrate_")+10)));
1015 _side_ring = _side * _ring;
1021 HcalDbOmds::from_string<int>(
result, _dpname.substr(_dpname.find(
"/S")+2,2),
std::dec);
1022 return (
unsigned int)
result;
1026 unsigned int result = 1000;
1027 HcalDbOmds::from_string<unsigned int>(
result, _dpname.substr(_dpname.find(
"/RM")+3,1),
std::dec);
1035 std::string _type = _dpname.substr(_dpname.find(
"/RM")+4);
1042 switch (subdet.at(1)){
void setAlgoString(std::string fAlgo)
void setUnitADC(bool isADC)
HcalOtherSubdetector getSubDetFromDpName(std::string _dpname)
static int slb(const HcalTriggerPrimitiveSample &theSample)
bool getObject(oracle::occi::Connection *connection, const std::string &fTag, const std::string &fVersion, const int fSubversion, const int fIOVBegin, const std::string &fQuery, HcalPedestals *fObject)
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
HcalOtherSubdetector getSubDetFromString(std::string subdet)
void setOffset(unsigned fCapId, unsigned fRange, float fValue)
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
bool addCoder(const HcalQIECoder &fCoder)
oracle::occi::SQLException SQLException
HcalSubdetector get_subdetector(std::string _det)
void setUnitADC(bool isADC)
unsigned int getSliceFromDpName(std::string _dpname)
HcalDcsDetId::DcsType getDcsTypeFromString(std::string type)
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
void setHTR(int crate, int slot, int tb)
HcalDcsDetId::DcsType getDcsTypeFromDpName(std::string _dpname)
bool from_string(T &t, const std::string &s, std::ios_base &(*f)(std::ios_base &))
oracle::occi::ResultSet ResultSet
bool addValue(HcalDcsValue const &newVal)
unsigned int getSubChannelFromDpName(std::string _dpname)
void setTagString(std::string fTag)
bool addValues(const Item &myItem)
DetId getId(oracle::occi::ResultSet *rs)
HcalZDCDetId::Section get_zdc_section(std::string _section)
int getSideRingFromDpName(std::string _dpname)
Readout chain identification for Hcal.
void setSigma(int fCapId1, int fCapId2, float fSigma)
void setSlope(unsigned fCapId, unsigned fRange, float fValue)