2 #include "gearimpl/Util.h"
4 #include "gear/PadRowLayout2D.h"
5 #include "gear/ZPlanarLayerLayout.h"
6 #include "gear/FTDLayerLayout.h"
7 #include "gear/TrackerPlanesLayerLayout.h"
8 #include "gear/SiPlanesLayerLayout.h"
9 #include "gear/LayerLayout.h"
10 #include "gear/SimpleMaterial.h"
18 std::ostream& operator<< ( std::ostream& s,
const GearMgr& m ) {
21 s <<
" ----------------------------------------------------- " << std::endl
22 <<
" GearMgr : " << std::endl
23 <<
" ----------------------------------------------------- " << std::endl ;
28 s <<
" ---- DetectorName ---- " << std::endl << std::endl
29 <<
" " << m.getDetectorName()
33 }
catch(UnknownParameterException &e){
35 s <<
" WARNING: NOT FOUND ! " << std::endl
36 <<
" please add it to the <gear> element of your gear file: "
39 <<
" <gear> " << std::endl
40 <<
" <global detectorName=\"MyDetectorModle007\" /> "
42 <<
" <detectors> ... <detectors/>" << std::endl
43 <<
" <gear/> " << std::endl
48 s << m.getBField() << std::endl ;
49 }
catch(UnknownParameterException &e){
51 s <<
" ---- BField ---- " << std::endl
52 <<
" WARNING: NOT FOUND ! " << std::endl
53 <<
" please add it to the <gear> element of your gear file, e.g.: "
55 <<
" <gear> " << std::endl
56 <<
" <BField type=\"ConstantBField\" x=\"0.0\" y=\"0.0\" z=\"4.0\"/> "
58 <<
" <detectors> ... <detectors/>" << std::endl
59 <<
" <gear/> " << std::endl
66 s <<
" ---- VXD ---- " << std::endl
67 << m.getVXDParameters() << std::endl ;
68 }
catch(UnknownParameterException &e){}
72 s << m.getFTDParameters() << std::endl ;
73 }
catch(UnknownParameterException &e){}
77 s <<
" ---- SIT ---- " << std::endl
78 << m.getSITParameters() << std::endl ;
79 }
catch(UnknownParameterException &e){}
84 s <<
" ---- SET ---- " << std::endl
85 << m.getSETParameters() << std::endl ;
86 }
catch(UnknownParameterException &e){}
91 s << m.getSITParameters() << std::endl ;
92 }
catch(UnknownParameterException &e){}
97 s << m.getSETParameters() << std::endl ;
98 }
catch(UnknownParameterException &e){}
102 s << m.getTPCParameters() << std::endl ;
103 }
catch(UnknownParameterException &e){}
107 s <<
" ---- Ecal barrel ---- " << std::endl
108 << m.getEcalBarrelParameters() << std::endl ;
109 }
catch(UnknownParameterException &e){}
112 s <<
" ---- Ecal endcap ---- " << std::endl
113 << m.getEcalEndcapParameters() << std::endl ;
114 }
catch(UnknownParameterException &e){}
117 s <<
" ---- Ecal plug ---- " << std::endl
118 << m.getEcalPlugParameters() << std::endl ;
119 }
catch(UnknownParameterException &e){}
122 s <<
" ---- Yoke barrel ---- " << std::endl
123 << m.getYokeBarrelParameters() << std::endl ;
124 }
catch(UnknownParameterException &e){}
127 s <<
" ---- Yoke endcap ---- " << std::endl
128 << m.getYokeEndcapParameters() << std::endl ;
129 }
catch(UnknownParameterException &e){}
132 s <<
" ---- Yoke plug ---- " << std::endl
133 << m.getYokePlugParameters() << std::endl ;
134 }
catch(UnknownParameterException &e){}
137 s <<
" ---- Hcal barrel ---- " << std::endl
138 << m.getHcalBarrelParameters() << std::endl ;
139 }
catch(UnknownParameterException &e){}
142 s <<
" ---- Hcal endcap ---- " << std::endl
143 << m.getHcalEndcapParameters() << std::endl ;
144 }
catch(UnknownParameterException &e){}
147 s <<
" ---- Hcal ring ---- " << std::endl
148 << m.getHcalRingParameters() << std::endl ;
149 }
catch(UnknownParameterException &e){}
152 s <<
" ---- Lcal ---- " << std::endl
153 << m.getLcalParameters() << std::endl ;
154 }
catch(UnknownParameterException &e){ }
157 s <<
" ---- LHcal ---- " << std::endl
158 << m.getLHcalParameters() << std::endl ;
159 }
catch(UnknownParameterException &e){}
162 s <<
" ---- BeamCal ---- " << std::endl
163 << m.getBeamCalParameters() << std::endl ;
164 }
catch(UnknownParameterException &e){}
167 s <<
" ---- TrackerPlanes ---- " << std::endl
168 << m.getTrackerPlanesParameters() << std::endl ;
169 }
catch(UnknownParameterException &e){}
172 s <<
" ---- SiPlanes ---- " << std::endl
173 << m.getSiPlanesParameters() << std::endl ;
174 }
catch(UnknownParameterException &e){}
179 <<
" parameter sections (detectors) : "
182 const StringVec& keys = m.getGearParameterKeys() ;
184 for(
unsigned int i=0 ; i < keys.size() ; ++i ) {
187 <<
" ------ name : " << keys[i] <<
" ------- " << std::endl ;
189 const GearParameters& p = m.getGearParameters( keys[i] ) ;
191 s << p << std::endl ;
197 s <<
" ------------------------------------------------------------------ " << std::endl
198 <<
" materials : " << std::endl ;
201 const StringVec& mNames = m.getMaterialNames() ;
203 for(
unsigned int i=0 ; i < mNames.size() ; ++i ) {
205 const SimpleMaterial& sm = m.getSimpleMaterial( mNames[i] ) ;
207 s << sm << std::endl ;
211 s <<
" ------------------------------------------------------------------ " << std::endl ;
220 std::ostream& operator<< ( std::ostream& s,
const SimpleMaterial& m ) {
222 const std::streamsize old_precision = s.precision();
224 s <<
" " << m.getName()
225 << std::showpos << std::scientific << std::setprecision(8)
226 <<
", A= " << m.getA()
227 <<
", Z= " << m.getZ()
228 <<
", density [kg/m3]= " << m.getDensity()
229 <<
", radiation length [mm]= " << m.getRadLength()
230 <<
", interaction length [mm]= " << m.getIntLength()
231 << std::noshowpos << std::fixed << std::setprecision(old_precision) << std::dec
237 std::ostream& operator<< ( std::ostream& s,
const GearParameters& p ) {
239 const StringVec& iKeys = p.getIntKeys() ;
241 for(
unsigned int i=0 ; i < iKeys.size() ; ++i ) {
243 s << std::endl <<
" [int] " << iKeys[i] <<
" \t " << p.getIntVal( iKeys[i] ) << std::endl ;
246 const StringVec& dKeys = p.getDoubleKeys() ;
248 for(
unsigned int i=0 ; i < dKeys.size() ; ++i ) {
250 s << std::endl <<
" [double] " << dKeys[i] <<
" \t " << p.getDoubleVal( dKeys[i] ) << std::endl ;
252 const StringVec& sKeys = p.getStringKeys() ;
254 for(
unsigned int i=0 ; i < sKeys.size() ; ++i ) {
256 s << std::endl <<
" [string] " << sKeys[i] <<
" \t " << p.getStringVal( sKeys[i] ) << std::endl ;
259 const StringVec& iVKeys = p.getIntVecKeys() ;
261 for(
unsigned int i=0 ; i < iVKeys.size() ; ++i ) {
263 s << std::endl <<
" [IntVec] " << iVKeys[i] <<
" \t " ;
265 const IntVec v = p.getIntVals( iVKeys[i] ) ;
266 for(
unsigned int j=0 ; j < v.size() ; ++j ) {
274 const StringVec& dVKeys = p.getDoubleVecKeys() ;
276 for(
unsigned int i=0 ; i < dVKeys.size() ; ++i ) {
278 s << std::endl <<
" [DoubleVec] " << dVKeys[i] <<
" \t " ;
280 const DoubleVec v = p.getDoubleVals( dVKeys[i] ) ;
281 for(
unsigned int j=0 ; j < v.size() ; ++j ) {
288 const StringVec& sVKeys = p.getStringVecKeys() ;
290 for(
unsigned int i=0 ; i < sVKeys.size() ; ++i ) {
292 s << std::endl <<
" [StringVec] " << sVKeys[i] <<
" \t " ;
294 const StringVec v = p.getStringVals( sVKeys[i] ) ;
295 for(
unsigned int j=0 ; j < v.size() ; ++j ) {
305 std::ostream& operator<< ( std::ostream& s,
const BField& b ) {
308 <<
" ----------- BField ------- " << std::endl << std::endl ;
310 Vector3D bv = b.at( Vector3D ( 0., 0., 0. ) ) ;
312 s <<
" field vector at origin : Bx = " << bv.x() <<
" , By = " << bv.y() <<
" , Bz = " << bv.z() <<
" [Tesla] " << std::endl ;
314 s << dynamic_cast<const GearParameters&>( b ) ;
323 std::ostream& operator<< ( std::ostream& s,
const TPCParameters& p ) {
326 <<
" ----------- TPCParameters ------- " << std::endl ;
328 s << dynamic_cast<const GearParameters&>( p ) ;
330 s << std::endl <<
" maxDriftLength : " << p.getMaxDriftLength() ;
331 s << std::endl <<
" coordinateType : ";
332 switch( p.getCoordinateType() )
334 case PadRowLayout2D::CARTESIAN : s <<
"cartesian";
break;
335 case PadRowLayout2D::POLAR : s <<
"polar";
break;
336 default : s <<
"unknown";
339 s << std::endl <<
" Number of modules : " << p.getNModules() << std::endl ;
341 std::vector<TPCModule *> moduleVec= p.getModules();
342 for (std::vector<TPCModule *>::iterator moduleIter = moduleVec.begin();
343 moduleIter < moduleVec.end(); moduleIter++)
354 std::ostream& operator<< ( std::ostream& s,
const TPCModule& m ) {
357 <<
" ----------- TPCModule ------- " << std::endl ;
359 s << dynamic_cast<const GearParameters&>( m ) ;
361 s << std::endl <<
" Readout frequency : " << m.getReadoutFrequency() ;
362 s << std::endl <<
" Type : ";
364 switch( m.getLocalPadLayout().getCoordinateType() )
366 case PadRowLayout2D::CARTESIAN : s <<
"cartesian";
break;
367 case PadRowLayout2D::POLAR : s <<
"polar";
break;
368 default : s <<
"unknown";
371 s << std::endl <<
" Number of pads : " << m.getNPads() ;
372 s << std::endl <<
" Number of Rows : " << m.getNRows() ;
373 s << std::endl <<
" Offset : " << m.getOffset()[0] <<
" ; "
374 << m.getOffset()[1] ;
377 s << std::endl <<
" zPosition : " << m.getZPosition();
379 catch ( TPCModule::NoZPositionException & e )
381 s <<
" no z Position set ";
384 s << std::endl <<
" Angle : " << m.getAngle();
387 const DoubleVec& ext = m.getPlaneExtent() ;
388 s <<
" extent (global): [" << ext[0] <<
","<< ext[1] <<
","<< ext[2] <<
","<< ext[3] <<
"]" << std::endl ;
396 std::ostream& operator<< ( std::ostream& s,
const CalorimeterParameters& p ) {
399 s << dynamic_cast<const GearParameters&>( p ) ;
401 if( p.getLayoutType() == CalorimeterParameters::BARREL ) {
403 s << std::endl <<
" calorimeter type: barrel " << std::endl ;
407 s << std::endl <<
" calorimeter type: endcap " << std::endl ;
410 s <<
" symmetry order: " << p.getSymmetryOrder() << std::endl ;
411 s <<
" phi0: " << p.getPhi0() << std::endl ;
414 const DoubleVec& ext = p.getExtent() ;
416 double rMin = ext[0] ;
417 double rMax = ext[1] ;
418 double zMin = ext[2] ;
419 double zMax = ext[3] ;
422 <<
" dimensions : " << std::endl
423 <<
" rMin: " << rMin << std::endl
424 <<
" rMax: " << rMax << std::endl
425 <<
" zMin: " << zMin << std::endl
426 <<
" zMax: " << zMax << std::endl
429 const LayerLayout& l = p.getLayerLayout() ;
431 int nLayer = l.getNLayers() ;
434 <<
" layers : #total " << nLayer << std::endl ;
436 double lastThickness = 0. ;
437 double lastAbsorber = 0. ;
439 for(
int i=0 ; i < nLayer ; ++i ) {
441 double thisThickness = l.getThickness(i) ;
442 double thisAbsorber = l.getAbsorberThickness(i) ;
444 if( (thisThickness != lastThickness || thisAbsorber != lastAbsorber ) ||
445 ( i == nLayer-1 ) ) {
447 s <<
" id: " << i <<
" thickness: " << thisThickness
448 <<
" absorber thickness: " << thisAbsorber
449 <<
" distance: " << l.getDistance(i)
450 <<
" cellsize-0: " << l.getCellSize0(i)
451 <<
" cellsize-1: " << l.getCellSize1(i)
455 lastThickness = thisThickness ;
456 lastAbsorber = thisAbsorber ;
464 std::ostream& operator<< ( std::ostream& s,
const ZPlanarParameters& p ) {
466 s <<
" --- ZPlanarParameters: " << std::endl ;
468 s << dynamic_cast<const GearParameters&>( p ) ;
470 const ZPlanarLayerLayout & l = p.getZPlanarLayerLayout() ;
472 int type = p.getVXDType() ;
474 s << std::endl <<
" type : " ;
478 case ZPlanarParameters::CCD :
480 s <<
" CCD " << std::endl ; break ;
481 case ZPlanarParameters::CMOS :
483 s <<
" CMOS " << std::endl ; break ;
484 case ZPlanarParameters::HYBRID :
486 s <<
" HYBRID " << std::endl ; break ;
489 s <<
" unknown " << std::endl ;
492 s <<
" Shell innerR : " << p.getShellInnerRadius() <<
" outerR : " << p.getShellOuterRadius() << std::endl
493 <<
" length : " << p.getShellHalfLength() <<
" gap " << p.getShellGap() << std::endl ;
498 s <<
" Layers : " << l.getNLayers()
499 << std::endl << std::endl ;
502 s <<
" layer parameters (note: ladder length (l) are half lengths ! )"
507 sprintf(buffer,
" |------------------------------------------------------------------------------------|\n") ;
510 sprintf(buffer,
" | | ladder: | sensitive part: |\n") ;
513 sprintf(buffer,
" | # | d | w | l | t | d | w | l | t | \n") ;
516 sprintf(buffer,
" |------------------------------------------------------------------------------------|\n") ;
519 for(
int i = 0 ; i < l.getNLayers() ; i++ ) {
522 sprintf(buffer1,
" | %3d | %4.2f | %4.2f | %4.2f | %4.2f | %4.2f | %4.2f | %4.2f | %4.2f |\n"
524 , l.getLadderDistance(i)
525 , l.getLadderWidth(i)
526 , l.getLadderLength(i)
527 , l.getLadderThickness(i)
528 , l.getSensitiveDistance(i)
529 , l.getSensitiveWidth(i)
530 , l.getSensitiveLength(i)
531 , l.getSensitiveThickness(i) ) ;
537 sprintf(buffer,
" |------------------------------------------------------------------------------------|\n") ;
545 std::ostream& operator<< ( std::ostream& s,
const FTDParameters& p )
548 <<
" ----------- FTDParameters ------- " << std::endl ;
551 s << dynamic_cast<const GearParameters&>( p ) ;
553 const FTDLayerLayout & l = p.getFTDLayerLayout() ;
558 s <<
" Layers : " << l.getNLayers()
559 << std::endl << std::endl ;
562 s <<
" layer parameters (note: ladder length (l) are half lengths ! )"
566 buffer =
" |------------------------------------------------------------------------------------|\n" ;
569 buffer =
" | | support: | sensitive part: |\n" ;
572 buffer =
" | # | x | X | y | t | x | X | y | t | \n" ;
575 buffer =
" |------------------------------------------------------------------------------------|\n" ;
578 for(
int i = 0 ; i < l.getNLayers() ; i++ )
581 sprintf(buffer1,
" | %3d | %4.2f | %4.2f | %4.2f | %4.2f | %4.2f | %4.2f | %4.2f | %4.2f |\n"
583 , l.getSupportLengthMin(i)
584 , l.getSupportLengthMax(i)
585 , l.getSupportWidth(i)
586 , l.getSupportThickness(i)
587 , l.getSensitiveLengthMin(i)
588 , l.getSensitiveLengthMax(i)
589 , l.getSensitiveWidth(i)
590 , l.getSensitiveThickness(i) ) ;
596 buffer =
" |------------------------------------------------------------------------------------|\n" ;
602 std::ostream& operator<< ( std::ostream& s,
const SiPlanesParameters& p ) {
605 <<
" ----------- SiPlanesParameters ------- " << std::endl ;
607 s << dynamic_cast<const GearParameters&>( p ) ;
609 const SiPlanesLayerLayout & l = p.getSiPlanesLayerLayout() ;
612 s << std::endl <<
" Setup ID : " << p.getSiPlanesID() << std::endl;
614 int type = p.getSiPlanesType() ;
616 s <<
" Telescope type : " ;
617 std::string strType ;
621 case SiPlanesParameters::TelescopeWithDUT :
622 strType =
"TelescopeWithDUT" ;
623 s <<
" TelescopeWithDUT" << std::endl ;
625 case SiPlanesParameters::TelescopeWithoutDUT :
626 strType =
"TelescopeWithoutDUT" ;
627 s <<
" TelescopeWithoutDUT " << std::endl ;
632 s <<
" unknown " << std::endl ;
635 s <<
" Number of telescope planes : " << p.getSiPlanesNumber() << std::endl;
641 s <<
" Number of layers : " << l.getNLayers() << std::endl << std::endl ;
643 s <<
" layer parameters : " << std::endl ;
647 sprintf(buffer,
" |----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n") ;
650 sprintf(buffer,
" | ladder: | sensitive part: |\n") ;
653 sprintf(buffer,
" | ID | pozX| pozY| pozZ |rotXY|rotZX|rotZY| sizeX| sizeY| Thick| ID | pozX| pozY| pozZ |sizeX|sizeY| Thick|NpixX|NpixY|PitchX|PitchY| Resol| Rot1| Rot2| Rot3| Rot4| \n") ;
657 sprintf(buffer,
" |----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n") ;
660 for(
int i = 0 ; i < l.getNLayers() ; i++ ) {
663 sprintf(buffer1,
" |%5d|%5.2f|%5.2f|%7.2f|%5.2f|%5.2f|%5.2f|%6.2f|%6.2f|%6.3f|%5d|%5.2f|%5.2f|%7.2f|%5.2f|%5.2f|%6.3f|%5d|%5d|%6.2f|%6.2f|%6.4f|%5.2f|%5.2f|%5.2f|%5.2f|\n"
665 , l.getLayerPositionX(i)
666 , l.getLayerPositionY(i)
667 , l.getLayerPositionZ(i)
668 , l.getLayerRotationXY(i)
669 , l.getLayerRotationZX(i)
670 , l.getLayerRotationZY(i)
673 , l.getLayerThickness(i)
674 , l.getSensitiveID(i)
675 , l.getSensitivePositionX(i)
676 , l.getSensitivePositionY(i)
677 , l.getSensitivePositionZ(i)
678 , l.getSensitiveSizeX(i)
679 , l.getSensitiveSizeY(i)
680 , l.getSensitiveThickness(i)
681 , l.getSensitiveNpixelX(i)
682 , l.getSensitiveNpixelY(i)
683 , l.getSensitivePitchX(i)
684 , l.getSensitivePitchY(i)
685 , l.getSensitiveResolution(i)
686 , l.getSensitiveRotation1(i)
687 , l.getSensitiveRotation2(i)
688 , l.getSensitiveRotation3(i)
689 , l.getSensitiveRotation4(i) ) ;
695 sprintf(buffer,
" |----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n") ;
700 if (strType ==
"TelescopeWithDUT"){
702 s <<
" DUT parameters : " << std::endl ;
706 sprintf(buffer,
" | ladder: | sensitive part: |\n") ;
709 sprintf(buffer,
" |----------------------------------------------------------------------------------------------------------------------------------------------|\n") ;
712 sprintf(buffer,
" | ID | pozX| pozY| pozZ | sizeX| sizeY| Thick| ID | pozX| pozY| pozZ |sizeX|sizeY| Thick|NpixX|NpixY|PitchX|PitchY| Rot1| Rot2| Rot3| Rot4| \n") ;
715 sprintf(buffer,
" |----------------------------------------------------------------------------------------------------------------------------------------------|\n") ;
719 sprintf(buffer1,
" |%5d|%5.2f|%5.2f|%7.2f|%6.2f|%6.2f|%6.3f|%5d|%5.2f|%5.2f|%7.2f|%5.2f|%5.2f|%6.3f|%5d|%5d|%6.2f|%6.2f|%5.2f|%5.2f|%5.2f|%5.2f|\n"
721 , l.getDUTPositionX()
722 , l.getDUTPositionY()
723 , l.getDUTPositionZ()
726 , l.getDUTThickness()
727 , l.getDUTSensitiveID()
728 , l.getDUTSensitivePositionX()
729 , l.getDUTSensitivePositionY()
730 , l.getDUTSensitivePositionZ()
731 , l.getDUTSensitiveSizeX()
732 , l.getDUTSensitiveSizeY()
733 , l.getDUTSensitiveThickness()
734 , l.getDUTSensitiveNpixelX()
735 , l.getDUTSensitiveNpixelY()
736 , l.getDUTSensitivePitchX()
737 , l.getDUTSensitivePitchY()
738 , l.getDUTSensitiveRotation1()
739 , l.getDUTSensitiveRotation2()
740 , l.getDUTSensitiveRotation3()
741 , l.getDUTSensitiveRotation4() ) ;
745 sprintf(buffer,
" |----------------------------------------------------------------------------------------------------------------------------------------------|\n") ;
754 std::ostream& operator<< ( std::ostream& s,
const TrackerPlanesParameters& p ) {
757 <<
" ----------- TrackerPlanesParameters ------- " << std::endl ;
759 s << dynamic_cast<const GearParameters&>( p ) ;
761 const TrackerPlanesLayerLayout & l = p.getTrackerPlanesLayerLayout() ;
764 s << std::endl <<
" Setup ID : " << p.getLayoutID() << std::endl;
767 s <<
" Number of telescope planes : " << p.getLayoutNumberOfLayers() << std::endl;