#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) |
bool dumpHcalMatrixObject | ( | std::ostream & | fOutput, |
const T & | fObject | ||
) |
Definition at line 256 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 121 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 168 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 213 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 232 of file HcalDbASCIIIO.cc.
References HcalDbASCIIIO::getId(), i, j, DetId::rawId(), and splitString().
{ if (!fObject) 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 93 of file HcalDbASCIIIO.cc.
References HcalDbASCIIIO::getId(), and splitString().
{ if (!fObject) 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 142 of file HcalDbASCIIIO.cc.
References HcalDbASCIIIO::getId(), and splitString().
{ if (!fObject) 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 8 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 187 of file HcalDbASCIIIO.cc.
References HcalDbASCIIIO::getId(), and splitString().
{ if (!fObject) 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 8 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 53 of file HcalDbASCIIIO.cc.
References relativeConstraints::empty, i, and query::result.
Referenced by cscdqm::Detector::AddressFromString(), 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; }