EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
romanPot_v2.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file romanPot_v2.C
1 //
2 // Implementation of a roman pot detector
3 //
4 // Written by R. Petti (09-29-2014)
5 //
6 
7 
9 {
10  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
11 
12  // create a geometry object
13  EicGeoParData *romanpot = new EicGeoParData("FWDST", 0, 0); // for some reason the expected name is FWDST, so put that here
14 
15  // set some basic parameteres and wafer sizes/absolute position
16  UInt_t waferNum = 1;
17  Double_t waferThickness = 0.2;
18  Double_t waferWidth = 2500.0;
19  Double_t waferSpacing = 100.0;
20  Double_t beamLineOffset = 18000.0;
21 
22  Double_t containerVolumeLength = (waferNum-1)*waferSpacing + waferThickness + 10.0;
23  Double_t containerVolumeWidth = waferWidth + 10.0;
24 
25 
26  // create the container volume
27  TGeoBBox *container = new TGeoBBox("ContainerVolume",0.1*containerVolumeWidth/2., 0.1*containerVolumeWidth/2., 0.1*containerVolumeLength/2.);
28  // probably should fill container volume with vacuum, but leave out for now
29  // this will probably form the vessel in which the sensors reside
30  TGeoVolume *vcontainer = new TGeoVolume("ContainerVolume", container, romanpot->GetMedium("vacuum"));
31 
32  // create the silicon wafers, first the shape, then fill the shape with material
33  TGeoBBox *wafer = new TGeoBBox("SiliconWafer", 0.1*waferWidth/2., 0.1*waferWidth/2., 0.1*waferThickness/2.);
34  TGeoVolume *vwafer = new TGeoVolume("SiliconWafer", wafer, romanpot->GetMedium("silicon"));
35 
36  // create the map for local to global coordinates for analysis later
37 
38  EicGeoMap *fgmap = romanpot->CreateNewMap();
39  fgmap->AddGeantVolumeLevel("SiliconWafer", waferNum);
40  fgmap->SetSingleSensorContainerVolume("SiliconWafer");
41 
42  romanpot->AddLogicalVolumeGroup(0, 0, waferNum);
43 
44  double offset = 0;
45 
46  // place the detector element(s)
47  for(unsigned int wf=0; wf<waferNum; wf++)
48  {
49  //double offset = 0.1*(wf - (waferNum-1)/2.)*waferSpacing;
50 
51  offset = wf*600.;
52 
53  UInt_t geant[1] = {wf}, group = 0, logical[3] = {0, 0, wf};
54 
55  if(romanpot->SetMappingTableEntry(fgmap, geant, group, logical))
56  {
57  cout << "Failed to set mapping table entry!" << endl;
58  exit(0);
59  }
60 
61  cout << offset << endl;
62 
63 
64  romanpot->GetTopVolume()->AddNode(vwafer, wf, new TGeoCombiTrans((0.1*waferWidth/2.+12.47)+1.2, 0.0, offset, new TGeoRotation()));
65  romanpot->GetTopVolume()->AddNode(vwafer, wf, new TGeoCombiTrans(-((0.1*waferWidth/2.-12.47))-1.2, 0.0, offset, new TGeoRotation()));
66 
67 
68  }
69 
70  double displacementInX = 1. + 0.1*waferWidth/2.;
71  // displacementInX = 12.5 - 0.1*waferWidth/2. - 0.1); //12.5 cm is where beam particles hit
72  displacementInX = 0.;
73 
74  TGeoRotation *rotator = new TGeoRotation();
75  //rotator->RotateY(TMath::RadToDeg()*10.e-3);
76 
77  romanpot->SetTopVolumeTransformation(new TGeoCombiTrans(displacementInX, 0.0, 0.1*beamLineOffset, rotator));
78 
79  romanpot->FinalizeOutput();
80 
81  exit(0);
82 }