CMS 3D CMS Logo

Typedefs | Functions
DDTypes.h File Reference
#include <string>
#include <vector>
#include <map>
#include "DetectorDescription/Core/interface/DDReadMapType.h"
#include <iosfwd>

Go to the source code of this file.

Typedefs

typedef ReadMapType< std::map< std::string, double > > DDMapArguments
 corresponds to a collection of named std::maps of strings to double */ More...
 
typedef ReadMapType< double > DDNumericArguments
 corresponds to a collection of named doubles More...
 
typedef ReadMapType< std::string > DDStringArguments
 corresponds to a collection of named strings More...
 
typedef ReadMapType< std::vector< std::string > > DDStringVectorArguments
 
typedef ReadMapType< std::vector< double > > DDVectorArguments
 corresponds to a collection of named std::vectors of doubles */ More...
 

Functions

std::string formatAsDegrees (double radianVal)
 
std::string formatAsDegreesInInteger (double radianVal)
 
std::ostream & operator<< (std::ostream &os, const DDNumericArguments &t)
 
std::ostream & operator<< (std::ostream &os, const DDStringArguments &t)
 
std::ostream & operator<< (std::ostream &os, const DDVectorArguments &t)
 

Typedef Documentation

typedef ReadMapType<std::map<std::string,double> > DDMapArguments

corresponds to a collection of named std::maps of strings to double */

in XML: a set of <Map name="n"> val:1, val_2:2 </Map>

Definition at line 24 of file DDTypes.h.

corresponds to a collection of named doubles

in XML: a set of <Numeric name="n" value="1">

Definition at line 12 of file DDTypes.h.

typedef ReadMapType<std::string> DDStringArguments

corresponds to a collection of named strings

in XML: a set of <String name="n" value="val">

Definition at line 16 of file DDTypes.h.

typedef ReadMapType<std::vector<std::string> > DDStringVectorArguments

Definition at line 26 of file DDTypes.h.

typedef ReadMapType<std::vector<double> > DDVectorArguments

corresponds to a collection of named std::vectors of doubles */

in XML: a set of <Vector name="n"> 1,2,3,4 </Vector>

Definition at line 20 of file DDTypes.h.

Function Documentation

std::string formatAsDegrees ( double  radianVal)

Definition at line 75 of file DDTypes.cc.

References geant_units::operators::convertRadToDeg().

Referenced by DDHGCalWafer::execute(), DDHGCalWaferAlgo::execute(), DDMuonAngular::execute(), DDHCalTBZposAlgo::execute(), and DDGEMAngular::execute().

76 {
77  const unsigned short numlen = 12;
78  char degstr[numlen];
79  int retval = snprintf(degstr, numlen, "%0*f", numlen - 1, convertRadToDeg( radianVal ));
80  if (retval == numlen - 1)
81  return degstr;
82  else return "0000.000000";
83 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: GeantUnits.h:98
std::string formatAsDegreesInInteger ( double  radianVal)

Definition at line 86 of file DDTypes.cc.

References geant_units::operators::convertRadToDeg().

Referenced by DDHCalBarrelAlgo::constructGeneralVolume(), DDHCalEndcapAlgo::constructGeneralVolume(), DDHCalTBCableAlgo::execute(), and DDHCalAngular::execute().

86  {
87 
88  const unsigned short numlen = 4;
89  char degstr[numlen];
90  int degVal = std::lround(convertRadToDeg( radianVal ));
91  if (degVal < 0) degVal += 360;
92  else if (degVal >= 360) degVal -= 360;
93  int retval = snprintf(degstr, numlen, "%0*d", numlen-1, degVal);
94 
95  if (retval == numlen - 1) return degstr;
96  else return "000";
97 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: GeantUnits.h:98
std::ostream& operator<< ( std::ostream &  os,
const DDNumericArguments t 
)

Definition at line 13 of file DDTypes.cc.

Referenced by operator<<().

14 {
15  DDNumericArguments::const_iterator it(t.begin()), ed(t.end());
16  for(; it != ed; ++it) {
17  os << it->first << '=' << it->second << std::endl;
18  }
19  return os;
20 }
std::ostream & operator<< ( std::ostream &  os,
const DDStringArguments t 
)

Definition at line 45 of file DDTypes.cc.

References operator<<(), and protons_cff::t.

46 {
47  DDMapArguments::const_iterator it(t.begin()), ed(t.end());
48  for(; it != ed; ++it) {
49  os << it->first << ": ";
50  std::map<std::string,double>::const_iterator mit(it->second.begin()), med(it->second.end());
51  for(;mit!=med;++mit) {
52  os << mit->first << '=' << mit->second << ' ';
53  }
54  os << std::endl;
55  }
56  return os;
57 }
std::ostream& operator<< ( std::ostream &  os,
const DDVectorArguments t 
)

Definition at line 31 of file DDTypes.cc.

32 {
33  DDVectorArguments::const_iterator it(t.begin()), ed(t.end());
34  for(; it != ed; ++it) {
35  os << it->first << ": ";
36  std::vector<double>::const_iterator vit(it->second.begin()), ved(it->second.end());
37  for(;vit!=ved;++vit) {
38  os << *vit << ' ';
39  }
40  os << std::endl;
41  }
42  return os;
43 }