#include <vector>
#include <string>
#include <cstdio>
#include <sstream>
#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h"
#include "DataFormats/HcalDetId/interface/HcalElectronicsId.h"
#include "DataFormats/HcalDetId/interface/HcalDcsDetId.h"
#include "CalibFormats/HcalObjects/interface/HcalText2DetIdConverter.h"
#include "CondFormats/HcalObjects/interface/AllObjects.h"
#include "CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
Go to the source code of this file.
Functions | |
template<class T > | |
bool | dumpHcalMatrixObject (std::ostream &fOutput, const T &fObject) |
template<class T > | |
bool | dumpHcalObject (std::ostream &fOutput, const T &fObject) |
template<class T > | |
bool | dumpHcalSingleFloatObject (std::ostream &fOutput, const T &fObject) |
template<class T > | |
bool | dumpHcalSingleIntObject (std::ostream &fOutput, const T &fObject) |
template<class T > | |
bool | from_string (T &t, const std::string &s, std::ios_base &(*f)(std::ios_base &)) |
template<class T , class S > | |
bool | getHcalMatrixObject (std::istream &fInput, T *fObject, S *fCondObject) |
template<class T , class S > | |
bool | getHcalObject (std::istream &fInput, T *fObject, S *fCondObject) |
template<class T , class S > | |
bool | getHcalSingleFloatObject (std::istream &fInput, T *fObject, S *fCondObject) |
template<class T , class S > | |
bool | getHcalSingleIntObject (std::istream &fInput, T *fObject, S *fCondObject) |
std::vector< std::string > | splitString (const std::string &fLine) |
std::vector< double > | splitStringToDoubleByComma (const std::string &fLine) |
std::vector< float > | splitStringToFloatByComma (const std::string &fLine) |
std::vector< unsigned int > | splitStringToIntByComma (const std::string &fLine) |
bool dumpHcalMatrixObject | ( | std::ostream & | fOutput, |
const T & | fObject | ||
) |
Definition at line 328 of file HcalDbASCIIIO.cc.
References HcalDbASCIIIO::dumpId(), i, j, m, and python::multivaluedict::sort().
{ char buffer [1024]; sprintf (buffer, "# %5s %5s %5s %5s %5s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %10s\n", "eta", "phi", "dep", "det", "capid","c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "DetId"); fOutput << buffer; std::vector<DetId> channels = fObject.getAllChannels (); std::sort (channels.begin(), channels.end(), DetIdLess ()); for (std::vector<DetId>::iterator channel = channels.begin (); channel != channels.end (); channel++) { float thisline[10]; for(int m = 0; m != 4; m++){ for(int i = 0; i != 10; i++){ for(int j = 0; j != 10; j++){ // std::cout <<"test "<<(fObject.getValues(*channel))->getValue(0,0,0); thisline[j] = fObject.getValues(*channel)->getValue(m,i,j); // thisline[j] = fObject.getValues(*channel)->getValue(1,1,1); } HcalDbASCIIIO::dumpId (fOutput, *channel); sprintf(buffer, " %5i %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %10X\n", m, thisline[0], thisline[1], thisline[2], thisline[3], thisline[4], thisline[5], thisline[6], thisline[7], thisline[8], thisline[9], channel->rawId()); fOutput << buffer; } } } return true; }
bool dumpHcalObject | ( | std::ostream & | fOutput, |
const T & | fObject | ||
) |
Definition at line 193 of file HcalDbASCIIIO.cc.
References HcalDbASCIIIO::dumpId(), python::multivaluedict::sort(), and makeHLTPrescaleTable::values.
{ char buffer [1024]; sprintf (buffer, "# %15s %15s %15s %15s %8s %8s %8s %8s %10s\n", "eta", "phi", "dep", "det", "cap0", "cap1", "cap2", "cap3", "DetId"); fOutput << buffer; std::vector<DetId> channels = fObject.getAllChannels (); std::sort (channels.begin(), channels.end(), DetIdLess ()); for (std::vector<DetId>::iterator channel = channels.begin (); channel != channels.end (); channel++) { const float* values = fObject.getValues (*channel)->getValues (); if (values) { HcalDbASCIIIO::dumpId (fOutput, *channel); sprintf (buffer, " %8.5f %8.5f %8.5f %8.5f %10X\n", values[0], values[1], values[2], values[3], channel->rawId ()); fOutput << buffer; } } return true; }
bool dumpHcalSingleFloatObject | ( | std::ostream & | fOutput, |
const T & | fObject | ||
) |
Definition at line 240 of file HcalDbASCIIIO.cc.
References HcalDbASCIIIO::dumpId(), python::multivaluedict::sort(), and relativeConstraints::value.
{ char buffer [1024]; sprintf (buffer, "# %15s %15s %15s %15s %8s %10s\n", "eta", "phi", "dep", "det", "value", "DetId"); fOutput << buffer; std::vector<DetId> channels = fObject.getAllChannels (); std::sort (channels.begin(), channels.end(), DetIdLess ()); for (std::vector<DetId>::iterator channel = channels.begin (); channel != channels.end (); channel++) { const float value = fObject.getValues (*channel)->getValue (); HcalDbASCIIIO::dumpId (fOutput, *channel); sprintf (buffer, " %8.5f %10X\n", value, channel->rawId ()); fOutput << buffer; } return true; }
bool dumpHcalSingleIntObject | ( | std::ostream & | fOutput, |
const T & | fObject | ||
) |
Definition at line 285 of file HcalDbASCIIIO.cc.
References HcalDbASCIIIO::dumpId(), python::multivaluedict::sort(), and relativeConstraints::value.
{ char buffer [1024]; sprintf (buffer, "# %15s %15s %15s %15s %8s %10s\n", "eta", "phi", "dep", "det", "value", "DetId"); fOutput << buffer; std::vector<DetId> channels = fObject.getAllChannels (); std::sort (channels.begin(), channels.end(), DetIdLess ()); for (std::vector<DetId>::iterator channel = channels.begin (); channel != channels.end (); channel++) { const int value = fObject.getValues (*channel)->getValue (); HcalDbASCIIIO::dumpId (fOutput, *channel); sprintf (buffer, " %15d %10X\n", value, channel->rawId ()); fOutput << buffer; } return true; }
bool HcalDbOmds::from_string | ( | T & | t, |
const std::string & | s, | ||
std::ios_base &(*)(std::ios_base &) | f | ||
) |
bool getHcalMatrixObject | ( | std::istream & | fInput, |
T * | fObject, | ||
S * | fCondObject | ||
) |
Definition at line 304 of file HcalDbASCIIIO.cc.
References HcalDbASCIIIO::getId(), i, j, DetId::rawId(), splitString(), and AlCaHLTBitMon_QueryRunRegistry::string.
{ if (!fObject) return false; //fObject = new T; char buffer [1024]; while (fInput.getline(buffer, 1024)) { if (buffer [0] == '#') continue; //ignore comment std::vector <std::string> items = splitString (std::string (buffer)); if (items.size()==0) continue; // blank line DetId firstid = HcalDbASCIIIO::getId (items); fCondObject = new S(firstid.rawId()); for(int j = 0; j != 10; j++) fCondObject->setValue(atoi(items[4].c_str()), 0, j, atof(items[j+5].c_str())); for(int i = 1; i != 40; i++){ fInput.getline(buffer, 1024); items = splitString (std::string (buffer)); DetId id = HcalDbASCIIIO::getId (items); if(id.rawId() != firstid.rawId()) break;//throw cms::Exception("Wrong number of elements"); for(int j = 0; j != 10; j++) fCondObject->setValue(atoi(items[4].c_str()), i%10, j, atof(items[j+5].c_str())); } fObject->addValues(*fCondObject); delete fCondObject; } return true; }
bool getHcalObject | ( | std::istream & | fInput, |
T * | fObject, | ||
S * | fCondObject | ||
) |
Definition at line 165 of file HcalDbASCIIIO.cc.
References HcalDbASCIIIO::getId(), splitString(), and AlCaHLTBitMon_QueryRunRegistry::string.
{ if (!fObject) return false; //fObject = new T; char buffer [1024]; while (fInput.getline(buffer, 1024)) { if (buffer [0] == '#') continue; //ignore comment std::vector <std::string> items = splitString (std::string (buffer)); if (items.size()==0) continue; // blank line if (items.size () < 8) { edm::LogWarning("Format Error") << "Bad line: " << buffer << "\n line must contain 8 items: eta, phi, depth, subdet, 4x values" << std::endl; continue; } DetId id = HcalDbASCIIIO::getId (items); // if (fObject->exists(id) ) // edm::LogWarning("Redefining Channel") << "line: " << buffer << "\n attempts to redefine data. Ignored" << std::endl; // else // { fCondObject = new S(id, atof (items [4].c_str()), atof (items [5].c_str()), atof (items [6].c_str()), atof (items [7].c_str())); fObject->addValues(*fCondObject); delete fCondObject; // } } return true; }
bool getHcalSingleFloatObject | ( | std::istream & | fInput, |
T * | fObject, | ||
S * | fCondObject | ||
) |
Definition at line 214 of file HcalDbASCIIIO.cc.
References HcalDbASCIIIO::getId(), splitString(), and AlCaHLTBitMon_QueryRunRegistry::string.
{ if (!fObject) return false; //fObject = new T; char buffer [1024]; while (fInput.getline(buffer, 1024)) { if (buffer [0] == '#') continue; //ignore comment std::vector <std::string> items = splitString (std::string (buffer)); if (items.size()==0) continue; // blank line if (items.size () < 5) { edm::LogWarning("Format Error") << "Bad line: " << buffer << "\n line must contain 5 items: eta, phi, depth, subdet, value" << std::endl; continue; } DetId id = HcalDbASCIIIO::getId (items); // if (fObject->exists(id) ) // edm::LogWarning("Redefining Channel") << "line: " << buffer << "\n attempts to redefine data. Ignored" << std::endl; // else // { fCondObject = new S(id, atof (items [4].c_str()) ); fObject->addValues(*fCondObject); delete fCondObject; // } } return true; }
bool getHcalSingleIntObject | ( | std::istream & | fInput, |
T * | fObject, | ||
S * | fCondObject | ||
) |
Definition at line 259 of file HcalDbASCIIIO.cc.
References HcalDbASCIIIO::getId(), splitString(), and AlCaHLTBitMon_QueryRunRegistry::string.
{ if (!fObject) return false; //fObject = new T; char buffer [1024]; while (fInput.getline(buffer, 1024)) { if (buffer [0] == '#') continue; //ignore comment std::vector <std::string> items = splitString (std::string (buffer)); if (items.size()==0) continue; // blank line if (items.size () < 5) { edm::LogWarning("Format Error") << "Bad line: " << buffer << "\n line must contain 5 items: eta, phi, depth, subdet, value" << std::endl; continue; } DetId id = HcalDbASCIIIO::getId (items); // if (fObject->exists(id) ) // edm::LogWarning("Redefining Channel") << "line: " << buffer << "\n attempts to redefine data. Ignored" << std::endl; // else // { fCondObject = new S(id, atoi (items [4].c_str()) ); fObject->addValues(*fCondObject); delete fCondObject; // } } return true; }
std::vector<std::string> splitString | ( | const std::string & | fLine | ) |
Definition at line 54 of file HcalDbASCIIIO.cc.
References relativeConstraints::empty, i, query::result, dqm_diff::start, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by HcalLutManager::create_lut_loader(), EgHLTOfflineClient::createLooseTightTrigEff(), getHcalMatrixObject(), getHcalObject(), getHcalSingleFloatObject(), getHcalSingleIntObject(), HcalQIEManager::getHfQieTable(), HcalLutManager::getLutSetFromFile(), HcalQIEManager::getQIETableFromFile(), egHLT::MonElemFuncs::initTightLooseDiObjTrigHistsTrigCuts(), egHLT::MonElemFuncs::initTightLooseTrigHists(), and egHLT::MonElemFuncs::initTightLooseTrigHistsTrigCuts().
{ std::vector <std::string> result; int start = 0; bool empty = true; for (unsigned i = 0; i <= fLine.size (); i++) { if (fLine [i] == ' ' || i == fLine.size ()) { if (!empty) { std::string item (fLine, start, i-start); result.push_back (item); empty = true; } start = i+1; } else { if (empty) empty = false; } } return result; }
std::vector<double> splitStringToDoubleByComma | ( | const std::string & | fLine | ) |
Definition at line 114 of file HcalDbASCIIIO.cc.
References relativeConstraints::empty, i, query::result, dqm_diff::start, and AlCaHLTBitMon_QueryRunRegistry::string.
{ std::vector <double> result; int start = 0; bool empty = true; for (unsigned i = 0; i <= fLine.size (); i++) { if (fLine [i] == ',' || i == fLine.size ()) { if (!empty) { std::string itemString (fLine, start, i-start); result.push_back (atof (itemString.c_str()) ); empty = true; } start = i+1; } else { if (empty) empty = false; } } return result; }
std::vector<float> splitStringToFloatByComma | ( | const std::string & | fLine | ) |
Definition at line 94 of file HcalDbASCIIIO.cc.
References relativeConstraints::empty, i, query::result, dqm_diff::start, and AlCaHLTBitMon_QueryRunRegistry::string.
{ std::vector <float> result; int start = 0; bool empty = true; for (unsigned i = 0; i <= fLine.size (); i++) { if (fLine [i] == ',' || i == fLine.size ()) { if (!empty) { std::string itemString (fLine, start, i-start); result.push_back (atof (itemString.c_str()) ); empty = true; } start = i+1; } else { if (empty) empty = false; } } return result; }
std::vector<unsigned int> splitStringToIntByComma | ( | const std::string & | fLine | ) |
Definition at line 74 of file HcalDbASCIIIO.cc.
References relativeConstraints::empty, i, query::result, dqm_diff::start, and AlCaHLTBitMon_QueryRunRegistry::string.
{ std::vector <unsigned int> result; int start = 0; bool empty = true; for (unsigned i = 0; i <= fLine.size (); i++) { if (fLine [i] == ',' || i == fLine.size ()) { if (!empty) { std::string itemString (fLine, start, i-start); result.push_back (atoi (itemString.c_str()) ); empty = true; } start = i+1; } else { if (empty) empty = false; } } return result; }