CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions
CastorDbASCIIIO Namespace Reference

Classes

class  CastorElectronicsIdLess
 
class  DetIdLess
 

Functions

template<class T >
bool dumpCastorObject (std::ostream &fOutput, const T &fObject)
 
template<class T >
bool dumpCastorSingleFloatObject (std::ostream &fOutput, const T &fObject)
 
template<class T >
bool dumpCastorSingleIntObject (std::ostream &fOutput, const T &fObject)
 
void dumpId (std::ostream &fOutput, DetId id)
 
bool dumpObject (std::ostream &fOutput, const CastorPedestals &fObject)
 
bool dumpObject (std::ostream &fOutput, const CastorPedestalWidths &fObject)
 
bool dumpObject (std::ostream &fOutput, const CastorGains &fObject)
 
bool dumpObject (std::ostream &fOutput, const CastorGainWidths &fObject)
 
bool dumpObject (std::ostream &fOutput, const CastorQIEData &fObject)
 
bool dumpObject (std::ostream &fOutput, const CastorCalibrationQIEData &fObject)
 
bool dumpObject (std::ostream &fOutput, const CastorElectronicsMap &fObject)
 
bool dumpObject (std::ostream &fOutput, const CastorChannelQuality &fObject)
 
bool dumpObject (std::ostream &fOutput, const CastorRecoParams &fObject)
 
bool dumpObject (std::ostream &fOutput, const CastorSaturationCorrs &fObject)
 
template<class T , class S >
bool getCastorObject (std::istream &fInput, T *fObject, S *fCondObject)
 
template<class T , class S >
bool getCastorSingleFloatObject (std::istream &fInput, T *fObject, S *fCondObject)
 
template<class T , class S >
bool getCastorSingleIntObject (std::istream &fInput, T *fObject, S *fCondObject)
 
DetId getId (const std::vector< std::string > &items)
 
bool getObject (std::istream &fInput, CastorPedestals *fObject)
 
bool getObject (std::istream &fInput, CastorPedestalWidths *fObject)
 
bool getObject (std::istream &fInput, CastorGains *fObject)
 
bool getObject (std::istream &fInput, CastorGainWidths *fObject)
 
bool getObject (std::istream &fInput, CastorQIEData *fObject)
 
bool getObject (std::istream &fInput, CastorCalibrationQIEData *fObject)
 
bool getObject (std::istream &fInput, CastorElectronicsMap *fObject)
 
bool getObject (std::istream &fInput, CastorChannelQuality *fObject)
 
bool getObject (std::istream &fInput, CastorRecoParams *fObject)
 
bool getObject (std::istream &fInput, CastorSaturationCorrs *fObject)
 
std::vector< std::string > splitString (const std::string &fLine)
 

Function Documentation

template<class T >
bool CastorDbASCIIIO::dumpCastorObject ( std::ostream &  fOutput,
const T fObject 
)

Definition at line 110 of file CastorDbASCIIIO.cc.

References dumpId(), and makeHLTPrescaleTable::values.

110  {
111  char buffer [1024];
112  sprintf (buffer, "# %15s %15s %15s %15s %8s %8s %8s %8s %10s\n", "eta", "phi", "dep", "det", "cap0", "cap1", "cap2", "cap3", "DetId");
113  fOutput << buffer;
114  std::vector<DetId> channels = fObject.getAllChannels ();
115  //std::sort (channels.begin(), channels.end(), DetIdLess ());
116  for (std::vector<DetId>::iterator channel = channels.begin ();
117  channel != channels.end ();
118  channel++) {
119  const float* values = fObject.getValues (*channel)->getValues ();
120  if (values) {
121  dumpId (fOutput, *channel);
122  sprintf (buffer, " %8.5f %8.5f %8.5f %8.5f %10X\n",
123  values[0], values[1], values[2], values[3], channel->rawId ());
124  fOutput << buffer;
125  }
126  }
127  return true;
128 }
void dumpId(std::ostream &fOutput, DetId id)
template<class T >
bool CastorDbASCIIIO::dumpCastorSingleFloatObject ( std::ostream &  fOutput,
const T fObject 
)

Definition at line 157 of file CastorDbASCIIIO.cc.

References dumpId(), python.multivaluedict::sort(), and relativeConstraints::value.

157  {
158  char buffer [1024];
159  sprintf (buffer, "# %15s %15s %15s %15s %8s %10s\n", "eta", "phi", "dep", "det", "value", "DetId");
160  fOutput << buffer;
161  std::vector<DetId> channels = fObject.getAllChannels ();
162  std::sort (channels.begin(), channels.end(), DetIdLess ());
163  for (std::vector<DetId>::iterator channel = channels.begin ();
164  channel != channels.end ();
165  channel++) {
166  const float value = fObject.getValues (*channel)->getValue ();
167  dumpId (fOutput, *channel);
168  sprintf (buffer, " %8.5f %10X\n",
169  value, channel->rawId ());
170  fOutput << buffer;
171  }
172  return true;
173 }
void dumpId(std::ostream &fOutput, DetId id)
template<class T >
bool CastorDbASCIIIO::dumpCastorSingleIntObject ( std::ostream &  fOutput,
const T fObject 
)

Definition at line 202 of file CastorDbASCIIIO.cc.

References dumpId(), python.multivaluedict::sort(), and relativeConstraints::value.

202  {
203  char buffer [1024];
204  sprintf (buffer, "# %15s %15s %15s %15s %8s %10s\n", "eta", "phi", "dep", "det", "value", "DetId");
205  fOutput << buffer;
206  std::vector<DetId> channels = fObject.getAllChannels ();
207  std::sort (channels.begin(), channels.end(), DetIdLess ());
208  for (std::vector<DetId>::iterator channel = channels.begin ();
209  channel != channels.end ();
210  channel++) {
211  const int value = fObject.getValues (*channel)->getValue ();
212  dumpId (fOutput, *channel);
213  sprintf (buffer, " %15d %10X\n",
214  value, channel->rawId ());
215  fOutput << buffer;
216  }
217  return true;
218 }
void dumpId(std::ostream &fOutput, DetId id)
void CastorDbASCIIIO::dumpId ( std::ostream &  fOutput,
DetId  id 
)
bool CastorDbASCIIIO::dumpObject ( std::ostream &  fOutput,
const CastorPedestals fObject 
)
bool CastorDbASCIIIO::dumpObject ( std::ostream &  fOutput,
const CastorPedestalWidths fObject 
)
bool CastorDbASCIIIO::dumpObject ( std::ostream &  fOutput,
const CastorGains fObject 
)
bool CastorDbASCIIIO::dumpObject ( std::ostream &  fOutput,
const CastorGainWidths fObject 
)
bool CastorDbASCIIIO::dumpObject ( std::ostream &  fOutput,
const CastorQIEData fObject 
)
bool CastorDbASCIIIO::dumpObject ( std::ostream &  fOutput,
const CastorCalibrationQIEData fObject 
)
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 CastorRecoParams fObject 
)
bool CastorDbASCIIIO::dumpObject ( std::ostream &  fOutput,
const CastorSaturationCorrs fObject 
)
template<class T , class S >
bool CastorDbASCIIIO::getCastorObject ( std::istream &  fInput,
T fObject,
S *  fCondObject 
)

Definition at line 82 of file CastorDbASCIIIO.cc.

References getId(), splitString(), and AlCaHLTBitMon_QueryRunRegistry::string.

82  {
83  if (!fObject) fObject = new T;
84  char buffer [1024];
85  while (fInput.getline(buffer, 1024)) {
86  if (buffer [0] == '#') continue; //ignore comment
87  std::vector <std::string> items = splitString (std::string (buffer));
88  if (items.size()==0) continue; // blank line
89  if (items.size () < 8) {
90  edm::LogWarning("Format Error") << "Bad line: " << buffer << "\n line must contain 8 items: eta, phi, depth, subdet, 4x values" << std::endl;
91  continue;
92  }
93  DetId id = getId (items);
94 
95 // if (fObject->exists(id) )
96 // edm::LogWarning("Redefining Channel") << "line: " << buffer << "\n attempts to redefine data. Ignored" << std::endl;
97 // else
98 // {
99  fCondObject = new S(id, atof (items [4].c_str()), atof (items [5].c_str()),
100  atof (items [6].c_str()), atof (items [7].c_str()));
101  fObject->addValues(*fCondObject);
102  delete fCondObject;
103  // }
104  }
105 
106  return true;
107 }
static unsigned int getId(void)
std::vector< std::string > splitString(const std::string &fLine)
Definition: DetId.h:18
long double T
template<class T , class S >
bool CastorDbASCIIIO::getCastorSingleFloatObject ( std::istream &  fInput,
T fObject,
S *  fCondObject 
)

Definition at line 131 of file CastorDbASCIIIO.cc.

References getId(), splitString(), and AlCaHLTBitMon_QueryRunRegistry::string.

131  {
132  if (!fObject) fObject = new T;
133  char buffer [1024];
134  while (fInput.getline(buffer, 1024)) {
135  if (buffer [0] == '#') continue; //ignore comment
136  std::vector <std::string> items = splitString (std::string (buffer));
137  if (items.size()==0) continue; // blank line
138  if (items.size () < 5) {
139  edm::LogWarning("Format Error") << "Bad line: " << buffer << "\n line must contain 5 items: eta, phi, depth, subdet, value" << std::endl;
140  continue;
141  }
142  DetId id = getId (items);
143 
144 // if (fObject->exists(id) )
145 // edm::LogWarning("Redefining Channel") << "line: " << buffer << "\n attempts to redefine data. Ignored" << std::endl;
146 // else
147 // {
148  fCondObject = new S(id, atof (items [4].c_str()) );
149  fObject->addValues(*fCondObject);
150  delete fCondObject;
151  // }
152  }
153  return true;
154 }
static unsigned int getId(void)
std::vector< std::string > splitString(const std::string &fLine)
Definition: DetId.h:18
long double T
template<class T , class S >
bool CastorDbASCIIIO::getCastorSingleIntObject ( std::istream &  fInput,
T fObject,
S *  fCondObject 
)

Definition at line 176 of file CastorDbASCIIIO.cc.

References getId(), splitString(), and AlCaHLTBitMon_QueryRunRegistry::string.

176  {
177  if (!fObject) fObject = new T;
178  char buffer [1024];
179  while (fInput.getline(buffer, 1024)) {
180  if (buffer [0] == '#') continue; //ignore comment
181  std::vector <std::string> items = splitString (std::string (buffer));
182  if (items.size()==0) continue; // blank line
183  if (items.size () < 5) {
184  edm::LogWarning("Format Error") << "Bad line: " << buffer << "\n line must contain 5 items: eta, phi, depth, subdet, value" << std::endl;
185  continue;
186  }
187  DetId id = getId (items);
188 
189 // if (fObject->exists(id) )
190 // edm::LogWarning("Redefining Channel") << "line: " << buffer << "\n attempts to redefine data. Ignored" << std::endl;
191 // else
192 // {
193  fCondObject = new S(id, atoi (items [4].c_str()) );
194  fObject->addValues(*fCondObject);
195  delete fCondObject;
196  // }
197  }
198  return true;
199 }
static unsigned int getId(void)
std::vector< std::string > splitString(const std::string &fLine)
Definition: DetId.h:18
long double T
DetId CastorDbASCIIIO::getId ( const std::vector< std::string > &  items)
bool CastorDbASCIIIO::getObject ( std::istream &  fInput,
CastorPedestals fObject 
)

Referenced by produce_impl().

bool CastorDbASCIIIO::getObject ( std::istream &  fInput,
CastorPedestalWidths fObject 
)
bool CastorDbASCIIIO::getObject ( std::istream &  fInput,
CastorGains fObject 
)
bool CastorDbASCIIIO::getObject ( std::istream &  fInput,
CastorGainWidths fObject 
)
bool CastorDbASCIIIO::getObject ( std::istream &  fInput,
CastorQIEData fObject 
)
bool CastorDbASCIIIO::getObject ( std::istream &  fInput,
CastorCalibrationQIEData fObject 
)
bool CastorDbASCIIIO::getObject ( std::istream &  fInput,
CastorElectronicsMap fObject 
)
bool CastorDbASCIIIO::getObject ( std::istream &  fInput,
CastorChannelQuality fObject 
)
bool CastorDbASCIIIO::getObject ( std::istream &  fInput,
CastorRecoParams fObject 
)
bool CastorDbASCIIIO::getObject ( std::istream &  fInput,
CastorSaturationCorrs fObject 
)
std::vector<std::string> CastorDbASCIIIO::splitString ( const std::string &  fLine)

Definition at line 48 of file CastorDbASCIIIO.cc.

References relativeConstraints::empty, i, query::result, dqm_diff::start, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getCastorObject(), getCastorSingleFloatObject(), and getCastorSingleIntObject().

48  {
49  std::vector <std::string> result;
50  int start = 0;
51  bool empty = true;
52  for (unsigned i = 0; i <= fLine.size (); i++) {
53  if (fLine [i] == ' ' || i == fLine.size ()) {
54  if (!empty) {
55  std::string item (fLine, start, i-start);
56  result.push_back (item);
57  empty = true;
58  }
59  start = i+1;
60  }
61  else {
62  if (empty) empty = false;
63  }
64  }
65  return result;
66 }
int i
Definition: DBlmapReader.cc:9
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
tuple result
Definition: query.py:137