Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:30

0001 #ifndef GUARD_DDCoreToDDXMLOutput_H
0002 #define GUARD_DDCoreToDDXMLOutput_H
0003 
0004 #include <iostream>
0005 #include <set>
0006 #include <string>
0007 #include <utility>
0008 
0009 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
0010 #include "DetectorDescription/Core/interface/DDMaterial.h"
0011 #include "DetectorDescription/Core/interface/DDPosData.h"
0012 #include "DetectorDescription/Core/interface/DDSolid.h"
0013 #include "DetectorDescription/Core/interface/DDSpecifics.h"
0014 #include "DetectorDescription/Core/interface/DDTransform.h"
0015 #include "DetectorDescription/Core/interface/DDsvalues.h"
0016 
0017 #include "DetectorDescription/DDCMS/interface/DDParsingContext.h"
0018 
0019 #include "DD4hep/SpecParRegistry.h"
0020 
0021 #include "TGeoMaterial.h"
0022 
0023 class DDPartSelection;
0024 class DDRotation;
0025 struct DDPosData;
0026 
0027 /** @class DDCoreToDDXMLOutput DDCoreToDDXMLOutput.h
0028  *
0029  *  @author:  Michael Case  Revison for DD4hep
0030  *  @version: 1.0
0031  * 
0032  *  Description:
0033  *       The idea is to store one large XML file containing the XML elements
0034  *     in DDL (Detector Description Language).  In doing so, all DDAlgorithms
0035  *     or other code generated DD in-memory components should be reproduced 
0036  *     without the need for them to run again if the geometry is read into
0037  *     DDLParser again.
0038  */
0039 
0040 struct DDCoreToDDXMLOutput {
0041   void solid(const DDSolid& solid, std::ostream& xos);
0042   void solid(const dd4hep::Solid& solid, const cms::DDParsingContext& context, std::ostream& xos);
0043 
0044   void element(const TGeoMaterial* element, std::ostream& xos);
0045   void material(const DDMaterial& material, std::ostream& xos);
0046   void material(const std::string& matName,
0047                 double density,
0048                 const std::vector<cms::DDParsingContext::CompositeMaterial>& matRefs,
0049                 std::ostream& xos);
0050 
0051   void rotation(const DDRotation& rotation, std::ostream& xos, const std::string& rotn = "");
0052   void rotation(const dd4hep::Rotation3D& rotation,
0053                 std::ostream& xos,
0054                 const cms::DDParsingContext& context,
0055                 const std::string& rotn);
0056 
0057   void logicalPart(const DDLogicalPart& lp, std::ostream& xos);
0058   void logicalPart(const std::string& asName, std::ostream& xos);
0059   void logicalPart(const TGeoVolume& lp, std::ostream& xos);
0060 
0061   void position(const DDLogicalPart& parent,
0062                 const DDLogicalPart& child,
0063                 DDPosData* edgeToChild,
0064                 int& rotNameSeed,
0065                 std::ostream& xos);
0066   void position(const TGeoVolume& parent,
0067                 const TGeoNode& child,
0068                 const std::string& childName,
0069                 cms::DDParsingContext& context,
0070                 std::ostream& xos);
0071   //
0072   // left in for now as legacy...
0073   void specpar(const DDSpecifics& sp, std::ostream& xos);
0074   void specpar(const std::pair<DDsvalues_type, std::set<const DDPartSelection*>>& pssv, std::ostream& xos);
0075   void specpar(const std::string& name, const dd4hep::SpecPar& specPar, std::ostream& xos);
0076 
0077   static std::string trimShapeName(const std::string& solidName);
0078   std::string ns_;  // default namespace
0079 };
0080 
0081 #endif