EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
example.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file example.C
1 {
2  auto eic = new EicToyModel();
3 
4  // Shift IP if needed; define canvas width; request eta=0 line in the drawing; set name;
5  eic->ip(-50.0)->width(1500)->AddEtaLine(0.0)->SetName("example");
6  // Define acceptance ranges and the vacuum chamber design;
7  eic->acceptance(-4.2, -1.0, 1.2, 4.2);
8  eic->DefineVacuumChamber(new vc2020_03_20());
9 
10  // Vertex tracker;
11  {
12  // BUG: G4 event display does not work well for <3.2cm;
13  auto vtx = eic->vtx(); vtx->offset( 3.2 * etm::cm);
14 
15  vtx->add("Si Tracker",17 * etm::cm);
16  }
17 
18  // Barrel;
19  {
20  auto mid = eic->mid(); mid->offset( 20 * etm::cm);
21 
22  mid->add("TPC", 60 * etm::cm);
23  mid->add("Cherenkov", 25 * etm::cm)->brick();
24  mid->add("MPGD", 5 * etm::cm)->brick();
25  mid->add("TOF", 5 * etm::cm)->brick();
26  mid->add("Preshower", 5 * etm::cm)->brick();
27  mid->add("EmCal", 30 * etm::cm);
28  mid->add("Cryostat", 40 * etm::cm);
29  mid->add("HCal", 120 * etm::cm);
30  }
31 
32  // Hadron-going endcap;
33  {
34  auto fwd = eic->fwd(); fwd->offset(150 * etm::cm);
35 
36  for(unsigned nn=0; nn<3; nn++)
37  fwd->add("MPGD", 5 * etm::cm)->brick();
38  fwd->marker();
39  fwd->add("HM RICH", 120 * etm::cm)->trim(0.8, 1.0);
40  for(unsigned nn=0; nn<3; nn++)
41  fwd->add("TRD", 15 * etm::cm)->brick();
42  fwd->add("TOF", 5 * etm::cm);
43  fwd->add("Preshower", 5 * etm::cm);
44  fwd->add("EmCal", 35 * etm::cm);
45  fwd->add("HCal", 105 * etm::cm);
46  }
47 
48  // Electron-going endcap;
49  {
50  auto bck = eic->bck(); bck->offset(120 * etm::cm);
51 
52  for(unsigned nn=0; nn<3; nn++)
53  bck->add("MPGD", 5 * etm::cm)->brick();
54 
55  for(unsigned nn=0; nn<3; nn++)
56  bck->add("TRD", 15 * etm::cm)->brick();
57  bck->marker();
58  bck->add("TOF", 5 * etm::cm);
59  bck->add("Cherenkov", 25 * etm::cm);
60  bck->add("Preshower", 5 * etm::cm);
61  bck->add("EmCal", 35 * etm::cm);
62  bck->add("HCal", 105 * etm::cm);
63  }
64 
65  // Declare eta boundary configuration;
66  {
67  eic->vtx()->get("Si Tracker")->stretch(eic->bck()->get("TOF"));
68  eic->vtx()->get("Si Tracker")->stretch(eic->fwd()->get("HM RICH"));
69 
70  eic->mid()->get("TPC") ->stretch(eic->bck()->get("MPGD"));
71  eic->mid()->get("TPC") ->stretch(eic->fwd()->get("MPGD"));
72 
73  eic->mid()->get("HCal") ->stretch(eic->bck()->get("HCal"), 50 * etm::cm);
74  eic->mid()->get("HCal") ->stretch(eic->fwd()->get("HCal"), 50 * etm::cm);
75  }
76 
77  // Beautify picture a little bit;
78  eic->ApplyStandardTrimming();
79  // Request flat field regions to be drawn in the endcaps;
80  eic->DrawFlatFieldLines(-3.0)->DrawFlatFieldLines(3.0);
81 
82  // Draw horizontal cross cut view;
83  eic->hdraw();
84 
85  // Prefer to save the original configuration, no matter user calls write()
86  // afterwards or not;
87  eic->write();
88  //eic->ExportVacuumChamber();
89 }