EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
b0tracker.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file b0tracker.C
1 
2 //
3 // resolutions are specified at a later stage (see digitization.C);
4 //
5 // Prefer to declare dimensions in [mm]; convert to [cm] when calling ROOT shape
6 // definition routines only;
7 //
8 
9 void b0tracker()
10 {
11  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
12 
13  EicGeoParData *b0tracker = new EicGeoParData("B0Tracker", 0, 0);
14  b0tracker->SetFileName("b0tracker.root");
15 
16  UInt_t waferNum = 4;
17  // 300um per layer: should be fine?;
18  Double_t waferThickness = 0.3;
19  Double_t waferWidth = 350.0;
20  Double_t waferHeight = 220.0;
21  // NB: weird things start happening in the reconstruction code if two outer
22  // silicon layer locations match exactly field region boundaries; so, displace a bit;
23  //Double_t waferSpacing = 420.0;
24  // FIXME: for now this should be in sync with B0 length, location &
25  // lambda setting in EicBeamLineElementGrad::GetFieldValue() call;
26  Double_t waferSpacing = (1200.+2*100.)/(waferNum-1);
27  Double_t beamLineOffsetX = 235.0;
28  Double_t beamLineOffsetZ = 5600.0;
29 
30  // Holes in the silicon plates will be done such that they mimic that many [mm]
31  // away from the nominal cone of that many [rad] of the outgoing hadron beam;
32  Double_t beam_pipe_clearance = 10.0;
33  Double_t nominal_proton_cone_size = 0.005;
34  // IR coordinate system is aligned with electron beam; same is true for B0 assembly;
35  // therefore proton beam pipe will be "moving towards +X" with increasing Z;
36  Double_t nominal_proton_direction = 0.0215;
37 
38  // Silicon wafer; use the same at all 4 locations; holes will be made differently
39  // though -> composite shapes and respective volumes will be unique;
40  TGeoBBox *wafer = new TGeoBBox("B0SiliconWafer",
41  0.1 * waferWidth/2,
42  0.1 * waferHeight/2,
43  0.1 * waferThickness/2);
44 
45  for(unsigned wf=0; wf<waferNum; wf++)
46  {
47  char hname[128];
48  sprintf(hname, "B0SiliconHole%02d", wf);
49 
50  double dz = (wf - (waferNum-1)/2.)*waferSpacing, z0 = beamLineOffsetZ + dz;
51 
52  // Calculate hole radius; the further away from the IP the more; there is
53  // no real gain in this complication, could have taken same r0 for all 4 plates;
54  double r0 = z0*tan(nominal_proton_cone_size) + beam_pipe_clearance;
55  TGeoTube *hole = new TGeoTube(hname,
56  0.0,
57  0.1 * r0,
58  0.1 * waferThickness/2 + 0.1);
59 
60  // Calculate hole offset in the local wafer coordinate system;
61  double dx = z0*tan(nominal_proton_direction) - beamLineOffsetX;
62  printf("%f %f\n", r0, dx);
63 
64  char tname[128];
65  sprintf(tname, "combi%02d", wf);
66  TGeoCombiTrans *combi = new TGeoCombiTrans(tname, 0.1 * dx, 0, 0, 0);
67  combi->RegisterYourself();
68 
69  char vname[128], cname[128];
70  sprintf(vname, "B0SiliconPlate%02d", wf);
71  sprintf(cname, "B0SiliconWafer-%s:%s", hname, tname);
72  TGeoCompositeShape *comp = new TGeoCompositeShape(vname, cname);
73 
74  TGeoVolume *vwafer = new TGeoVolume(vname, comp, b0tracker->GetMedium("silicon"));
75 
76  EicGeoMap *fgmap = b0tracker->CreateNewMap();
77  fgmap->AddGeantVolumeLevel(vname, waferNum);
78  fgmap->SetSingleSensorContainerVolume(vname);
79 
80  b0tracker->AddLogicalVolumeGroup(0, 0, 1);//waferNum);
81 
82  {
83  UInt_t geant[1] = {0}, group = wf, logical[3] = {0, 0, 0};
84 
85  if (b0tracker->SetMappingTableEntry(fgmap, geant, group, logical)) {
86  cout << "Failed to set mapping table entry!" << endl;
87  exit(0);
88  } //if
89  }
90 
91  b0tracker->GetTopVolume()->AddNode(vwafer, 0,
92  new TGeoCombiTrans(0.1 * beamLineOffsetX, 0.0, 0.1 * (beamLineOffsetZ + dz), 0));
93  } // for wf
94 
95  b0tracker->GetColorTable()->AddPatternMatch ("Silicon", kYellow);
96  b0tracker->GetTransparencyTable()->AddPatternMatch("Silicon", 50);
97 
98  b0tracker->FinalizeOutput();
99 
100  // Yes, always exit;
101  exit(0);
102 } // b0tracker()
103