ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4tgbPlaceParamLinear.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4tgbPlaceParamLinear.cc
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 //
28 //
29 // class G4tgbPlaceParamLinear
30 
31 // History:
32 // - Created. P.Arce, CIEMAT (November 2007)
33 // -------------------------------------------------------------------------
34 
35 #include "G4tgbPlaceParamLinear.hh"
36 #include "G4RotationMatrix.hh"
37 #include "G4VPhysicalVolume.hh"
38 #include "G4tgrMessenger.hh"
40 
41 // -------------------------------------------------------------------------
43 {
44 }
45 
46 
47 // -------------------------------------------------------------------------
50  : G4tgbPlaceParameterisation(tgrParam)
51 {
52  //---- Get translation and rotation
53  if( tgrParam->GetParamType() == "LINEAR" )
54  {
55  CheckNExtraData( tgrParam, 6, WLSIZE_EQ, "G4tgbPlaceParamLinear:");
56  theDirection = G4ThreeVector( tgrParam->GetExtraData()[3],
57  tgrParam->GetExtraData()[4],
58  tgrParam->GetExtraData()[5] );
59  theAxis = kZAxis;
60  }
61  else
62  {
63  CheckNExtraData( tgrParam, 3, WLSIZE_EQ, "G4tgbPlaceParamLinear:");
64  if( tgrParam->GetParamType() == "LINEAR_X" ) {
65  theDirection = G4ThreeVector(1.,0.,0.);
66  theAxis = kXAxis;
67  } else if( tgrParam->GetParamType() == "LINEAR_Y" ) {
68  theDirection = G4ThreeVector(0.,1.,0.);
69  theAxis = kYAxis;
70  } else if( tgrParam->GetParamType() == "LINEAR_Z" ) {
71  theDirection = G4ThreeVector(0.,0.,1.);
72  theAxis = kZAxis;
73  }
74  }
75 
76  if( theDirection.mag() == 0. )
77  {
78  G4Exception("G4tgbPlaceParamLinear::G4tgbPlaceParamLinear()",
79  "InvalidSetup", FatalException, "Direction is zero !");
80  }
81  else
82  {
84  }
85 
86  theNCopies = G4int(tgrParam->GetExtraData()[0]);
87  theStep = tgrParam->GetExtraData()[1];
88  theOffset = tgrParam->GetExtraData()[2];
89 
91 
92 #ifdef G4VERBOSE
94  {
95  G4cout << " G4tgbPlaceParamLinear::G4tgbPlaceParamLinear(): "
96  << " param type " << tgrParam->GetParamType() << G4endl
97  << " N copies " << theNCopies << G4endl
98  << " step " << theStep << G4endl
99  << " offset " << theOffset << G4endl
100  << " translation " << theTranslation << G4endl
101  << " direction " << theDirection << G4endl
102  << " axis " << theAxis << G4endl;
103  }
104 #endif
105 }
106 
107 
108 // -------------------------------------------------------------------------
110 ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const
111 {
113 
114 #ifdef G4VERBOSE
116  {
117  G4cout << " G4tgbPlaceParamLinear::ComputeTransformation() -"
118  << physVol->GetName() << G4endl
119  << " copyNo " << copyNo << " pos " << origin << G4endl;
120  }
121 #endif
122  //----- Set traslation and rotation
123  physVol->SetTranslation(origin);
124  physVol->SetCopyNo( copyNo );
125  physVol->SetRotation( theRotationMatrix );
126 }