Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_FHCAL.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_FHCAL.C
1 using namespace std;
2 
3 void
5 {
6 }
7 
8 void FHCAL_Cells(int verbosity = 0) {
9 
10  gSystem->Load("libfun4all.so");
11  gSystem->Load("libg4detectors.so");
13 
14  PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FHCALCellReco");
15  hc->Detector("FHCAL");
16  se->registerSubsystem(hc);
17 
18  return;
19 }
20 
21 void
22 FHCALSetup(PHG4Reco* g4Reco, const int absorberactive = 0)
23 {
24 
25  gSystem->Load("libg4detectors.so");
26 
28 
30  PHG4ForwardHcalSubsystem *hhcal = new PHG4ForwardHcalSubsystem("FHCAL");
31 
32  ostringstream mapping_hhcal;
33 
34  /* path to central copy of calibrations repositry */
35  mapping_hhcal << getenv("CALIBRATIONROOT") ;
36  mapping_hhcal << "/ForwardHcal/mapping/towerMap_FHCAL_v004.txt";
37  cout << mapping_hhcal.str() << endl;
38  //mapping_hhcal << "towerMap_FHCAL_latest.txt";
39 
40  hhcal->SetTowerMappingFile( mapping_hhcal.str() );
41  hhcal->OverlapCheck(overlapcheck);
42 
43  if (absorberactive) hhcal->SetAbsorberActive();
44 
45  g4Reco->registerSubsystem( hhcal );
46 
47 }
48 
49 void FHCAL_Towers(int verbosity = 0) {
50 
51  gSystem->Load("libfun4all.so");
52  gSystem->Load("libg4detectors.so");
54 
55  ostringstream mapping_fhcal;
56  mapping_fhcal << getenv("CALIBRATIONROOT") <<
57  "/ForwardHcal/mapping/towerMap_FHCAL_v004.txt";
58  //mapping_fhcal << "towerMap_FHCAL_latest.txt";
59 
60  RawTowerBuilderByHitIndex* tower_FHCAL = new RawTowerBuilderByHitIndex("TowerBuilder_FHCAL");
61  tower_FHCAL->Detector("FHCAL");
62  tower_FHCAL->set_sim_tower_node_prefix("SIM");
63  tower_FHCAL->GeometryTableFile( mapping_fhcal.str() );
64 
65  se->registerSubsystem(tower_FHCAL);
66 
67  // const double FHCAL_photoelectron_per_GeV = 500;
68 
69  // RawTowerDigitizer *TowerDigitizer_FHCAL = new RawTowerDigitizer("FHCALRawTowerDigitizer");
70 
71  // TowerDigitizer_FHCAL->Detector("FHCAL");
72  // TowerDigitizer_FHCAL->Verbosity(verbosity);
73  // TowerDigitizer_FHCAL->set_raw_tower_node_prefix("RAW");
74  // TowerDigitizer_FHCAL->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization);
75  // TowerDigitizer_FHCAL->set_pedstal_central_ADC(0);
76  // TowerDigitizer_FHCAL->set_pedstal_width_ADC(8);// eRD1 test beam setting
77  // TowerDigitizer_FHCAL->set_photonelec_ADC(1);//not simulating ADC discretization error
78  // TowerDigitizer_FHCAL->set_photonelec_yield_visible_GeV( FHCAL_photoelectron_per_GeV );
79  // TowerDigitizer_FHCAL->set_zero_suppression_ADC(16); // eRD1 test beam setting
80 
81  // se->registerSubsystem( TowerDigitizer_FHCAL );
82 
83  // RawTowerCalibration *TowerCalibration_FHCAL = new RawTowerCalibration("FHCALRawTowerCalibration");
84  // TowerCalibration_FHCAL->Detector("FHCAL");
85  // TowerCalibration_FHCAL->Verbosity(verbosity);
86  // TowerCalibration_FHCAL->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration);
87  // TowerCalibration_FHCAL->set_calib_const_GeV_ADC( 1. / FHCAL_photoelectron_per_GeV );
88  // TowerCalibration_FHCAL->set_pedstal_ADC( 0 );
89 
90  // se->registerSubsystem( TowerCalibration_FHCAL );
91 
92  RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer");
93  TowerDigitizer->Detector("FHCAL");
94  TowerDigitizer->Verbosity(verbosity);
96  se->registerSubsystem( TowerDigitizer );
97 
98  RawTowerCalibration *TowerCalibration = new RawTowerCalibration("FHCALRawTowerCalibration");
99  TowerCalibration->Detector("FHCAL");
100  TowerCalibration->Verbosity(verbosity);
102  TowerCalibration->set_calib_const_GeV_ADC(1./0.03898); // calibrated with muons
103  TowerCalibration->set_pedstal_ADC(0);
104  se->registerSubsystem( TowerCalibration );
105 
106 
107 }
108 
109 void FHCAL_Clusters(int verbosity = 0) {
110 
111  gSystem->Load("libfun4all.so");
112  gSystem->Load("libg4detectors.so");
114 
115  RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FHCALRawClusterBuilderFwd");
116  ClusterBuilder->Detector("FHCAL");
117  ClusterBuilder->Verbosity(verbosity);
118  ClusterBuilder->set_threshold_energy(0.100);
119  se->registerSubsystem( ClusterBuilder );
120 
121  return;
122 }
123 
124 void FHCAL_Eval(std::string outputfile, int verbosity = 0)
125 {
126  gSystem->Load("libfun4all.so");
127  gSystem->Load("libg4eval.so");
129 
130  CaloEvaluator *eval = new CaloEvaluator("FHCALEVALUATOR", "FHCAL", outputfile.c_str());
131  eval->Verbosity(verbosity);
132  se->registerSubsystem(eval);
133 
134  return;
135 }