EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tpc.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file tpc.C
1 
2 // Meaningless number for now; fine;
3 #define _VERSION_ 1
4 #define _SUBVERSION_ 0
5 
6 // Do not want to always overwrite "official" files; place "test" tag into the file name;
7 #define _TEST_VERSION_
8 
9 // No real structure for now, clear;
10 #define _NO_STRUCTURE_GEOMETRY_
11 
12 // Give up something like 1" extra on both inner and outer radial size;
13 // so effectively the radial thickness of the sensitive volume will be
14 // 2x25.0mm less than Rmax-Rmin value; for now assume I can just declare
15 // a smaller tube volume and let "world air" fill the radial gap;
16 // FIXME: eventually put this into the parameter list;
17 #define _GAS_VOLUME_RADIAL_GAP_ 25.0
18 // Just for a better visibility?;
19 //#define _GAS_VOLUME_LINEAR_GAP_ 5.0
20 
21 tpc()
22 {
23  //TString filename = "tpc.root";
24 
25  // Load basic libraries;
26  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
27 
28  //
29  // Prefer to think in [mm] and convert to [cm] when calling ROOT shape
30  // definition routines only;
31  //
32 
34 
35  // No offset per default;
36  //tpc->SetTopVolumeTransformation(new TGeoTranslation(0.0, 0.0, 0.0));
37 
38 #ifdef _NO_STRUCTURE_GEOMETRY_
40 #endif
41 #ifdef _TEST_VERSION_
42  tpc->SetTestGeometryFlag();
43 #endif
44 
45  //
46  // Declare basic parameters;
47  //
48 
49  // NB: these are the GAS VOLUME dimensions;
50  tpc->mInnerGasVolumeRadius = 200.0;
51  tpc->mOuterGasVolumeRadius = 800.0;
52  tpc->mTotalGasVolumeLength = 1960.0;
53 
54  // Shielding will be simulated as 50um alu on 150um effective single capton
55  // layers; the rest will be taken as lower-than-diamond density
56  // (1.76g/cm^3, see media.geo) carbon fiber layer in order to match
57  // overall rad.length values of ~1.2% for IFC and ~4.0% for OFC (just tune
58  // via macro/rad_length.C media scan by hand);
59  tpc->mKaptonBarrelThickness = 0.150;
60  tpc->mAluBarrelThickness = 0.050;
61  tpc->mIfcCarbonFiberThickness = 2.620;
62  tpc->mOfcCarbonFiberThickness = 9.280;
63 
64  // Central membrane; let it be 100um thick kapton;
65  tpc->mCentralMembraneThickness = 0.100;
66 
67  // Will be simulated as aluminum disks matching 15% rad.length;
68  tpc->mAluEndcapThickness = 13.4;
69 
70  tpc->AddLogicalVolumeGroup(0, 0, 2);
71 
72  // Field cage layers will have this length;
73  double barrelLayerLength = tpc->mTotalGasVolumeLength + tpc->mCentralMembraneThickness;
74 
75  // Mapping table: just two independent gas volumes;
76  EicGeoMap *fgmap = tpc->CreateNewMap();
77  fgmap->AddGeantVolumeLevel("TpcGas", 2);
78  fgmap->SetSingleSensorContainerVolume("TpcGas");
79 
80  tpc->AddStepEnforcedVolume("TpcGas");
81 
82  //
83  // Well, consider to put ALL volumes independently (so they will appear on the same
84  // level in the geometry tree;
85  //
86 
87  // A pair of gas volumes (upstream and downstream);
88  {
89  // Yes, ~2m is a full length -> divide by 2 here to get one-half full length;
90  double singleHalfLength = tpc->mTotalGasVolumeLength/2;
91 
92  TGeoTube *gas = new TGeoTube("TpcGas",
95  0.1 * singleHalfLength/2);
96  //0.1 * (singleHalfLength/2 - _GAS_VOLUME_LINEAR_GAP_));
97  TGeoVolume *vgas = new TGeoVolume("TpcGas", gas, tpc->GetMedium("ArCF4iC4H10"));
98 
99  for(unsigned ud=0; ud<2; ud++) {
100  // Insert mapping table entry; a trivial one, indeed;
101  UInt_t geant[1] = {ud}, logical[3] = {0, 0, ud};
102  if (tpc->SetMappingTableEntry(fgmap, geant, 0, logical)) {
103  cout << "Failed to set mapping table entry!" << endl;
104  exit(0);
105  } //if
106 
107  double zOffset = (ud ? -1.0 : 1.0)*(tpc->mCentralMembraneThickness + singleHalfLength)/2;
108 
109  // Yes, prefer to rotate right here -> local coordinates will point towards
110  // the registering pads for both upstream and downstream halves;
111  {
112  TGeoRotation *rw = new TGeoRotation();
113 
114  if (ud) rw->RotateY(180);
115 
116  tpc->GetTopVolume()->AddNode(vgas, ud, new TGeoCombiTrans(0.0, 0.0, 0.1 * zOffset, rw));
117  }
118  } //for up
119  }
120 
121  // Inner field cage layers;
122  {
123  double radialOffset = tpc->mInnerGasVolumeRadius;
124 
125  //#if _TODAY_
126  // Carbon fiber barrel;
127  {
128  TGeoTube *ifcC = new TGeoTube("TpcIfcCarbon",
129  0.1 * (radialOffset - tpc->mIfcCarbonFiberThickness),
130  0.1 * radialOffset,
131  0.1 * barrelLayerLength/2);
132  TGeoVolume *vifcC = new TGeoVolume("TpcIfcCarbon", ifcC, tpc->GetMedium("CarbonFiber"));
133 
134  tpc->GetTopVolume()->AddNode(vifcC, 0, new TGeoCombiTrans(0.0, 0.0, 0.0, 0));
135 
136  radialOffset -= tpc->mIfcCarbonFiberThickness;
137  }
138 
139  //#if _TODAY_
140  // Kapton layer;
141  {
142  TGeoTube *ifcK = new TGeoTube("TpcIfcKapton",
143  0.1 * (radialOffset - tpc->mKaptonBarrelThickness),
144  0.1 * radialOffset,
145  0.1 * barrelLayerLength/2);
146  TGeoVolume *vifcK = new TGeoVolume("TpcIfcKapton", ifcK, tpc->GetMedium("kapton"));
147 
148  tpc->GetTopVolume()->AddNode(vifcK, 0, new TGeoCombiTrans(0.0, 0.0, 0.0, 0));
149 
150  radialOffset -= tpc->mKaptonBarrelThickness;
151  }
152  //#endif
153 
154  // Alu layer;
155  {
156  TGeoTube *ifcA = new TGeoTube("TpcIfcAlu",
157  0.1 * (radialOffset - tpc->mAluBarrelThickness),
158  0.1 * radialOffset,
159  0.1 * barrelLayerLength/2);
160  TGeoVolume *vifcA = new TGeoVolume("TpcIfcAlu", ifcA, tpc->GetMedium("aluminum"));
161 
162  tpc->GetTopVolume()->AddNode(vifcA, 0, new TGeoCombiTrans(0.0, 0.0, 0.0, 0));
163  }
164  }
165 
166 #if 1
167  // Outer field cage layers;
168  {
169  double radialOffset = tpc->mOuterGasVolumeRadius;
170 
171  // Carbon fiber barrel;
172  {
173  TGeoTube *ofcC = new TGeoTube("TpcOfcCarbon",
174  0.1 * radialOffset,
175  0.1 * (radialOffset + tpc->mOfcCarbonFiberThickness),
176  0.1 * barrelLayerLength/2);
177  TGeoVolume *vofcC = new TGeoVolume("TpcOfcCarbon", ofcC, tpc->GetMedium("CarbonFiber"));
178 
179  tpc->GetTopVolume()->AddNode(vofcC, 0, new TGeoCombiTrans(0.0, 0.0, 0.0, 0));
180 
181  radialOffset += tpc->mOfcCarbonFiberThickness;
182  }
183 
184  // Kapton layer;
185  {
186  TGeoTube *ofcK = new TGeoTube("TpcOfcKapton",
187  0.1 * radialOffset,
188  0.1 * (radialOffset + tpc->mKaptonBarrelThickness),
189  0.1 * barrelLayerLength/2);
190  TGeoVolume *vofcK = new TGeoVolume("TpcOfcKapton", ofcK, tpc->GetMedium("kapton"));
191 
192  tpc->GetTopVolume()->AddNode(vofcK, 0, new TGeoCombiTrans(0.0, 0.0, 0.0, 0));
193 
194  radialOffset += tpc->mKaptonBarrelThickness;
195  }
196 
197  // Alu layer;
198  {
199  TGeoTube *ofcA = new TGeoTube("TpcOfcAlu",
200  0.1 * radialOffset,
201  0.1 * (radialOffset + tpc->mAluBarrelThickness),
202  0.1 * barrelLayerLength/2);
203  TGeoVolume *vofcA = new TGeoVolume("TpcOfcAlu", ofcA, tpc->GetMedium("aluminum"));
204 
205  tpc->GetTopVolume()->AddNode(vofcA, 0, new TGeoCombiTrans(0.0, 0.0, 0.0, 0));
206  }
207  }
208 
209  // Central membrane; do not account _GAS_VOLUME_RADIAL_GAP_ here?;
210  {
211  TGeoTube *CM = new TGeoTube("TpcCentralMembrane",
212  0.1 * tpc->mInnerGasVolumeRadius,
213  0.1 * tpc->mOuterGasVolumeRadius,
214  0.1 * tpc->mCentralMembraneThickness/2);
215  TGeoVolume *vCM = new TGeoVolume("TpcCentralMembrane", CM, tpc->GetMedium("kapton"));
216 
217  tpc->GetTopVolume()->AddNode(vCM, 0, new TGeoCombiTrans(0.0, 0.0, 0.0, 0));
218  }
219 
220  // Alu endcaps;
221  {
222  TGeoTube *ecap = new TGeoTube("TpcEndcap",
223  0.1 * (tpc->mInnerGasVolumeRadius -
224  (tpc->mKaptonBarrelThickness +
225  tpc->mAluBarrelThickness +
227  0.1 * (tpc->mOuterGasVolumeRadius +
228  (tpc->mKaptonBarrelThickness +
229  tpc->mAluBarrelThickness +
231  0.1 * tpc->mAluEndcapThickness/2);
232  TGeoVolume *vecap = new TGeoVolume("TpcEndcap", ecap, tpc->GetMedium("aluminum"));
233 
234  for(unsigned ud=0; ud<2; ud++) {
235  double zOffset = (ud ? -1.0 : 1.0)*(barrelLayerLength + tpc->mAluEndcapThickness)/2;
236 
237  tpc->GetTopVolume()->AddNode(vecap, ud, new TGeoCombiTrans(0.0, 0.0, 0.1 * zOffset, 0));
238  } //for ud
239  }
240 #endif
241 
242  tpc->AttachSourceFile("./tpc.C");
243 
244  // Want to see gas volume only; let it also be a bit transparent?;
245  tpc->GetColorTable()->AddPrefixMatch("TpcGas", kCyan);
246  tpc->GetTransparencyTable()->AddPrefixMatch("TpcGas", 30);
247  //-tpc->GetTransparencyTable()->AddPrefixMatch("TpcGas", 70);
248  //-tpc->GetColorTable()->AddPrefixMatch("TpcIfc", kGray+2);
249  //-tpc->GetColorTable()->AddPrefixMatch("TpcOfc", kGray+2);
250  //-tpc->GetColorTable()->AddPrefixMatch("TpcEndcap", kGray+2);
251 
252  // And put this stuff as a whole into the top volume;
253  tpc->FinalizeOutput();
254 
255  // Yes, always exit;
256  exit(0);
257 }
258