CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
KalFitReadGdml.cxx
Go to the documentation of this file.
1#include "G4Geo/MdcG4Geo.h"
2#include "G4Geo/BesG4Geo.h"
3#include "G4Geo/CgemG4Geo.h"
6#include "G4Material.hh"
7#include "G4Tubs.hh"
8#include "GDMLProcessor.hh"
9#include "G4NistManager.hh"
10#include "math.h"
11
13 // --- gas Volumes
14 int nGas=2;
15 TString gasVolumes[3]={"logicalMdc", "logicalWorld", "Cgem_logic"};
16 if(useNCGem_>0) nGas=2;
17
18 // --- inner DC
19 int nIDC=3;
20 TString IDCVolumes[3]={"LogicalMdcInnerFilm1", "logicalMdcSegment2", "LogicalMdcInnerFilm0"};
21 if(useNCGem_>0) nIDC=0;
22
23 // --- CGEM-IT
24 int nCgemVolumes=114;
25 TString CgemVolumes[114]={
26 "Separator_logic_Al2", "Separator_logic_CarFib", "Separator_logic_Al1", // 3
27
28 "Anode_Cu4_logic2", "Anode_Kapton6_logic2", "Anode_Kapton5_logic2", "Anode_Cu3_logic2", "Anode_Epoxy5_logic2", "Anode_Carbonf2_logic2", "Anode_Epoxy4_logic2", "Anode_Honeycomb_logic2",
29 "Anode_Epoxy3_logic2", "Anode_Kapton3_logic2", "Anode_Epoxy2_logic2", "Anode_Kapton2_logic2", "Anode_Epoxy1_logic2", "Anode_Cu2_logic2", "Anode_Kapton1_logic2", "Anode_Cu1_logic2", //16
30 "Gap_I_logic2",
31 "GemFoil_Cu2_logic2foil2", "GemFoil_Kapton_logic2foil2", "GemFoil_Cu1_logic2foil2",
32 "Gap_T2_logic2",
33 "GemFoil_Cu2_logic2foil1", "GemFoil_Kapton_logic2foil1", "GemFoil_Cu1_logic2foil1",
34 "Gap_T1_logic2",
35 "GemFoil_Cu2_logic2foil0", "GemFoil_Kapton_logic2foil0", "GemFoil_Cu1_logic2foil0",
36 "Gap_D_logic2",//13
37 "Cathode_Cu2_logic2", "Cathode_Kapton3_logic2", "Cathode_Epoxy3_logic2", "Cathode_Kapton2_logic2", "Cathode_Epoxy2_logic2", "Cathode_Honeycomb_logic2", "Cathode_Epoxy1_logic2", "Cathode_Carbonf_logic2", "Cathode_Epoxy0_logic2",//9
38
39 "Anode_Kapton5_logic1", "Anode_Cu3_logic1", "Anode_Epoxy5_logic1", "Anode_Rohacell2_logic1", "Anode_Epoxy4_logic1", "Anode_Kapton4_logic1", "Anode_Epoxy3_logic1",
40 "Anode_Rohacell1_logic1", "Anode_Epoxy2_logic1", "Anode_Kapton2_logic1", "Anode_Epoxy1_logic1", "Anode_Cu2_logic1", "Anode_Kapton1_logic1", "Anode_Cu1_logic1",//14
41 "Gap_I_logic1",
42 "GemFoil_Cu2_logic1foil2", "GemFoil_Kapton_logic1foil2", "GemFoil_Cu1_logic1foil2",
43 "Gap_T2_logic1",
44 "GemFoil_Cu2_logic1foil1", "GemFoil_Kapton_logic1foil1", "GemFoil_Cu1_logic1foil1",
45 "Gap_T1_logic1",
46 "GemFoil_Cu2_logic1foil0", "GemFoil_Kapton_logic1foil0", "GemFoil_Cu1_logic1foil0",
47 "Gap_D_logic1",//13
48 "Cathode_Cu2_logic1", "Cathode_Kapton3_logic1", "Cathode_Epoxy4_logic1", "Cathode_Rohacell2_logic1", "Cathode_Epoxy3_logic1", "Cathode_Kapton2_logic1", "Cathode_Epoxy2_logic1", "Cathode_Rohacell1_logic1", "Cathode_Epoxy1_logic1", "Cathode_Kapton1_logic1",//10
49
50 "Anode_Kapton5_logic0", "Anode_Cu3_logic0", "Anode_Epoxy5_logic0", "Anode_Carbonf2_logic0", "Anode_Epoxy4_logic0", "Anode_Honeycomb_logic0", "Anode_Epoxy3_logic0", "Anode_Carbonf1_logic0",
51 "Anode_Epoxy2_logic0", "Anode_Kapton2_logic0", "Anode_Epoxy1_logic0", "Anode_Cu2_logic0", "Anode_Kapton1_logic0", "Anode_Cu1_logic0",//14
52 "Gap_I_logic0",
53 "GemFoil_Cu2_logic0foil2", "GemFoil_Kapton_logic0foil2", "GemFoil_Cu1_logic0foil2",
54 "Gap_T2_logic0",
55 "GemFoil_Cu2_logic0foil1", "GemFoil_Kapton_logic0foil1", "GemFoil_Cu1_logic0foil1",
56 "Gap_T1_logic0",
57 "GemFoil_Cu2_logic0foil0", "GemFoil_Kapton_logic0foil0", "GemFoil_Cu1_logic0foil0",
58 "Gap_D_logic0",//13
59 "Cathode_Cu2_logic0", "Cathode_Kapton3_logic0", "Cathode_Epoxy3_logic0", "Cathode_Kapton2_logic0", "Cathode_Epoxy2_logic0", "Cathode_Honeycomb_logic0", "Cathode_Epoxy1_logic0", "Cathode_Kapton1_logic0", "Cathode_Cu1_logic0"//9
60 };
61 if(useNCGem_==0) nCgemVolumes=0;
62
63 // --- beam pipe
64 int nPipeV=4;
65 TString beamPipeVolumes[4]={"logicalouterBe", "logicaloilLayer", "logicalinnerBe", "logicalgoldLayer"};
66
67 // --- volumes to construct
68 TString volumes[124];
69 int iV=0; int nV=nGas+nIDC+nCgemVolumes+nPipeV;
70 cout<<"KalFitAlg needs to prepare "<<nV<<" volumes"<<endl;
71 for(int i=0; i<nGas; i++, iV++) volumes[iV]=gasVolumes[i];
72 for(int i=0; i<nIDC; i++, iV++) volumes[iV]=IDCVolumes[i];
73 for(int i=0; i<nCgemVolumes; i++, iV++) volumes[iV]=CgemVolumes[i];
74 for(int i=0; i<nPipeV; i++, iV++) volumes[iV]=beamPipeVolumes[i];
75
76 // --- G4 from gdml
77 MdcG4Geo* aMdcG4Geo = new MdcG4Geo();
78 if(useNCGem_>0) CgemG4Geo* aCgemG4Geo = new CgemG4Geo();
79 BesG4Geo* aBesG4Geo = new BesG4Geo();
80
81 // --- fill materials
82 double Z(0.),A(0.),Ionization(0.),Density(0.),Radlen(0.);
83 for(iV=0; iV<nV; iV++)// fill materials
84 {
85 G4LogicalVolume* logicVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(volumes[iV]));
86 G4Material* material = logicVolume->GetMaterial();
87 Z = 0.;
88 A = 0.;
89 for(int i=0; i<material->GetElementVector()->size(); i++){
90 Z += (material->GetElement(i)->GetZ())*
91 (material->GetFractionVector()[i]);
92 A += (material->GetElement(i)->GetA())*
93 (material->GetFractionVector()[i]);
94 }
95 Ionization = material->GetIonisation()->GetMeanExcitationEnergy();
96 Density = material->GetDensity()/(g/cm3);
97 Radlen = material->GetRadlen();
98 if(iV==0) KalFitTrack::mdcGasRadlen_ = Radlen/10.;
99 KalFitMaterial kalFitMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
100 _BesKalmanFitMaterials.push_back(kalFitMaterial);
101 cout<<volumes[iV]<<": Z: "<<Z<<", A: "<<(A/(g/mole))<<", Ionization: "<<(Ionization/eV)<<", Density: "<<Density<<", Radlen: "<<Radlen<<", as material "<<_BesKalmanFitMaterials.size()<<endl;
102 }
103
104 // --- fill cylinders
105 double lastRmin=-100;
106 double radius, Rmax, thick, length , z0;
107 for(iV=nGas; iV<nV; iV++)// fill cylinders
108 {
109 G4LogicalVolume* logicVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(volumes[iV]));
110
111 G4Tubs* tub = dynamic_cast<G4Tubs*>(logicVolume->GetSolid());
112 radius = tub->GetInnerRadius()/(cm);
113 Rmax = tub->GetOuterRadius()/(cm);
114 thick = tub->GetOuterRadius()/(cm) - tub->GetInnerRadius()/(cm);
115 length = 2.0*tub->GetZHalfLength()/(cm);
116 z0 = 0.0;
117 if(iV>nGas&&lastRmin!=Rmax) {
118 cout<<" lastRmin!=Rmax from "<<volumes[iV-1]<<" to "<<volumes[iV]<<std::endl;
119 if(lastRmin-Rmax>0.0001) // 1 micon
120 {
121 KalFitCylinder aCylinder(&_BesKalmanFitMaterials[1], Rmax, lastRmin-Rmax, length , z0);
122 _BesKalmanFitWalls.push_back(aCylinder);
123 cout<<" add a cylinder with "<<lastRmin-Rmax<<" cm air"<<endl;
124 }
125 }
126 KalFitCylinder aCylinder(&_BesKalmanFitMaterials[iV], radius, thick, length , z0);
127 _BesKalmanFitWalls.push_back(aCylinder);
128 std::cout<<volumes[iV]<<": "<<"radius outer to inner: "<<radius+thick<<" "<<radius<<", length: "<<length<<std::endl;
129 cout<<" wall "<<_BesKalmanFitWalls.size()<<" Z: "<<_BesKalmanFitMaterials[iV].Z()<<endl;
130 lastRmin=radius;
131 }
132
133}//end of setBesFromGdml
double length
void setBesFromGdml(void)
Cylinder is an Element whose shape is a cylinder.
static double mdcGasRadlen_