1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | // * conditions of the Geant4 Software License, included in the file * |
---|
8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | // * include a list of copyright holders. * |
---|
10 | // * * |
---|
11 | // * Neither the authors of this software system, nor their employing * |
---|
12 | // * institutes,nor the agencies providing financial support for this * |
---|
13 | // * work make any representation or warranty, express or implied, * |
---|
14 | // * regarding this software system or assume any liability for its * |
---|
15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
16 | // * for the full disclaimer and the limitation of liability. * |
---|
17 | // * * |
---|
18 | // * This code implementation is the result of the scientific and * |
---|
19 | // * technical work of the GEANT4 collaboration. * |
---|
20 | // * By using, copying, modifying or distributing the software (or * |
---|
21 | // * any work based on the software) you agree to acknowledge its * |
---|
22 | // * use in resulting scientific publications, and indicate your * |
---|
23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
24 | // ******************************************************************** |
---|
25 | // |
---|
26 | // |
---|
27 | // File name: RadmonDetectorMultilayerPlacementLayout.cc |
---|
28 | // Creation date: Sep 2005 |
---|
29 | // Main author: Riccardo Capra <capra@ge.infn.it> |
---|
30 | // |
---|
31 | // Id: $Id: RadmonDetectorMultilayerPlacementLayout.cc,v 1.5 2006/06/29 16:14:05 gunter Exp $ |
---|
32 | // Tag: $Name: $ |
---|
33 | // |
---|
34 | |
---|
35 | // Include files |
---|
36 | #include "RadmonDetectorMultilayerPlacementLayout.hh" |
---|
37 | #include "RadmonDumpStyle.hh" |
---|
38 | #include "G4UnitsTable.hh" |
---|
39 | |
---|
40 | #include <iomanip> |
---|
41 | |
---|
42 | |
---|
43 | |
---|
44 | G4ThreeVector RadmonDetectorMultilayerPlacementLayout :: GetRelativePosition(const RadmonDetectorMultilayerPlacementLayout & reference) const |
---|
45 | { |
---|
46 | G4ThreeVector v(multilayerPosition); |
---|
47 | v-=reference.multilayerPosition; |
---|
48 | |
---|
49 | return reference.multilayerRotation.inverse()*v; |
---|
50 | } |
---|
51 | |
---|
52 | |
---|
53 | |
---|
54 | G4RotationMatrix RadmonDetectorMultilayerPlacementLayout :: GetRelativeRotation(const RadmonDetectorMultilayerPlacementLayout & reference) const |
---|
55 | { |
---|
56 | return reference.multilayerRotation.inverse()*multilayerRotation; |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | |
---|
62 | |
---|
63 | void RadmonDetectorMultilayerPlacementLayout :: SetRelativePosition(const RadmonDetectorMultilayerPlacementLayout & reference, const G4ThreeVector & position) |
---|
64 | { |
---|
65 | multilayerPosition=reference.multilayerRotation*position; |
---|
66 | multilayerPosition+=reference.multilayerPosition; |
---|
67 | } |
---|
68 | |
---|
69 | |
---|
70 | |
---|
71 | void RadmonDetectorMultilayerPlacementLayout :: SetRelativeRotation(const RadmonDetectorMultilayerPlacementLayout & reference, const G4RotationMatrix & rotation) |
---|
72 | { |
---|
73 | multilayerRotation=reference.multilayerRotation; |
---|
74 | multilayerRotation*=rotation; |
---|
75 | } |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | |
---|
80 | |
---|
81 | void RadmonDetectorMultilayerPlacementLayout :: DumpLayout(std::ostream & out, const G4String &indent) const |
---|
82 | { |
---|
83 | G4int width(RADMONDUMP_INDENT_WIDTH-indent.length()); |
---|
84 | if (width<0) |
---|
85 | width=0; |
---|
86 | |
---|
87 | G4int width2(width+4+indent.length()); |
---|
88 | |
---|
89 | out << indent << std::setw(width); out.setf(std::ostream::left, std::ostream::adjustfield); out << "Label"; out.setf(std::ostream::right, std::ostream::adjustfield); out << " = \"" << placementLabel << "\"\n" |
---|
90 | << indent << std::setw(width); out.setf(std::ostream::left, std::ostream::adjustfield); out << "Multilayer label"; out.setf(std::ostream::right, std::ostream::adjustfield); out << " = \"" << multilayerLabel << "\"\n" |
---|
91 | << indent << std::setw(width); out.setf(std::ostream::left, std::ostream::adjustfield); out << "Position"; out.setf(std::ostream::right, std::ostream::adjustfield); out << " = (" << std::setprecision(RADMONDUMP_DOUBLE_PRECISION) << std::setw(RADMONDUMP_DOUBLE_WIDTH) << G4BestUnit(multilayerPosition.getX(), "Length") << ", " |
---|
92 | << std::setprecision(RADMONDUMP_DOUBLE_PRECISION) << std::setw(RADMONDUMP_DOUBLE_WIDTH) << G4BestUnit(multilayerPosition.getY(), "Length") << ", " |
---|
93 | << std::setprecision(RADMONDUMP_DOUBLE_PRECISION) << std::setw(RADMONDUMP_DOUBLE_WIDTH) << G4BestUnit(multilayerPosition.getZ(), "Length") << ")\n" |
---|
94 | << std::setw(width2); out.setf(std::ostream::right, std::ostream::adjustfield); out << "|" << std::setprecision(RADMONDUMP_DOUBLE_PRECISION) << std::setw(RADMONDUMP_DOUBLE_WIDTH) << multilayerRotation.xx() << ", " << std::setprecision(RADMONDUMP_DOUBLE_PRECISION) << std::setw(RADMONDUMP_DOUBLE_WIDTH) << multilayerRotation.xy() << ", " << std::setprecision(RADMONDUMP_DOUBLE_PRECISION) << std::setw(RADMONDUMP_DOUBLE_WIDTH) << multilayerRotation.xz() << "|\n" |
---|
95 | << indent << std::setw(width); out.setf(std::ostream::left, std::ostream::adjustfield); out << "Rotation"; out.setf(std::ostream::right, std::ostream::adjustfield); out << " = |" << std::setprecision(RADMONDUMP_DOUBLE_PRECISION) << std::setw(RADMONDUMP_DOUBLE_WIDTH) << multilayerRotation.yx() << ", " << std::setprecision(RADMONDUMP_DOUBLE_PRECISION) << std::setw(RADMONDUMP_DOUBLE_WIDTH) << multilayerRotation.yy() << ", " << std::setprecision(RADMONDUMP_DOUBLE_PRECISION) << std::setw(RADMONDUMP_DOUBLE_WIDTH) << multilayerRotation.yz() << "|\n" |
---|
96 | << std::setw(width2); out.setf(std::ostream::right, std::ostream::adjustfield); out << "|" << std::setprecision(RADMONDUMP_DOUBLE_PRECISION) << std::setw(RADMONDUMP_DOUBLE_WIDTH) << multilayerRotation.zx() << ", " << std::setprecision(RADMONDUMP_DOUBLE_PRECISION) << std::setw(RADMONDUMP_DOUBLE_WIDTH) << multilayerRotation.zy() << ", " << std::setprecision(RADMONDUMP_DOUBLE_PRECISION) << std::setw(RADMONDUMP_DOUBLE_WIDTH) << multilayerRotation.zz() << "|\n"; |
---|
97 | } |
---|