Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:32

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 
0014 // Framework include files
0015 #if defined(DD4HEP_PARSER_HEADER)
0016 
0017 #define DD4HEP_NEED_EVALUATOR
0018 // This is the case, if the parsers are externalized
0019 // and the dd4hep namespace is renamed!
0020 #include DD4HEP_PARSER_HEADER
0021 
0022 #else
0023 
0024 // Standard dd4hep parser handling
0025 #include "Parsers/spirit/ToStream.h"
0026 
0027 #endif
0028 
0029 #ifndef DD4HEP_PARSERS_NO_ROOT
0030 #include "Math/Translation3D.h"
0031 
0032 /// Namespace for the AIDA detector description toolkit
0033 namespace dd4hep {
0034   /// Namespace for the AIDA detector for utilities using boost::spirit parsers
0035   namespace Parsers {
0036     // ============================================================================
0037     // print XYZ-point
0038     std::ostream& toStream_(const ROOT::Math::XYZPoint&  obj, std::ostream& s)  {
0039       s << "( ";
0040       toStream_(obj.X () , s );
0041       s << " , ";
0042       toStream_(obj.Y () , s );
0043       s << " , ";
0044       toStream_(obj.Z () , s );
0045       s << " )";
0046       return s;
0047     }
0048     template <> std::ostream& toStream(const ROOT::Math::XYZPoint& obj, std::ostream& s)
0049     {  return toStream_(obj, s); }
0050     // ============================================================================
0051     // print XYZ-vector
0052     std::ostream& toStream_(const ROOT::Math::XYZVector& obj, std::ostream& s)  {
0053       s << "( ";
0054       toStream_(obj.X () , s );
0055       s << " , ";
0056       toStream_(obj.Y () , s );
0057       s << " , ";
0058       toStream_(obj.Z () , s );
0059       s << " )";
0060       return s;
0061     }
0062     template <> std::ostream& toStream(const ROOT::Math::XYZVector& obj, std::ostream& s)
0063     {  return toStream_(obj, s); }
0064     // ============================================================================
0065     // print LorentzVector
0066     std::ostream& toStream_(const ROOT::Math::PxPyPzEVector& obj, std::ostream& s){
0067       s << "( ";
0068       toStream_(obj.Px () , s , 12 );
0069       s << " , ";
0070       toStream_(obj.Py () , s , 12 );
0071       s << " , ";
0072       toStream_(obj.Pz () , s , 13 );
0073       s << " , ";
0074       toStream_(obj.E  () , s , 14 );
0075       s << " )";
0076       return s;
0077     }
0078     template <> std::ostream& toStream(const ROOT::Math::PxPyPzEVector& obj, std::ostream& s)
0079     {  return toStream_(obj, s); }
0080     // ============================================================================
0081     // print Translation3D
0082     std::ostream& toStream_(const ROOT::Math::Translation3D& obj, std::ostream& s){
0083       double x,y,z;
0084       obj.GetComponents(x,y,z);
0085       s << "( ";
0086       toStream_(x , s );
0087       s << " , ";
0088       toStream_(y , s );
0089       s << " , ";
0090       toStream_(z, s );
0091       s << " )";
0092       return s;
0093     }
0094     template <> std::ostream& toStream(const ROOT::Math::Translation3D& obj, std::ostream& s)
0095     {  return toStream_(obj, s); }
0096     // ============================================================================
0097     // print RotationZYX
0098     std::ostream& toStream_(const ROOT::Math::RotationZYX& obj, std::ostream& s){
0099       s << "( ";
0100       toStream_(obj.Phi () , s , 12 );    // Z-angle
0101       s << " , ";
0102       toStream_(obj.Theta () , s , 12 );  // Y-angle
0103       s << " , ";
0104       toStream_(obj.Psi () , s , 12 );    // X-angle
0105       s << " )";
0106       return s;
0107     }
0108     template <> std::ostream& toStream(const ROOT::Math::RotationZYX& obj, std::ostream& s)
0109     {  return toStream_(obj, s); }
0110   }
0111 }
0112 #endif