Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_EEMC.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_EEMC.C
1 using namespace std;
2 
3 void
5 {
6 }
7 
8 void EEMC_Cells(int verbosity = 0) {
9 
10  gSystem->Load("libfun4all.so");
11  gSystem->Load("libg4detectors.so");
13 
14  PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("EEMCCellReco");
15  hc->Detector("EEMC");
16  se->registerSubsystem(hc);
17 
18  return;
19 }
20 
21 void
22 EEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0)
23 {
24 
25  gSystem->Load("libg4detectors.so");
26 
28  PHG4CrystalCalorimeterSubsystem *eemc = new PHG4CrystalCalorimeterSubsystem("EEMC");
29 
30  /* path to central copy of calibrations repositry */
31  ostringstream mapping_eemc;
32 
33  /* Use non-projective geometry */
34  mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v004.txt";
35  cout << mapping_eemc.str() << endl;
36 
37  eemc->SetTowerMappingFile( mapping_eemc.str() );
38  eemc->OverlapCheck(overlapcheck);
39 
40  if (absorberactive) eemc->SetAbsorberActive();
41 
42  /* register Ecal module */
43  g4Reco->registerSubsystem( eemc );
44 
45 }
46 
47 void EEMC_Towers(int verbosity = 0) {
48 
49  gSystem->Load("libfun4all.so");
50  gSystem->Load("libg4detectors.so");
52 
53  ostringstream mapping_eemc;
54  mapping_eemc << getenv("CALIBRATIONROOT") <<
55  "/CrystalCalorimeter/mapping/towerMap_EEMC_v004.txt";
56 
57  RawTowerBuilderByHitIndex* tower_EEMC = new RawTowerBuilderByHitIndex("TowerBuilder_EEMC");
58  tower_EEMC->Detector("EEMC");
59  tower_EEMC->set_sim_tower_node_prefix("SIM");
60  tower_EEMC->GeometryTableFile( mapping_eemc.str() );
61 
62  se->registerSubsystem(tower_EEMC);
63 
64 
65  /* Calorimeter digitization */
66 
67  // CMS lead tungstate barrel ECAL at 18 degree centrigrade: 4.5 photoelectrons per MeV
68  const double EEMC_photoelectron_per_GeV = 4500;
69 
70  RawTowerDigitizer *TowerDigitizer_EEMC = new RawTowerDigitizer("EEMCRawTowerDigitizer");
71  TowerDigitizer_EEMC->Detector("EEMC");
72  TowerDigitizer_EEMC->Verbosity(verbosity);
73  TowerDigitizer_EEMC->set_raw_tower_node_prefix("RAW");
75  TowerDigitizer_EEMC->set_pedstal_central_ADC(0);
76  TowerDigitizer_EEMC->set_pedstal_width_ADC(8);// eRD1 test beam setting
77  TowerDigitizer_EEMC->set_photonelec_ADC(1);//not simulating ADC discretization error
78  TowerDigitizer_EEMC->set_photonelec_yield_visible_GeV( EEMC_photoelectron_per_GeV );
79  TowerDigitizer_EEMC->set_zero_suppression_ADC(16); // eRD1 test beam setting
80 
81  se->registerSubsystem( TowerDigitizer_EEMC );
82 
83 
84  /* Calorimeter calibration */
85 
86  RawTowerCalibration *TowerCalibration_EEMC = new RawTowerCalibration("EEMCRawTowerCalibration");
87  TowerCalibration_EEMC->Detector("EEMC");
88  TowerCalibration_EEMC->Verbosity(verbosity);
90  TowerCalibration_EEMC->set_calib_const_GeV_ADC( 1. / EEMC_photoelectron_per_GeV );
91  TowerCalibration_EEMC->set_pedstal_ADC( 0 );
92 
93  se->registerSubsystem( TowerCalibration_EEMC );
94 
95 }
96 
97 void EEMC_Clusters(int verbosity = 0) {
98 
99  gSystem->Load("libfun4all.so");
100  gSystem->Load("libg4detectors.so");
102 
103  RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd");
104  ClusterBuilder->Detector("EEMC");
105  ClusterBuilder->Verbosity(verbosity);
106  se->registerSubsystem( ClusterBuilder );
107 
108  return;
109 }
110 
111 void EEMC_Eval(std::string outputfile, int verbosity = 0)
112 {
113  gSystem->Load("libfun4all.so");
114  gSystem->Load("libg4eval.so");
116 
117  CaloEvaluator *eval = new CaloEvaluator("EEMCEVALUATOR", "EEMC", outputfile.c_str());
118  eval->Verbosity(verbosity);
119  se->registerSubsystem(eval);
120 
121  return;
122 }