EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tracker.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file tracker.C
1 
2 //
3 // Example tracker: 5x XY GEM stations, 0.86% rad.length each (use carbon of appropriate
4 // thickness); output file (FwdGT.root) can be used as geometry input for
5 // simulation.C->digitization.C->reconstruction.C scripts in this directory;
6 // resolutions are specified at a later stage (see digitization.C);
7 //
8 // Prefer to declare dimensions in [mm]; convert to [cm] when calling ROOT shape
9 // definition routines only;
10 //
11 
12 // 5 GEM XY-stations at predefined locations;
13 #define _GNUM_ 5
14 
15 void tracker()
16 {
17  // Load basic libraries;
18  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
19 
20  // Detector name will be "FwdGT" (Forward GEM Tracker); should be consistent through
21  // all the simulation.C->digitization.C->reconstruction.C chain; see calorimetry/calorimeter.C
22  // for the rationale behind using EicGeoParDataHelper wrapper class;
23  //EicGeoParDataHelper *helper = new EicGeoParDataHelper(NULL, "FwdGT", "FwdGT.root");
24  EicGeoParData *fwdgt = new EicGeoParData("FwdGT", 0, 0);
25  fwdgt->SetFileName("fwdgt.root");
26 
27  // 5 XY-planes at predefined locations;
28  Double_t zGem[_GNUM_] = {170., 600., 1500., 2000., 3000.};
29  Double_t rMax = 500.0;
30 
31  // GEM module thickness and RICH entrance window thickness (use carbon layers);
32  Double_t carbonX0 = 188.0;
33  Double_t gemThickness = 0.86 * carbonX0 / 100.0;
34  // Assume 1% rad.length (HERMES ~1.0% alu, LHC-B ~1.4% carbon fiber);
35  Double_t wndThickness = 1.00 * carbonX0 / 100.0;
36  Double_t wndLocation = 2005.0;
37  Double_t cf4Thickness = 980.0;
38  Double_t cf4Location = 2500.0;
39 
40  // Give it +/-5mm on all sides; use 5-th GEM as a reference; fix later;
41  Double_t holderVolumeLength = 2.*zGem[_GNUM_-1] + 10.0;
42  Double_t holderVolumeRadius = rMax + 5.0;
43  //cout << holderVolumeLength << " " << holderVolumeRadius << endl; exit(0);
44 
45  // Create a "holder" volume;
46  TGeoTube *holder = new TGeoTube("holderVolume",
47  0.1 * 0.0,
48  0.1 * holderVolumeRadius,
49  0.1 * holderVolumeLength/2);
50  TGeoVolume *vholder = new TGeoVolume("holderVolume", holder, fwdgt->GetMedium("air"));
51 
52  // RICH entrance window;
53  TGeoTube *wnd = new TGeoTube("richWnd",
54  0.1 * 0.0,
55  0.1 * rMax,
56  0.1 * wndThickness/2);
57  TGeoVolume *vwnd = new TGeoVolume("richWnd", wnd, fwdgt->GetMedium("carbon"));
58  vholder->AddNode(vwnd, 0, new TGeoCombiTrans(0.0, 0.0, 0.1 * wndLocation, new TGeoRotation()));
59 
60  // RICH gas volume;
61  TGeoTube *cf4 = new TGeoTube("richVolume",
62  0.1 * 0.0,
63  0.1 * rMax,
64  0.1 * cf4Thickness/2);
65  TGeoVolume *vcf4 = new TGeoVolume("richVolume", cf4, fwdgt->GetMedium("CF4"));
66  vholder->AddNode(vcf4, 0, new TGeoCombiTrans(0.0, 0.0, 0.1 * cf4Location, new TGeoRotation()));
67 
68  TGeoTube *gem = new TGeoTube("gemVolume",
69  0.1 * 0.0,
70  0.1 * rMax,
71  0.1 * gemThickness/2);
72  TGeoVolume *vgem = new TGeoVolume("gemVolume", gem, fwdgt->GetMedium("carbon"));
73 
74  EicGeoMap *fgmap = fwdgt->CreateNewMap();
75  fgmap->AddGeantVolumeLevel("gemVolume", _GNUM_);
76  fgmap->SetSingleSensorContainerVolume("gemVolume");
77  fwdgt->AddLogicalVolumeGroup(0, 0, _GNUM_);
78 
79  // Silicon "plates"; just place them one by one;
80  for(unsigned gm=0; gm<_GNUM_; gm++) {
81  UInt_t geant[1] = {gm}, group = 0, logical[3] = {0, 0, gm};
82 
83  if (fwdgt->SetMappingTableEntry(fgmap, geant, group, logical)) {
84  cout << "Failed to set mapping table entry!" << endl;
85  exit(0);
86  } //if
87 
88  vholder->AddNode(vgem, gm, new TGeoCombiTrans(0.0, 0.0, 0.1 * zGem[gm], new TGeoRotation()));
89  } //for gm
90 
91  // Place holder volume;
92  fwdgt->GetTopVolume()->AddNode(vholder, 0, new TGeoCombiTrans(0.0, 0.0, 0.0, new TGeoRotation()));
93 
94  fwdgt->GetColorTable()->AddPatternMatch ("gemVolume", kOrange);
95  fwdgt->GetTransparencyTable()->AddPatternMatch("gemVolume", 50);
96 
97  fwdgt->GetColorTable()->AddPatternMatch ("richWnd", kMagenta);
98  fwdgt->GetTransparencyTable()->AddPatternMatch("richWnd", 50);
99 
100  fwdgt->FinalizeOutput();
101  exit(0);
102 } // tracker()
103