CMS 3D CMS Logo

Functions
DDTypes.cc File Reference
#include "DetectorDescription/Core/interface/DDTypes.h"
#include "DataFormats/Math/interface/GeantUnits.h"
#include <iostream>
#include <utility>

Go to the source code of this file.

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)
 

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 22 of file DDTypes.cc.

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

23 {
24  DDStringArguments::const_iterator it(t.begin()), ed(t.end());
25  for(; it != ed; ++it) {
26  os << it->first << '=' << it->second << std::endl;
27  }
28  return os;
29 }
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 }