#include <vector>
#include <string>
#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h"
#include "DataFormats/HcalDetId/interface/HcalDetId.h"
#include "DataFormats/HcalDetId/interface/HcalCastorDetId.h"
#include "DataFormats/HcalDetId/interface/CastorElectronicsId.h"
#include "CalibFormats/CastorObjects/interface/CastorText2DetIdConverter.h"
#include "CondFormats/CastorObjects/interface/AllObjects.h"
#include "CalibCalorimetry/CastorCalib/interface/CastorDbASCIIIO.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
Go to the source code of this file.
Functions | |
template<class T> | |
bool | dumpHcalObject (std::ostream &fOutput, const T &fObject) |
void | dumpId (std::ostream &fOutput, DetId id) |
bool | CastorDbASCIIIO::dumpObject (std::ostream &fOutput, const CastorElectronicsMap &fObject) |
bool | CastorDbASCIIIO::dumpObject (std::ostream &fOutput, const CastorChannelQuality &fObject) |
bool | CastorDbASCIIIO::dumpObject (std::ostream &fOutput, const CastorCalibrationQIEData &fObject) |
bool | CastorDbASCIIIO::dumpObject (std::ostream &fOutput, const CastorQIEData &fObject) |
bool | CastorDbASCIIIO::dumpObject (std::ostream &fOutput, const CastorPedestalWidths &fObject) |
bool | CastorDbASCIIIO::dumpObject (std::ostream &fOutput, const CastorGainWidths &fObject) |
bool | CastorDbASCIIIO::dumpObject (std::ostream &fOutput, const CastorGains &fObject) |
bool | CastorDbASCIIIO::dumpObject (std::ostream &fOutput, const CastorPedestals &fObject) |
template<class T> | |
bool | getHcalObject (std::istream &fInput, T *fObject) |
DetId | getId (const std::vector< std::string > &items) |
bool | CastorDbASCIIIO::getObject (std::istream &fInput, CastorElectronicsMap *fObject) |
bool | CastorDbASCIIIO::getObject (std::istream &fInput, CastorChannelQuality *fObject) |
bool | CastorDbASCIIIO::getObject (std::istream &fInput, CastorCalibrationQIEData *fObject) |
bool | CastorDbASCIIIO::getObject (std::istream &fInput, CastorQIEData *fObject) |
bool | CastorDbASCIIIO::getObject (std::istream &fInput, CastorPedestalWidths *fObject) |
bool | CastorDbASCIIIO::getObject (std::istream &fInput, CastorGainWidths *fObject) |
bool | CastorDbASCIIIO::getObject (std::istream &fInput, CastorGains *fObject) |
bool | CastorDbASCIIIO::getObject (std::istream &fInput, CastorPedestals *fObject) |
std::vector< std::string > | splitString (const std::string &fLine) |
bool dumpHcalObject | ( | std::ostream & | fOutput, | |
const T & | fObject | |||
) | [inline] |
Definition at line 110 of file CastorDbASCIIIO.cc.
References dumpId(), python::multivaluedict::sort(), and values.
00110 { 00111 char buffer [1024]; 00112 sprintf (buffer, "# %15s %15s %15s %15s %8s %8s %8s %8s %10s\n", "eta", "phi", "dep", "det", "cap0", "cap1", "cap2", "cap3", "DetId"); 00113 fOutput << buffer; 00114 std::vector<DetId> channels = fObject.getAllChannels (); 00115 std::sort (channels.begin(), channels.end(), DetIdLess ()); 00116 for (std::vector<DetId>::iterator channel = channels.begin (); 00117 channel != channels.end (); 00118 channel++) { 00119 const float* values = fObject.getValues (*channel)->getValues (); 00120 if (values) { 00121 dumpId (fOutput, *channel); 00122 sprintf (buffer, " %8.5f %8.5f %8.5f %8.5f %10X\n", 00123 values[0], values[1], values[2], values[3], channel->rawId ()); 00124 fOutput << buffer; 00125 } 00126 } 00127 return true; 00128 }
Definition at line 73 of file CastorDbASCIIIO.cc.
References CastorText2DetIdConverter::getField1(), CastorText2DetIdConverter::getField2(), CastorText2DetIdConverter::getField3(), and CastorText2DetIdConverter::getFlavor().
Referenced by dumpHcalObject(), dumpHcalSingleFloatObject(), and dumpHcalSingleIntObject().
00073 { 00074 CastorText2DetIdConverter converter (id); 00075 char buffer [1024]; 00076 sprintf (buffer, " %15s %15s %15s %15s", 00077 converter.getField1 ().c_str (), converter.getField2 ().c_str (), converter.getField3 ().c_str (),converter.getFlavor ().c_str ()); 00078 fOutput << buffer; 00079 }
bool getHcalObject | ( | std::istream & | fInput, | |
T * | fObject | |||
) | [inline] |
Definition at line 82 of file CastorDbASCIIIO.cc.
References e, lat::endl(), getId(), and splitString().
00082 { 00083 if (!fObject) fObject = new T; 00084 char buffer [1024]; 00085 while (fInput.getline(buffer, 1024)) { 00086 if (buffer [0] == '#') continue; //ignore comment 00087 std::vector <std::string> items = splitString (std::string (buffer)); 00088 if (items.size()==0) continue; // blank line 00089 if (items.size () < 8) { 00090 edm::LogWarning("Format Error") << "Bad line: " << buffer << "\n line must contain 8 items: eta, phi, depth, subdet, 4x values" << std::endl; 00091 continue; 00092 } 00093 DetId id = getId (items); 00094 fObject->sort (); 00095 try { 00096 fObject->getValues (id); 00097 edm::LogWarning("Redefining Channel") << "line: " << buffer << "\n attempts to redefine data. Ignored" << std::endl; 00098 } 00099 catch (cms::Exception& e) { 00100 fObject->addValue (id, 00101 atof (items [4].c_str()), atof (items [5].c_str()), 00102 atof (items [6].c_str()), atof (items [7].c_str())); 00103 } 00104 } 00105 fObject->sort (); 00106 return true; 00107 }
DetId getId | ( | const std::vector< std::string > & | items | ) |
Definition at line 68 of file CastorDbASCIIIO.cc.
References CastorText2DetIdConverter::getId().
Referenced by EvtGenProducer::EvtGenProducer(), AdaptiveVertexFitter::fit(), getHcalObject(), getHcalSingleFloatObject(), getHcalSingleIntObject(), VisCuTkLayerSelection::paintEvent(), AdaptiveVertexFitter::reWeightTracks(), and AdaptiveVertexFitter::weightTracks().
00068 { 00069 CastorText2DetIdConverter converter (items [3], items [0], items [1], items [2]); 00070 return converter.getId (); 00071 }
std::vector<std::string> splitString | ( | const std::string & | fLine | ) |
Definition at line 48 of file CastorDbASCIIIO.cc.
References empty, i, and HLT_VtxMuL3::result.
Referenced by cscdqm::Detector::AddressFromString(), getHcalObject(), getHcalSingleFloatObject(), and getHcalSingleIntObject().
00048 { 00049 std::vector <std::string> result; 00050 int start = 0; 00051 bool empty = true; 00052 for (unsigned i = 0; i <= fLine.size (); i++) { 00053 if (fLine [i] == ' ' || i == fLine.size ()) { 00054 if (!empty) { 00055 std::string item (fLine, start, i-start); 00056 result.push_back (item); 00057 empty = true; 00058 } 00059 start = i+1; 00060 } 00061 else { 00062 if (empty) empty = false; 00063 } 00064 } 00065 return result; 00066 }