Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_FEMC.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_FEMC.C
1 using namespace std;
2 
3 void
5 {
6 }
7 
8 void FEMC_Cells(int verbosity = 0) {
9 
10  gSystem->Load("libfun4all.so");
11  gSystem->Load("libg4detectors.so");
13 
14  PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco");
15  hc->Detector("FEMC");
16  se->registerSubsystem(hc);
17 
18  return;
19 }
20 
21 void
22 FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0)
23 {
24 
25  gSystem->Load("libg4detectors.so");
26 
28 
30  PHG4ForwardEcalSubsystem *femc = new PHG4ForwardEcalSubsystem("FEMC");
31 
32  ostringstream mapping_femc;
33 
34  // fsPHENIX ECAL
35  femc->SetfsPHENIXDetector();
36  mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v002.txt";
37 
38  cout << mapping_femc.str() << endl;
39 
40  femc->SetTowerMappingFile( mapping_femc.str() );
41  femc->OverlapCheck(overlapcheck);
42 
43  if (absorberactive) femc->SetAbsorberActive();
44 
45  g4Reco->registerSubsystem( femc );
46 
47 }
48 
49 void FEMC_Towers(int verbosity = 0) {
50 
51  gSystem->Load("libfun4all.so");
52  gSystem->Load("libg4detectors.so");
54 
55  ostringstream mapping_femc;
56 
57  // fsPHENIX ECAL
58  mapping_femc << getenv("CALIBRATIONROOT") <<
59  "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v002.txt";
60 
61  RawTowerBuilderByHitIndex* tower_FEMC = new RawTowerBuilderByHitIndex("TowerBuilder_FEMC");
62  tower_FEMC->Detector("FEMC");
63  tower_FEMC->set_sim_tower_node_prefix("SIM");
64  tower_FEMC->GeometryTableFile( mapping_femc.str() );
65 
66  se->registerSubsystem(tower_FEMC);
67 
68  // PbW crystals
69  RawTowerDigitizer *TowerDigitizer1 = new RawTowerDigitizer("FEMCRawTowerDigitizer1");
70  TowerDigitizer1->Detector("FEMC");
71  TowerDigitizer1->TowerType(1);
72  TowerDigitizer1->Verbosity(verbosity);
74  se->registerSubsystem( TowerDigitizer1 );
75 
76  // PbSc towers
77  RawTowerDigitizer *TowerDigitizer2 = new RawTowerDigitizer("FEMCRawTowerDigitizer2");
78  TowerDigitizer2->Detector("FEMC");
79  TowerDigitizer2->TowerType(2);
80  TowerDigitizer2->Verbosity(verbosity);
82  se->registerSubsystem( TowerDigitizer2 );
83 
84  // PbW crystals
85  RawTowerCalibration *TowerCalibration1 = new RawTowerCalibration("FEMCRawTowerCalibration1");
86  TowerCalibration1->Detector("FEMC");
87  TowerCalibration1->TowerType(1);
88  TowerCalibration1->Verbosity(verbosity);
90  TowerCalibration1->set_calib_const_GeV_ADC(1.0); // sampling fraction = 1.0
91  TowerCalibration1->set_pedstal_ADC(0);
92  se->registerSubsystem( TowerCalibration1 );
93 
94  // PbSc towers
95  RawTowerCalibration *TowerCalibration2 = new RawTowerCalibration("FEMCRawTowerCalibration2");
96  TowerCalibration2->Detector("FEMC");
97  TowerCalibration2->TowerType(2);
98  TowerCalibration2->Verbosity(verbosity);
100  TowerCalibration2->set_calib_const_GeV_ADC(1.0/0.249); // sampling fraction = 0.249 for e-
101  TowerCalibration2->set_pedstal_ADC(0);
102  se->registerSubsystem( TowerCalibration2 );
103 
104 }
105 
106 void FEMC_Clusters(int verbosity = 0) {
107 
108  gSystem->Load("libfun4all.so");
109  gSystem->Load("libg4detectors.so");
111 
112  RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd");
113  ClusterBuilder->Detector("FEMC");
114  ClusterBuilder->Verbosity(verbosity);
115  ClusterBuilder->set_threshold_energy(0.100);
116  se->registerSubsystem( ClusterBuilder );
117 
118  return;
119 }
120 
121 void FEMC_Eval(std::string outputfile, int verbosity = 0)
122 {
123  gSystem->Load("libfun4all.so");
124  gSystem->Load("libg4eval.so");
126 
127  CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile.c_str());
128  eval->Verbosity(verbosity);
129  se->registerSubsystem(eval);
130 
131  return;
132 }