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)
 
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)
 
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 111 of file CastorDbASCIIIO.cc.

References dumpId(), and makeHLTPrescaleTable::values.

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

Definition at line 158 of file CastorDbASCIIIO.cc.

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

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

Definition at line 203 of file CastorDbASCIIIO.cc.

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

203  {
204  char buffer [1024];
205  sprintf (buffer, "# %15s %15s %15s %15s %8s %10s\n", "eta", "phi", "dep", "det", "value", "DetId");
206  fOutput << buffer;
207  std::vector<DetId> channels = fObject.getAllChannels ();
208  std::sort (channels.begin(), channels.end(), DetIdLess ());
209  for (std::vector<DetId>::iterator channel = channels.begin ();
210  channel != channels.end ();
211  channel++) {
212  const int value = fObject.getValues (*channel)->getValue ();
213  dumpId (fOutput, *channel);
214  sprintf (buffer, " %15d %10X\n",
215  value, channel->rawId ());
216  fOutput << buffer;
217  }
218  return true;
219 }
void dumpId(std::ostream &fOutput, DetId id)
void CastorDbASCIIIO::dumpId ( std::ostream &  fOutput,
DetId  id 
)

Definition at line 74 of file CastorDbASCIIIO.cc.

References CastorText2DetIdConverter::getField1(), CastorText2DetIdConverter::getField2(), CastorText2DetIdConverter::getField3(), and CastorText2DetIdConverter::getFlavor().

Referenced by dumpCastorObject(), dumpCastorSingleFloatObject(), dumpCastorSingleIntObject(), dumpHcalMatrixObject(), dumpHcalObject(), dumpHcalSingleFloatObject(), and dumpHcalSingleIntObject().

74  {
75  CastorText2DetIdConverter converter (id);
76  char buffer [1024];
77  sprintf (buffer, " %15s %15s %15s %15s",
78  converter.getField1 ().c_str (), converter.getField2 ().c_str (), converter.getField3 ().c_str (),converter.getFlavor ().c_str ());
79  fOutput << buffer;
80 }
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 
)
template<class T , class S >
bool CastorDbASCIIIO::getCastorObject ( std::istream &  fInput,
T *  fObject,
S *  fCondObject 
)

Definition at line 83 of file CastorDbASCIIIO.cc.

References getId(), and splitString().

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

Definition at line 132 of file CastorDbASCIIIO.cc.

References getId(), and splitString().

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

Definition at line 177 of file CastorDbASCIIIO.cc.

References getId(), and splitString().

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

Definition at line 69 of file CastorDbASCIIIO.cc.

References CastorText2DetIdConverter::getId().

Referenced by gen::EvtGenInterface::EvtGenInterface(), AdaptiveVertexFitter::fit(), getCastorObject(), getCastorSingleFloatObject(), getCastorSingleIntObject(), getHcalMatrixObject(), getHcalObject(), getHcalSingleFloatObject(), getHcalSingleIntObject(), NtupleROOTFile::getIsthep(), NtupleROOTFile::getJdahep(), NtupleROOTFile::getJmohep(), NtupleROOTFile::getJsdhep(), NtupleROOTFile::getJsmhep(), HitComparator::operator()(), FEConfigBadXTInfo::prepareWrite(), ODFEPedestalOffsetInfo::prepareWrite(), ODFEWeightsInfo::prepareWrite(), ODGolBiasCurrentInfo::prepareWrite(), ODTowersToByPassInfo::prepareWrite(), ODFEDelaysInfo::prepareWrite(), ODVfeToRejectInfo::prepareWrite(), ODBadTTInfo::prepareWrite(), ODBadXTInfo::prepareWrite(), FEConfigBadStripInfo::prepareWrite(), FEConfigBadTTInfo::prepareWrite(), ODCond2ConfInfo::prepareWrite(), FEConfigSpikeInfo::prepareWrite(), FEConfigTimingInfo::prepareWrite(), FEConfigWeightInfo::prepareWrite(), FEConfigFgrInfo::prepareWrite(), FEConfigLinInfo::prepareWrite(), FEConfigLUTInfo::prepareWrite(), FEConfigPedInfo::prepareWrite(), FEConfigSlidingInfo::prepareWrite(), AdaptiveVertexFitter::reWeightTracks(), AdaptiveVertexFitter::weightTracks(), ODLaserCycle::writeDB(), ODDCCCycle::writeDB(), ODSRPCycle::writeDB(), ODLTSCycle::writeDB(), ODTCCCycle::writeDB(), ODTCCEECycle::writeDB(), ODDCUCycle::writeDB(), ODTTCFCycle::writeDB(), ODTTCciCycle::writeDB(), ODJBH4Cycle::writeDB(), ODScanCycle::writeDB(), ODLTCCycle::writeDB(), and ODCCSCycle::writeDB().

69  {
70  CastorText2DetIdConverter converter (items [3], items [0], items [1], items [2]);
71  return converter.getId ();
72 }
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 
)
std::vector<std::string> CastorDbASCIIIO::splitString ( const std::string &  fLine)

Definition at line 49 of file CastorDbASCIIIO.cc.

References relativeConstraints::empty, i, and query::result.

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

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