DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
ToStream.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework include files
15 #if defined(DD4HEP_PARSER_HEADER)
16 
17 #define DD4HEP_NEED_EVALUATOR
18 // This is the case, if the parsers are externalized
19 // and the dd4hep namespace is renamed!
20 #include DD4HEP_PARSER_HEADER
21 
22 #else
23 
24 // Standard dd4hep parser handling
25 #include "Parsers/spirit/ToStream.h"
26 
27 #endif
28 
29 #ifndef DD4HEP_PARSERS_NO_ROOT
30 #include "Math/Translation3D.h"
31 
33 namespace dd4hep {
35  namespace Parsers {
36  // ============================================================================
37  // print XYZ-point
38  std::ostream& toStream_(const ROOT::Math::XYZPoint& obj, std::ostream& s) {
39  s << "( ";
40  toStream_(obj.X () , s );
41  s << " , ";
42  toStream_(obj.Y () , s );
43  s << " , ";
44  toStream_(obj.Z () , s );
45  s << " )";
46  return s;
47  }
48  template <> std::ostream& toStream(const ROOT::Math::XYZPoint& obj, std::ostream& s)
49  { return toStream_(obj, s); }
50  // ============================================================================
51  // print XYZ-vector
52  std::ostream& toStream_(const ROOT::Math::XYZVector& obj, std::ostream& s) {
53  s << "( ";
54  toStream_(obj.X () , s );
55  s << " , ";
56  toStream_(obj.Y () , s );
57  s << " , ";
58  toStream_(obj.Z () , s );
59  s << " )";
60  return s;
61  }
62  template <> std::ostream& toStream(const ROOT::Math::XYZVector& obj, std::ostream& s)
63  { return toStream_(obj, s); }
64  // ============================================================================
65  // print LorentzVector
66  std::ostream& toStream_(const ROOT::Math::PxPyPzEVector& obj, std::ostream& s){
67  s << "( ";
68  toStream_(obj.Px () , s , 12 );
69  s << " , ";
70  toStream_(obj.Py () , s , 12 );
71  s << " , ";
72  toStream_(obj.Pz () , s , 13 );
73  s << " , ";
74  toStream_(obj.E () , s , 14 );
75  s << " )";
76  return s;
77  }
78  template <> std::ostream& toStream(const ROOT::Math::PxPyPzEVector& obj, std::ostream& s)
79  { return toStream_(obj, s); }
80  // ============================================================================
81  // print Translation3D
82  std::ostream& toStream_(const ROOT::Math::Translation3D& obj, std::ostream& s){
83  double x,y,z;
84  obj.GetComponents(x,y,z);
85  s << "( ";
86  toStream_(x , s );
87  s << " , ";
88  toStream_(y , s );
89  s << " , ";
90  toStream_(z, s );
91  s << " )";
92  return s;
93  }
94  template <> std::ostream& toStream(const ROOT::Math::Translation3D& obj, std::ostream& s)
95  { return toStream_(obj, s); }
96  // ============================================================================
97  // print RotationZYX
98  std::ostream& toStream_(const ROOT::Math::RotationZYX& obj, std::ostream& s){
99  s << "( ";
100  toStream_(obj.Phi () , s , 12 ); // Z-angle
101  s << " , ";
102  toStream_(obj.Theta () , s , 12 ); // Y-angle
103  s << " , ";
104  toStream_(obj.Psi () , s , 12 ); // X-angle
105  s << " )";
106  return s;
107  }
108  template <> std::ostream& toStream(const ROOT::Math::RotationZYX& obj, std::ostream& s)
109  { return toStream_(obj, s); }
110  }
111 }
112 #endif
dd4hep::Parsers::toStream_
std::ostream & toStream_(const ROOT::Math::XYZPoint &obj, std::ostream &s)
Definition: ToStream.cpp:38
dd4hep::Translation3D
ROOT::Math::Translation3D Translation3D
Definition: Objects.h:119
dd4hep::Parsers::toStream
std::ostream & toStream(const Property &result, std::ostream &os)
Definition: ComponentProperties.cpp:191
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::RotationZYX
ROOT::Math::RotationZYX RotationZYX
Definition: Objects.h:105