ACTARSim
ACTAR TPC Simulation Reference Guide
ActarSimPlaDetectorConstruction.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 ActarSimPlaDetectorConstruction
11 /// Scintillator plastic detector description
12 /////////////////////////////////////////////////////////////////
13 
17 //#include "ActarSimPlaDetectorMessenger.hh"
18 #include "ActarSimROOTAnalysis.hh"
19 #include "ActarSimPlaSD.hh"
20 
21 #include "G4Material.hh"
22 #include "G4Box.hh"
23 #include "G4Trd.hh"
24 #include "G4Cons.hh"
25 #include "G4LogicalVolume.hh"
26 #include "G4PVPlacement.hh"
27 #include "G4RotationMatrix.hh"
28 #include "G4VisAttributes.hh"
29 #include "G4Colour.hh"
30 #include "G4RunManager.hh"
31 #include "G4Transform3D.hh"
32 
33 #include "globals.hh"
34 
35 #include "HodoParametrisation.hh"
36 #include "G4PVParameterised.hh"
37 
38 #include "G4PhysicalConstants.hh"
39 #include "G4SystemOfUnits.hh"
40 
41 //////////////////////////////////////////////////////////////////
42 /// Constructor. Sets the material and the pointer to the Messenger
45  : plaBulkMaterial(0),detConstruction(det) {
46 
47  SetPlaBulkMaterial("BC408");
48  SetSideCoverage(1);
49  SetXBoxPlaHalfLength(100*cm);
50  SetYBoxPlaHalfLength(100*cm);
51  SetZBoxPlaHalfLength(100*cm);
52 
53  // create commands for interactive definition of the calorimeter
54  //plaMessenger = new ActarSimPlaDetectorMessenger(this);
55 }
56 
57 //////////////////////////////////////////////////////////////////
58 /// Destructor
60  // delete plaMessenger;
61 }
62 
63 //////////////////////////////////////////////////////////////////
64 /// Wrap for the construction functions within the TOF
65 G4VPhysicalVolume* ActarSimPlaDetectorConstruction::Construct(G4LogicalVolume* worldLog) {
66  //Introduce here other constructors for materials around the TOF (windows, frames...)
67  //which can be controlled by the calMessenger
68  //ConstructTOFWorld(worldLog);
69  return ConstructPla(worldLog);
70 }
71 
72 //////////////////////////////////////////////////////////////////
73 /// Chamber Y,Z length
74 G4VPhysicalVolume* ActarSimPlaDetectorConstruction::ConstructPla(G4LogicalVolume* worldLog) {
75  //G4double chamberSizeY=detConstruction->GetChamberYLength();
76  G4double chamberSizeZ=detConstruction->GetChamberSizeZ();
77 
78  //Gas chamber position inside the chamber
80  G4double zGasBoxPosition=gasDet->GetGasBoxCenterZ();
81 
82  //Hodo Box
83  G4double hodo_x=105*cm;
84  G4double hodo_y=105*cm;
85  G4double hodo_z=60.0*cm;
86 
87  G4double plaBulk_x = 9.95*mm; //half length=12.5mm
88  G4double plaBulk_y = 100*mm; //half length=12.5mm
89  G4double plaBulk_z = 5.0*mm; //half length=15.0mm
90 
91  //the numbers
92  G4double nDE=13; //number of Scint in dE
93  G4double nE1=16; //number of Scint in E1
94  G4double nE2=13; //number of Scint in E2
95  //G4double nTarget=1;//number of Targets
96 
97  //G4double yHodo=chamberSizeY/2-1*mm;
98  G4double yHodo=0;
99  G4double zHodo=5.0*m+chamberSizeZ-zGasBoxPosition;
100 
101  //G4double defectHalfLength = 0.5*mm;
102  //G4double separationFromBox = 25*mm;
103 
104  // Printing the final settings...
105  /*G4cout << "##################################################################"
106  << G4endl
107  << "######### ActarSimSciDetectorConstruction::ConstructSci() #######"
108  << G4endl
109  << " Note that only a thin (1 micron) Al window is defined in front"
110  << G4endl
111  << " of the silicons. Here only the scintillator volume is described."
112  << G4endl
113  << " x dimension (half-side) of scintillator: " << sciBulk_x/mm << " mm"
114  << G4endl
115  << " y dimension (half-side) of scintillator: " << sciBulk_y/mm << " mm"
116  << G4endl
117  << " z dimension (half-side) of scintillator: " << sciBulk_z/mm << " mm"
118  << G4endl;
119  G4cout << "##################################################################"
120  << G4endl;
121  */
122 
123  G4LogicalVolume* plaLog(0);
124  G4VPhysicalVolume* plaPhys(0);
125 
126  // G4Box* sciBox =
127  // new G4Box("sciBox", sciBulk_x, sciBulk_y, sciBulk_z);
128 
129  // sciLog =
130  // new G4LogicalVolume(sciBox, sciBulkMaterial, "sciLog");
131 
132 
133  G4double density;//, pressure, temperature;
134  //G4int ncomponents, natoms;
135  //G4double fractionmass;
136 
137  G4double a; // atomic mass
138  G4double z; // atomic number
139 
140  G4Material* Vacuum =
141  new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density,
142  kStateGas, 3.e-18*pascal, 2.73*kelvin);
143  Vacuum->SetChemicalFormula("NOMATTER");
144 
145  //Hodo
146  G4Box* solidHodo = new G4Box("solidhodo",0.5*hodo_x,0.5*hodo_y,0.5*hodo_z);
147  G4LogicalVolume* logicHodo = new G4LogicalVolume(solidHodo,Vacuum,"logichodo",0,0,0);
148  G4VPhysicalVolume* physiHodo = new G4PVPlacement(0,G4ThreeVector(0.,yHodo,zHodo),logicHodo,"physihodo",worldLog,false,0);
149 
150  if(physiHodo){;}
151 
152  G4VisAttributes* logicHodo_VisAtt = new G4VisAttributes(G4Colour(0,0,1.0));
153  //logicHodo->SetVisAttributes(G4VisAttributes::GetInvisible());
154  logicHodo->SetVisAttributes(logicHodo_VisAtt);
155  //
156  G4Box* plaBox =new G4Box("solidbar",0.5*plaBulk_x,0.5*plaBulk_y,0.5*plaBulk_z);
157  plaLog = new G4LogicalVolume(plaBox,plaBulkMaterial,"logicbar",0,0,0);
158 
159  G4VPVParameterisation* BarParam = new HodoParametrisation(nDE,nE1,nE2,-0.0*hodo_z);
160  // dummy value : kXAxis -- modified by parameterised volume
161  plaPhys = new G4PVParameterised("plaPhys",plaLog,logicHodo,kXAxis, nDE+nE1+nE2, BarParam);
162 
163  G4VisAttributes* logicBar_VisAtt = new G4VisAttributes(G4Colour(0.7,1.0,0.0));
164  plaLog->SetVisAttributes(logicBar_VisAtt);
165 
166  //------------------------------------------------
167  // Sensitive detectors
168  //------------------------------------------------
169  plaLog->SetSensitiveDetector( detConstruction->GetPlaSD() );
170 
171  //------------------------------------------------------------------
172  // Visualization attributes
173  //------------------------------------------------------------------
174  G4VisAttributes* plaVisAtt1 = new G4VisAttributes(G4Colour(1,1,1));
175  plaVisAtt1->SetVisibility(true);
176  plaLog->SetVisAttributes(plaVisAtt1);
177 
178  return plaPhys;
179 }
180 
181 //////////////////////////////////////////////////////////////////
182 /// Set the material the scintillator bulk is made of
184  G4Material* pttoMaterial = G4Material::GetMaterial(mat);
185  if (pttoMaterial) plaBulkMaterial = pttoMaterial;
186 }
187 
188 //////////////////////////////////////////////////////////////////
189 /// Updates Scintillator detector
192  G4RunManager::GetRunManager()->
193  DefineWorldVolume(detConstruction->GetWorldPhysicalVolume());
194 }
195 
196 //////////////////////////////////////////////////////////////////
197 /// Prints Scintillator detector parameters. To be filled
199  G4cout << "##################################################################"
200  << G4endl
201  << "#### ActarSimSciDetectorConstruction::PrintDetectorParameters() ####"
202  << G4endl;
203  G4cout << "##################################################################"
204  << G4endl;
205 }
void SetPlaBulkMaterial(G4String)
Set the material the scintillator bulk is made of.
ActarSimPlaDetectorConstruction(ActarSimDetectorConstruction *)
Constructor. Sets the material and the pointer to the Messenger.
void UpdateGeometry()
Updates Scintillator detector.
ActarSimDetectorConstruction * detConstruction
pointer to the global detector
ActarSimGasDetectorConstruction * GetGasDetector()
G4VPhysicalVolume * Construct(G4LogicalVolume *)
Wrap for the construction functions within the TOF.
G4VPhysicalVolume * ConstructPla(G4LogicalVolume *)
Chamber Y,Z length.
void PrintDetectorParameters()
Prints Scintillator detector parameters. To be filled.