Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:17:41

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     : F.Gaede
0011 //
0012 //==========================================================================
0013 #include "DDRec/DetectorData.h"
0014 
0015 #include <boost/io/ios_state.hpp>
0016 
0017 namespace dd4hep {
0018   namespace rec {
0019 
0020 
0021     std::ostream& operator<<( std::ostream& io , const FixedPadSizeTPCData& d ){
0022       boost::io::ios_base_all_saver ifs(io);
0023 
0024       io <<  " --FixedPadSizeTPCData: "  << std::scientific << std::endl ; 
0025       io <<  "   zHalf : "              <<  d.zHalf  << std::endl ; 
0026       io <<  "   rMin : "               <<  d.rMin << std::endl ; 
0027       io <<  "   rMax : "               <<  d.rMax << std::endl ; 
0028       io <<  "   driftLength : "        <<  d.driftLength << std::endl ;
0029       io <<  "   zMinReadout : "        <<  d.zMinReadout << std::endl ;
0030       io <<  "   rMinReadout : "        <<  d.rMinReadout << std::endl ; 
0031       io <<  "   rMaxReadout : "        <<  d.rMaxReadout << std::endl ; 
0032       io <<  "   innerWallThickness : " <<  d.innerWallThickness << std::endl ; 
0033       io <<  "   outerWallThickness : " <<  d.outerWallThickness << std::endl ; 
0034       io <<  "   padHeight : "          <<  d.padHeight  << std::endl ; 
0035       io <<  "   padWidth : "           <<  d.padWidth  << std::endl ; 
0036       io <<  "   maxRow : "             <<  d.maxRow << std::endl ; 
0037       io <<  "   padGap : "             <<  d.padGap  << std::endl ; 
0038       //      io <<  "   : " <<  d.  << std::endl ; 
0039       return io ;
0040     }
0041     
0042 
0043 
0044     std::ostream& operator<<( std::ostream& io , const ZPlanarData& d ) {
0045       boost::io::ios_base_all_saver ifs(io);
0046 
0047       io <<  " -- ZPlanarData: "  << std::scientific << std::endl ; 
0048       io <<  " zHalfShell  : " <<  d.zHalfShell  << std::endl ; 
0049       io <<  " gapShell  : " <<  d.gapShell  << std::endl ; 
0050       io <<  " rInnerShell  : " <<  d.rInnerShell  << std::endl ; 
0051       io <<  " rOuterShell  : " <<  d.rOuterShell  << std::endl ; 
0052       io <<  " widthStrip  : " <<  d.widthStrip  << std::endl ; 
0053       io <<  " lengthStrip  : " <<  d.lengthStrip  << std::endl ; 
0054       io <<  " pitchStrip  : " <<  d.pitchStrip  << std::endl ; 
0055       io <<  " angleStrip  : " <<  d.angleStrip  << std::endl ; 
0056 
0057       std::vector<ZPlanarData::LayerLayout> layers = d.layers ;
0058 
0059       io <<  " Layers : " << std::endl 
0060      <<  "  nLadder phi0     nSensors    lengthSensor distSupport  thickSupport  offsetSupport widthSupport zHalfSupport distSense   thickSense   offsetSense   widthSense  zHalfSense" << std::endl ;
0061 
0062       //"ladderNumber phi0 sensorsPerLadder lengthSensor distanceSupport thicknessSupport offsetSupport widthSupport zHalfSupport distanceSensitive thicknessSensitive offsetSensitive widthSensitive zHalfSensitive"  <<  std::endl ; 
0063 
0064       for(unsigned i=0,N=layers.size() ; i<N ; ++i){
0065 
0066     ZPlanarData::LayerLayout l = layers[i] ;
0067 
0068     io << " " << l.ladderNumber
0069        << " " << l.phi0
0070        << " " << l.sensorsPerLadder
0071        << " " << l.lengthSensor
0072        << " " << l.distanceSupport
0073        << " " << l.thicknessSupport
0074        << " " << l.offsetSupport
0075        << " " << l.widthSupport
0076        << " " << l.zHalfSupport
0077        << " " << l.distanceSensitive
0078        << " " << l.thicknessSensitive
0079        << " " << l.offsetSensitive
0080        << " " << l.widthSensitive
0081        << " " << l.zHalfSensitive
0082        << std::endl ;
0083       }
0084    
0085       return io ;
0086     }
0087 
0088     std::ostream& operator<<( std::ostream& io , const ZDiskPetalsData& d ) {
0089       boost::io::ios_base_all_saver ifs(io);
0090 
0091       io <<  " -- ZDiskPetalsData: "  << std::scientific << std::endl ; 
0092       io <<  "  widthStrip : " <<  d.widthStrip  << std::endl ; 
0093       io <<  "  lengthStrip : " <<  d.lengthStrip  << std::endl ; 
0094       io <<  "  pitchStrip : " <<  d.pitchStrip  << std::endl ; 
0095       io <<  "  angleStrip : " <<  d.angleStrip  << std::endl ; 
0096 
0097       std::vector<ZDiskPetalsData::LayerLayout> layers = d.layers ;
0098 
0099       io <<  " Layers : " << std::endl 
0100      <<  " petHalfAngle  alphaPetal  zPosition    nP n d p    phi0        zOffsetSup  distSupport  thickSupport widthInSup  widthOutSup   lengthSup   zOffsetSense  distSense    thickSense  widthInSense widthOutSense lenSense" << std::endl ;
0101 
0102       //"petalHalfAngle alphaPetal zPosition petalNumber sensorsPerPetal DoubleSided Pixel phi0 zOffsetSupport distanceSupport thicknessSupport widthInnerSupport widthOuterSupport lengthSupport zOffsetSensitive distanceSensitive thicknessSensitive widthInnerSensitive widthOuterSensitive lengthSensitive" << std::endl ;
0103 
0104       for(unsigned i=0,N=layers.size() ; i<N ; ++i){
0105 
0106     ZDiskPetalsData::LayerLayout l = layers[i] ;
0107 
0108     io << " " << l.petalHalfAngle
0109        << " " << l.alphaPetal
0110        << " " << l.zPosition
0111        << " " << l.petalNumber
0112        << " " << l.sensorsPerPetal
0113        << " " << l.typeFlags[ ZDiskPetalsData::SensorType::DoubleSided ]
0114        << " " << l.typeFlags[ ZDiskPetalsData::SensorType::Pixel ]
0115        << " " << l.phi0
0116        << " " << l.zOffsetSupport
0117        << " " << l.distanceSupport
0118        << " " << l.thicknessSupport
0119        << " " << l.widthInnerSupport
0120        << " " << l.widthOuterSupport
0121        << " " << l.lengthSupport 
0122        << " " << l.zOffsetSensitive
0123        << " " << l.distanceSensitive
0124        << " " << l.thicknessSensitive
0125        << " " << l.widthInnerSensitive
0126        << " " << l.widthOuterSensitive
0127        << " " << l.lengthSensitive
0128        << std::endl ;
0129       }
0130 
0131       io <<  " nP:petalNumber  n:sensorsPerPetal  d:DoubleSided  p: Pixel "  << std::endl ;
0132 
0133       return io ;
0134     }
0135 
0136     
0137     std::ostream& operator<<( std::ostream& io , const ConicalSupportData& d ) {
0138       boost::io::ios_base_all_saver ifs(io);
0139 
0140       io <<  " -- ConicalSupportData : "  << std::scientific << std::endl ; 
0141       io <<  "  isSymmetricInZ : " <<  d.isSymmetricInZ  << std::endl ; 
0142       
0143       std::vector<ConicalSupportData::Section> layers = d.sections ;
0144 
0145       io <<  " Sections : " << std::endl 
0146      <<  "rInner rOuter zPos " << std::endl ;
0147       
0148       for(unsigned i=0,N=layers.size() ; i<N ; ++i){
0149     
0150     ConicalSupportData::Section l = layers[i] ;
0151     
0152     io << " " << l.rInner
0153        << " " << l.rOuter
0154        << " " << l.zPos
0155        << std::endl ;
0156       }
0157       return io ;
0158     }
0159 
0160     
0161     std::ostream& operator<<( std::ostream& io , const LayeredCalorimeterData& d ) {
0162       boost::io::ios_base_all_saver ifs(io);
0163       
0164       io <<  " -- LayeredCalorimeterData : "  << std::scientific << std::endl ; 
0165       switch (d.layoutType){
0166       case LayeredCalorimeterStruct::BarrelLayout: { io <<  " LayoutType : BarrelLayout "  << std::endl ;  io <<  "  extent[ rmin, rmax, zmin, zmax ] : " 
0167                             <<  d.extent[0] << " "  << d.extent[1] << " "  << d.extent[2] << " " << d.extent[3]  << std::endl ;  break; }
0168       case LayeredCalorimeterStruct::EndcapLayout: { io <<  " LayoutType : EndcapLayout "  << std::endl ;  io <<  "  extent[ rmin, rmax, zmin, zmax ] : " 
0169                             <<  d.extent[0] << " "  << d.extent[1] << " "  << d.extent[2] << " " << d.extent[3]  << std::endl ;  break; }
0170       case LayeredCalorimeterStruct::ConicalLayout: { io <<  " LayoutType : ConicalLayout "  << std::endl ; io <<  "  extent[ rmin, rmax, zmin, zmax, rEndMin, rEndMax ] : "                                                 <<  d.extent[0] << " "  << d.extent[1] << " "  << d.extent[2] << " " << d.extent[3] << " "  << d.extent[4] << " " << d.extent[5] << std::endl ;   break;}
0171       }
0172       io <<  " outer_symmetry : " <<  d.outer_symmetry  << std::endl ; 
0173       io <<  " inner_symmetry : " <<  d.inner_symmetry  << std::endl ; 
0174       io <<  " outer_phi0 : " <<  d.outer_phi0  << std::endl ; 
0175       io <<  " inner_phi0 : " <<  d.inner_phi0  << std::endl ; 
0176       io <<  " gap1 : " <<  d.gap1  << std::endl ; 
0177       io <<  " gap2 : " <<  d.gap2  << std::endl ; 
0178       
0179       std::vector<LayeredCalorimeterData::Layer> layers = d.layers ;
0180 
0181       io <<  " Layers : " << std::endl 
0182      <<  "  distance      inner_nX0   outer_nX0    inner_nInt    outer_nInt  inner_thick outer_thick   sense_thick  cellSize0  cellSize1" 
0183      << std::endl ;
0184 
0185       for(unsigned i=0,N=layers.size() ; i<N ; ++i){
0186 
0187     LayeredCalorimeterData::Layer l = layers[i] ;
0188 
0189     io << " " << l.distance
0190        << " " << l.inner_nRadiationLengths
0191        << " " << l.outer_nRadiationLengths
0192        << " " << l.inner_nInteractionLengths 
0193        << " " << l.outer_nInteractionLengths
0194        << " " << l.inner_thickness
0195        << " " << l.outer_thickness
0196        << " " << l.sensitive_thickness
0197        << " " << l.cellSize0
0198        << " " << l.cellSize1
0199        << std::endl ;
0200       }
0201 
0202       return io ;
0203     }
0204 
0205 
0206 
0207     std::ostream& operator<<( std::ostream& io , const NeighbourSurfacesData& d ){
0208       boost::io::ios_base_all_saver ifs(io);
0209 
0210       io <<  " --NeighbourSurfacesData: "  << std::scientific << std::endl ; 
0211       io <<  "   sameLayer.size() : " << d.sameLayer.size() << std::endl ; 
0212       return io ;
0213     }
0214 
0215 
0216     std::ostream& operator<<(std::ostream& io, const DoubleParameters& d) {
0217       boost::io::ios_base_all_saver ifs(io);
0218       io <<  " --DoubleParameters: "  << std::scientific << std::endl ;
0219       for (auto const& thePair: d.doubleParameters) {
0220         io <<  "    "
0221            << std::setw(40) << thePair.first << ":"
0222            << std::setw(14) << thePair.second
0223            << std::endl;
0224       }
0225       return io ;
0226     }
0227 
0228     namespace { 
0229       struct visitor_impl {
0230         std::ostream& m_io;
0231         void operator()(std::string value) const {
0232           m_io << ": str = " << value;
0233         }
0234 
0235         void operator()(int value) const {
0236           m_io << ": int = " << value;
0237         }
0238 
0239         void operator()(double value) const {
0240           m_io << ": double = " << value;
0241         }
0242 
0243         void operator()(bool value) const {
0244           m_io << ": bool = " << (value ? "true" : "false");
0245         }
0246 
0247       };
0248     }
0249 
0250     std::ostream& operator<<(std::ostream& io, const VariantParameters& v) {
0251       boost::io::ios_base_all_saver ifs(io);
0252       io <<  " --VariantParameters: "  << std::scientific << std::endl ;
0253 
0254       visitor_impl visitor{io};
0255 
0256       for (auto const& thePair: v.variantParameters) {
0257         io <<  "    "
0258            << std::setw(40) << thePair.first << "";
0259         boost::apply_visitor(visitor, thePair.second);
0260         io << std::endl;
0261       }
0262       return io ;
0263     }
0264  
0265 
0266   } // namespace
0267 }