EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rp.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file rp.C
1 
2 void rp()
3 {
4  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
5 
6  EicGeoParData *rp = new EicGeoParData("RP", 0, 0);
7  rp->SetFileName("rp.root");
8 
9  UInt_t waferNum = 2;
10  Double_t waferThickness = 0.3;
11  // Just very large rectangular pieces of silicon;
12  Double_t waferWidth = 1200.0;
13  Double_t waferHeight = 500.0;
14  Double_t waferSpacing = 200.0;
15  // Move roughly to the beam line axis;
16  Double_t beamLineOffsetX = 815.0;
17  //+Double_t beamLineOffsetZ = 28200.0;
18  Double_t beamLineOffsetZ = 28100.0;
19  //Double_t nominal_proton_direction = 0.022;
20 
21  // Silicon wafer;
22  TGeoBBox *wafer = new TGeoBBox("RpSiliconWafer",
23  0.1 * waferWidth/2,
24  0.1 * waferHeight/2,
25  0.1 * waferThickness/2);
26  TGeoVolume *vwafer = new TGeoVolume("RpSiliconWafer", wafer, rp->GetMedium("silicon"));
27 
28  EicGeoMap *fgmap = rp->CreateNewMap();
29  fgmap->AddGeantVolumeLevel("RpSiliconWafer", waferNum);
30  fgmap->SetSingleSensorContainerVolume("RpSiliconWafer");
31 
32  rp->AddLogicalVolumeGroup(0, 0, waferNum);
33 
34  // And place all wafers into the container volume;
35  for(unsigned wf=0; wf<waferNum; wf++)
36  {
37  double offset = 0.1 * (wf - (waferNum-1)/2.)*waferSpacing;
38 
39  UInt_t geant[1] = {wf}, group = 0, logical[3] = {0, 0, wf};
40 
41  if (rp->SetMappingTableEntry(fgmap, geant, group, logical)) {
42  cout << "Failed to set mapping table entry!" << endl;
43  exit(0);
44  } //if
45 
46  rp->GetTopVolume()->AddNode(vwafer, wf, new TGeoCombiTrans(0.1 * beamLineOffsetX, 0.0, offset + 0.1 * beamLineOffsetZ, 0));
47  } // for wf
48 
49  rp->GetColorTable()->AddPatternMatch ("Silicon", kYellow);
50  rp->GetTransparencyTable()->AddPatternMatch("Silicon", 50);
51 
52  rp->FinalizeOutput();
53 
54  exit(0);
55 } // rp()
56