Skip to content

Commit

Permalink
Merge production into production_pythia8
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Sep 11, 2021
2 parents 228d5b5 + df8db21 commit 247ac01
Show file tree
Hide file tree
Showing 24 changed files with 2,201 additions and 540 deletions.
46 changes: 46 additions & 0 deletions common/G4_AllSilicon.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#ifndef MACRO_G4ALLSILICON_C
#define MACRO_G4ALLSILICON_C

#include <GlobalVariables.C>

#include <g4lblvtx/AllSiliconTrackerSubsystem.h>

R__LOAD_LIBRARY(libg4lblvtx.so)

namespace Enable
{
bool ALLSILICON = false;
bool ALLSILICON_ABSORBER = false;
bool ALLSILICON_OVERLAPCHECK = false;
} // namespace Enable

namespace G4ALLSILICON
{
namespace SETTING
{
int geomVersion = 2;
} // namespace SETTING
} // namespace G4FHCAL

void AllSiliconInit() {}

void AllSiliconSetup(PHG4Reco *g4Reco)
{
bool AbsorberActive = Enable::ABSORBER || Enable::ALLSILICON_ABSORBER;
bool OverlapCheck = Enable::OVERLAPCHECK || Enable::ALLSILICON_OVERLAPCHECK;
AllSiliconTrackerSubsystem *allsili = new AllSiliconTrackerSubsystem();


allsili->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + Form("/AllSiliconTracker/genfitGeom_AllSi_v%d.gdml",G4ALLSILICON::SETTING::geomVersion));

allsili->AddAssemblyVolume("VST"); // Barrel
allsili->AddAssemblyVolume("FST"); // Forward disks
allsili->AddAssemblyVolume("BST"); // Backward disks
//allsili->AddAssemblyVolume("BEAMPIPE"); // Beampipe
allsili->SuperDetector("LBLVTX");
allsili->OverlapCheck(OverlapCheck);
allsili->SetActive(); // this saves hits in the MimosaCore volumes
if (AbsorberActive) allsili->SetAbsorberActive(); // this saves hits in all volumes (in the absorber node)
g4Reco->registerSubsystem(allsili);
}
#endif
162 changes: 162 additions & 0 deletions common/G4_BECAL.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
#ifndef MACRO_G4BECAL_C
#define MACRO_G4BECAL_C

#include <GlobalVariables.C>

#include <g4calo/RawTowerDigitizer.h>

#include <g4eiccalos/PHG4BarrelEcalSubsystem.h>
#include <g4eiccalos/RawTowerBuilderByHitIndexBECAL.h>

#include <g4eval/CaloEvaluator.h>

#include <g4main/PHG4Reco.h>

#include <caloreco/RawClusterBuilderFwd.h>
#include <caloreco/RawClusterBuilderTemplate.h>
#include <caloreco/RawTowerCalibration.h>

#include <fun4all/Fun4AllServer.h>

R__LOAD_LIBRARY(libcalo_reco.so)
R__LOAD_LIBRARY(libg4calo.so)
R__LOAD_LIBRARY(libg4eiccalos.so)
R__LOAD_LIBRARY(libg4eval.so)

namespace Enable
{
bool BECAL = false;
bool BECAL_ABSORBER = false;
bool BECAL_CELL = false;
bool BECAL_TOWER = false;
bool BECAL_CLUSTER = false;
bool BECAL_EVAL = false;
bool BECAL_OVERLAPCHECK = false;
int BECAL_VERBOSITY = 0;
} // namespace Enable



namespace G4BECAL
{

//double minz = -273.6*cm;
//double maxz = 142.4*cm;
double minz = -453;
double maxz = 371;
double topradius = 138;
double radius = 85;

// this is default set to -1.5<eta<1.24 for 2018 Letter of Intent
// if the user changes these, the z position of the

// Digitization (default photon digi):
RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kSiPM_photon_digitization;
// directly pass the energy of sim tower to digitized tower
// kNo_digitization
// simple digitization with photon statistics, single amplitude ADC conversion and pedestal
// kSimple_photon_digitization
// digitization with photon statistics on SiPM with an effective pixel N, ADC conversion and pedestal
// kSiPM_photon_digitization

} // namespace G4BECAL

void BECALInit()
{

// update black hole settings
BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4BECAL::topradius);
BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4BECAL::maxz);
BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4BECAL::minz);

}

double BECALSetup(PHG4Reco *g4Reco)
{

bool AbsorberActive = Enable::ABSORBER || Enable::BECAL_ABSORBER;
bool OverlapCheck = Enable::OVERLAPCHECK || Enable::BECAL_OVERLAPCHECK;

ostringstream mapping_becal;
mapping_becal << getenv("CALIBRATIONROOT") << "/BarrelEcal/mapping/towerMap_BEMC_v001.txt";

PHG4BarrelEcalSubsystem *becal = new PHG4BarrelEcalSubsystem("BECAL");
becal->set_string_param("mapping_file", mapping_becal.str());
becal->OverlapCheck(OverlapCheck);
becal->SetActive();
becal->SuperDetector("BECAL");
if (AbsorberActive) becal->SetAbsorberActive();

g4Reco->registerSubsystem(becal);

return G4BECAL::topradius;

}

void BECAL_Cells(int verbosity = 0)
{
return;
}

void BECAL_Towers()
{

int verbosity = std::max(Enable::VERBOSITY, Enable::BECAL_VERBOSITY);

Fun4AllServer *se = Fun4AllServer::instance();

ostringstream mapping_BECAL;
mapping_BECAL << getenv("CALIBRATIONROOT") << "/BarrelEcal/mapping/towerMap_BEMC_v001.txt";

const double photoelectron_per_GeV = 5000;

RawTowerBuilderByHitIndexBECAL *tower_BECAL = new RawTowerBuilderByHitIndexBECAL("TowerBuilder_BECAL");
tower_BECAL->Detector("BECAL");
tower_BECAL->set_sim_tower_node_prefix("SIM");
tower_BECAL->EminCut(1e-7);
tower_BECAL->GeometryTableFile(mapping_BECAL.str());
tower_BECAL->Verbosity(verbosity);
se->registerSubsystem(tower_BECAL);

RawTowerDigitizer *TowerDigitizer_BECAL = new RawTowerDigitizer("BECALRawTowerDigitizer");
TowerDigitizer_BECAL->Detector("BECAL");
TowerDigitizer_BECAL->Verbosity(verbosity);
// TowerDigitizer_BECAL->Verbosity(verbosity);
TowerDigitizer_BECAL->set_digi_algorithm(G4BECAL::TowerDigi);
TowerDigitizer_BECAL->set_raw_tower_node_prefix("RAW");
TowerDigitizer_BECAL->set_pedstal_central_ADC(0);
TowerDigitizer_BECAL->set_pedstal_width_ADC(0); // eRD1 test beam setting
TowerDigitizer_BECAL->set_photonelec_ADC(1); // not simulating ADC discretization error
TowerDigitizer_BECAL->set_photonelec_yield_visible_GeV(photoelectron_per_GeV);
TowerDigitizer_BECAL->set_zero_suppression_ADC(0); // eRD1 test beam setting
se->registerSubsystem(TowerDigitizer_BECAL);

RawTowerCalibration *TowerCalibration_BECAL = new RawTowerCalibration("BECALRawTowerCalibration");
TowerCalibration_BECAL->Detector("BECAL");
TowerCalibration_BECAL->Verbosity(verbosity);
TowerCalibration_BECAL->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration);
TowerCalibration_BECAL->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV);
TowerCalibration_BECAL->set_pedstal_ADC(0);
se->registerSubsystem(TowerCalibration_BECAL);

}

void BECAL_Clusters()
{

return;
}

void BECAL_Eval(const std::string &outputfile)
{
int verbosity = std::max(Enable::VERBOSITY, Enable::BECAL_VERBOSITY);
Fun4AllServer *se = Fun4AllServer::instance();

CaloEvaluator *eval = new CaloEvaluator("BECALEVALUATOR", "BECAL", outputfile.c_str());
eval->set_do_cluster_eval(false);
eval->Verbosity(1);
se->registerSubsystem(eval);

return;
}
#endif
111 changes: 62 additions & 49 deletions common/G4_Barrel_EIC.C
Original file line number Diff line number Diff line change
Expand Up @@ -21,69 +21,82 @@ namespace Enable
void BarrelInit()
{
}

void BarrelFastKalmanFilterConfig(PHG4TrackFastSim * kalman_filter)
{

// import Kalman filter config (lines 226 to 246 here: https://github.com/eic/g4lblvtx/blob/master/macros/auxiliary_studies/simplified_geometry/Fun4All_G4_simplified_v2.C):

// add Vertexing Layers
kalman_filter->add_phg4hits(
"G4HIT_SVTX", // const std::string& phg4hitsNames,
PHG4TrackFastSim::Cylinder,
999., // radial-resolution [cm]
10. / 10000. / sqrt(12.), // azimuthal-resolution [cm]
10. / 10000. / sqrt(12.), // z-resolution [cm]
1, // efficiency,
0 // noise hits
);

// add Barrel Layers
kalman_filter->add_phg4hits(
"G4HIT_BARR", // const std::string& phg4hitsNames,
PHG4TrackFastSim::Cylinder,
999., // radial-resolution [cm]
10. / 10000. / sqrt(12.), // azimuthal-resolution [cm]
10. / 10000. / sqrt(12.), // z-resolution [cm]
1, // efficiency,
0 // noise hits
);

}


//-----------------------------------------------------------------------------------//
void Barrel(PHG4Reco *g4Reco, int det_ver = 3)
{

// import Geometry (lines 111 to 148 in https://github.com/eic/g4lblvtx/blob/master/macros/auxiliary_studies/simplified_geometry/Fun4All_G4_simplified_v2.C):
PHG4CylinderSubsystem * cyl(nullptr);
PHG4CylinderSubsystem *cyl(nullptr);

//---------------------------
// Vertexing
double si_vtx_r_pos[] = {3.30,5.70};
const int nVtxLayers = sizeof(si_vtx_r_pos)/sizeof(*si_vtx_r_pos);
for (int ilayer = 0; ilayer < nVtxLayers ; ilayer++){
cyl = new PHG4CylinderSubsystem("SVTX", ilayer);
cyl->set_string_param("material" , "G4_Si" );
cyl->set_double_param("radius" , si_vtx_r_pos[ilayer] );
cyl->set_double_param("thickness", 0.05/100.*9.37 );
cyl->set_double_param("place_z" , 0 );
cyl->set_double_param("length" , 30.);
cyl->SetActive();
cyl->SuperDetector("SVTX");
g4Reco->registerSubsystem(cyl);
double si_vtx_r_pos[] = {3.30, 5.70, 8.10};
const int nVtxLayers = sizeof(si_vtx_r_pos) / sizeof(*si_vtx_r_pos);
for (int ilayer = 0; ilayer < nVtxLayers; ilayer++)
{
cyl = new PHG4CylinderSubsystem("SVTX", ilayer);
cyl->set_string_param("material", "G4_Si");
cyl->set_double_param("radius", si_vtx_r_pos[ilayer]);
cyl->set_double_param("thickness", 0.05 / 100. * 9.37);
cyl->set_double_param("place_z", 0);
cyl->set_double_param("length", 30.);
cyl->SetActive();
cyl->SuperDetector("SVTX");
g4Reco->registerSubsystem(cyl);
}
//---------------------------
// Barrel
double si_r_pos[] = {21.,22.68,39.3,43.23};
const int nTrckLayers = sizeof(si_r_pos)/sizeof(*si_r_pos);
double si_z_length[] = {54.,60.,105.,114.};
for (int ilayer = 0; ilayer < nTrckLayers ; ilayer++){
cyl = new PHG4CylinderSubsystem("BARR", ilayer);
cyl->set_string_param("material" , "G4_Si" );
cyl->set_double_param("radius" , si_r_pos[ilayer] );
cyl->set_double_param("thickness", 0.55/100.*9.37 );
cyl->set_double_param("place_z" , 0 );
cyl->set_double_param("length" , si_z_length[ilayer]);
cyl->SetActive();
cyl->SuperDetector("BARR");
g4Reco->registerSubsystem(cyl);
double si_r_pos[] = {21., 22.68};
const int nTrckLayers = sizeof(si_r_pos) / sizeof(*si_r_pos);
double si_z_length[] = {60., 60.};
for (int ilayer = 0; ilayer < nTrckLayers; ilayer++)
{
cyl = new PHG4CylinderSubsystem("BARR", ilayer);
cyl->set_string_param("material", "G4_Si");
cyl->set_double_param("radius", si_r_pos[ilayer]);
cyl->set_double_param("thickness", 0.05 / 100. * 9.37);
cyl->set_double_param("place_z", 0);
cyl->set_double_param("length", si_z_length[ilayer]);
cyl->SetActive();
cyl->SuperDetector("BARR");
g4Reco->registerSubsystem(cyl);
}

// import Kalman filter config (lines 226 to 246 here: https://github.com/eic/g4lblvtx/blob/master/macros/auxiliary_studies/simplified_geometry/Fun4All_G4_simplified_v2.C):

// add Vertexing Layers
TRACKING::FastKalmanFilter->add_phg4hits(
"G4HIT_SVTX", // const std::string& phg4hitsNames,
PHG4TrackFastSim::Cylinder,
999., // radial-resolution [cm]
10./10000./sqrt(12.), // azimuthal-resolution [cm]
10./10000./sqrt(12.), // z-resolution [cm]
1, // efficiency,
0 // noise hits
);
BarrelFastKalmanFilterConfig(TRACKING::FastKalmanFilter);

// add Barrel Layers
TRACKING::FastKalmanFilter->add_phg4hits(
"G4HIT_BARR", // const std::string& phg4hitsNames,
PHG4TrackFastSim::Cylinder,
999., // radial-resolution [cm]
10./10000./sqrt(12.), // azimuthal-resolution [cm]
10./10000./sqrt(12.), // z-resolution [cm]
1, // efficiency,
0 // noise hits
);
BarrelFastKalmanFilterConfig(TRACKING::FastKalmanFilterInnerTrack);

BarrelFastKalmanFilterConfig(TRACKING::FastKalmanFilterSiliconTrack);
}

#endif
Loading

0 comments on commit 247ac01

Please sign in to comment.