ACTARSim
ACTAR TPC Simulation Reference Guide
ActarSimSciRingDetectorConstruction.cc
Go to the documentation of this file.
1 // - AUTHOR: Hector Alvarez-Pol 04/2008
2 /******************************************************************
3  * Copyright (C) 2005-2016, Hector Alvarez-Pol *
4  * All rights reserved. *
5  * *
6  * License according to GNU LESSER GPL (see lgpl-3.0.txt). *
7  * For the list of contributors see CREDITS. *
8  ******************************************************************/
9 //////////////////////////////////////////////////////////////////
10 /// \class ActarSimSciRingDetectorConstruction
11 /// Scintillator detector description
12 /////////////////////////////////////////////////////////////////
13 
17 //#include "ActarSimSciRingDetectorMessenger.hh"
18 #include "ActarSimROOTAnalysis.hh"
19 #include "ActarSimSciRingSD.hh"
20 
21 #include "G4Material.hh"
22 #include "G4Box.hh"
23 #include "G4Tubs.hh"
24 #include "G4Trd.hh"
25 #include "G4Cons.hh"
26 #include "G4LogicalVolume.hh"
27 #include "G4PVPlacement.hh"
28 #include "G4PVReplica.hh"
29 #include "G4RotationMatrix.hh"
30 #include "G4VisAttributes.hh"
31 #include "G4Colour.hh"
32 #include "G4RunManager.hh"
33 #include "G4Transform3D.hh"
34 
35 #include "G4PhysicalConstants.hh"
36 #include "G4SystemOfUnits.hh"
37 
38 #include "globals.hh"
39 
40 //////////////////////////////////////////////////////////////////
41 /// Constructor. Sets the material and the pointer to the Messenger
44  : sciBulkMaterial(0),detConstruction(det) {
45  SetSciBulkMaterial("CsI");
46 
47  //Options for Silicon and scintillator coverage:
48  // 6 bits to indicate which sci wall is present (1) or absent (0)
49  // order is:
50  // bit1 (lsb) beam output wall
51  // bit2 lower (gravity based) wall
52  // bit3 upper (gravity based) wall
53  // bit4 left (from beam point of view) wall
54  // bit5 right (from beam point of view) wall
55  // bit6 (msb) beam entrance wall
56  SetSideCoverage(1);
57 
58  SetXBoxSciHalfLength(100*cm);
59  SetYBoxSciHalfLength(100*cm);
60  SetZBoxSciHalfLength(100*cm);
61 
62  // create commands for interactive definition of the calorimeter
63  // sciMessenger = new ActarSimSciDetectorMessenger(this);
64 }
65 
66 //////////////////////////////////////////////////////////////////
67 /// Destructor
69  // delete sciMessenger;
70 }
71 
72 //////////////////////////////////////////////////////////////////
73 /// Wrap for the construction functions
74 G4VPhysicalVolume* ActarSimSciRingDetectorConstruction::Construct(G4LogicalVolume* worldLog) {
75  //Introduce here other constructors for materials around the TOF (windows, frames...)
76  //which can be controlled by the calMessenger
77  //ConstructTOFWorld(worldLog);
78  return ConstructSci(worldLog);
79 }
80 
81 //////////////////////////////////////////////////////////////////
82 /// Real construction work is performed here.
83 G4VPhysicalVolume* ActarSimSciRingDetectorConstruction::ConstructSci(G4LogicalVolume* worldLog) {
84  //Chamber Y,Z length
85  //G4double chamberSizeY=detConstruction->GetChamberYLength();
86  G4double chamberSizeZ=detConstruction->GetChamberSizeZ();
87 
88  //Gas chamber position inside the chamber
90  G4double zGasBoxPosition=gasDet->GetGasBoxCenterZ();
91 
92  //----------------------------- the Silicon and CsI disks
93  G4double Rmax=48*mm;
94  G4double Rmin=24*mm;
95  G4double Phi_0=0*deg;
96  G4double Phi_f=360*deg;
97  G4double ZlengthCsI=10.00*mm;
98 
99  G4Tubs *CsIring=new G4Tubs("CsIring",Rmin,Rmax,ZlengthCsI,Phi_0,Phi_f);
100 
101  G4LogicalVolume* CsIring_log= new G4LogicalVolume(CsIring,sciBulkMaterial,"CsIring_log",0,0,0);
102 
103  G4double sectorPhi=Phi_f/16.;
104 
105  G4Tubs *CsISector=new G4Tubs("CsISector",Rmin,Rmax,ZlengthCsI,0.,sectorPhi);
106 
107  G4LogicalVolume *CsISector_log=new G4LogicalVolume(CsISector,sciBulkMaterial,"CsISector_log",0,0,0);
108  G4VisAttributes* CsISectorVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
109 
110  CsISectorVisAtt->SetVisibility(true);
111 
112  G4double CsIPos_x=0*mm;
113  //G4double CsIPos_y=chamberSizeY/2-1*mm;
114  G4double CsIPos_y=0;
115  G4double CsIPos_z=0.0*mm;
116 
117  G4double distance[3]={320*mm,550*mm,1090*mm}; //For 10Li experiment
118 
119  //G4double distance[3]={570*mm,0*mm,0*mm}; //For 16C experiment Only one ring detector
120 
121  for(G4int k=0;k<3;k++){
122  CsIPos_z=distance[k]+chamberSizeZ-zGasBoxPosition;
123 
124  G4VPhysicalVolume *CsIring_phys=new G4PVPlacement(0,
125  G4ThreeVector(CsIPos_x,CsIPos_y,CsIPos_z),
126  CsIring_log,"CsIringdet",worldLog,false,k);
127 
128  if(CsIring_phys){;}
129  }
130 
131  G4VPhysicalVolume *CsISector_phys=new G4PVReplica("CsISector",CsISector_log,CsIring_log,kPhi,16,sectorPhi);
132 
133  //------------------------------------------------
134  // Sensitive detectors
135  //------------------------------------------------
136  CsISector_log->SetSensitiveDetector( detConstruction->GetSciRingSD() );
137 
138  //------------------------------------------------------------------
139  // Visualization attributes
140  //------------------------------------------------------------------
141  return CsISector_phys;
142 }
143 
144 //////////////////////////////////////////////////////////////////
145 /// Set the material the scintillator bulk is made of
147  G4Material* pttoMaterial = G4Material::GetMaterial(mat);
148  if (pttoMaterial) sciBulkMaterial = pttoMaterial;
149 }
150 
151 //////////////////////////////////////////////////////////////////
152 /// Updates Scintillator detector
155  G4RunManager::GetRunManager()->
156  DefineWorldVolume(detConstruction->GetWorldPhysicalVolume());
157 }
158 
159 //////////////////////////////////////////////////////////////////
160 /// Prints Scintillator detector parameters. To be filled
162  G4cout << "##################################################################"
163  << G4endl
164  << "#### ActarSimSciRingDetectorConstruction::PrintDetectorParameters() ####"
165  << G4endl;
166  G4cout << "##################################################################"
167  << G4endl;
168 }
G4Material * sciBulkMaterial
Pointer to the scintillator material.
ActarSimDetectorConstruction * detConstruction
Pointer to the global detector.
void SetSciBulkMaterial(G4String)
Set the material the scintillator bulk is made of.
void PrintDetectorParameters()
Prints Scintillator detector parameters. To be filled.
G4VPhysicalVolume * Construct(G4LogicalVolume *)
Wrap for the construction functions.
void UpdateGeometry()
Updates Scintillator detector.
G4VPhysicalVolume * ConstructSci(G4LogicalVolume *)
Real construction work is performed here.
ActarSimSciRingDetectorConstruction(ActarSimDetectorConstruction *)
Constructor. Sets the material and the pointer to the Messenger.
ActarSimGasDetectorConstruction * GetGasDetector()