EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
zdc.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file zdc.C
1 
2 void zdc()
3 {
4  // Load basic libraries;
5  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
6 
7  EicGeoParData *zdc = new EicGeoParData("ZDC", 0, 0);
8  zdc->SetFileName("zdc.root");
9 
10  // Do not care much about precise description;
11  Double_t zdcWidth = 600.0;
12  Double_t zdcHeight = 600.0;
13  Double_t zdcLength = 1000.0;
14  Double_t beamLineOffset =28800.0;
15  Double_t waferThickness = 0.3;
16 
17 
18  TGeoRotation *rw = new TGeoRotation();
19  double angle = 0.022, dx = 110.0 + 30.0;
20  rw->RotateY(angle * TMath::RadToDeg());
21 
22  TGeoBBox *bzdc = new TGeoBBox("ZdcBox",
23  0.1 * zdcWidth/2,
24  0.1 * zdcHeight/2,
25  0.1 * zdcLength/2);
26  TGeoVolume *vzdc = new TGeoVolume("ZdcBox", bzdc, zdc->GetMedium("iron"));
27  {
28  // NB: it looks like it is ~190mm proton beam line separation; give another 30mm as
29  // a ten signa estimate for now;
30  double xx = beamLineOffset*sin(angle) - dx, zz = beamLineOffset*cos(angle);
31 
32  zdc->GetTopVolume()->AddNode(vzdc, 0, new TGeoCombiTrans(0.1 * xx, 0.0, 0.1 * zz, rw));
33  }
34 
35  // Fake silicon wafer in front of it;
36  TGeoBBox *bwafer = new TGeoBBox("ZdcSiliconWafer",
37  0.1 * zdcWidth/2,
38  0.1 * zdcHeight/2,
39  0.1 * waferThickness/2);
40  TGeoVolume *vwafer = new TGeoVolume("ZdcSiliconWafer", bwafer, zdc->GetMedium("silicon"));
41  {
42  double z0 = beamLineOffset - 530;
43  double xx = z0*sin(angle) - dx, zz = z0*cos(angle);
44 
45  zdc->GetTopVolume()->AddNode(vwafer, 0, new TGeoCombiTrans(0.1 * xx, 0.0, 0.1 * zz, rw));
46  }
47  zdc->AddWantedParticle("ZdcSiliconWafer", 2112);
48  EicGeoMap *fgmap = zdc->CreateNewMap();
49  fgmap->AddGeantVolumeLevel("ZdcSiliconWafer", 1);//waferNum);
50  fgmap->SetSingleSensorContainerVolume("ZdcSiliconWafer");
51 
52  // Easiest option: encode wafer ID along beam axis as Z-index; XY-indices are not needed;
53  // alternatively could define 10 separate groups without XYZ-substructure;
54  zdc->AddLogicalVolumeGroup(0, 0, 1);//waferNum);
55 
56  UInt_t geant[1] = {0}, group = 0, logical[3] = {0, 0, 0};
57 
58  if (zdc->SetMappingTableEntry(fgmap, geant, group, logical)) {
59  cout << "Failed to set mapping table entry!" << endl;
60  exit(0);
61  } //if
62 
63  zdc->GetColorTable()->AddPatternMatch ("ZdcBox", kRed);
64  zdc->GetTransparencyTable()->AddPatternMatch("ZdcBox", 0);
65  zdc->GetColorTable()->AddPatternMatch ("Silicon", kYellow);
66  zdc->GetTransparencyTable()->AddPatternMatch("Silicon", 50);
67 
68  // A unified user call which places assembled detector volume in a proper place in MASTER (top)
69  // coordinate system, puts this MASTER (top) volume into GEANT volume tree, and dumps this tree
70  // together with EicRoot mapping table in one file;
71  zdc->FinalizeOutput();
72 
73  // Yes, always exit;
74  exit(0);
75 } // zdc()
76