1
/* This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus
3
* MAUS is free software: you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License as published by
5
* the Free Software Foundation, either version 3 of the License, or
6
* (at your option) any later version.
8
* MAUS is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with MAUS. If not, see <http://www.gnu.org/licenses/>.
18
#include <G4Material.hh>
20
#include <G4LogicalVolume.hh>
21
#include <G4PVPlacement.hh>
22
#include <G4PVParameterised.hh>
23
#include <G4UserLimits.hh>
24
#include <G4VisAttributes.hh>
25
#include <G4Colour.hh>
27
#include <G4ThreeVector.hh>
28
#include <G4RotationMatrix.hh>
30
#include <G4SDManager.hh>
32
#include "DetModel/SciFi/SciFiPlane.hh"
33
#include "DetModel/SciFi/SciFiSD.hh"
34
#include "DetModel/SciFi/DoubletFiberParam.hh"
36
#include "CLHEP/Vector/Rotation.h"
38
// NOTE: not sure how Geant4 deals with the deletion
39
// of Logical and Solid Volumes;
40
// possible bug in the destructor.
42
G4int SciFiPlane::SciFi_numFibres = 0;
44
// SciFiPlane - Specific parameterisation of the SciFi station
45
// to be called by the generic MICE detector construction code
46
SciFiPlane::SciFiPlane(MiceModule* mod,
48
G4VPhysicalVolume *mlv) {
49
G4double tr = mod->dimensions().x();
50
G4double fd = mod->propertyDouble("FibreDiameter");
51
G4double fp = mod->propertyDouble("Pitch");
52
G4double cd = mod->propertyDouble("CoreDiameter");
53
G4double ar = mod->propertyDouble("ActiveRadius");
55
G4double doubletThickness = mod->dimensions().y();
57
G4String doubletName = mod->fullName() + "Doublet";
58
G4String coreName = mod->fullName() + "DoubletCores";
59
G4String clad1Name = mod->fullName() + "DoubletClad1";
60
G4String clad2Name = mod->fullName() + "DoubletClad2";
62
// Getting the rotations right.
63
// A "z-flip" is a rotation of 180 degrees over the y axis.
64
// Remember that the rotation matrix for
65
// a rotation over the y axis is given by:
67
// [cos(theta) 0 sin(theta)]
68
// R_y(theta) =[0 1 0 ]
69
// [-sin(theta) 0 cos(theta)]
72
CLHEP::HepRotation zflip;
73
const Hep3Vector rowx(-1., 0, 0);
74
const Hep3Vector rowy(0, 1., 0);
75
const Hep3Vector rowz(0, 0, -1.);
76
zflip.setRows(rowx, rowy, rowz);
78
G4RotationMatrix* trot = new G4RotationMatrix(mod->globalRotation());
79
// this is the rotation of the fibre array
80
(*trot) = (*trot)*zflip;
83
solidDoublet = new G4Tubs(doubletName, 0.0,
84
tr, doubletThickness / 2.0,
85
0.0 * deg, 360.0 * deg);
87
logicDoublet = new G4LogicalVolume(solidDoublet, mater, doubletName, 0, 0, 0);
89
physiDoublet = placeCore = new G4PVPlacement(trot, mod->position(),
90
logicDoublet, doubletName,
91
mlv->GetLogicalVolume(),
94
// lenght of the tube of fibre
95
G4double tlen = 1.0 * mm;
97
// the number of fibres to be simulated
98
SciFiPlane::SciFi_numFibres = (G4int)floor(2. * ar / (0.5 * fp));
100
// Beginning of the fiber core definitions
101
solidCore = new G4Tubs(coreName, 0.0, cd / 2., tlen, 0.0 * deg, 360.0 * deg);
103
logicCore = new G4LogicalVolume(solidCore, mater, coreName, 0, 0, 0);
105
G4VPVParameterisation* coreParam = new DoubletFiberParam(ar, ar, cd,
108
physiCore = new G4PVParameterised(coreName, logicCore, physiDoublet,
109
kUndefined, SciFi_numFibres, coreParam);
112
SciFiPlane::~SciFiPlane() {