test
CMS 3D CMS Logo

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

Namespaces

 Calibration
 
 helper
 

Classes

class  AtomicId
 Cheap generic unique keyword identifier class. More...
 
class  BitSet
 A compact container for storing single bits. More...
 
class  Interceptor
 
class  LeastSquares
 
class  MLP
 
class  MVAComputer
 Main interface class to the generic discriminator computer framework. More...
 
class  MVAComputerCache
 Creates and and MVAComputer from calibrations via EventSetup. More...
 
class  MVAComputerESSourceBase
 
class  MVAComputerESSourceImpl
 
class  MVAModuleHelper
 Template for automated variable collection and MVA computation in EDM modules. More...
 
class  MVAModuleHelperDefaultFiller
 Default template for MVAModuleHelper "Filler" template argument. More...
 
class  MVATrainer
 
class  MVATrainerContainer
 
class  MVATrainerContainerLooperImpl
 
class  MVATrainerContainerSave
 
class  MVATrainerContainerSaveImpl
 
class  MVATrainerFileSave
 
class  MVATrainerFileSaveImpl
 
class  MVATrainerLooper
 
class  MVATrainerLooperImpl
 
class  MVATrainerSave
 
class  MVATrainerSaveImpl
 
class  ProcessRegistry
 Generic registry template for polymorphic processor implementations. More...
 
class  ProcessRegistryImpl
 template to generate a registry singleton for a type. More...
 
class  Source
 
class  SourceVariable
 
class  SourceVariableSet
 
class  Spline
 A simple class for cubic splines. More...
 
class  TrainerMonitoring
 
class  TrainMVAComputerCalibration
 for internal use by MVATrainer More...
 
class  TrainProcessor
 
class  TreeReader
 
class  TreeTrainer
 
class  Variable
 Class describing an input variable. More...
 
class  VarProcessor
 Common base class for variable processors. More...
 

Functions

static std::string escape (const std::string &in)
 
static IdCache & getAtomicIdCache ()
 
static bool isMagic (AtomicId id)
 
static void loadMatrix (DOMElement *elem, unsigned int n, TMatrixDBase &matrix)
 
static void loadVector (DOMElement *elem, unsigned int n, TVectorD &vector)
 
template<typename T >
static std::pair< void
*, std::vector< T > > 
makeMulti ()
 
std::ostream & operator<< (std::ostream &os, const PhysicsTools::AtomicId &id)
 STL streaming operator. More...
 
static DOMElement * saveMatrix (DOMDocument *doc, unsigned int n, const TMatrixDBase &matrix)
 
static DOMElement * saveVector (DOMDocument *doc, unsigned int n, const TVectorD &vector)
 
static std::vector< std::string > split (const std::string line, char delim)
 
static std::string stdStringPrintf (const char *format,...)
 
static std::string stdStringVPrintf (const char *format, std::va_list va)
 

Variables

static const AtomicId kOutputId ("__OUTPUT__")
 
static Interceptor::Registry registry ("Interceptor")
 

Function Documentation

static std::string PhysicsTools::escape ( const std::string &  in)
static

Definition at line 405 of file MVATrainer.cc.

References mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by PhysicsTools::MVATrainer::MVATrainer().

406 {
407  std::string result("'");
408  for(std::string::const_iterator iter = in.begin();
409  iter != in.end(); ++iter) {
410  switch(*iter) {
411  case '\'':
412  result += "'\\''";
413  break;
414  default:
415  result += *iter;
416  }
417  }
418  result += '\'';
419  return result;
420 }
tuple result
Definition: mps_fire.py:84
static IdCache& PhysicsTools::getAtomicIdCache ( )
static

Definition at line 59 of file AtomicId.cc.

Referenced by PhysicsTools::AtomicId::lookup().

60 {
61  [[cms::thread_safe]] static IdCache atomicIdCache;
62  return atomicIdCache;
63 }
static bool PhysicsTools::isMagic ( AtomicId  id)
static

Definition at line 398 of file MVATrainer.cc.

References kOutputId.

Referenced by PhysicsTools::MVATrainer::fillOutputVars().

399 {
400  return id == MVATrainer::kTargetId ||
401  id == MVATrainer::kWeightId ||
402  id == kOutputId;
403 }
static const AtomicId kOutputId("__OUTPUT__")
static void PhysicsTools::loadMatrix ( DOMElement *  elem,
unsigned int  n,
TMatrixDBase &  matrix 
)
static

Definition at line 144 of file LeastSquares.cc.

References cuy::col, Exception, and makeMuonMisalignmentScenario::matrix.

Referenced by PhysicsTools::LeastSquares::load(), and FWGeometry::loadMap().

145 {
146  if (std::strcmp(XMLSimpleStr(elem->getNodeName()),
147  "matrix") != 0)
148  throw cms::Exception("LeastSquares")
149  << "Expected matrix in data file."
150  << std::endl;
151 
152  unsigned int row = 0;
153  for(DOMNode *node = elem->getFirstChild();
154  node; node = node->getNextSibling()) {
155  if (node->getNodeType() != DOMNode::ELEMENT_NODE)
156  continue;
157 
158  if (std::strcmp(XMLSimpleStr(node->getNodeName()),
159  "row") != 0)
160  throw cms::Exception("LeastSquares")
161  << "Expected row tag in data file."
162  << std::endl;
163 
164  if (row >= n)
165  throw cms::Exception("LeastSquares")
166  << "Too many rows in data file." << std::endl;
167 
168  elem = static_cast<DOMElement*>(node);
169 
170  unsigned int col = 0;
171  for(DOMNode *subNode = elem->getFirstChild();
172  subNode; subNode = subNode->getNextSibling()) {
173  if (subNode->getNodeType() != DOMNode::ELEMENT_NODE)
174  continue;
175 
176  if (std::strcmp(XMLSimpleStr(subNode->getNodeName()),
177  "value") != 0)
178  throw cms::Exception("LeastSquares")
179  << "Expected value tag in data file."
180  << std::endl;
181 
182  if (col >= n)
183  throw cms::Exception("LeastSquares")
184  << "Too many columns in data file."
185  << std::endl;
186 
187  matrix(row, col) =
188  XMLDocument::readContent<double>(subNode);
189  col++;
190  }
191 
192  if (col != n)
193  throw cms::Exception("LeastSquares")
194  << "Missing columns in data file."
195  << std::endl;
196  row++;
197  }
198 
199  if (row != n)
200  throw cms::Exception("LeastSquares")
201  << "Missing rows in data file."
202  << std::endl;
203 }
int col
Definition: cuy.py:1008
static void PhysicsTools::loadVector ( DOMElement *  elem,
unsigned int  n,
TVectorD &  vector 
)
static

Definition at line 205 of file LeastSquares.cc.

References cuy::col, and Exception.

Referenced by PhysicsTools::LeastSquares::load().

206 {
207  if (std::strcmp(XMLSimpleStr(elem->getNodeName()),
208  "vector") != 0)
209  throw cms::Exception("LeastSquares")
210  << "Expected matrix in data file."
211  << std::endl;
212 
213  unsigned int col = 0;
214  for(DOMNode *node = elem->getFirstChild();
215  node; node = node->getNextSibling()) {
216  if (node->getNodeType() != DOMNode::ELEMENT_NODE)
217  continue;
218 
219  if (std::strcmp(XMLSimpleStr(node->getNodeName()),
220  "value") != 0)
221  throw cms::Exception("LeastSquares")
222  << "Expected value tag in data file."
223  << std::endl;
224 
225  if (col >= n)
226  throw cms::Exception("LeastSquares")
227  << "Too many columns in data file."
228  << std::endl;
229 
230  vector(col) = XMLDocument::readContent<double>(node);
231  col++;
232  }
233 
234  if (col != n)
235  throw cms::Exception("LeastSquares")
236  << "Missing columns in data file."
237  << std::endl;
238 }
int col
Definition: cuy.py:1008
template<typename T >
static std::pair<void*, std::vector<T> > PhysicsTools::makeMulti ( )
static

Definition at line 196 of file TreeReader.cc.

197 { return std::pair<void*, std::vector<T> >(0, std::vector<T>()); }
std::ostream& PhysicsTools::operator<< ( std::ostream &  os,
const PhysicsTools::AtomicId id 
)
inline

STL streaming operator.

Definition at line 72 of file AtomicId.h.

73 { return os << (const char*)id; }
static DOMElement* PhysicsTools::saveMatrix ( DOMDocument *  doc,
unsigned int  n,
const TMatrixDBase &  matrix 
)
static

Definition at line 240 of file LeastSquares.cc.

References i, j, makeMuonMisalignmentScenario::matrix, gen::n, pyrootRender::root, and relativeConstraints::value.

Referenced by PhysicsTools::LeastSquares::save().

242 {
243  DOMElement *root = doc->createElement(XMLUniStr("matrix"));
244  XMLDocument::writeAttribute<unsigned int>(root, "size", n);
245 
246  for(unsigned int i = 0; i < n; i++) {
247  DOMElement *row = doc->createElement(XMLUniStr("row"));
248  root->appendChild(row);
249 
250  for(unsigned int j = 0; j < n; j++) {
251  DOMElement *value =
252  doc->createElement(XMLUniStr("value"));
253  row->appendChild(value);
254 
255  XMLDocument::writeContent<double>(value, doc,
256  matrix(i, j));
257  }
258  }
259 
260  return root;
261 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
static DOMElement* PhysicsTools::saveVector ( DOMDocument *  doc,
unsigned int  n,
const TVectorD &  vector 
)
static

Definition at line 263 of file LeastSquares.cc.

References i, gen::n, pyrootRender::root, and relativeConstraints::value.

Referenced by PhysicsTools::LeastSquares::save().

265 {
266  DOMElement *root = doc->createElement(XMLUniStr("vector"));
267  XMLDocument::writeAttribute<unsigned int>(root, "size", n);
268 
269  for(unsigned int i = 0; i < n; i++) {
270  DOMElement *value =
271  doc->createElement(XMLUniStr("value"));
272  root->appendChild(value);
273 
274  XMLDocument::writeContent<double>(value, doc, vector(i));
275  }
276 
277  return root;
278 }
int i
Definition: DBlmapReader.cc:9
static std::vector<std::string> PhysicsTools::split ( const std::string  line,
char  delim 
)
static

Definition at line 18 of file MLP.cc.

References AlCaHLTBitMon_ParallelJobs::p, lumiQueryAPI::q, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by PhysicsTools::MLP::MLP(), and PhysicsTools::MVATrainer::setCrossValidation().

19 {
20  const char *str = line.c_str();
21  const char *p = str;
22 
23  std::vector<std::string> tokens;
24 
25  if (line[0] == '\0')
26  return tokens;
27 
28  while(p) {
29  const char *q = std::strchr(p, delim);
30 
31  if (!q) {
32  tokens.push_back(std::string(p));
33  p = 0;
34  } else {
35  tokens.push_back(std::string(p, q - p));
36  p = q + 1;
37  }
38  }
39 
40  return tokens;
41 }
static std::string PhysicsTools::stdStringPrintf ( const char *  format,
  ... 
)
static

Definition at line 183 of file MVATrainer.cc.

References mps_fire::result, stdStringVPrintf(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by PhysicsTools::MVATrainer::bookMonitor(), and PhysicsTools::MVATrainer::trainFileName().

184 {
185  std::va_list va;
186  va_start(va, format);
188  va_end(va);
189  return result;
190 }
tuple result
Definition: mps_fire.py:84
static std::string stdStringVPrintf(const char *format, std::va_list va)
Definition: MVATrainer.cc:160
static std::string PhysicsTools::stdStringVPrintf ( const char *  format,
std::va_list  va 
)
static

Definition at line 160 of file MVATrainer.cc.

References gen::n, mps_fire::result, findQualityFiles::size, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by stdStringPrintf().

161 {
162  unsigned int size = std::min<unsigned int>(128, std::strlen(format));
163  char *buffer = new char[size];
164  for(;;) {
165  int n = std::vsnprintf(buffer, size, format, va);
166  if (n >= 0 && (unsigned int)n < size)
167  break;
168 
169  if (n >= 0)
170  size = n + 1;
171  else
172  size *= 2;
173 
174  delete[] buffer;
175  buffer = new char[size];
176  }
177 
178  std::string result(buffer);
179  delete[] buffer;
180  return result;
181 }
tuple result
Definition: mps_fire.py:84
tuple size
Write out results.

Variable Documentation

const AtomicId PhysicsTools::kOutputId("__OUTPUT__")
static
Interceptor::Registry PhysicsTools::registry("Interceptor")
static