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] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 /// \file electromagnetic/TestEm10/src/DetectorBari05.cc
 27 /// \brief Implementation of the DetectorBari05 class
 28 //
 29 //
 30 //
 31 //
 32 
 33 #include "DetectorBari05.hh"
 34 
 35 #include "Materials.hh"
 36 #include "SensitiveDetector.hh"
 37 
 38 #include "G4Box.hh"
 39 #include "G4FieldManager.hh"
 40 #include "G4LogicalVolume.hh"
 41 #include "G4Material.hh"
 42 #include "G4PVPlacement.hh"
 43 #include "G4Region.hh"
 44 #include "G4SDManager.hh"
 45 #include "G4SystemOfUnits.hh"
 46 #include "G4TransportationManager.hh"
 47 #include "G4UniformMagField.hh"
 48 #include "G4UnitsTable.hh"
 49 #include "G4ios.hh"
 50 
 51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 52 
 53 DetectorBari05::DetectorBari05() : fRadiatorDescription(0) {}
 54 
 55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 56 
 57 DetectorBari05::~DetectorBari05()
 58 {
 59   // delete fRadiatorDescription;
 60   // the description is deleted in detector construction
 61 }
 62 
 63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 64 
 65 G4VPhysicalVolume* DetectorBari05::Construct()
 66 {
 67   // Geometry parameters
 68   //
 69 
 70   G4cout << "DetectorBari05 setup" << G4endl;
 71 
 72   G4double worldSizeZ = 600. * cm;
 73   G4double worldSizeR = 22. * cm;
 74 
 75   // Radiator and detector parameters
 76 
 77   G4double radThickness = 0.0055 * mm;  // Reg2
 78   G4double gasGap = 0.23 * mm;  // Reg2
 79   G4double foilGasRatio = radThickness / (radThickness + gasGap);
 80   G4double foilNumber = 191;  // Reg2
 81 
 82   G4double absorberThickness = 0.4 * mm;
 83   G4double absorberRadius = 100. * mm;
 84 
 85   G4double electrodeThick = 100.0 * micrometer;
 86   G4double pipeLength = 50.0 * cm;
 87   G4double mylarThick = 20.0 * micrometer;
 88   G4double detGap = 0.01 * mm;
 89 
 90   G4double startZ = 100.0 * mm;
 91 
 92   // Preparation of mixed radiator material
 93 
 94   // Materials
 95   //
 96 
 97   // Change to create materials using NIST
 98   G4Material* air = Materials::GetInstance()->GetMaterial("Air");
 99   G4Material* ch2 = Materials::GetInstance()->GetMaterial("CH2");
100   G4Material* he = Materials::GetInstance()->GetMaterial("He");
101   G4Material* si = Materials::GetInstance()->GetMaterial("Si");
102 
103   G4double foilDensity = ch2->GetDensity();
104   G4double gasDensity = air->GetDensity();
105   G4double totDensity = foilDensity * foilGasRatio + gasDensity * (1.0 - foilGasRatio);
106 
107   G4double fractionFoil = foilDensity * foilGasRatio / totDensity;
108   G4double fractionGas = gasDensity * (1.0 - foilGasRatio) / totDensity;
109   G4Material* radiatorMat = new G4Material("radiatorMat", totDensity, 2);
110   radiatorMat->AddMaterial(ch2, fractionFoil);
111   radiatorMat->AddMaterial(air, fractionGas);
112 
113   // Radiator description
114   fRadiatorDescription = new RadiatorDescription;
115   fRadiatorDescription->fFoilMaterial = ch2;  // CH2; // Kapton; // Mylar ; // Li ; // CH2 ;
116   fRadiatorDescription->fGasMaterial = air;  // CO2; // He; //
117   fRadiatorDescription->fFoilThickness = radThickness;
118   fRadiatorDescription->fGasThickness = gasGap;
119   fRadiatorDescription->fFoilNumber = foilNumber;
120 
121   // pipe material is assumed to be He + small admixture of air
122   foilGasRatio = 0.99999;
123   foilDensity = 1.2928 * mg / cm3;  // Air
124   gasDensity = 0.178 * mg / cm3;  // He
125   totDensity = foilDensity * foilGasRatio + gasDensity * (1.0 - foilGasRatio);
126 
127   fractionFoil = foilDensity * foilGasRatio / totDensity;
128   fractionGas = gasDensity * (1.0 - foilGasRatio) / totDensity;
129 
130   G4Material* pipeMat = new G4Material("pipeMat", totDensity, 2);
131   pipeMat->AddMaterial(air, fractionFoil);
132   pipeMat->AddMaterial(he, fractionGas);
133 
134   G4Material* worldMaterial = air;  // CO2;
135   G4Material* absorberMaterial = si;
136 
137   // Volumes
138   //
139 
140   G4VSolid* solidWorld = new G4Box("World", worldSizeR, worldSizeR, worldSizeZ / 2.);
141 
142   G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, worldMaterial, "World");
143 
144   G4VPhysicalVolume* physicsWorld =
145     new G4PVPlacement(0, G4ThreeVector(), "World", logicWorld, 0, false, 0);
146 
147   // TR radiator envelope
148 
149   G4double radThick = foilNumber * (radThickness + gasGap) - gasGap + detGap;
150   G4double radZ = startZ + 0.5 * radThick;
151 
152   G4VSolid* solidRadiator =
153     new G4Box("Radiator", 1.1 * absorberRadius, 1.1 * absorberRadius, 0.5 * radThick);
154 
155   G4LogicalVolume* logicRadiator = new G4LogicalVolume(solidRadiator, radiatorMat, "Radiator");
156 
157   new G4PVPlacement(0, G4ThreeVector(0, 0, radZ), "Radiator", logicRadiator, physicsWorld, false,
158                     0);
159 
160   fRadiatorDescription->fLogicalVolume = logicRadiator;
161 
162   // create region for window inside windowR for
163 
164   G4Region* radRegion = new G4Region("XTRradiator");
165   radRegion->AddRootLogicalVolume(logicRadiator);
166 
167   // Drift Electrode on both sides of Radiator:
168   // (not placed)
169 
170   G4double zElectrode1 = radZ - radThick / 2. - electrodeThick / 2.;
171   G4double zElectrode2 = radZ + radThick / 2. + electrodeThick / 2.;
172 
173   G4cout << "zElectrode1 = " << zElectrode1 / mm << " mm" << G4endl;
174   G4cout << "zElectrode2 = " << zElectrode2 / mm << " mm" << G4endl;
175   G4cout << "electrodeThick = " << electrodeThick / mm << " mm" << G4endl << G4endl;
176 
177   // Helium Pipe
178   // (not placed)
179 
180   G4double pipeDist = 1. * cm;  // Distance between pipe and radiator / absorber
181   G4double zPipe = zElectrode2 + electrodeThick / 2. + pipeLength / 2. + pipeDist / 2.;
182 
183   G4cout << "zPipe = " << zPipe / mm << " mm" << G4endl;
184   G4cout << "pipeLength = " << pipeLength / mm << " mm" << G4endl << G4endl;
185 
186   // Mylar Foil on both sides of helium pipe
187   // (not placed)
188 
189   G4double zMylar1 = zPipe - pipeLength / 2. - mylarThick / 2 - 0.01 * mm;
190   G4double zMylar2 = zPipe + pipeLength / 2. + mylarThick / 2 + 0.01 * mm;
191 
192   G4cout << "zMylar1 = " << zMylar1 / mm << " mm" << G4endl;
193   G4cout << "zMylar2 = " << zMylar2 / mm << " mm" << G4endl;
194   G4cout << "fMylarThick = " << mylarThick / mm << " mm" << G4endl << G4endl;
195 
196   // Mylar Foil on Chamber
197   // (not placed)
198 
199   G4double zMylar = zElectrode2 + electrodeThick / 2. + mylarThick / 2. + 1.0 * mm;
200   zMylar += (pipeLength + pipeDist);
201 
202   G4cout << "zMylar = " << zMylar / mm << " mm" << G4endl;
203   G4cout << "mylarThick = " << mylarThick / mm << " mm" << G4endl << G4endl;
204 
205   // Absorber
206 
207   G4double absorberZ = zMylar + mylarThick / 2. + absorberThickness / 2.;
208 
209   G4VSolid* solidAbsorber = new G4Box("Absorber", 10. * mm, 10. * mm, absorberThickness / 2.);
210 
211   G4LogicalVolume* logicAbsorber = new G4LogicalVolume(solidAbsorber, absorberMaterial, "Absorber");
212 
213   new G4PVPlacement(0, G4ThreeVector(0., 0., absorberZ), "Absorber", logicAbsorber, physicsWorld,
214                     false, 0);
215 
216   // Create region for radiator
217 
218   G4Region* regGasDet = new G4Region("XTRdEdxDetector");
219   regGasDet->AddRootLogicalVolume(logicAbsorber);
220 
221   // Sensitive Detectors: Absorber
222 
223   SensitiveDetector* sd = new SensitiveDetector("AbsorberSD");
224   G4SDManager::GetSDMpointer()->AddNewDetector(sd);
225   logicAbsorber->SetSensitiveDetector(sd);
226 
227   // Print geometry parameters
228 
229   G4cout << "\n The  WORLD   is made of " << worldSizeZ / mm << "mm of "
230          << worldMaterial->GetName();
231   G4cout << ", the transverse size (R) of the world is " << worldSizeR / mm << " mm. " << G4endl;
232   G4cout << " The ABSORBER is made of " << absorberThickness / mm << "mm of "
233          << absorberMaterial->GetName();
234   G4cout << ", the transverse size (R) is " << absorberRadius / mm << " mm. " << G4endl;
235   G4cout << " Z position of the (middle of the) absorber " << absorberZ / mm << "  mm." << G4endl;
236 
237   G4cout << "radZ = " << radZ / mm << " mm" << G4endl;
238   G4cout << "startZ = " << startZ / mm << " mm" << G4endl;
239 
240   G4cout << "fRadThick = " << radThick / mm << " mm" << G4endl;
241   G4cout << "fFoilNumber = " << foilNumber << G4endl;
242   G4cout << "fRadiatorMat = " << radiatorMat->GetName() << G4endl;
243   G4cout << "WorldMaterial = " << worldMaterial->GetName() << G4endl;
244   G4cout << G4endl;
245 
246   return physicsWorld;
247 }
248 
249 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
250