ACTARSim
ACTAR TPC Simulation Reference Guide
ActarSimSilRingDetectorConstruction.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 ActarSimSilRingDetectorConstruction
11 /// Silicon ring detector description
12 /////////////////////////////////////////////////////////////////
13 
17 //#include "ActarSimSilDetectorMessenger.hh"
18 #include "ActarSimROOTAnalysis.hh"
19 #include "ActarSimSilRingSD.hh"
20 
21 #include "G4Material.hh"
22 #include "G4Box.hh"
23 #include "G4Cons.hh"
24 #include "G4Tubs.hh"
25 #include "G4LogicalVolume.hh"
26 #include "G4PVPlacement.hh"
27 #include "G4PVReplica.hh"
28 #include "G4RotationMatrix.hh"
29 #include "G4VisAttributes.hh"
30 #include "G4Colour.hh"
31 #include "G4RunManager.hh"
32 #include "G4Transform3D.hh"
33 
34 #include "G4PhysicalConstants.hh"
35 #include "G4SystemOfUnits.hh"
36 
37 #include "globals.hh"
38 
39 //////////////////////////////////////////////////////////////////
40 /// Constructor. Sets the material and the pointer to the Messenger
43  : silBulkMaterial(0),detConstruction(det) {
44  SetSilBulkMaterial("Silicon");
45 
46  //Options for Silicon and scintillator coverage:
47  // 6 bits to indicate which sci wall is present (1) or absent (0)
48  // order is:
49  // bit1 (lsb) beam output wall
50  // bit2 lower (gravity based) wall
51  // bit3 upper (gravity based) wall
52  // bit4 left (from beam point of view) wall
53  // bit5 right (from beam point of view) wall
54  // bit6 (msb) beam entrance wall
55  SetSideCoverage(1);
56 
57  SetXBoxSilHalfLength(100*cm);
58  SetYBoxSilHalfLength(100*cm);
59  SetZBoxSilHalfLength(100*cm);
60 
61  // create commands for interactive definition of the calorimeter
62  //silMessenger = new ActarSimSilRingDetectorMessenger(this);
63 }
64 
65 //////////////////////////////////////////////////////////////////
66 /// Destructor
68  //delete silMessenger;
69 }
70 
71 
72 //////////////////////////////////////////////////////////////////
73 /// Wrap for the construction functions
74 G4VPhysicalVolume* ActarSimSilRingDetectorConstruction::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 ConstructSil(worldLog);
79 }
80 
81 //////////////////////////////////////////////////////////////////
82 /// Real construction work is performed here.
83 G4VPhysicalVolume* ActarSimSilRingDetectorConstruction::ConstructSil(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 Zlength=0.25*mm; //Half length 500 um
98 
99  G4Tubs *Silicon=new G4Tubs("Silicon",Rmin,Rmax,Zlength,Phi_0,Phi_f);
100 
101  G4VisAttributes* SilVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
102  SilVisAtt->SetVisibility(false);
103 
104  G4LogicalVolume* SiliconDisk_log= new G4LogicalVolume(Silicon,silBulkMaterial,"SiliconDisk_log",0,0,0);
105 
106  SiliconDisk_log->SetVisAttributes(SilVisAtt);
107 
108  G4double sectorPhi=Phi_f/16.;
109 
110  G4Tubs *Sector=new G4Tubs("Sector",Rmin,Rmax,Zlength,0.,sectorPhi);
111 
112  G4LogicalVolume *Sector_log=new G4LogicalVolume(Sector,silBulkMaterial,"Sector_log",0,0,0);
113  G4VisAttributes* SectorVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
114  SectorVisAtt->SetVisibility(true);
115 
116  G4double silPos_x=0;
117  //G4double silPos_y=chamberSizeY/2-10*mm;
118  G4double silPos_y=0;
119  G4double silPos_z=0*mm;
120 
121  G4double distance[3]={300*mm,530*mm,1070*mm}; //For 10Li experiment
122 
123  //G4double distance[3]={550*mm,0*mm,0*mm}; //For 16C experiment Only one ring detector
124 
125  for(G4int k=0;k<3;k++){
126  silPos_z=distance[k]+chamberSizeZ-zGasBoxPosition;
127 
128  G4VPhysicalVolume *SiliconDisk_phys=new G4PVPlacement(0,
129  G4ThreeVector(silPos_x,silPos_y,silPos_z),
130  SiliconDisk_log,"SiliconDisk",worldLog,false,k);
131 
132  if(SiliconDisk_phys){;}
133  }
134  Sector_log->SetVisAttributes(SectorVisAtt);
135 
136  G4VPhysicalVolume *Sector_phys=new G4PVReplica("Sectors",Sector_log,SiliconDisk_log,kPhi,16,sectorPhi);
137 
138  //------------------------------------------------
139  // Sensitive detectors
140  //------------------------------------------------
141  Sector_log->SetSensitiveDetector( detConstruction->GetSilRingSD() );
142 
143  //------------------------------------------------------------------
144  // Visualization attributes
145  //------------------------------------------------------------------
146  G4VisAttributes* silVisAtt1 = new G4VisAttributes(G4Colour(0,1,0));
147  silVisAtt1->SetVisibility(true);
148  Sector_log->SetVisAttributes(silVisAtt1);
149 
150  return Sector_phys;
151 }
152 
153 //////////////////////////////////////////////////////////////////
154 /// Set the material the scintillator bulk is made of
156  G4Material* pttoMaterial = G4Material::GetMaterial(mat);
157  if (pttoMaterial) silBulkMaterial = pttoMaterial;
158 }
159 
160 //////////////////////////////////////////////////////////////////
161 /// Updates Scintillator detector
164  G4RunManager::GetRunManager()->
165  DefineWorldVolume(detConstruction->GetWorldPhysicalVolume());
166 }
167 
168 //////////////////////////////////////////////////////////////////
169 /// Prints Scintillator detector parameters. To be filled
171  G4cout << "##################################################################"
172  << G4endl
173  << "#### ActarSimSilRingDetectorConstruction::PrintDetectorParameters() ####"
174  << G4endl;
175  G4cout << "##################################################################"
176  << G4endl;
177 }
ActarSimSilRingDetectorConstruction(ActarSimDetectorConstruction *)
Constructor. Sets the material and the pointer to the Messenger.
G4VPhysicalVolume * Construct(G4LogicalVolume *)
Wrap for the construction functions.
void UpdateGeometry()
Updates Scintillator detector.
ActarSimDetectorConstruction * detConstruction
Pointer to the global detector.
ActarSimGasDetectorConstruction * GetGasDetector()
void PrintDetectorParameters()
Prints Scintillator detector parameters. To be filled.
G4VPhysicalVolume * ConstructSil(G4LogicalVolume *)
Real construction work is performed here.
void SetSilBulkMaterial(G4String)
Set the material the scintillator bulk is made of.
G4Material * silBulkMaterial
Pointer to the silicon material.