EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_GEM_CYL.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_GEM_CYL.C
1 #ifndef MACRO_G4GEMCYL_C
2 #define MACRO_G4GEMCYL_C
3 
4 #include "GlobalVariables.C"
6 #include <g4main/PHG4Reco.h>
7 #include <string>
8 
9 /*
10 macro written by R. Cruz-Torres (reynier@lbl.gov)
11 adapted from the existing plane GEMs in Fun4All
12 */
13 
14 R__LOAD_LIBRARY(libg4detectors.so)
15 // ======================================================================================================================
16 int make_GEM_barrel_section(string name, PHG4Reco *g4Reco, double Rpos, double zpos){
18  const double mm = 0.1;
19  const double um = 1e-4;
20  // ---------------------------------------------------------------------------------------------------
21  // Mini-TPC
22  TString mat_tpc[] = {"G4_MYLAR","G4_METHANE","G4_GRAPHITE"};
23  const int n_layers_tpc = sizeof(mat_tpc)/sizeof(*mat_tpc);
24  double thick_tpc[] = { 25*um , 2 , 10*um };
25  double cl1_tpc[] = {1.0,0.1,0.1};
26  double cl2_tpc[] = {0.6,0.3,0.7};
27  double cl3_tpc[] = {0.1,0.9,0.2};
28 
29  double last_r = Rpos;
30 
31  for (int ilayer = 0; ilayer < n_layers_tpc; ilayer++){
32  cyl = new PHG4CylinderSubsystem(name+"_miniTPC", ilayer);
33  cyl->set_string_param("material" , (string)(mat_tpc[ilayer]));
34  cyl->set_double_param("radius" , last_r );
35  cyl->set_double_param("thickness", thick_tpc[ilayer] );
36  cyl->set_double_param("place_z" , 0 );
37  cyl->set_double_param("length" , zpos );
38  if(mat_tpc[ilayer]=="G4_METHANE")
39  cyl->SetActive();
40  cyl->SuperDetector(name);
41  cyl->set_color(cl1_tpc[ilayer],cl2_tpc[ilayer],cl3_tpc[ilayer]);
42  g4Reco->registerSubsystem(cyl);
43 
44  last_r += thick_tpc[ilayer];
45  }
46  // ---------------------------------------------------------------------------------------------------
47  // HBD
48  // For the Hadron Blind Detector (HBD) details
49  // see line 411 here: https://sphenix-collaboration.github.io/doxygen/d4/d18/PHG4SectorConstructor_8cc_source.html
50  // GEM Copper 1.43 0.0005x6 64 0.134
51  // GEM Kapton 28.6 0.005x3 64 0.034
52  // GEM Copper 1.43 0.0005x6 64 0.134
53  // GEM frames FR4 17.1 0.15x4 6.5 0.228
54  const int nGEMLayers = 3; // for HBD
55  TString mat_hbd1[] = {"G4_Cu","G4_KAPTON","G4_Cu","G10"};
56  const int n_layers_hbd1 = sizeof(mat_hbd1)/sizeof(*mat_hbd1);
57  double thick_hbd1[] = {0.0005 ,0.005 ,0.0005 ,0.15 };
58  double perc_filled_hbd1[] = { .64 , .64 , .64 ,.065 };
59  double cl1_hbd1[] = {1.0,0.0,1.0,0.9};
60  double cl2_hbd1[] = {0.1,0.0,0.1,1.0};
61  double cl3_hbd1[] = {0.1,0.5,0.1,0.8};
62 
63  for(int ngem = 0 ; ngem<nGEMLayers ; ngem++){
64  for (int ilayer = 0; ilayer < n_layers_hbd1; ilayer++){
65  cyl = new PHG4CylinderSubsystem(name, 10*(ngem+1)+ilayer);
66  cyl->set_string_param("material" , (string)(mat_hbd1[ilayer]) );
67  cyl->set_double_param("radius" , last_r );
68  cyl->set_double_param("thickness", thick_hbd1[ilayer]*perc_filled_hbd1[ilayer] );
69  cyl->set_double_param("place_z" , 0 );
70  cyl->set_double_param("length" , zpos );
71  cyl->SuperDetector(name);
72  cyl->set_color(cl1_hbd1[ilayer],cl2_hbd1[ilayer],cl3_hbd1[ilayer]);
73  g4Reco->registerSubsystem(cyl);
74 
75  last_r += thick_hbd1[ilayer];
76  }
77  }
78  // -------------------------------------
79  // PCB Kapton 28.6 0.005 100 0.017
80  // PCB Copper 1.43 0.0005 80 0.028
81  // Facesheet FR4 17.1 0.025x2 100 0.292
82  TString mat_hbd2[] = {"G4_KAPTON","G4_Cu","G10"};
83  const int n_layers_hbd2 = sizeof(mat_hbd2)/sizeof(*mat_hbd2);
84  double thick_hbd2[] = {0.005 ,0.0005 ,0.025*2};
85  double perc_filled_hbd2[] = { 1 , .80 , 1 };
86  double cl1_hbd2[] = {0.0,1.0,0.9};
87  double cl2_hbd2[] = {0.0,0.1,1.0};
88  double cl3_hbd2[] = {0.5,0.1,0.8};
89 
90  for (int ilayer = 0; ilayer < n_layers_hbd2; ilayer++){
91  cyl = new PHG4CylinderSubsystem(name+"_hbd", 40+ilayer);
92  cyl->set_string_param("material" , (string)(mat_hbd2[ilayer]) );
93  cyl->set_double_param("radius" , last_r );
94  cyl->set_double_param("thickness", thick_hbd2[ilayer]*perc_filled_hbd2[ilayer] );
95  cyl->set_double_param("place_z" , 0 );
96  cyl->set_double_param("length" , zpos );
97  cyl->SuperDetector(name);
98  cyl->set_color(cl1_hbd2[ilayer],cl2_hbd2[ilayer],cl3_hbd2[ilayer]);
99  g4Reco->registerSubsystem(cyl);
100 
101  last_r += thick_hbd2[ilayer];
102  }
103  // ---------------------------------------------------------------------------------------------------
104  return 0;
105 }
106 // ======================================================================================================================
107 #endif