-
Notifications
You must be signed in to change notification settings - Fork 31
/
G4_HToF.C
128 lines (106 loc) · 4.82 KB
/
G4_HToF.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifndef MACRO_G4HToF_C
#define MACRO_G4HToF_C
#include <GlobalVariables.C>
#include <fun4all/Fun4AllServer.h>
#include <g4etof/PHG4ECAPToFSubsystem.h>
#include <g4main/PHG4Reco.h>
#include <g4trackfastsim/PHG4TrackFastSim.h>
R__LOAD_LIBRARY(libg4etof.so)
//R__LOAD_LIBRARY(libfun4all.so)
R__LOAD_LIBRARY(libg4detectors.so)
namespace Enable
{
bool HTOF = false;
bool HTOF_GAS = false;
bool HTOF_OVERLAPCHECK = true;
int HTOF_VERBOSITY = 0;
} // namespace Enable
namespace HTOF
{
int f_gas_lyr = 6.; // total number of layers
int f_mrpc_lyr = 7.; //total number of layers
int b_gas_lyr = 6.; // total number of layers
int b_mrpc_lyr = 7.; //total number of layers
int pcb_lyr = 3.;
int mylar_lyr = 4.;
int cu_lyr = 4.;
int carbon_lyr = 4.;
int honeycomb_lyr = 2.;
double z_start = 287.; //cm, starting point from left on +ve Z axis moving away from origin
double R_in = 15.0; // cm
double R_out = 170.; //cm
double gas_gap = 0.0220; // 220 microns
double mrpc_thick = 0.04; // 400 microns
double pcb_thick = 0.06; // 600 microns
double cu_thick = 0.003; // 30 microns, layer over pcb, (1 each on outer pcb and 2 on central pcb = 4)
double carbon_thick = 0.01; // 100 microns , 2 layers
double mylar_thick = 0.04; // 400 microns, 4 layers
double honeycomb_thick = 0.75; // 7.5 mm, 2 honeycomb
double tof_width = (f_gas_lyr + b_gas_lyr) * gas_gap + (f_mrpc_lyr + b_mrpc_lyr) * mrpc_thick + carbon_lyr * carbon_thick + pcb_lyr * pcb_thick + cu_lyr * cu_thick + mylar_lyr * mylar_thick + honeycomb_lyr * honeycomb_thick;
double z_end = (z_start + tof_width);
} // namespace HTOF
void HTOFInit()
{
BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, HTOF::R_out);
BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, HTOF::z_end + 5);
BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, HTOF::z_start - 5);
}
void HTOFSetup(PHG4Reco* g4Reco)
{
int verbosity = std::max(Enable::VERBOSITY, Enable::HTOF_VERBOSITY);
bool GasActive = Enable::ABSORBER || Enable::HTOF_GAS;
bool OverlapCheck = Enable::OVERLAPCHECK || Enable::HTOF_OVERLAPCHECK;
Fun4AllServer* se = Fun4AllServer::instance();
se->Verbosity(verbosity);
PHG4ECAPToFSubsystem* hTOF = new PHG4ECAPToFSubsystem("hTOF", 1);
hTOF->Verbosity(verbosity);
hTOF->set_int_param("n_fgas_layer", HTOF::f_gas_lyr);
hTOF->set_int_param("n_bgas_layer", HTOF::b_gas_lyr);
hTOF->set_double_param("gas_gap", HTOF::gas_gap);
hTOF->set_double_param("glass_thick", HTOF::mrpc_thick);
hTOF->set_double_param("Carbon_thick", HTOF::carbon_thick);
hTOF->set_double_param("pcb_thick", HTOF::pcb_thick);
hTOF->set_double_param("cu_thick", HTOF::cu_thick);
hTOF->set_double_param("honeycomb_thick", HTOF::honeycomb_thick);
hTOF->set_double_param("mylar_thick", HTOF::mylar_thick);
hTOF->set_double_param("Rin", HTOF::R_in);
hTOF->set_double_param("Rout", HTOF::R_out);
hTOF->set_double_param("z_begin", HTOF::z_start);
hTOF->set_int_param("use_g4steps", 1);
hTOF->SetActive(1);
hTOF->SuperDetector("HTOF");
if (GasActive)
{
hTOF->SetAbsorberActive(1);
}
hTOF->OverlapCheck(OverlapCheck);
g4Reco->registerSubsystem(hTOF);
//trd_hcap->OverlapCheck(1);
if (verbosity > 1) cout << " HTOF gas layer :" << HTOF::f_gas_lyr << endl;
if (TRACKING::FastKalmanFilter)
{
/*
TRACKING::FastKalmanFilter->add_phg4hits(string("G4HIT_") + string(Form("ACTIVEGAS_HTOF")), // const std::string& phg4hitsNames,
PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype,
1, //1. / sqrt(12.), // const float radres,
5.0e-1,//55e-4, // const float phires,
5.0e-1,//55e-4, // const float lonres,
1, // const float eff,
0); // const float noise
*/
//Reference plane projection at initial R of ToF
TRACKING::FastKalmanFilter->add_zplane_state(string("G4HIT_") + string(Form("ACTIVEGAS_HTOF")), HTOF::z_end);
TRACKING::ProjectionNames.insert(string("G4HIT_") + string(Form("ACTIVEGAS_HTOF")));
}
return;
}
void HTOF_Reco()
{
gSystem->Load("libfun4all.so");
gSystem->Load("libg4detectors.so");
int verbosity = std::max(Enable::VERBOSITY, Enable::HTOF_VERBOSITY);
Fun4AllServer* se = Fun4AllServer::instance();
//se->Verbosity(INT_MAX-10);
return;
}
#endif