DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
DetectorData.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 : F.Gaede
11 //
12 //==========================================================================
13 #include "DDRec/DetectorData.h"
14 
15 #include <boost/io/ios_state.hpp>
16 
17 namespace dd4hep {
18  namespace rec {
19 
20 
21  std::ostream& operator<<( std::ostream& io , const FixedPadSizeTPCData& d ){
22  boost::io::ios_base_all_saver ifs(io);
23 
24  io << " --FixedPadSizeTPCData: " << std::scientific << std::endl ;
25  io << " zHalf : " << d.zHalf << std::endl ;
26  io << " rMin : " << d.rMin << std::endl ;
27  io << " rMax : " << d.rMax << std::endl ;
28  io << " driftLength : " << d.driftLength << std::endl ;
29  io << " zMinReadout : " << d.zMinReadout << std::endl ;
30  io << " rMinReadout : " << d.rMinReadout << std::endl ;
31  io << " rMaxReadout : " << d.rMaxReadout << std::endl ;
32  io << " innerWallThickness : " << d.innerWallThickness << std::endl ;
33  io << " outerWallThickness : " << d.outerWallThickness << std::endl ;
34  io << " padHeight : " << d.padHeight << std::endl ;
35  io << " padWidth : " << d.padWidth << std::endl ;
36  io << " maxRow : " << d.maxRow << std::endl ;
37  io << " padGap : " << d.padGap << std::endl ;
38  // io << " : " << d. << std::endl ;
39  return io ;
40  }
41 
42 
43 
44  std::ostream& operator<<( std::ostream& io , const ZPlanarData& d ) {
45  boost::io::ios_base_all_saver ifs(io);
46 
47  io << " -- ZPlanarData: " << std::scientific << std::endl ;
48  io << " zHalfShell : " << d.zHalfShell << std::endl ;
49  io << " gapShell : " << d.gapShell << std::endl ;
50  io << " rInnerShell : " << d.rInnerShell << std::endl ;
51  io << " rOuterShell : " << d.rOuterShell << std::endl ;
52  io << " widthStrip : " << d.widthStrip << std::endl ;
53  io << " lengthStrip : " << d.lengthStrip << std::endl ;
54  io << " pitchStrip : " << d.pitchStrip << std::endl ;
55  io << " angleStrip : " << d.angleStrip << std::endl ;
56 
57  std::vector<ZPlanarData::LayerLayout> layers = d.layers ;
58 
59  io << " Layers : " << std::endl
60  << " nLadder phi0 nSensors lengthSensor distSupport thickSupport offsetSupport widthSupport zHalfSupport distSense thickSense offsetSense widthSense zHalfSense" << std::endl ;
61 
62  //"ladderNumber phi0 sensorsPerLadder lengthSensor distanceSupport thicknessSupport offsetSupport widthSupport zHalfSupport distanceSensitive thicknessSensitive offsetSensitive widthSensitive zHalfSensitive" << std::endl ;
63 
64  for(unsigned i=0,N=layers.size() ; i<N ; ++i){
65 
66  ZPlanarData::LayerLayout l = layers[i] ;
67 
68  io << " " << l.ladderNumber
69  << " " << l.phi0
70  << " " << l.sensorsPerLadder
71  << " " << l.lengthSensor
72  << " " << l.distanceSupport
73  << " " << l.thicknessSupport
74  << " " << l.offsetSupport
75  << " " << l.widthSupport
76  << " " << l.zHalfSupport
77  << " " << l.distanceSensitive
78  << " " << l.thicknessSensitive
79  << " " << l.offsetSensitive
80  << " " << l.widthSensitive
81  << " " << l.zHalfSensitive
82  << std::endl ;
83  }
84 
85  return io ;
86  }
87 
88  std::ostream& operator<<( std::ostream& io , const ZDiskPetalsData& d ) {
89  boost::io::ios_base_all_saver ifs(io);
90 
91  io << " -- ZDiskPetalsData: " << std::scientific << std::endl ;
92  io << " widthStrip : " << d.widthStrip << std::endl ;
93  io << " lengthStrip : " << d.lengthStrip << std::endl ;
94  io << " pitchStrip : " << d.pitchStrip << std::endl ;
95  io << " angleStrip : " << d.angleStrip << std::endl ;
96 
97  std::vector<ZDiskPetalsData::LayerLayout> layers = d.layers ;
98 
99  io << " Layers : " << std::endl
100  << " petHalfAngle alphaPetal zPosition nP n d p phi0 zOffsetSup distSupport thickSupport widthInSup widthOutSup lengthSup zOffsetSense distSense thickSense widthInSense widthOutSense lenSense" << std::endl ;
101 
102  //"petalHalfAngle alphaPetal zPosition petalNumber sensorsPerPetal DoubleSided Pixel phi0 zOffsetSupport distanceSupport thicknessSupport widthInnerSupport widthOuterSupport lengthSupport zOffsetSensitive distanceSensitive thicknessSensitive widthInnerSensitive widthOuterSensitive lengthSensitive" << std::endl ;
103 
104  for(unsigned i=0,N=layers.size() ; i<N ; ++i){
105 
106  ZDiskPetalsData::LayerLayout l = layers[i] ;
107 
108  io << " " << l.petalHalfAngle
109  << " " << l.alphaPetal
110  << " " << l.zPosition
111  << " " << l.petalNumber
112  << " " << l.sensorsPerPetal
113  << " " << l.typeFlags[ ZDiskPetalsData::SensorType::DoubleSided ]
114  << " " << l.typeFlags[ ZDiskPetalsData::SensorType::Pixel ]
115  << " " << l.phi0
116  << " " << l.zOffsetSupport
117  << " " << l.distanceSupport
118  << " " << l.thicknessSupport
119  << " " << l.widthInnerSupport
120  << " " << l.widthOuterSupport
121  << " " << l.lengthSupport
122  << " " << l.zOffsetSensitive
123  << " " << l.distanceSensitive
124  << " " << l.thicknessSensitive
125  << " " << l.widthInnerSensitive
126  << " " << l.widthOuterSensitive
127  << " " << l.lengthSensitive
128  << std::endl ;
129  }
130 
131  io << " nP:petalNumber n:sensorsPerPetal d:DoubleSided p: Pixel " << std::endl ;
132 
133  return io ;
134  }
135 
136 
137  std::ostream& operator<<( std::ostream& io , const ConicalSupportData& d ) {
138  boost::io::ios_base_all_saver ifs(io);
139 
140  io << " -- ConicalSupportData : " << std::scientific << std::endl ;
141  io << " isSymmetricInZ : " << d.isSymmetricInZ << std::endl ;
142 
143  std::vector<ConicalSupportData::Section> layers = d.sections ;
144 
145  io << " Sections : " << std::endl
146  << "rInner rOuter zPos " << std::endl ;
147 
148  for(unsigned i=0,N=layers.size() ; i<N ; ++i){
149 
150  ConicalSupportData::Section l = layers[i] ;
151 
152  io << " " << l.rInner
153  << " " << l.rOuter
154  << " " << l.zPos
155  << std::endl ;
156  }
157  return io ;
158  }
159 
160 
161  std::ostream& operator<<( std::ostream& io , const LayeredCalorimeterData& d ) {
162  boost::io::ios_base_all_saver ifs(io);
163 
164  io << " -- LayeredCalorimeterData : " << std::scientific << std::endl ;
165  switch (d.layoutType){
166  case LayeredCalorimeterStruct::BarrelLayout: { io << " LayoutType : BarrelLayout " << std::endl ; io << " extent[ rmin, rmax, zmin, zmax ] : "
167  << d.extent[0] << " " << d.extent[1] << " " << d.extent[2] << " " << d.extent[3] << std::endl ; break; }
168  case LayeredCalorimeterStruct::EndcapLayout: { io << " LayoutType : EndcapLayout " << std::endl ; io << " extent[ rmin, rmax, zmin, zmax ] : "
169  << d.extent[0] << " " << d.extent[1] << " " << d.extent[2] << " " << d.extent[3] << std::endl ; break; }
170  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;}
171  }
172  io << " outer_symmetry : " << d.outer_symmetry << std::endl ;
173  io << " inner_symmetry : " << d.inner_symmetry << std::endl ;
174  io << " outer_phi0 : " << d.outer_phi0 << std::endl ;
175  io << " inner_phi0 : " << d.inner_phi0 << std::endl ;
176  io << " gap1 : " << d.gap1 << std::endl ;
177  io << " gap2 : " << d.gap2 << std::endl ;
178 
179  std::vector<LayeredCalorimeterData::Layer> layers = d.layers ;
180 
181  io << " Layers : " << std::endl
182  << " distance inner_nX0 outer_nX0 inner_nInt outer_nInt inner_thick outer_thick sense_thick cellSize0 cellSize1"
183  << std::endl ;
184 
185  for(unsigned i=0,N=layers.size() ; i<N ; ++i){
186 
187  LayeredCalorimeterData::Layer l = layers[i] ;
188 
189  io << " " << l.distance
190  << " " << l.inner_nRadiationLengths
191  << " " << l.outer_nRadiationLengths
192  << " " << l.inner_nInteractionLengths
193  << " " << l.outer_nInteractionLengths
194  << " " << l.inner_thickness
195  << " " << l.outer_thickness
196  << " " << l.sensitive_thickness
197  << " " << l.cellSize0
198  << " " << l.cellSize1
199  << std::endl ;
200  }
201 
202  return io ;
203  }
204 
205 
206 
207  std::ostream& operator<<( std::ostream& io , const NeighbourSurfacesData& d ){
208  boost::io::ios_base_all_saver ifs(io);
209 
210  io << " --NeighbourSurfacesData: " << std::scientific << std::endl ;
211  io << " sameLayer.size() : " << d.sameLayer.size() << std::endl ;
212  return io ;
213  }
214 
215 
216  std::ostream& operator<<(std::ostream& io, const DoubleParameters& d) {
217  boost::io::ios_base_all_saver ifs(io);
218  io << " --DoubleParameters: " << std::scientific << std::endl ;
219  for (auto const& thePair: d.doubleParameters) {
220  io << " "
221  << std::setw(40) << thePair.first << ":"
222  << std::setw(14) << thePair.second
223  << std::endl;
224  }
225  return io ;
226  }
227 
228  namespace {
229  struct visitor_impl {
230  std::ostream& m_io;
231  void operator()(std::string value) const {
232  m_io << ": str = " << value;
233  }
234 
235  void operator()(int value) const {
236  m_io << ": int = " << value;
237  }
238 
239  void operator()(double value) const {
240  m_io << ": double = " << value;
241  }
242 
243  void operator()(bool value) const {
244  m_io << ": bool = " << (value ? "true" : "false");
245  }
246 
247  };
248  }
249 
250  std::ostream& operator<<(std::ostream& io, const VariantParameters& v) {
251  boost::io::ios_base_all_saver ifs(io);
252  io << " --VariantParameters: " << std::scientific << std::endl ;
253 
254  visitor_impl visitor{io};
255 
256  for (auto const& thePair: v.variantParameters) {
257  io << " "
258  << std::setw(40) << thePair.first << "";
259  boost::apply_visitor(visitor, thePair.second);
260  io << std::endl;
261  }
262  return io ;
263  }
264 
265 
266  } // namespace
267 }
DetectorData.h
v
View * v
Definition: MultiView.cpp:28
dd4hep::rec::LayeredCalorimeterStruct::ConicalLayout
@ ConicalLayout
Definition: DetectorData.h:364
dd4hep::rec::LayeredCalorimeterStruct::BarrelLayout
@ BarrelLayout
Definition: DetectorData.h:362
m_io
std::ostream & m_io
Definition: DetectorData.cpp:230
dd4hep::rec::StructExtension
Definition: DetectorData.h:37
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::rec::operator<<
std::ostream & operator<<(std::ostream &io, const DCH_info &d)
Definition: DCH_info.h:197
dd4hep::rec::LayeredCalorimeterStruct::EndcapLayout
@ EndcapLayout
Definition: DetectorData.h:363