Project

General

Profile

Support #595 » DoubletFiberParam.cc

Heidt, Christopher, 13 August 2011 02:59

 
1
/* This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus
2
 *
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.
7
 *
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.
12
 *
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/>.
15
 *
16
 */
17
#include <iostream>
18
#include <fstream>
19

    
20
#include "G4VPhysicalVolume.hh"
21
#include "G4ThreeVector.hh"
22
#include "G4Tubs.hh"
23

    
24
#include "DetModel/SciFi/DoubletFiberParam.hh"
25

    
26
// taking the parameters that define a fibre
27
DoubletFiberParam::DoubletFiberParam(G4double pSensitiveRadius,
28
                                     G4double pActiveRadius,
29
                                     G4double pOuterDiameter,
30
                                     G4double pInnerDiameter,
31
                                     G4double pFiberDiameter,
32
                                     G4double pFiberPitch ) {
33
  sensitiveRadius = pSensitiveRadius;
34
  activeRadius = pActiveRadius;
35
  outerDiameter = pOuterDiameter;
36
  innerDiameter = pInnerDiameter;
37
  fiberDiameter = pFiberDiameter;
38
  //The fiberPitch is ratio of the x-displacement between to two fibers on the 
39
  //same plane and the fiber diameter (fiberPitch < 2)
40
  fiberPitch = pFiberPitch;
41

    
42
  coreRotation = new G4RotationMatrix(CLHEP::HepRotationX(90.0*deg));
43
}
44

    
45
void DoubletFiberParam::ComputeTransformation(const G4int copyNo,
46
                                              G4VPhysicalVolume* physVol) const { 
47
  // Spacing is the displacement in the z-direction of two touching fibers
48
  // Stated differently this is the distance between the two layers of fibers in a channel
49
  G4double spacing = sqrt(fiberDiameter*fiberDiameter*
50
                         (1-fiberPitch*fiberPitch/4));
51

    
52
  // The x position is determined by the radius of the total plane
53
  // minus the x displacement between each fiber
54
  G4double xPos = - copyNo*fiberDiameter*fiberPitch/2
55
                  + (activeRadius-fiberDiameter/2);
56
  // before rotation each fiber rest on the y=0 axis
57
  G4double yPos = 0.0;
58
  //Each fiber rest on either an upper or lower z-plane
59
  G4double zPos = (copyNo%2) ? -0.5*spacing : 0.5*spacing;
60

    
61
  //Rotates the fibers to the u,v,w axis
62
  physVol->SetRotation(coreRotation);
63
  physVol->SetTranslation(G4ThreeVector(xPos, yPos, zPos));
64
}
65

    
66
void DoubletFiberParam::ComputeDimensions
67
(G4Tubs& fiberElement, const G4int copyNo,
68
  const G4VPhysicalVolume* physVol) const {
69
  // this is the number of fibers (212channels * 7fibre/channel)
70
  G4double nFiber = 2*floor(activeRadius/(fiberDiameter*fiberPitch/2));
71

    
72
  G4double xPos = 2*activeRadius*(copyNo/nFiber)
73
                  -(activeRadius-fiberDiameter/2);
74

    
75
  G4double fiberHalfLen = 0.;
76

    
77
  if ( sensitiveRadius > fabs( xPos ) )
78
    fiberHalfLen = sqrt(sensitiveRadius * sensitiveRadius - xPos * xPos);
79

    
80
  fiberElement.SetInnerRadius(innerDiameter/2);
81
  fiberElement.SetOuterRadius(outerDiameter/2);
82
  fiberElement.SetZHalfLength(fiberHalfLen);
83
  fiberElement.SetStartPhiAngle(0.0*deg);
84
  fiberElement.SetDeltaPhiAngle(360.0*deg);
85
}
(1-1/2)