diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..4f197fbf6 --- /dev/null +++ b/.clang-format @@ -0,0 +1,90 @@ +--- +Language: Cpp +# BasedOnStyle: sphenix +AccessModifierOffset: -1 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlinesLeft: true +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: true +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: true +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: true + AfterControlStatement: true + AfterEnum: false + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Allman +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: true +ColumnLimit: 0 +CommentPragmas: '^ IWYU pragma:' +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 2 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: true +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +IncludeCategories: + - Regex: '^<.*\.h>' + Priority: 1 + - Regex: '^<.*' + Priority: 2 + - Regex: '.*' + Priority: 3 +IndentCaseLabels: false +IndentWidth: 2 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: All +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Right +ReflowComments: true +SortIncludes: true +SpaceAfterCStyleCast: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Auto +TabWidth: 8 +UseTab: Never +... + diff --git a/.gitignore b/.gitignore index 056828149..99a83f379 100644 --- a/.gitignore +++ b/.gitignore @@ -82,3 +82,11 @@ tmtags # For rubinius: *.rbc + +# root/G4 output files +*.root +*.macro + +# valgrind +*.valgrind +*.log diff --git a/README.md b/README.md new file mode 100644 index 000000000..3620f0cfa --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ + +# Welcome + +This is the standard macros respository for [sPHENIX collaboration](https://www.sphenix.bnl.gov/). Following is the 10-min tutorial on using the sPHENIX macros from [this wiki link](https://wiki.bnl.gov/sPHENIX/index.php/Tutorial/sPHENIX_simulation). + +[![Build Status](https://web.sdcc.bnl.gov/jenkins-sphenix/buildStatus/icon?job=sPHENIX/sPHENIX_CoreSoftware_MasterBranch)](https://web.sdcc.bnl.gov/jenkins-sphenix/job/sPHENIX/job/sPHENIX_CoreSoftware_MasterBranch/) +[![Doxygen](https://img.shields.io/badge/code%20reference-Doxygen-green.svg)](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/) +[![Singularity](https://img.shields.io/badge/container-Singularity%20via%20CVMFS-green.svg)](https://github.com/sPHENIX-Collaboration/Singularity) + +[![Open Issues](https://img.shields.io/github/issues/sPHENIX-Collaboration/macros.svg)](https://github.com/sPHENIX-Collaboration/macros/issues) +[![Open Pull Request](https://img.shields.io/github/issues-pr/sPHENIX-Collaboration/macros.svg)](https://github.com/sPHENIX-Collaboration/macros/pulls) +[![Monthly Commits](https://img.shields.io/github/commit-activity/m/sPHENIX-Collaboration/macros.svg)](https://github.com/sPHENIX-Collaboration/macros/commits/master) +[![Last Commit](https://img.shields.io/github/last-commit/sPHENIX-Collaboration/macros.svg)](https://github.com/sPHENIX-Collaboration/macros/commits/master) + +# Get started + +Please follow [SPHENIX software day-1 checklist](https://wiki.bnl.gov/sPHENIX/index.php/SPHENIX_software_day-1_checklist) to get started on [RHIC computing facility at BNL](https://www.racf.bnl.gov/), or follow the [sPHENIX container setup](https://github.com/sPHENIX-Collaboration/Singularity) for your own computing environment. + +# Check out macro repository + +Download the newest macro repository from GitHub: + +``` +[jinhuang@rcas2073 test]$ git clone https://github.com/sPHENIX-Collaboration/macros.git +Cloning into 'macros'... +remote: Counting objects: 1125, done. +remote: Total 1125 (delta 0), reused 0 (delta 0), pack-reused 1125 +Receiving objects: 100% (1125/1125), 181.75 KiB | 0 bytes/s, done. +Resolving deltas: 100% (471/471), done. +Checking connectivity... done. +[jinhuang@rcas2073 test]$ cd macros/detectors +[jinhuang@rcas2073 detectors]$ # here are all the subdirectories with macros to run sPHENIX, fsPHENIX and EIC detector simulations +``` + +The default sPHENIX simulation + reconstruction macro is Fun4All_G4_sPHENIX.C, which is self-explanatory. It is not a black box!. You are welcome to open/edit it to work for your purpose of study. + +# Try an event display + +Then let's see what is implemented by firing up one event: +``` +[jinhuang@rcas2072 sPHENIX]$ source /opt/sphenix/core/bin/sphenix_setup.csh -n # setup sPHENIX environment if not already done so +# Note, for bash users, please use /opt/sphenix/core/bin/sphenix_setup.sh instead +[jinhuang@rcas2072 sPHENIX]$ root +root [] .x Fun4All_G4_sPHENIX.C(-1) // here negative value in event number start an event display of one event +root [] .L DisplayOn.C +root [] PHG4Reco* g4 = DisplayOn() +root [] Fun4AllServer *se = Fun4AllServer::instance(); +root [] se->run(1) +root [] displaycmd() # this one show more Geant4 command we can run from the ROOT prompt +``` + + +# Run more events + +This is simpler, just run with first parameter as the intended number of event: +``` +[jinhuang@rcas2072 sPHENIX]$ source /opt/sphenix/core/bin/sphenix_setup.csh -n # setup sPHENIX environment if not already done so +[jinhuang@rcas2072 sPHENIX]$ root +root [] .x Fun4All_G4_sPHENIX.C(10) // run 10 events +``` + +# What next? + +Now you are able to run the whole sPHENIX simulation + reconstruction chain. Many next-step topics are listed in the [software](https://wiki.bnl.gov/sPHENIX/index.php/Software) page. And specifically, to use the simulation for your study, a few thing you might want to try: + +* Checkout the [evaluator Ntuples](https://wiki.bnl.gov/sPHENIX/index.php/Tracking) output from your 10 events for a generic look of the reconstructed data. +* Run [sPHENIX software tutorials](https://github.com/sPHENIX-Collaboration/tutorials). +* [Write your analysis module for more dedicated analysis](https://wiki.bnl.gov/sPHENIX/index.php/Example_of_using_DST_nodes), for which the module produced the evaluator NTuple ([CaloEvaluator](https://sphenix-collaboration.github.io/doxygen/dd/d59/classCaloEvaluator.html), [JetEvaluator](https://sphenix-collaboration.github.io/doxygen/dd/d59/classCaloEvaluator.html), [SvtxEvaluator](https://sphenix-collaboration.github.io/doxygen/d6/d11/classSvtxEvaluator.html)) can usually serve as good examples. diff --git a/calibrations/README.md b/calibrations/README.md new file mode 100644 index 000000000..47bf30333 --- /dev/null +++ b/calibrations/README.md @@ -0,0 +1,4 @@ + +# Welcome + +This is the place for the calibration macros. Create subdirectories as needed (don't cram all macros into a single place) diff --git a/calibrations/calo/tower_slope_macro/Fun4All_G4_SlopeCal.C b/calibrations/calo/tower_slope_macro/Fun4All_G4_SlopeCal.C new file mode 100644 index 000000000..1ebadd407 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/Fun4All_G4_SlopeCal.C @@ -0,0 +1,56 @@ +// these include guards are not really needed, but if we ever include this +// file somewhere they would be missed and we will have to refurbish all macros +#ifndef MACRO_FUN4ALLG4SLOPECAL_C +#define MACRO_FUN4ALLG4SLOPECAL_C + +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) + +void Fun4All_G4_SlopeCal( + const int nEvents = 1, + const string &inputClustersFileList = "dst_calo_cluster.list", + const string &outputFile = "test1") +{ + // this convenience library knows all our i/o objects so you don't + // have to figure out what is in each dst type + gSystem->Load("libg4dst.so"); + gSystem->Load("libLiteCaloEvalTowSlope.so"); + + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(); // set it to 1 if you want event printouts + + Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTClusters"); + in->AddListFile(inputClustersFileList); + se->registerInputManager(in); + + string outputfile = outputFile + "_g4cemc_eval.root"; + string outputfile2 = outputFile + "_g4hcalin_eval.root"; + string outputfile3 = outputFile + "_g4hcalout_eval.root"; + + LiteCaloEval *eval = new LiteCaloEval("CEMCEVALUATOR", "CEMC", outputfile); + // eval->Verbosity(verbosity); + eval->CaloType(LiteCaloEval::CEMC); + se->registerSubsystem(eval); + + LiteCaloEval *eval2 = new LiteCaloEval("HINEVALUATOR", "HCALIN", outputfile2); + eval2->CaloType(LiteCaloEval::HCALIN); + // eval->Verbosity(verbosity); + se->registerSubsystem(eval2); + + LiteCaloEval *eval3 = new LiteCaloEval("HOUTEVALUATOR", "HCALOUT", outputfile3); + // eval->Verbosity(verbosity); + eval3->CaloType(LiteCaloEval::HCALOUT); + se->registerSubsystem(eval3); + + se->run(nEvents); + se->End(); + delete se; + gSystem->Exit(0); +} + +#endif //MACRO_FUN4ALLG4SLOPECAL_C diff --git a/calibrations/calo/tower_slope_macro/G4_CEmc_Spacal.C b/calibrations/calo/tower_slope_macro/G4_CEmc_Spacal.C new file mode 100644 index 000000000..add4658d6 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/G4_CEmc_Spacal.C @@ -0,0 +1,588 @@ +#ifndef MACRO_G4CEMCSPACAL_C +#define MACRO_G4CEMCSPACAL_C + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +double +CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings); + +double +CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings); + +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool CEMC = false; + bool CEMC_ABSORBER = false; + bool CEMC_OVERLAPCHECK = false; + bool CEMC_CELL = false; + bool CEMC_TOWER = false; + bool CEMC_CLUSTER = false; + bool CEMC_EVAL = false; + bool CEMC_QA = false; + int CEMC_VERBOSITY = 0; +} // namespace Enable + +namespace G4CEMC +{ + int Min_cemc_layer = 1; + int Max_cemc_layer = 1; + + // Digitization (default photon digi): + RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kSimple_photon_digitization; + // RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kNo_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 + + // set a default value for SPACAL configuration + // // 1D azimuthal projective SPACAL (fast) + //int Cemc_spacal_configuration = PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal; + // 2D azimuthal projective SPACAL (slow) + int Cemc_spacal_configuration = PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal; + + enum enu_Cemc_clusterizer + { + kCemcGraphClusterizer, + + kCemcTemplateClusterizer + }; + + //! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky + enu_Cemc_clusterizer Cemc_clusterizer = kCemcTemplateClusterizer; + //! graph clusterizer, RawClusterBuilderGraph + //enu_Cemc_clusterizer Cemc_clusterizer = kCemcGraphClusterizer; + +} // namespace G4CEMC + +// black hole parameters are set in CEmc function +// needs a dummy argument to play with current G4Setup_sPHENIX.C +void CEmcInit(const int i = 0) +{ +} + +//! EMCal main setup macro +double +CEmc(PHG4Reco *g4Reco, double radius, const int crossings) +{ + if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) + { + return CEmc_1DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ crossings); + } + else if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) + { + return CEmc_2DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ crossings); + } + else + { + std::cout + << "G4_CEmc_Spacal.C::CEmc - Fatal Error - unrecognized SPACAL configuration #" + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << std::endl; + exit(-1); + return 0; + } +} + +//! EMCal setup macro - 1D azimuthal projective SPACAL +double +CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::CEMC_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::CEMC_OVERLAPCHECK; + + double emc_inner_radius = 95.; // emc inner radius from engineering drawing + double cemcthickness = 12.7; + double emc_outer_radius = emc_inner_radius + cemcthickness; // outer radius + + if (radius > emc_inner_radius) + { + cout << "inconsistency: pstof outer radius: " << radius + << " larger than emc inner radius: " << emc_inner_radius + << endl; + gSystem->Exit(-1); + } + + // boundary check + if (radius > emc_inner_radius - 1.5 - no_overlapp) + { + cout << "G4_CEmc_Spacal.C::CEmc() - expect radius < " << emc_inner_radius - 1.5 - no_overlapp << " to install SPACAL" << endl; + exit(1); + } + radius = emc_inner_radius - 1.5 - no_overlapp; + + // 1.5cm thick teflon as an approximation for EMCAl light collection + electronics (10% X0 total estimated) + PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); + cyl->SuperDetector("CEMC_ELECTRONICS"); + cyl->set_double_param("radius", radius); + cyl->set_string_param("material", "G4_TEFLON"); + cyl->set_double_param("thickness", 1.5); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + + radius += 1.5; + radius += no_overlapp; + + int ilayer = G4CEMC::Min_cemc_layer; + PHG4SpacalSubsystem *cemc = new PHG4SpacalSubsystem("CEMC", ilayer); + cemc->set_double_param("radius", emc_inner_radius); + cemc->set_double_param("thickness", cemcthickness); + + cemc->SetActive(); + cemc->SuperDetector("CEMC"); + if (AbsorberActive) cemc->SetAbsorberActive(); + cemc->OverlapCheck(OverlapCheck); + + g4Reco->registerSubsystem(cemc); + + if (ilayer > G4CEMC::Max_cemc_layer) + { + cout << "layer discrepancy, current layer " << ilayer + << " max cemc layer: " << G4CEMC::Max_cemc_layer << endl; + } + + radius += cemcthickness; + radius += no_overlapp; + + // 0.5cm thick Stainless Steel as an approximation for EMCAl support system + cyl = new PHG4CylinderSubsystem("CEMC_SPT", 0); + cyl->SuperDetector("CEMC_SPT"); + cyl->set_double_param("radius", radius); + cyl->set_string_param("material", "SS310"); // SS310 Stainless Steel + cyl->set_double_param("thickness", 0.5); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + radius += 0.5; + // this is the z extend and outer radius of the support structure and therefore the z extend + // and radius of the surrounding black holes + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 149.47); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -149.47); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius); + radius += no_overlapp; + + return radius; +} + +//! 2D full projective SPACAL +double +CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::CEMC_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::CEMC_OVERLAPCHECK; + + double emc_inner_radius = 92; // emc inner radius from engineering drawing + double cemcthickness = 24.00000 - no_overlapp; + + //max radius is 116 cm; + double emc_outer_radius = emc_inner_radius + cemcthickness; // outer radius + assert(emc_outer_radius < 116); + + if (radius > emc_inner_radius) + { + cout << "inconsistency: preshower radius+thickness: " << radius + << " larger than emc inner radius: " << emc_inner_radius << endl; + gSystem->Exit(-1); + } + + // the radii are only to determined the thickness of the cemc + radius = emc_inner_radius; + + // 1.5cm thick teflon as an approximation for EMCAl light collection + electronics (10% X0 total estimated) + PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); + cyl->set_double_param("radius", radius); + cyl->set_string_param("material", "G4_TEFLON"); + cyl->set_double_param("thickness", 1.5 - no_overlapp); + cyl->SuperDetector("CEMC_ELECTRONICS"); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + + radius += 1.5; + cemcthickness -= 1.5 + no_overlapp; + + // 0.5cm thick Stainless Steel as an approximation for EMCAl support system + cyl = new PHG4CylinderSubsystem("CEMC_SPT", 0); + cyl->SuperDetector("CEMC_SPT"); + cyl->set_double_param("radius", radius + cemcthickness - 0.5); + cyl->set_string_param("material", "SS310"); // SS310 Stainless Steel + cyl->set_double_param("thickness", 0.5 - no_overlapp); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + + // this is the z extend and outer radius of the support structure and therefore the z extend + // and radius of the surrounding black holes + double sptlen = PHG4Utils::GetLengthForRapidityCoverage(radius + cemcthickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, sptlen); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -sptlen); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius + cemcthickness); + + cemcthickness -= 0.5 + no_overlapp; + + int ilayer = 0; + PHG4SpacalSubsystem *cemc; + + cemc = new PHG4SpacalSubsystem("CEMC", ilayer); + + cemc->set_int_param("virualize_fiber", 0); + cemc->set_int_param("azimuthal_seg_visible", 1); + cemc->set_int_param("construction_verbose", 0); + cemc->Verbosity(0); + + cemc->UseCalibFiles(PHG4DetectorSubsystem::xml); + cemc->SetCalibrationFileDir(string(getenv("CALIBRATIONROOT")) + string("/CEMC/Geometry_2018ProjTilted/")); + cemc->set_double_param("radius", radius); // overwrite minimal radius + cemc->set_double_param("thickness", cemcthickness); // overwrite thickness + + cemc->SetActive(); + cemc->SuperDetector("CEMC"); + if (AbsorberActive) cemc->SetAbsorberActive(); + cemc->OverlapCheck(OverlapCheck); + + g4Reco->registerSubsystem(cemc); + + if (ilayer > G4CEMC::Max_cemc_layer) + { + cout << "layer discrepancy, current layer " << ilayer + << " max cemc layer: " << G4CEMC::Max_cemc_layer << endl; + } + + radius += cemcthickness; + radius += no_overlapp; + + return radius; +} + +void CEMC_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) + { + PHG4CylinderCellReco *cemc_cells = new PHG4CylinderCellReco("CEMCCYLCELLRECO"); + cemc_cells->Detector("CEMC"); + cemc_cells->Verbosity(verbosity); + for (int i = G4CEMC::Min_cemc_layer; i <= G4CEMC::Max_cemc_layer; i++) + { + // cemc_cells->etaphisize(i, 0.024, 0.024); + const double radius = 95; + cemc_cells->cellsize(i, 2 * M_PI / 256. * radius, 2 * M_PI / 256. * radius); + } + se->registerSubsystem(cemc_cells); + } + else if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) + { + PHG4FullProjSpacalCellReco *cemc_cells = new PHG4FullProjSpacalCellReco("CEMCCYLCELLRECO"); + cemc_cells->Detector("CEMC"); + cemc_cells->Verbosity(verbosity); + cemc_cells->get_light_collection_model().load_data_file( + string(getenv("CALIBRATIONROOT")) + string("/CEMC/LightCollection/Prototype3Module.xml"), + "data_grid_light_guide_efficiency", "data_grid_fiber_trans"); + se->registerSubsystem(cemc_cells); + } + else + { + cout << "G4_CEmc_Spacal.C::CEmc - Fatal Error - unrecognized SPACAL configuration #" + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << endl; + gSystem->Exit(-1); + return; + } + + return; +} + +void CEMC_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + RawTowerBuilder *TowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); + TowerBuilder->Detector("CEMC"); + TowerBuilder->set_sim_tower_node_prefix("SIM"); + TowerBuilder->Verbosity(verbosity); + se->registerSubsystem(TowerBuilder); + + double sampling_fraction = 1; + if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) + { + sampling_fraction = 0.0234335; //from production:/gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.3/single_particle/spacal1d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root + } + else if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) + { + // sampling_fraction = 0.02244; //from production: /gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.3/single_particle/spacal2d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root + // sampling_fraction = 2.36081e-02; //from production: /gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.5/single_particle/spacal2d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root + // sampling_fraction = 1.90951e-02; // 2017 Tilt porjective SPACAL, 8 GeV photon, eta = 0.3 - 0.4 + sampling_fraction = 2e-02; // 2017 Tilt porjective SPACAL, tower-by-tower calibration + } + else + { + std::cout + << "G4_CEmc_Spacal.C::CEMC_Towers - Fatal Error - unrecognized SPACAL configuration #" + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << std::endl; + exit(-1); + return; + } + + const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition + + bool doSimple = true; + + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); + TowerDigitizer->Detector("CEMC"); + TowerDigitizer->Verbosity(verbosity); + TowerDigitizer->set_digi_algorithm(G4CEMC::TowerDigi); + TowerDigitizer->set_variable_pedestal(true); //read ped central and width from calibrations file comment next 2 lines if true + // TowerDigitizer->set_pedstal_central_ADC(0); + // TowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting + TowerDigitizer->set_photonelec_ADC(1); //not simulating ADC discretization error + TowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); + TowerDigitizer->set_variable_zero_suppression(true); //read zs values from calibrations file comment next line if true + // TowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting + TowerDigitizer->GetParameters().ReadFromFile("CEMC", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/CEMC/TowerCalibCombinedParams_2020/")); // calibration database + + + // tower digitizer settings for doing decalibration -JEF May '22 + + TowerDigitizer->set_UseConditionsDB(false); + + //--------------- + // if conditions db is enabled in the line above, how to handle filename + // needs decided see below examples (TBD by Chris P) + //------------------ + // Some standard decal files specification where full decal is happening + // uses the same db file accessor api as for TowerCalib and thus format + // (format can change along with accessor internals, but user + // needs to know/give a readable format file). + // Decal tower by tow. factors in file are apply as a multiplicative + // factor to raw energy/adc see below about adc level + //--- + // TowerDigitizer->set_DoTowerDecal(true,"emcal_corr_sec12bands.root",false); + // TowerDigitizer->set_DoTowerDecal(true,"emcal_corr1_29.root",false); + TowerDigitizer->set_DoTowerDecal(true,"emcal_newPatternCinco.root",false); + + // third parameter (doInverse) specifies if you want + //to instead apply the reciprocal of the TowbyTow factors + // in the db file as a multiplicative factor + // here is an example of that + //TowerDigitizer->set_DoTowerDecal(true,"emcal_newPatternCinco.root",true); + + // in actuality we do not actually suffer from digitization + // effects on the entire pulse amplitude but rather sample + // ~12-14 times (pulse/pedestal itself about ~8 times) + // and both the pedestal and pulse are extracted as continuous + // (or near continous) quantities. In the near future the + // simple ("old fashioned") digitization scheme needs to implement + // a full sim of the pulse extraction procedure. + // therefore for now when running in decal mode, as a temporary + // more realistic approximation of this procedure, we change the + // energy response to continuous adc/energy values rather than digitized. + // this behavior currently only occurs if running in the decal mode + // .... + // If you want to apply this non-digitizing part of the code + // WITHOUT mod'ing the energy (ie w/o decal), call the DoDecal function without + // specifiying a filename as in the following example + // + // TowerDigitizer->set_DoTowerDecal(true, "",false); + + se->registerSubsystem(TowerDigitizer); + + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); + TowerCalibration->Detector("CEMC"); + TowerCalibration->Verbosity(verbosity); + + + + + if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) + { + if (G4CEMC::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + // just use sampling fraction set previously + TowerCalibration->set_calib_const_GeV_ADC(1.0 / sampling_fraction); + } + else + { + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV); + TowerCalibration->set_pedstal_ADC(0); + } + } + else if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) + { + if (G4CEMC::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + // just use sampling fraction set previously + TowerCalibration->set_calib_const_GeV_ADC(1.0 / sampling_fraction); + } + else + { + + if (!doSimple) + { + + + //for tower by tower cal + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kTower_by_tower_calibration); + TowerCalibration->GetCalibrationParameters().ReadFromFile("CEMC", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/CEMC/TowerCalibCombinedParams_2020/")); // calibration database + TowerCalibration->set_variable_GeV_ADC(true); //read GeV per ADC from calibrations file comment next line if true + // TowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / 0.9715); // overall energy scale based on 4-GeV photon simulations + TowerCalibration->set_variable_pedestal(true); //read pedestals from calibrations file comment next line if true + // TowerCalibration->set_pedstal_ADC(0); + /////////////////////////// + + } + else // dosimple + { + + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kDbfile_tbt_gain_corr); + TowerCalibration->set_UseConditionsDB(false); + + // Some standard db calo calibration files specification + // + // uses the db file accessor api and thus format + // (format can change along with accessor internals, but user + // needs to know/give a readable format file). + // Decal tower by tow. factors in file are apply as a multiplicative + + //TowerCalibration->set_CalibrationFileName("emcal_corr1_29.root"); + //TowerCalibration->set_CalibrationFileName("inv_emcal_corr_sec12bands.root"); + TowerCalibration->set_CalibrationFileName("emcal_corr1_00.root"); + //TowerCalibration->set_CalibrationFileName("emcal_newPatternCinco.root"); + + // since for this loop we avert the tower by tower improvements + // in the kTower_by_tower xml-file based cemc calibration + // which can be reimplemented in the new tower by tower dbfile format + // but for now we make a single overall reduction factor of 0.87 + // that matches the same average calibration correction + // changing the following line to the one after it. -JEF + // TowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / 0.9715); // overall energy scale based on 4-GeV photon simulations + TowerCalibration->set_calib_const_GeV_ADC(0.87 * 1./ photoelectron_per_GeV / 0.9715); // overall energy scale based on 4-GeV photon simulations + TowerCalibration->set_pedstal_ADC(0); + // note that in the TowerCalibration object, the pedestal subtraction is no + // longer applied, the above line simply follows suit with all the other + // "calib_algorithms" on that object + + /////////////////////////// + } + + } + } + else + { + cout << "G4_CEmc_Spacal.C::CEMC_Towers - Fatal Error - unrecognized SPACAL configuration #" + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << endl; + gSystem->Exit(-1); + return; + } + se->registerSubsystem(TowerCalibration); + + return; +} + +void CEMC_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below + std::string emc_prof = getenv("CALIBRATIONROOT"); + emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder->LoadProfile(emc_prof); + se->registerSubsystem(ClusterBuilder); + } + else if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcGraphClusterizer) + { + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "CEMC_Clusters - unknown clusterizer setting!" << endl; + exit(1); + } + + RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC"); + + clusterCorrection->Get_eclus_CalibrationParameters().ReadFromFile("CEMC_RECALIB", "xml", 0, 0, + //raw location + string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + + clusterCorrection->Get_ecore_CalibrationParameters().ReadFromFile("CEMC_ECORE_RECALIB", "xml", 0, 0, + //raw location + string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + + clusterCorrection->Verbosity(verbosity); + se->registerSubsystem(clusterCorrection); + + return; +} +void CEMC_Eval(const std::string &outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("CEMCEVALUATOR", "CEMC", outputfile); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + +void CEMC_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + QAG4SimulationCalorimeter *qa = new QAG4SimulationCalorimeter("CEMC"); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + return; +} + +#endif diff --git a/calibrations/calo/tower_slope_macro/G4_HcalIn_ref.C b/calibrations/calo/tower_slope_macro/G4_HcalIn_ref.C new file mode 100644 index 000000000..c1568be24 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/G4_HcalIn_ref.C @@ -0,0 +1,355 @@ +//Inner HCal reconstruction macro +#ifndef MACRO_G4HCALINREF_C +#define MACRO_G4HCALINREF_C + +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libqa_modules.so) + +void HCalInner_SupportRing(PHG4Reco *g4Reco); + +namespace Enable +{ + bool HCALIN = false; + bool HCALIN_ABSORBER = false; + bool HCALIN_OVERLAPCHECK = false; + bool HCALIN_CELL = false; + bool HCALIN_TOWER = false; + bool HCALIN_CLUSTER = false; + bool HCALIN_EVAL = false; + bool HCALIN_QA = false; + bool HCALIN_SUPPORT = false; + int HCALIN_VERBOSITY = 0; +} // namespace Enable + +namespace G4HCALIN +{ + double support_ring_outer_radius = 178.0 - 0.001; + double support_ring_z_ring2 = (2150 + 2175) / 2. / 10.; + double dz = 25. / 10.; + + //Inner HCal absorber material selector: + //false - old version, absorber material is SS310 + //true - default Choose if you want Aluminum + bool inner_hcal_material_Al = true; + + int inner_hcal_eic = 0; + + // Digitization (default photon digi): + RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kSimple_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 + + enum enu_HCalIn_clusterizer + { + kHCalInGraphClusterizer, + + kHCalInTemplateClusterizer + }; + + //! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky + enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInTemplateClusterizer; + //! graph clusterizer, RawClusterBuilderGraph + //enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInGraphClusterizer; +} // namespace G4HCALIN + +// Init is called by G4Setup.C +void HCalInnerInit(const int iflag = 0) +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4HCALIN::support_ring_outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4HCALIN::support_ring_z_ring2 + G4HCALIN::dz / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4HCALIN::support_ring_z_ring2 - G4HCALIN::dz / 2.); + if (iflag == 1) + { + G4HCALIN::inner_hcal_eic = 1; + } +} + +double HCalInner(PHG4Reco *g4Reco, + double radius, + const int crossings) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::HCALIN_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::HCALIN_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + + // all sizes are in cm! + PHG4InnerHcalSubsystem *hcal = new PHG4InnerHcalSubsystem("HCALIN"); + // these are the parameters you can change with their default settings + // hcal->set_string_param("material","SS310"); + if (G4HCALIN::inner_hcal_material_Al) + { + if (verbosity > 0) + { + cout << "HCalInner - construct inner HCal absorber with G4_Al" << endl; + } + hcal->set_string_param("material", "G4_Al"); + } + else + { + if (verbosity > 0) + { + cout << "HCalInner - construct inner HCal absorber with SS310" << endl; + } + hcal->set_string_param("material", "SS310"); + } + // hcal->set_double_param("inner_radius", 117.27); + //----------------------------------------- + // the light correction can be set in a single call + // hcal->set_double_param("light_balance_inner_corr", NAN); + // hcal->set_double_param("light_balance_inner_radius", NAN); + // hcal->set_double_param("light_balance_outer_corr", NAN); + // hcal->set_double_param("light_balance_outer_radius", NAN); + // hcal->SetLightCorrection(NAN,NAN,NAN,NAN); + //----------------------------------------- + // hcal->set_double_param("outer_radius", 134.42); + // hcal->set_double_param("place_x", 0.); + // hcal->set_double_param("place_y", 0.); + // hcal->set_double_param("place_z", 0.); + // hcal->set_double_param("rot_x", 0.); + // hcal->set_double_param("rot_y", 0.); + // hcal->set_double_param("rot_z", 0.); + // hcal->set_double_param("scinti_eta_coverage", 1.1); + // hcal->set_double_param("scinti_gap_neighbor", 0.1); + // hcal->set_double_param("scinti_inner_gap", 0.85); + // hcal->set_double_param("scinti_outer_gap", 1.22 * (5.0 / 4.0)); + // hcal->set_double_param("scinti_outer_radius", 133.3); + // hcal->set_double_param("scinti_tile_thickness", 0.7); + // hcal->set_double_param("size_z", 175.94 * 2); + // hcal->set_double_param("steplimits", NAN); + // hcal->set_double_param("tilt_angle", 36.15); + + // hcal->set_int_param("light_scint_model", 1); + // hcal->set_int_param("ncross", 0); + // hcal->set_int_param("n_towers", 64); + // hcal->set_int_param("n_scinti_plates_per_tower", 4); + // hcal->set_int_param("n_scinti_tiles", 12); + + // hcal->set_string_param("material", "SS310"); + + hcal->SetActive(); + hcal->SuperDetector("HCALIN"); + if (AbsorberActive) + { + hcal->SetAbsorberActive(); + } + hcal->OverlapCheck(OverlapCheck); + + g4Reco->registerSubsystem(hcal); + + radius = hcal->get_double_param("outer_radius"); + + HCalInner_SupportRing(g4Reco); + + radius += no_overlapp; + return radius; +} + +//! A rough version of the inner HCal support ring, from Richie's CAD drawing. - Jin +void HCalInner_SupportRing(PHG4Reco *g4Reco) +{ + bool AbsorberActive = Enable::SUPPORT || Enable::HCALIN_SUPPORT; + + const double z_ring1 = (2025 + 2050) / 2. / 10.; + const double innerradius_sphenix = 116.; + const double innerradius_ephenix_hadronside = 138.; + const double z_rings[] = + {-G4HCALIN::support_ring_z_ring2, -z_ring1, z_ring1, G4HCALIN::support_ring_z_ring2}; + + PHG4CylinderSubsystem *cyl; + + for (int i = 0; i < 4; i++) + { + double innerradius = innerradius_sphenix; + if (z_rings[i] > 0 && G4HCALIN::inner_hcal_eic == 1) + { + innerradius = innerradius_ephenix_hadronside; + } + cyl = new PHG4CylinderSubsystem("HCALIN_SPT_N1", i); + cyl->set_double_param("place_z", z_rings[i]); + cyl->SuperDetector("HCALIN_SPT"); + cyl->set_double_param("radius", innerradius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4HCALIN::dz); + cyl->set_string_param("material", "SS310"); + cyl->set_double_param("thickness", G4HCALIN::support_ring_outer_radius - innerradius); + if (AbsorberActive) + { + cyl->SetActive(); + } + g4Reco->registerSubsystem(cyl); + } + + return; +} + +void HCALInner_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALIN_CELLRECO"); + hc->Detector("HCALIN"); + // hc->Verbosity(2); + // check for energy conservation - needs modified "infinite" timing cuts + // 0-999999999 + // hc->checkenergy(); + // timing cuts with their default settings + // hc->set_double_param("tmin",0.); + // hc->set_double_param("tmax",60.0); + // or all at once: + // hc->set_timing_window(0.0,60.0); + // this sets all cells to a fixed energy for debugging + // hc->set_fixed_energy(1.); + se->registerSubsystem(hc); + + return; +} + +void HCALInner_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalInRawTowerBuilder"); + TowerBuilder->Detector("HCALIN"); + TowerBuilder->set_sim_tower_node_prefix("SIM"); + // this sets specific decalibration factors + // for a given cell + // TowerBuilder->set_cell_decal_factor(1,10,0.1); + // for a whole tower + // TowerBuilder->set_tower_decal_factor(0,10,0.2); + TowerBuilder->Verbosity(verbosity); + se->registerSubsystem(TowerBuilder); + + // From 2016 Test beam sim + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HcalInRawTowerDigitizer"); + TowerDigitizer->Detector("HCALIN"); + // TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); + TowerDigitizer->set_digi_algorithm(G4HCALIN::TowerDigi); + TowerDigitizer->set_pedstal_central_ADC(0); + TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update + TowerDigitizer->set_photonelec_ADC(32. / 5.); + TowerDigitizer->set_photonelec_yield_visible_GeV(32. / 5 / (0.4e-3)); + TowerDigitizer->set_zero_suppression_ADC(-0); // no-zero suppression + se->registerSubsystem(TowerDigitizer); + + //Default sampling fraction for SS310 + double visible_sample_fraction_HCALIN = 0.0631283; //, /gpfs/mnt/gpfs04/sphenix/user/jinhuang/prod_analysis/hadron_shower_res_nightly/./G4Hits_sPHENIX_pi-_eta0_16GeV-0000.root_qa.rootQA_Draw_HCALIN_G4Hit.pdf + + if (G4HCALIN::inner_hcal_material_Al) visible_sample_fraction_HCALIN = 0.162166; //for "G4_Al", Abhisek Sen + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HcalInRawTowerCalibration"); + TowerCalibration->Detector("HCALIN"); + // TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); + // TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); + + // TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kDbfile_tbt_gain_corr); + TowerCalibration->set_UseConditionsDB(false); + // see documentation in github/jtaou/coresoft + // ...[calib/towerslope] /macros/G4_CEmc_Spacal.C + // for more info about TowerCalibration dbfile mode + + // TowerCalibration->set_CalibrationFileName("HCALIN_GainsCalib1.22.txt"); + TowerCalibration->set_CalibrationFileName("HCALIN_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt"); + + + if (G4HCALIN::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + // 0.176 extracted from electron sims (edep(scintillator)/edep(total)) + TowerCalibration->set_calib_const_GeV_ADC(1. / 0.176); + } + else + { + TowerCalibration->set_calib_const_GeV_ADC(0.4e-3 / visible_sample_fraction_HCALIN); + } + TowerCalibration->set_pedstal_ADC(0); + se->registerSubsystem(TowerCalibration); + + return; +} + +void HCALInner_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4HCALIN::HCalIn_clusterizer == G4HCALIN::kHCalInTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); + ClusterBuilder->Detector("HCALIN"); + ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else if (G4HCALIN::HCalIn_clusterizer == G4HCALIN::kHCalInGraphClusterizer) + { + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("HcalInRawClusterBuilderGraph"); + ClusterBuilder->Detector("HCALIN"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "HCalIn_Clusters - unknown clusterizer setting!" << endl; + exit(1); + } + return; +} + +void HCALInner_Eval(const std::string &outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("HCALINEVALUATOR", "HCALIN", outputfile); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + +void HCALInner_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::HCALIN_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + QAG4SimulationCalorimeter *qa = new QAG4SimulationCalorimeter("HCALIN"); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + return; +} + +#endif diff --git a/calibrations/calo/tower_slope_macro/G4_HcalOut_ref.C b/calibrations/calo/tower_slope_macro/G4_HcalOut_ref.C new file mode 100644 index 000000000..d06d44bb0 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/G4_HcalOut_ref.C @@ -0,0 +1,284 @@ +#ifndef MACRO_G4HCALOUTREF_C +#define MACRO_G4HCALOUTREF_C + +#include +#include + +#include +#include + +#include +#include + +#include + +#include + +#include +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool HCALOUT = false; + bool HCALOUT_ABSORBER = false; + bool HCALOUT_OVERLAPCHECK = false; + bool HCALOUT_CELL = false; + bool HCALOUT_TOWER = false; + bool HCALOUT_CLUSTER = false; + bool HCALOUT_EVAL = false; + bool HCALOUT_QA = false; + int HCALOUT_VERBOSITY = 0; +} // namespace Enable + +namespace G4HCALOUT +{ + double outer_radius = 264.71; + double size_z = 304.91 * 2; + + // Digitization (default photon digi): + RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kSimple_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 + + enum enu_HCalOut_clusterizer + { + kHCalOutGraphClusterizer, + kHCalOutTemplateClusterizer + }; + + //! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky + enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutTemplateClusterizer; + //! graph clusterizer, RawClusterBuilderGraph + //enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutGraphClusterizer; +} // namespace G4HCALOUT + +// Init is called by G4Setup.C +void HCalOuterInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4HCALOUT::outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4HCALOUT::size_z / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4HCALOUT::size_z / 2.); +} + +double HCalOuter(PHG4Reco *g4Reco, + double radius, + const int crossings) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::HCALOUT_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::HCALOUT_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + PHG4OuterHcalSubsystem *hcal = new PHG4OuterHcalSubsystem("HCALOUT"); + // hcal->set_double_param("inner_radius", 183.3); + //----------------------------------------- + // the light correction can be set in a single call + // hcal->set_double_param("light_balance_inner_corr", NAN); + // hcal->set_double_param("light_balance_inner_radius", NAN); + // hcal->set_double_param("light_balance_outer_corr", NAN); + // hcal->set_double_param("light_balance_outer_radius", NAN); + // hcal->set_double_param("magnet_cutout_radius", 195.31); + // hcal->set_double_param("magnet_cutout_scinti_radius", 195.96); + // hcal->SetLightCorrection(NAN,NAN,NAN,NAN); + //----------------------------------------- + // hcal->set_double_param("outer_radius", G4HCALOUT::outer_radius); + // hcal->set_double_param("place_x", 0.); + // hcal->set_double_param("place_y", 0.); + // hcal->set_double_param("place_z", 0.); + // hcal->set_double_param("rot_x", 0.); + // hcal->set_double_param("rot_y", 0.); + // hcal->set_double_param("rot_z", 0.); + // hcal->set_double_param("scinti_eta_coverage", 1.1); + // hcal->set_double_param("scinti_gap", 0.85); + // hcal->set_double_param("scinti_gap_neighbor", 0.1); + // hcal->set_double_param("scinti_inner_radius",183.89); + // hcal->set_double_param("scinti_outer_radius",263.27); + // hcal->set_double_param("scinti_tile_thickness", 0.7); + // hcal->set_double_param("size_z", G4HCALOUT::size_z); + // hcal->set_double_param("steplimits", NAN); + // hcal->set_double_param("tilt_angle", -11.23); + + // hcal->set_int_param("light_scint_model", 1); + // hcal->set_int_param("magnet_cutout_first_scinti", 8); + // hcal->set_int_param("ncross", 0); + // hcal->set_int_param("n_towers", 64); + // hcal->set_int_param("n_scinti_plates_per_tower", 5); + // hcal->set_int_param("n_scinti_tiles", 12); + + // hcal->set_string_param("material", "Steel_1006"); + + hcal->SetActive(); + hcal->SuperDetector("HCALOUT"); + if (AbsorberActive) + { + hcal->SetAbsorberActive(); + } + hcal->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(hcal); + + radius = hcal->get_double_param("outer_radius"); + + radius += no_overlapp; + + return radius; +} + +void HCALOuter_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALOUT_CELLRECO"); + hc->Detector("HCALOUT"); + // hc->Verbosity(2); + // check for energy conservation - needs modified "infinite" timing cuts + // 0-999999999 + // hc->checkenergy(); + // timing cuts with their default settings + // hc->set_double_param("tmin",0.); + // hc->set_double_param("tmax",60.0); + // or all at once: + // hc->set_timing_window(0.0,60.0); + // this sets all cells to a fixed energy for debugging + // hc->set_fixed_energy(1.); + se->registerSubsystem(hc); + + return; +} + +void HCALOuter_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalOutRawTowerBuilder"); + TowerBuilder->Detector("HCALOUT"); + TowerBuilder->set_sim_tower_node_prefix("SIM"); + // this sets specific decalibration factors + // for a given cell + // TowerBuilder->set_cell_decal_factor(1,10,0.1); + // for a whole tower + // TowerBuilder->set_tower_decal_factor(0,10,0.2); + // TowerBuilder->set_cell_decal_factor(1,10,0.1); + // TowerBuilder->set_tower_decal_factor(0,10,0.2); + TowerBuilder->Verbosity(verbosity); + se->registerSubsystem(TowerBuilder); + + // From 2016 Test beam sim + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HcalOutRawTowerDigitizer"); + TowerDigitizer->Detector("HCALOUT"); + // TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); + TowerDigitizer->set_digi_algorithm(G4HCALOUT::TowerDigi); + TowerDigitizer->set_pedstal_central_ADC(0); + TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update + TowerDigitizer->set_photonelec_ADC(16. / 5.); + TowerDigitizer->set_photonelec_yield_visible_GeV(16. / 5 / (0.2e-3)); + TowerDigitizer->set_zero_suppression_ADC(-0); // no-zero suppression + se->registerSubsystem(TowerDigitizer); + + const double visible_sample_fraction_HCALOUT = 3.38021e-02; // /gpfs/mnt/gpfs04/sphenix/user/jinhuang/prod_analysis/hadron_shower_res_nightly/./G4Hits_sPHENIX_pi-_eta0_16GeV.root_qa.rootQA_Draw_HCALOUT_G4Hit.pdf + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HcalOutRawTowerCalibration"); + TowerCalibration->Detector("HCALOUT"); + // TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); + // TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); + + //TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + + + // see documentation in github/jtaou/coresoft + // ...[calib/towerslope] /macros/G4_CEmc_Spacal.C + // for more info about TowerCalibration dbfile mode + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kDbfile_tbt_gain_corr); + TowerCalibration->set_UseConditionsDB(false); + // + //TowerCalibration->set_CalibrationFileName("HCALOUT_GainsCalib1.22.txt"); + TowerCalibration->set_CalibrationFileName("HCALOUT_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt"); + + + if (G4HCALOUT::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + // 0.033 extracted from electron sims (edep(scintillator)/edep(total)) + TowerCalibration->set_calib_const_GeV_ADC(1. / 0.033); + } + else + { + TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / visible_sample_fraction_HCALOUT); + } + TowerCalibration->set_pedstal_ADC(0); + se->registerSubsystem(TowerCalibration); + + return; +} + +void HCALOuter_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4HCALOUT::HCalOut_clusterizer == G4HCALOUT::kHCalOutTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalOutRawClusterBuilderTemplate"); + ClusterBuilder->Detector("HCALOUT"); + ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else if (G4HCALOUT::HCalOut_clusterizer == G4HCALOUT::kHCalOutGraphClusterizer) + { + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("HcalOutRawClusterBuilderGraph"); + ClusterBuilder->Detector("HCALOUT"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "HCALOuter_Clusters - unknown clusterizer setting!" << endl; + exit(1); + } + + return; +} + +void HCALOuter_Eval(const std::string &outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("HCALOUTEVALUATOR", "HCALOUT", outputfile); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + +void HCALOuter_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + QAG4SimulationCalorimeter *qa = new QAG4SimulationCalorimeter("HCALOUT"); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + return; +} + +#endif diff --git a/calibrations/calo/tower_slope_macro/HCALIN_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt b/calibrations/calo/tower_slope_macro/HCALIN_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt new file mode 100644 index 000000000..aba66f7cb --- /dev/null +++ b/calibrations/calo/tower_slope_macro/HCALIN_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt @@ -0,0 +1,1536 @@ +0 0 1.0 +0 1 1.0 +0 2 1.0 +0 3 1.0 +0 4 1.0 +0 5 1.0 +0 6 1.0 +0 7 1.0 +0 8 1.0 +0 9 1.0 +0 10 1.0 +0 11 1.0 +0 12 1.0 +0 13 1.0 +0 14 1.0 +0 15 1.0 +0 16 1.0 +0 17 1.0 +0 18 1.0 +0 19 1.0 +0 20 1.0 +0 21 1.0 +0 22 1.0 +0 23 1.0 +0 24 1.0 +0 25 1.0 +0 26 1.0 +0 27 1.0 +0 28 1.0 +0 29 1.0 +0 30 1.0 +0 31 1.0 +0 32 1.0 +0 33 1.0 +0 34 1.0 +0 35 1.0 +0 36 1.0 +0 37 1.0 +0 38 1.0 +0 39 1.0 +0 40 1.0 +0 41 1.0 +0 42 1.0 +0 43 1.0 +0 44 1.0 +0 45 1.0 +0 46 1.0 +0 47 1.0 +0 48 1.0 +0 49 1.0 +0 50 1.0 +0 51 1.0 +0 52 1.0 +0 53 1.0 +0 54 1.0 +0 55 1.0 +0 56 1.0 +0 57 1.0 +0 58 1.0 +0 59 1.0 +0 60 1.0 +0 61 1.0 +0 62 1.0 +0 63 1.0 +1 0 1.0 +1 1 1.0 +1 2 1.0 +1 3 1.0 +1 4 1.0 +1 5 1.0 +1 6 1.0 +1 7 1.0 +1 8 1.0 +1 9 1.0 +1 10 1.0 +1 11 1.0 +1 12 1.0 +1 13 1.0 +1 14 1.0 +1 15 1.0 +1 16 1.0 +1 17 1.0 +1 18 1.0 +1 19 1.0 +1 20 1.0 +1 21 1.0 +1 22 1.0 +1 23 1.0 +1 24 1.0 +1 25 1.0 +1 26 1.0 +1 27 1.0 +1 28 1.0 +1 29 1.0 +1 30 1.0 +1 31 1.0 +1 32 1.0 +1 33 1.0 +1 34 1.0 +1 35 1.0 +1 36 1.0 +1 37 1.0 +1 38 1.0 +1 39 1.0 +1 40 1.0 +1 41 1.0 +1 42 1.0 +1 43 1.0 +1 44 1.0 +1 45 1.0 +1 46 1.0 +1 47 1.0 +1 48 1.0 +1 49 1.0 +1 50 1.0 +1 51 1.0 +1 52 1.0 +1 53 1.0 +1 54 1.0 +1 55 1.0 +1 56 1.0 +1 57 1.0 +1 58 1.0 +1 59 1.0 +1 60 1.0 +1 61 1.0 +1 62 1.0 +1 63 1.0 +2 0 1.0 +2 1 1.0 +2 2 1.0 +2 3 1.0 +2 4 1.0 +2 5 1.0 +2 6 1.0 +2 7 1.0 +2 8 1.0 +2 9 1.0 +2 10 1.0 +2 11 1.0 +2 12 1.0 +2 13 1.0 +2 14 1.0 +2 15 1.0 +2 16 1.0 +2 17 1.0 +2 18 1.0 +2 19 1.0 +2 20 1.0 +2 21 1.0 +2 22 1.0 +2 23 1.0 +2 24 1.0 +2 25 1.0 +2 26 1.0 +2 27 1.0 +2 28 1.0 +2 29 1.0 +2 30 1.0 +2 31 1.0 +2 32 1.0 +2 33 1.0 +2 34 1.0 +2 35 1.0 +2 36 1.0 +2 37 1.0 +2 38 1.0 +2 39 1.0 +2 40 1.0 +2 41 1.0 +2 42 1.0 +2 43 1.0 +2 44 1.0 +2 45 1.0 +2 46 1.0 +2 47 1.0 +2 48 1.0 +2 49 1.0 +2 50 1.0 +2 51 1.0 +2 52 1.0 +2 53 1.0 +2 54 1.0 +2 55 1.0 +2 56 1.0 +2 57 1.0 +2 58 1.0 +2 59 1.0 +2 60 1.0 +2 61 1.0 +2 62 1.0 +2 63 1.0 +3 0 1.0 +3 1 1.0 +3 2 1.0 +3 3 1.0 +3 4 1.0 +3 5 1.0 +3 6 1.0 +3 7 1.0 +3 8 1.0 +3 9 1.0 +3 10 1.0 +3 11 1.0 +3 12 1.0 +3 13 1.0 +3 14 1.0 +3 15 1.0 +3 16 1.0 +3 17 1.0 +3 18 1.0 +3 19 1.0 +3 20 1.0 +3 21 1.0 +3 22 1.0 +3 23 1.0 +3 24 1.0 +3 25 1.0 +3 26 1.0 +3 27 1.0 +3 28 1.0 +3 29 1.0 +3 30 1.0 +3 31 1.0 +3 32 1.0 +3 33 1.0 +3 34 1.0 +3 35 1.0 +3 36 1.0 +3 37 1.0 +3 38 1.0 +3 39 1.0 +3 40 1.0 +3 41 1.0 +3 42 1.0 +3 43 1.0 +3 44 1.0 +3 45 1.0 +3 46 1.0 +3 47 1.0 +3 48 1.0 +3 49 1.0 +3 50 1.0 +3 51 1.0 +3 52 1.0 +3 53 1.0 +3 54 1.0 +3 55 1.0 +3 56 1.0 +3 57 1.0 +3 58 1.0 +3 59 1.0 +3 60 1.0 +3 61 1.0 +3 62 1.0 +3 63 1.0 +4 0 1.0 +4 1 1.0 +4 2 1.0 +4 3 1.0 +4 4 1.0 +4 5 1.0 +4 6 1.0 +4 7 1.0 +4 8 1.0 +4 9 1.0 +4 10 1.0 +4 11 1.0 +4 12 1.0 +4 13 1.0 +4 14 1.0 +4 15 1.0 +4 16 1.0 +4 17 1.0 +4 18 1.0 +4 19 1.0 +4 20 1.0 +4 21 1.0 +4 22 1.0 +4 23 1.0 +4 24 1.0 +4 25 1.0 +4 26 1.0 +4 27 1.0 +4 28 1.0 +4 29 1.0 +4 30 1.0 +4 31 1.0 +4 32 1.0 +4 33 1.0 +4 34 1.0 +4 35 1.0 +4 36 1.0 +4 37 1.0 +4 38 1.0 +4 39 1.0 +4 40 1.0 +4 41 1.0 +4 42 1.0 +4 43 1.0 +4 44 1.0 +4 45 1.0 +4 46 1.0 +4 47 1.0 +4 48 1.0 +4 49 1.0 +4 50 1.0 +4 51 1.0 +4 52 1.0 +4 53 1.0 +4 54 1.0 +4 55 1.0 +4 56 1.0 +4 57 1.0 +4 58 1.0 +4 59 1.0 +4 60 1.0 +4 61 1.0 +4 62 1.0 +4 63 1.0 +5 0 1.0 +5 1 1.0 +5 2 1.0 +5 3 1.0 +5 4 1.0 +5 5 1.0 +5 6 1.0 +5 7 1.0 +5 8 1.0 +5 9 1.0 +5 10 1.0 +5 11 1.0 +5 12 1.0 +5 13 1.0 +5 14 1.0 +5 15 1.0 +5 16 1.0 +5 17 1.0 +5 18 1.0 +5 19 1.0 +5 20 1.0 +5 21 1.0 +5 22 1.0 +5 23 1.0 +5 24 1.0 +5 25 1.0 +5 26 1.0 +5 27 1.0 +5 28 1.0 +5 29 1.0 +5 30 1.0 +5 31 1.0 +5 32 1.0 +5 33 1.0 +5 34 1.0 +5 35 1.0 +5 36 1.0 +5 37 1.0 +5 38 1.0 +5 39 1.0 +5 40 1.0 +5 41 1.0 +5 42 1.0 +5 43 1.0 +5 44 1.0 +5 45 1.0 +5 46 1.0 +5 47 1.0 +5 48 1.0 +5 49 1.0 +5 50 1.0 +5 51 1.0 +5 52 1.0 +5 53 1.0 +5 54 1.0 +5 55 1.0 +5 56 1.0 +5 57 1.0 +5 58 1.0 +5 59 1.0 +5 60 1.0 +5 61 1.0 +5 62 1.0 +5 63 1.0 +6 0 1.0 +6 1 1.0 +6 2 1.0 +6 3 1.0 +6 4 1.0 +6 5 1.0 +6 6 1.0 +6 7 1.0 +6 8 1.0 +6 9 1.0 +6 10 1.0 +6 11 1.0 +6 12 1.0 +6 13 1.0 +6 14 1.0 +6 15 1.0 +6 16 1.0 +6 17 1.0 +6 18 1.0 +6 19 1.0 +6 20 1.0 +6 21 1.0 +6 22 1.0 +6 23 1.0 +6 24 1.0 +6 25 1.0 +6 26 1.0 +6 27 1.0 +6 28 1.0 +6 29 1.0 +6 30 1.0 +6 31 1.0 +6 32 1.0 +6 33 1.0 +6 34 1.0 +6 35 1.0 +6 36 1.0 +6 37 1.0 +6 38 1.0 +6 39 1.0 +6 40 1.0 +6 41 1.0 +6 42 1.0 +6 43 1.0 +6 44 1.0 +6 45 1.0 +6 46 1.0 +6 47 1.0 +6 48 1.0 +6 49 1.0 +6 50 1.0 +6 51 1.0 +6 52 1.0 +6 53 1.0 +6 54 1.0 +6 55 1.0 +6 56 1.0 +6 57 1.0 +6 58 1.0 +6 59 1.0 +6 60 1.0 +6 61 1.0 +6 62 1.0 +6 63 1.0 +7 0 1.0 +7 1 1.0 +7 2 1.0 +7 3 1.0 +7 4 1.0 +7 5 1.0 +7 6 1.0 +7 7 1.0 +7 8 1.0 +7 9 1.0 +7 10 1.0 +7 11 1.0 +7 12 1.0 +7 13 1.0 +7 14 1.0 +7 15 1.0 +7 16 1.0 +7 17 1.0 +7 18 1.0 +7 19 1.0 +7 20 1.0 +7 21 1.0 +7 22 1.0 +7 23 1.0 +7 24 1.0 +7 25 1.0 +7 26 1.0 +7 27 1.0 +7 28 1.0 +7 29 1.0 +7 30 1.0 +7 31 1.0 +7 32 1.0 +7 33 1.0 +7 34 1.0 +7 35 1.0 +7 36 1.0 +7 37 1.0 +7 38 1.0 +7 39 1.0 +7 40 1.0 +7 41 1.0 +7 42 1.0 +7 43 1.0 +7 44 1.0 +7 45 1.0 +7 46 1.0 +7 47 1.0 +7 48 1.0 +7 49 1.0 +7 50 1.0 +7 51 1.0 +7 52 1.0 +7 53 1.0 +7 54 1.0 +7 55 1.0 +7 56 1.0 +7 57 1.0 +7 58 1.0 +7 59 1.0 +7 60 1.0 +7 61 1.0 +7 62 1.0 +7 63 1.0 +8 0 1.0 +8 1 1.0 +8 2 1.0 +8 3 1.0 +8 4 1.0 +8 5 1.0 +8 6 1.0 +8 7 1.0 +8 8 1.0 +8 9 1.0 +8 10 1.0 +8 11 1.0 +8 12 1.0 +8 13 1.0 +8 14 1.0 +8 15 1.0 +8 16 1.0 +8 17 1.0 +8 18 1.0 +8 19 1.0 +8 20 1.0 +8 21 1.0 +8 22 1.0 +8 23 1.0 +8 24 1.0 +8 25 1.0 +8 26 1.0 +8 27 1.0 +8 28 1.0 +8 29 1.0 +8 30 1.0 +8 31 1.0 +8 32 1.0 +8 33 1.0 +8 34 1.0 +8 35 1.0 +8 36 1.0 +8 37 1.0 +8 38 1.0 +8 39 1.0 +8 40 1.0 +8 41 1.0 +8 42 1.0 +8 43 1.0 +8 44 1.0 +8 45 1.0 +8 46 1.0 +8 47 1.0 +8 48 1.0 +8 49 1.0 +8 50 1.0 +8 51 1.0 +8 52 1.0 +8 53 1.0 +8 54 1.0 +8 55 1.0 +8 56 1.0 +8 57 1.0 +8 58 1.0 +8 59 1.0 +8 60 1.0 +8 61 1.0 +8 62 1.0 +8 63 1.0 +9 0 1.0 +9 1 1.0 +9 2 1.0 +9 3 1.0 +9 4 1.0 +9 5 1.0 +9 6 1.0 +9 7 1.0 +9 8 1.0 +9 9 1.0 +9 10 1.0 +9 11 1.0 +9 12 1.0 +9 13 1.0 +9 14 1.0 +9 15 1.0 +9 16 1.0 +9 17 1.0 +9 18 1.0 +9 19 1.0 +9 20 1.0 +9 21 1.0 +9 22 1.0 +9 23 1.0 +9 24 1.0 +9 25 1.0 +9 26 1.0 +9 27 1.0 +9 28 1.0 +9 29 1.0 +9 30 1.0 +9 31 1.0 +9 32 1.0 +9 33 1.0 +9 34 1.0 +9 35 1.0 +9 36 1.0 +9 37 1.0 +9 38 1.0 +9 39 1.0 +9 40 1.0 +9 41 1.0 +9 42 1.0 +9 43 1.0 +9 44 1.0 +9 45 1.0 +9 46 1.0 +9 47 1.0 +9 48 1.0 +9 49 1.0 +9 50 1.0 +9 51 1.0 +9 52 1.0 +9 53 1.0 +9 54 1.0 +9 55 1.0 +9 56 1.0 +9 57 1.0 +9 58 1.0 +9 59 1.0 +9 60 1.0 +9 61 1.0 +9 62 1.0 +9 63 1.0 +10 0 1.0 +10 1 1.0 +10 2 1.0 +10 3 1.0 +10 4 1.0 +10 5 1.0 +10 6 1.0 +10 7 1.0 +10 8 1.0 +10 9 1.0 +10 10 1.0 +10 11 1.0 +10 12 1.0 +10 13 1.0 +10 14 1.0 +10 15 1.0 +10 16 1.0 +10 17 1.0 +10 18 1.0 +10 19 1.0 +10 20 1.0 +10 21 1.0 +10 22 1.0 +10 23 1.0 +10 24 1.0 +10 25 1.0 +10 26 1.0 +10 27 1.0 +10 28 1.0 +10 29 1.0 +10 30 1.0 +10 31 1.0 +10 32 1.0 +10 33 1.0 +10 34 1.0 +10 35 1.0 +10 36 1.0 +10 37 1.0 +10 38 1.0 +10 39 1.0 +10 40 1.0 +10 41 1.0 +10 42 1.0 +10 43 1.0 +10 44 1.0 +10 45 1.0 +10 46 1.0 +10 47 1.0 +10 48 1.0 +10 49 1.0 +10 50 1.0 +10 51 1.0 +10 52 1.0 +10 53 1.0 +10 54 1.0 +10 55 1.0 +10 56 1.0 +10 57 1.0 +10 58 1.0 +10 59 1.0 +10 60 1.0 +10 61 1.0 +10 62 1.0 +10 63 1.0 +11 0 1.0 +11 1 1.0 +11 2 1.0 +11 3 1.0 +11 4 1.0 +11 5 1.0 +11 6 1.0 +11 7 1.0 +11 8 1.0 +11 9 1.0 +11 10 1.0 +11 11 1.0 +11 12 1.0 +11 13 1.0 +11 14 1.0 +11 15 1.0 +11 16 1.0 +11 17 1.0 +11 18 1.0 +11 19 1.0 +11 20 1.0 +11 21 1.0 +11 22 1.0 +11 23 1.0 +11 24 1.0 +11 25 1.0 +11 26 1.0 +11 27 1.0 +11 28 1.0 +11 29 1.0 +11 30 1.0 +11 31 1.0 +11 32 1.0 +11 33 1.0 +11 34 1.0 +11 35 1.0 +11 36 1.0 +11 37 1.0 +11 38 1.0 +11 39 1.0 +11 40 1.0 +11 41 1.0 +11 42 1.0 +11 43 1.0 +11 44 1.0 +11 45 1.0 +11 46 1.0 +11 47 1.0 +11 48 1.0 +11 49 1.0 +11 50 1.0 +11 51 1.0 +11 52 1.0 +11 53 1.0 +11 54 1.0 +11 55 1.0 +11 56 1.0 +11 57 1.0 +11 58 1.0 +11 59 1.0 +11 60 1.0 +11 61 1.0 +11 62 1.0 +11 63 1.0 +12 0 1.12 +12 1 1.12 +12 2 1.12 +12 3 1.12 +12 4 1.12 +12 5 1.12 +12 6 1.12 +12 7 1.12 +12 8 1.12 +12 9 1.12 +12 10 1.12 +12 11 1.12 +12 12 1.12 +12 13 1.12 +12 14 1.12 +12 15 1.12 +12 16 1.12 +12 17 1.12 +12 18 1.12 +12 19 1.12 +12 20 1.12 +12 21 1.12 +12 22 1.12 +12 23 1.12 +12 24 1.12 +12 25 1.12 +12 26 1.12 +12 27 1.12 +12 28 1.12 +12 29 1.12 +12 30 1.12 +12 31 1.12 +12 32 1.12 +12 33 1.12 +12 34 1.12 +12 35 1.12 +12 36 1.12 +12 37 1.12 +12 38 1.12 +12 39 1.12 +12 40 1.12 +12 41 1.12 +12 42 1.12 +12 43 1.12 +12 44 1.12 +12 45 1.12 +12 46 1.12 +12 47 1.12 +12 48 1.12 +12 49 1.12 +12 50 1.12 +12 51 1.12 +12 52 1.12 +12 53 1.12 +12 54 1.12 +12 55 1.12 +12 56 1.12 +12 57 1.12 +12 58 1.12 +12 59 1.12 +12 60 1.12 +12 61 1.12 +12 62 1.12 +12 63 1.12 +13 0 1.12 +13 1 1.12 +13 2 1.12 +13 3 1.12 +13 4 1.12 +13 5 1.12 +13 6 1.12 +13 7 1.12 +13 8 1.12 +13 9 1.12 +13 10 1.12 +13 11 1.12 +13 12 1.12 +13 13 1.12 +13 14 1.12 +13 15 1.12 +13 16 1.12 +13 17 1.12 +13 18 1.12 +13 19 1.12 +13 20 1.12 +13 21 1.12 +13 22 1.12 +13 23 1.12 +13 24 1.12 +13 25 1.12 +13 26 1.12 +13 27 1.12 +13 28 1.12 +13 29 1.12 +13 30 1.12 +13 31 1.12 +13 32 1.12 +13 33 1.12 +13 34 1.12 +13 35 1.12 +13 36 1.12 +13 37 1.12 +13 38 1.12 +13 39 1.12 +13 40 1.12 +13 41 1.12 +13 42 1.12 +13 43 1.12 +13 44 1.12 +13 45 1.12 +13 46 1.12 +13 47 1.12 +13 48 1.12 +13 49 1.12 +13 50 1.12 +13 51 1.12 +13 52 1.12 +13 53 1.12 +13 54 1.12 +13 55 1.12 +13 56 1.12 +13 57 1.12 +13 58 1.12 +13 59 1.12 +13 60 1.12 +13 61 1.12 +13 62 1.12 +13 63 1.12 +14 0 1.12 +14 1 1.12 +14 2 1.12 +14 3 1.12 +14 4 1.12 +14 5 1.12 +14 6 1.12 +14 7 1.12 +14 8 1.12 +14 9 1.12 +14 10 1.12 +14 11 1.12 +14 12 1.12 +14 13 1.12 +14 14 1.12 +14 15 1.12 +14 16 1.12 +14 17 1.12 +14 18 1.12 +14 19 1.12 +14 20 1.12 +14 21 1.12 +14 22 1.12 +14 23 1.12 +14 24 1.12 +14 25 1.12 +14 26 1.12 +14 27 1.12 +14 28 1.12 +14 29 1.12 +14 30 1.12 +14 31 1.12 +14 32 1.12 +14 33 1.12 +14 34 1.12 +14 35 1.12 +14 36 1.12 +14 37 1.12 +14 38 1.12 +14 39 1.12 +14 40 1.12 +14 41 1.12 +14 42 1.12 +14 43 1.12 +14 44 1.12 +14 45 1.12 +14 46 1.12 +14 47 1.12 +14 48 1.12 +14 49 1.12 +14 50 1.12 +14 51 1.12 +14 52 1.12 +14 53 1.12 +14 54 1.12 +14 55 1.12 +14 56 1.12 +14 57 1.12 +14 58 1.12 +14 59 1.12 +14 60 1.12 +14 61 1.12 +14 62 1.12 +14 63 1.12 +15 0 1.12 +15 1 1.12 +15 2 1.12 +15 3 1.12 +15 4 1.12 +15 5 1.12 +15 6 1.12 +15 7 1.12 +15 8 1.12 +15 9 1.12 +15 10 1.12 +15 11 1.12 +15 12 1.12 +15 13 1.12 +15 14 1.12 +15 15 1.12 +15 16 1.12 +15 17 1.12 +15 18 1.12 +15 19 1.12 +15 20 1.12 +15 21 1.12 +15 22 1.12 +15 23 1.12 +15 24 1.12 +15 25 1.12 +15 26 1.12 +15 27 1.12 +15 28 1.12 +15 29 1.12 +15 30 1.12 +15 31 1.12 +15 32 1.12 +15 33 1.12 +15 34 1.12 +15 35 1.12 +15 36 1.12 +15 37 1.12 +15 38 1.12 +15 39 1.12 +15 40 1.12 +15 41 1.12 +15 42 1.12 +15 43 1.12 +15 44 1.12 +15 45 1.12 +15 46 1.12 +15 47 1.12 +15 48 1.12 +15 49 1.12 +15 50 1.12 +15 51 1.12 +15 52 1.12 +15 53 1.12 +15 54 1.12 +15 55 1.12 +15 56 1.12 +15 57 1.12 +15 58 1.12 +15 59 1.12 +15 60 1.12 +15 61 1.12 +15 62 1.12 +15 63 1.12 +16 0 1.12 +16 1 1.12 +16 2 1.12 +16 3 1.12 +16 4 1.12 +16 5 1.12 +16 6 1.12 +16 7 1.12 +16 8 1.12 +16 9 1.12 +16 10 1.12 +16 11 1.12 +16 12 1.12 +16 13 1.12 +16 14 1.12 +16 15 1.12 +16 16 1.12 +16 17 1.12 +16 18 1.12 +16 19 1.12 +16 20 1.12 +16 21 1.12 +16 22 1.12 +16 23 1.12 +16 24 1.12 +16 25 1.12 +16 26 1.12 +16 27 1.12 +16 28 1.12 +16 29 1.12 +16 30 1.12 +16 31 1.12 +16 32 1.12 +16 33 1.12 +16 34 1.12 +16 35 1.12 +16 36 1.12 +16 37 1.12 +16 38 1.12 +16 39 1.12 +16 40 1.12 +16 41 1.12 +16 42 1.12 +16 43 1.12 +16 44 1.12 +16 45 1.12 +16 46 1.12 +16 47 1.12 +16 48 1.12 +16 49 1.12 +16 50 1.12 +16 51 1.12 +16 52 1.12 +16 53 1.12 +16 54 1.12 +16 55 1.12 +16 56 1.12 +16 57 1.12 +16 58 1.12 +16 59 1.12 +16 60 1.12 +16 61 1.12 +16 62 1.12 +16 63 1.12 +17 0 1.12 +17 1 1.12 +17 2 1.12 +17 3 1.12 +17 4 1.12 +17 5 1.12 +17 6 1.12 +17 7 1.12 +17 8 1.12 +17 9 1.12 +17 10 1.12 +17 11 1.12 +17 12 1.12 +17 13 1.12 +17 14 1.12 +17 15 1.12 +17 16 1.12 +17 17 1.12 +17 18 1.12 +17 19 1.12 +17 20 1.12 +17 21 1.12 +17 22 1.12 +17 23 1.12 +17 24 1.12 +17 25 1.12 +17 26 1.12 +17 27 1.12 +17 28 1.12 +17 29 1.12 +17 30 1.12 +17 31 1.12 +17 32 1.12 +17 33 1.12 +17 34 1.12 +17 35 1.12 +17 36 1.12 +17 37 1.12 +17 38 1.12 +17 39 1.12 +17 40 1.12 +17 41 1.12 +17 42 1.12 +17 43 1.12 +17 44 1.12 +17 45 1.12 +17 46 1.12 +17 47 1.12 +17 48 1.12 +17 49 1.12 +17 50 1.12 +17 51 1.12 +17 52 1.12 +17 53 1.12 +17 54 1.12 +17 55 1.12 +17 56 1.12 +17 57 1.12 +17 58 1.12 +17 59 1.12 +17 60 1.12 +17 61 1.12 +17 62 1.12 +17 63 1.12 +18 0 1.12 +18 1 1.12 +18 2 1.12 +18 3 1.12 +18 4 1.12 +18 5 1.12 +18 6 1.12 +18 7 1.12 +18 8 1.12 +18 9 1.12 +18 10 1.12 +18 11 1.12 +18 12 1.12 +18 13 1.12 +18 14 1.12 +18 15 1.12 +18 16 1.12 +18 17 1.12 +18 18 1.12 +18 19 1.12 +18 20 1.12 +18 21 1.12 +18 22 1.12 +18 23 1.12 +18 24 1.12 +18 25 1.12 +18 26 1.12 +18 27 1.12 +18 28 1.12 +18 29 1.12 +18 30 1.12 +18 31 1.12 +18 32 1.12 +18 33 1.12 +18 34 1.12 +18 35 1.12 +18 36 1.12 +18 37 1.12 +18 38 1.12 +18 39 1.12 +18 40 1.12 +18 41 1.12 +18 42 1.12 +18 43 1.12 +18 44 1.12 +18 45 1.12 +18 46 1.12 +18 47 1.12 +18 48 1.12 +18 49 1.12 +18 50 1.12 +18 51 1.12 +18 52 1.12 +18 53 1.12 +18 54 1.12 +18 55 1.12 +18 56 1.12 +18 57 1.12 +18 58 1.12 +18 59 1.12 +18 60 1.12 +18 61 1.12 +18 62 1.12 +18 63 1.12 +19 0 1.12 +19 1 1.12 +19 2 1.12 +19 3 1.12 +19 4 1.12 +19 5 1.12 +19 6 1.12 +19 7 1.12 +19 8 1.12 +19 9 1.12 +19 10 1.12 +19 11 1.12 +19 12 1.12 +19 13 1.12 +19 14 1.12 +19 15 1.12 +19 16 1.12 +19 17 1.12 +19 18 1.12 +19 19 1.12 +19 20 1.12 +19 21 1.12 +19 22 1.12 +19 23 1.12 +19 24 1.12 +19 25 1.12 +19 26 1.12 +19 27 1.12 +19 28 1.12 +19 29 1.12 +19 30 1.12 +19 31 1.12 +19 32 1.12 +19 33 1.12 +19 34 1.12 +19 35 1.12 +19 36 1.12 +19 37 1.12 +19 38 1.12 +19 39 1.12 +19 40 1.12 +19 41 1.12 +19 42 1.12 +19 43 1.12 +19 44 1.12 +19 45 1.12 +19 46 1.12 +19 47 1.12 +19 48 1.12 +19 49 1.12 +19 50 1.12 +19 51 1.12 +19 52 1.12 +19 53 1.12 +19 54 1.12 +19 55 1.12 +19 56 1.12 +19 57 1.12 +19 58 1.12 +19 59 1.12 +19 60 1.12 +19 61 1.12 +19 62 1.12 +19 63 1.12 +20 0 1.12 +20 1 1.12 +20 2 1.12 +20 3 1.12 +20 4 1.12 +20 5 1.12 +20 6 1.12 +20 7 1.12 +20 8 1.12 +20 9 1.12 +20 10 1.12 +20 11 1.12 +20 12 1.12 +20 13 1.12 +20 14 1.12 +20 15 1.12 +20 16 1.12 +20 17 1.12 +20 18 1.12 +20 19 1.12 +20 20 1.12 +20 21 1.12 +20 22 1.12 +20 23 1.12 +20 24 1.12 +20 25 1.12 +20 26 1.12 +20 27 1.12 +20 28 1.12 +20 29 1.12 +20 30 1.12 +20 31 1.12 +20 32 1.12 +20 33 1.12 +20 34 1.12 +20 35 1.12 +20 36 1.12 +20 37 1.12 +20 38 1.12 +20 39 1.12 +20 40 1.12 +20 41 1.12 +20 42 1.12 +20 43 1.12 +20 44 1.12 +20 45 1.12 +20 46 1.12 +20 47 1.12 +20 48 1.12 +20 49 1.12 +20 50 1.12 +20 51 1.12 +20 52 1.12 +20 53 1.12 +20 54 1.12 +20 55 1.12 +20 56 1.12 +20 57 1.12 +20 58 1.12 +20 59 1.12 +20 60 1.12 +20 61 1.12 +20 62 1.12 +20 63 1.12 +21 0 1.12 +21 1 1.12 +21 2 1.12 +21 3 1.12 +21 4 1.12 +21 5 1.12 +21 6 1.12 +21 7 1.12 +21 8 1.12 +21 9 1.12 +21 10 1.12 +21 11 1.12 +21 12 1.12 +21 13 1.12 +21 14 1.12 +21 15 1.12 +21 16 1.12 +21 17 1.12 +21 18 1.12 +21 19 1.12 +21 20 1.12 +21 21 1.12 +21 22 1.12 +21 23 1.12 +21 24 1.12 +21 25 1.12 +21 26 1.12 +21 27 1.12 +21 28 1.12 +21 29 1.12 +21 30 1.12 +21 31 1.12 +21 32 1.12 +21 33 1.12 +21 34 1.12 +21 35 1.12 +21 36 1.12 +21 37 1.12 +21 38 1.12 +21 39 1.12 +21 40 1.12 +21 41 1.12 +21 42 1.12 +21 43 1.12 +21 44 1.12 +21 45 1.12 +21 46 1.12 +21 47 1.12 +21 48 1.12 +21 49 1.12 +21 50 1.12 +21 51 1.12 +21 52 1.12 +21 53 1.12 +21 54 1.12 +21 55 1.12 +21 56 1.12 +21 57 1.12 +21 58 1.12 +21 59 1.12 +21 60 1.12 +21 61 1.12 +21 62 1.12 +21 63 1.12 +22 0 1.12 +22 1 1.12 +22 2 1.12 +22 3 1.12 +22 4 1.12 +22 5 1.12 +22 6 1.12 +22 7 1.12 +22 8 1.12 +22 9 1.12 +22 10 1.12 +22 11 1.12 +22 12 1.12 +22 13 1.12 +22 14 1.12 +22 15 1.12 +22 16 1.12 +22 17 1.12 +22 18 1.12 +22 19 1.12 +22 20 1.12 +22 21 1.12 +22 22 1.12 +22 23 1.12 +22 24 1.12 +22 25 1.12 +22 26 1.12 +22 27 1.12 +22 28 1.12 +22 29 1.12 +22 30 1.12 +22 31 1.12 +22 32 1.12 +22 33 1.12 +22 34 1.12 +22 35 1.12 +22 36 1.12 +22 37 1.12 +22 38 1.12 +22 39 1.12 +22 40 1.12 +22 41 1.12 +22 42 1.12 +22 43 1.12 +22 44 1.12 +22 45 1.12 +22 46 1.12 +22 47 1.12 +22 48 1.12 +22 49 1.12 +22 50 1.12 +22 51 1.12 +22 52 1.12 +22 53 1.12 +22 54 1.12 +22 55 1.12 +22 56 1.12 +22 57 1.12 +22 58 1.12 +22 59 1.12 +22 60 1.12 +22 61 1.12 +22 62 1.12 +22 63 1.12 +23 0 1.12 +23 1 1.12 +23 2 1.12 +23 3 1.12 +23 4 1.12 +23 5 1.12 +23 6 1.12 +23 7 1.12 +23 8 1.12 +23 9 1.12 +23 10 1.12 +23 11 1.12 +23 12 1.12 +23 13 1.12 +23 14 1.12 +23 15 1.12 +23 16 1.12 +23 17 1.12 +23 18 1.12 +23 19 1.12 +23 20 1.12 +23 21 1.12 +23 22 1.12 +23 23 1.12 +23 24 1.12 +23 25 1.12 +23 26 1.12 +23 27 1.12 +23 28 1.12 +23 29 1.12 +23 30 1.12 +23 31 1.12 +23 32 1.12 +23 33 1.12 +23 34 1.12 +23 35 1.12 +23 36 1.12 +23 37 1.12 +23 38 1.12 +23 39 1.12 +23 40 1.12 +23 41 1.12 +23 42 1.12 +23 43 1.12 +23 44 1.12 +23 45 1.12 +23 46 1.12 +23 47 1.12 +23 48 1.12 +23 49 1.12 +23 50 1.12 +23 51 1.12 +23 52 1.12 +23 53 1.12 +23 54 1.12 +23 55 1.12 +23 56 1.12 +23 57 1.12 +23 58 1.12 +23 59 1.12 +23 60 1.12 +23 61 1.12 +23 62 1.12 +23 63 1.12 diff --git a/calibrations/calo/tower_slope_macro/HCALIN_GainsCalib1.22.txt b/calibrations/calo/tower_slope_macro/HCALIN_GainsCalib1.22.txt new file mode 100644 index 000000000..7138c4c00 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/HCALIN_GainsCalib1.22.txt @@ -0,0 +1,1536 @@ +0 0 1.22 +0 1 1.22 +0 2 1.22 +0 3 1.22 +0 4 1.22 +0 5 1.22 +0 6 1.22 +0 7 1.22 +0 8 1.22 +0 9 1.22 +0 10 1.22 +0 11 1.22 +0 12 1.22 +0 13 1.22 +0 14 1.22 +0 15 1.22 +0 16 1.22 +0 17 1.22 +0 18 1.22 +0 19 1.22 +0 20 1.22 +0 21 1.22 +0 22 1.22 +0 23 1.22 +0 24 1.22 +0 25 1.22 +0 26 1.22 +0 27 1.22 +0 28 1.22 +0 29 1.22 +0 30 1.22 +0 31 1.22 +0 32 1.22 +0 33 1.22 +0 34 1.22 +0 35 1.22 +0 36 1.22 +0 37 1.22 +0 38 1.22 +0 39 1.22 +0 40 1.22 +0 41 1.22 +0 42 1.22 +0 43 1.22 +0 44 1.22 +0 45 1.22 +0 46 1.22 +0 47 1.22 +0 48 1.22 +0 49 1.22 +0 50 1.22 +0 51 1.22 +0 52 1.22 +0 53 1.22 +0 54 1.22 +0 55 1.22 +0 56 1.22 +0 57 1.22 +0 58 1.22 +0 59 1.22 +0 60 1.22 +0 61 1.22 +0 62 1.22 +0 63 1.22 +1 0 1.22 +1 1 1.22 +1 2 1.22 +1 3 1.22 +1 4 1.22 +1 5 1.22 +1 6 1.22 +1 7 1.22 +1 8 1.22 +1 9 1.22 +1 10 1.22 +1 11 1.22 +1 12 1.22 +1 13 1.22 +1 14 1.22 +1 15 1.22 +1 16 1.22 +1 17 1.22 +1 18 1.22 +1 19 1.22 +1 20 1.22 +1 21 1.22 +1 22 1.22 +1 23 1.22 +1 24 1.22 +1 25 1.22 +1 26 1.22 +1 27 1.22 +1 28 1.22 +1 29 1.22 +1 30 1.22 +1 31 1.22 +1 32 1.22 +1 33 1.22 +1 34 1.22 +1 35 1.22 +1 36 1.22 +1 37 1.22 +1 38 1.22 +1 39 1.22 +1 40 1.22 +1 41 1.22 +1 42 1.22 +1 43 1.22 +1 44 1.22 +1 45 1.22 +1 46 1.22 +1 47 1.22 +1 48 1.22 +1 49 1.22 +1 50 1.22 +1 51 1.22 +1 52 1.22 +1 53 1.22 +1 54 1.22 +1 55 1.22 +1 56 1.22 +1 57 1.22 +1 58 1.22 +1 59 1.22 +1 60 1.22 +1 61 1.22 +1 62 1.22 +1 63 1.22 +2 0 1.22 +2 1 1.22 +2 2 1.22 +2 3 1.22 +2 4 1.22 +2 5 1.22 +2 6 1.22 +2 7 1.22 +2 8 1.22 +2 9 1.22 +2 10 1.22 +2 11 1.22 +2 12 1.22 +2 13 1.22 +2 14 1.22 +2 15 1.22 +2 16 1.22 +2 17 1.22 +2 18 1.22 +2 19 1.22 +2 20 1.22 +2 21 1.22 +2 22 1.22 +2 23 1.22 +2 24 1.22 +2 25 1.22 +2 26 1.22 +2 27 1.22 +2 28 1.22 +2 29 1.22 +2 30 1.22 +2 31 1.22 +2 32 1.22 +2 33 1.22 +2 34 1.22 +2 35 1.22 +2 36 1.22 +2 37 1.22 +2 38 1.22 +2 39 1.22 +2 40 1.22 +2 41 1.22 +2 42 1.22 +2 43 1.22 +2 44 1.22 +2 45 1.22 +2 46 1.22 +2 47 1.22 +2 48 1.22 +2 49 1.22 +2 50 1.22 +2 51 1.22 +2 52 1.22 +2 53 1.22 +2 54 1.22 +2 55 1.22 +2 56 1.22 +2 57 1.22 +2 58 1.22 +2 59 1.22 +2 60 1.22 +2 61 1.22 +2 62 1.22 +2 63 1.22 +3 0 1.22 +3 1 1.22 +3 2 1.22 +3 3 1.22 +3 4 1.22 +3 5 1.22 +3 6 1.22 +3 7 1.22 +3 8 1.22 +3 9 1.22 +3 10 1.22 +3 11 1.22 +3 12 1.22 +3 13 1.22 +3 14 1.22 +3 15 1.22 +3 16 1.22 +3 17 1.22 +3 18 1.22 +3 19 1.22 +3 20 1.22 +3 21 1.22 +3 22 1.22 +3 23 1.22 +3 24 1.22 +3 25 1.22 +3 26 1.22 +3 27 1.22 +3 28 1.22 +3 29 1.22 +3 30 1.22 +3 31 1.22 +3 32 1.22 +3 33 1.22 +3 34 1.22 +3 35 1.22 +3 36 1.22 +3 37 1.22 +3 38 1.22 +3 39 1.22 +3 40 1.22 +3 41 1.22 +3 42 1.22 +3 43 1.22 +3 44 1.22 +3 45 1.22 +3 46 1.22 +3 47 1.22 +3 48 1.22 +3 49 1.22 +3 50 1.22 +3 51 1.22 +3 52 1.22 +3 53 1.22 +3 54 1.22 +3 55 1.22 +3 56 1.22 +3 57 1.22 +3 58 1.22 +3 59 1.22 +3 60 1.22 +3 61 1.22 +3 62 1.22 +3 63 1.22 +4 0 1.22 +4 1 1.22 +4 2 1.22 +4 3 1.22 +4 4 1.22 +4 5 1.22 +4 6 1.22 +4 7 1.22 +4 8 1.22 +4 9 1.22 +4 10 1.22 +4 11 1.22 +4 12 1.22 +4 13 1.22 +4 14 1.22 +4 15 1.22 +4 16 1.22 +4 17 1.22 +4 18 1.22 +4 19 1.22 +4 20 1.22 +4 21 1.22 +4 22 1.22 +4 23 1.22 +4 24 1.22 +4 25 1.22 +4 26 1.22 +4 27 1.22 +4 28 1.22 +4 29 1.22 +4 30 1.22 +4 31 1.22 +4 32 1.22 +4 33 1.22 +4 34 1.22 +4 35 1.22 +4 36 1.22 +4 37 1.22 +4 38 1.22 +4 39 1.22 +4 40 1.22 +4 41 1.22 +4 42 1.22 +4 43 1.22 +4 44 1.22 +4 45 1.22 +4 46 1.22 +4 47 1.22 +4 48 1.22 +4 49 1.22 +4 50 1.22 +4 51 1.22 +4 52 1.22 +4 53 1.22 +4 54 1.22 +4 55 1.22 +4 56 1.22 +4 57 1.22 +4 58 1.22 +4 59 1.22 +4 60 1.22 +4 61 1.22 +4 62 1.22 +4 63 1.22 +5 0 1.22 +5 1 1.22 +5 2 1.22 +5 3 1.22 +5 4 1.22 +5 5 1.22 +5 6 1.22 +5 7 1.22 +5 8 1.22 +5 9 1.22 +5 10 1.22 +5 11 1.22 +5 12 1.22 +5 13 1.22 +5 14 1.22 +5 15 1.22 +5 16 1.22 +5 17 1.22 +5 18 1.22 +5 19 1.22 +5 20 1.22 +5 21 1.22 +5 22 1.22 +5 23 1.22 +5 24 1.22 +5 25 1.22 +5 26 1.22 +5 27 1.22 +5 28 1.22 +5 29 1.22 +5 30 1.22 +5 31 1.22 +5 32 1.22 +5 33 1.22 +5 34 1.22 +5 35 1.22 +5 36 1.22 +5 37 1.22 +5 38 1.22 +5 39 1.22 +5 40 1.22 +5 41 1.22 +5 42 1.22 +5 43 1.22 +5 44 1.22 +5 45 1.22 +5 46 1.22 +5 47 1.22 +5 48 1.22 +5 49 1.22 +5 50 1.22 +5 51 1.22 +5 52 1.22 +5 53 1.22 +5 54 1.22 +5 55 1.22 +5 56 1.22 +5 57 1.22 +5 58 1.22 +5 59 1.22 +5 60 1.22 +5 61 1.22 +5 62 1.22 +5 63 1.22 +6 0 1.22 +6 1 1.22 +6 2 1.22 +6 3 1.22 +6 4 1.22 +6 5 1.22 +6 6 1.22 +6 7 1.22 +6 8 1.22 +6 9 1.22 +6 10 1.22 +6 11 1.22 +6 12 1.22 +6 13 1.22 +6 14 1.22 +6 15 1.22 +6 16 1.22 +6 17 1.22 +6 18 1.22 +6 19 1.22 +6 20 1.22 +6 21 1.22 +6 22 1.22 +6 23 1.22 +6 24 1.22 +6 25 1.22 +6 26 1.22 +6 27 1.22 +6 28 1.22 +6 29 1.22 +6 30 1.22 +6 31 1.22 +6 32 1.22 +6 33 1.22 +6 34 1.22 +6 35 1.22 +6 36 1.22 +6 37 1.22 +6 38 1.22 +6 39 1.22 +6 40 1.22 +6 41 1.22 +6 42 1.22 +6 43 1.22 +6 44 1.22 +6 45 1.22 +6 46 1.22 +6 47 1.22 +6 48 1.22 +6 49 1.22 +6 50 1.22 +6 51 1.22 +6 52 1.22 +6 53 1.22 +6 54 1.22 +6 55 1.22 +6 56 1.22 +6 57 1.22 +6 58 1.22 +6 59 1.22 +6 60 1.22 +6 61 1.22 +6 62 1.22 +6 63 1.22 +7 0 1.22 +7 1 1.22 +7 2 1.22 +7 3 1.22 +7 4 1.22 +7 5 1.22 +7 6 1.22 +7 7 1.22 +7 8 1.22 +7 9 1.22 +7 10 1.22 +7 11 1.22 +7 12 1.22 +7 13 1.22 +7 14 1.22 +7 15 1.22 +7 16 1.22 +7 17 1.22 +7 18 1.22 +7 19 1.22 +7 20 1.22 +7 21 1.22 +7 22 1.22 +7 23 1.22 +7 24 1.22 +7 25 1.22 +7 26 1.22 +7 27 1.22 +7 28 1.22 +7 29 1.22 +7 30 1.22 +7 31 1.22 +7 32 1.22 +7 33 1.22 +7 34 1.22 +7 35 1.22 +7 36 1.22 +7 37 1.22 +7 38 1.22 +7 39 1.22 +7 40 1.22 +7 41 1.22 +7 42 1.22 +7 43 1.22 +7 44 1.22 +7 45 1.22 +7 46 1.22 +7 47 1.22 +7 48 1.22 +7 49 1.22 +7 50 1.22 +7 51 1.22 +7 52 1.22 +7 53 1.22 +7 54 1.22 +7 55 1.22 +7 56 1.22 +7 57 1.22 +7 58 1.22 +7 59 1.22 +7 60 1.22 +7 61 1.22 +7 62 1.22 +7 63 1.22 +8 0 1.22 +8 1 1.22 +8 2 1.22 +8 3 1.22 +8 4 1.22 +8 5 1.22 +8 6 1.22 +8 7 1.22 +8 8 1.22 +8 9 1.22 +8 10 1.22 +8 11 1.22 +8 12 1.22 +8 13 1.22 +8 14 1.22 +8 15 1.22 +8 16 1.22 +8 17 1.22 +8 18 1.22 +8 19 1.22 +8 20 1.22 +8 21 1.22 +8 22 1.22 +8 23 1.22 +8 24 1.22 +8 25 1.22 +8 26 1.22 +8 27 1.22 +8 28 1.22 +8 29 1.22 +8 30 1.22 +8 31 1.22 +8 32 1.22 +8 33 1.22 +8 34 1.22 +8 35 1.22 +8 36 1.22 +8 37 1.22 +8 38 1.22 +8 39 1.22 +8 40 1.22 +8 41 1.22 +8 42 1.22 +8 43 1.22 +8 44 1.22 +8 45 1.22 +8 46 1.22 +8 47 1.22 +8 48 1.22 +8 49 1.22 +8 50 1.22 +8 51 1.22 +8 52 1.22 +8 53 1.22 +8 54 1.22 +8 55 1.22 +8 56 1.22 +8 57 1.22 +8 58 1.22 +8 59 1.22 +8 60 1.22 +8 61 1.22 +8 62 1.22 +8 63 1.22 +9 0 1.22 +9 1 1.22 +9 2 1.22 +9 3 1.22 +9 4 1.22 +9 5 1.22 +9 6 1.22 +9 7 1.22 +9 8 1.22 +9 9 1.22 +9 10 1.22 +9 11 1.22 +9 12 1.22 +9 13 1.22 +9 14 1.22 +9 15 1.22 +9 16 1.22 +9 17 1.22 +9 18 1.22 +9 19 1.22 +9 20 1.22 +9 21 1.22 +9 22 1.22 +9 23 1.22 +9 24 1.22 +9 25 1.22 +9 26 1.22 +9 27 1.22 +9 28 1.22 +9 29 1.22 +9 30 1.22 +9 31 1.22 +9 32 1.22 +9 33 1.22 +9 34 1.22 +9 35 1.22 +9 36 1.22 +9 37 1.22 +9 38 1.22 +9 39 1.22 +9 40 1.22 +9 41 1.22 +9 42 1.22 +9 43 1.22 +9 44 1.22 +9 45 1.22 +9 46 1.22 +9 47 1.22 +9 48 1.22 +9 49 1.22 +9 50 1.22 +9 51 1.22 +9 52 1.22 +9 53 1.22 +9 54 1.22 +9 55 1.22 +9 56 1.22 +9 57 1.22 +9 58 1.22 +9 59 1.22 +9 60 1.22 +9 61 1.22 +9 62 1.22 +9 63 1.22 +10 0 1.22 +10 1 1.22 +10 2 1.22 +10 3 1.22 +10 4 1.22 +10 5 1.22 +10 6 1.22 +10 7 1.22 +10 8 1.22 +10 9 1.22 +10 10 1.22 +10 11 1.22 +10 12 1.22 +10 13 1.22 +10 14 1.22 +10 15 1.22 +10 16 1.22 +10 17 1.22 +10 18 1.22 +10 19 1.22 +10 20 1.22 +10 21 1.22 +10 22 1.22 +10 23 1.22 +10 24 1.22 +10 25 1.22 +10 26 1.22 +10 27 1.22 +10 28 1.22 +10 29 1.22 +10 30 1.22 +10 31 1.22 +10 32 1.22 +10 33 1.22 +10 34 1.22 +10 35 1.22 +10 36 1.22 +10 37 1.22 +10 38 1.22 +10 39 1.22 +10 40 1.22 +10 41 1.22 +10 42 1.22 +10 43 1.22 +10 44 1.22 +10 45 1.22 +10 46 1.22 +10 47 1.22 +10 48 1.22 +10 49 1.22 +10 50 1.22 +10 51 1.22 +10 52 1.22 +10 53 1.22 +10 54 1.22 +10 55 1.22 +10 56 1.22 +10 57 1.22 +10 58 1.22 +10 59 1.22 +10 60 1.22 +10 61 1.22 +10 62 1.22 +10 63 1.22 +11 0 1.22 +11 1 1.22 +11 2 1.22 +11 3 1.22 +11 4 1.22 +11 5 1.22 +11 6 1.22 +11 7 1.22 +11 8 1.22 +11 9 1.22 +11 10 1.22 +11 11 1.22 +11 12 1.22 +11 13 1.22 +11 14 1.22 +11 15 1.22 +11 16 1.22 +11 17 1.22 +11 18 1.22 +11 19 1.22 +11 20 1.22 +11 21 1.22 +11 22 1.22 +11 23 1.22 +11 24 1.22 +11 25 1.22 +11 26 1.22 +11 27 1.22 +11 28 1.22 +11 29 1.22 +11 30 1.22 +11 31 1.22 +11 32 1.22 +11 33 1.22 +11 34 1.22 +11 35 1.22 +11 36 1.22 +11 37 1.22 +11 38 1.22 +11 39 1.22 +11 40 1.22 +11 41 1.22 +11 42 1.22 +11 43 1.22 +11 44 1.22 +11 45 1.22 +11 46 1.22 +11 47 1.22 +11 48 1.22 +11 49 1.22 +11 50 1.22 +11 51 1.22 +11 52 1.22 +11 53 1.22 +11 54 1.22 +11 55 1.22 +11 56 1.22 +11 57 1.22 +11 58 1.22 +11 59 1.22 +11 60 1.22 +11 61 1.22 +11 62 1.22 +11 63 1.22 +12 0 1.22 +12 1 1.22 +12 2 1.22 +12 3 1.22 +12 4 1.22 +12 5 1.22 +12 6 1.22 +12 7 1.22 +12 8 1.22 +12 9 1.22 +12 10 1.22 +12 11 1.22 +12 12 1.22 +12 13 1.22 +12 14 1.22 +12 15 1.22 +12 16 1.22 +12 17 1.22 +12 18 1.22 +12 19 1.22 +12 20 1.22 +12 21 1.22 +12 22 1.22 +12 23 1.22 +12 24 1.22 +12 25 1.22 +12 26 1.22 +12 27 1.22 +12 28 1.22 +12 29 1.22 +12 30 1.22 +12 31 1.22 +12 32 1.22 +12 33 1.22 +12 34 1.22 +12 35 1.22 +12 36 1.22 +12 37 1.22 +12 38 1.22 +12 39 1.22 +12 40 1.22 +12 41 1.22 +12 42 1.22 +12 43 1.22 +12 44 1.22 +12 45 1.22 +12 46 1.22 +12 47 1.22 +12 48 1.22 +12 49 1.22 +12 50 1.22 +12 51 1.22 +12 52 1.22 +12 53 1.22 +12 54 1.22 +12 55 1.22 +12 56 1.22 +12 57 1.22 +12 58 1.22 +12 59 1.22 +12 60 1.22 +12 61 1.22 +12 62 1.22 +12 63 1.22 +13 0 1.22 +13 1 1.22 +13 2 1.22 +13 3 1.22 +13 4 1.22 +13 5 1.22 +13 6 1.22 +13 7 1.22 +13 8 1.22 +13 9 1.22 +13 10 1.22 +13 11 1.22 +13 12 1.22 +13 13 1.22 +13 14 1.22 +13 15 1.22 +13 16 1.22 +13 17 1.22 +13 18 1.22 +13 19 1.22 +13 20 1.22 +13 21 1.22 +13 22 1.22 +13 23 1.22 +13 24 1.22 +13 25 1.22 +13 26 1.22 +13 27 1.22 +13 28 1.22 +13 29 1.22 +13 30 1.22 +13 31 1.22 +13 32 1.22 +13 33 1.22 +13 34 1.22 +13 35 1.22 +13 36 1.22 +13 37 1.22 +13 38 1.22 +13 39 1.22 +13 40 1.22 +13 41 1.22 +13 42 1.22 +13 43 1.22 +13 44 1.22 +13 45 1.22 +13 46 1.22 +13 47 1.22 +13 48 1.22 +13 49 1.22 +13 50 1.22 +13 51 1.22 +13 52 1.22 +13 53 1.22 +13 54 1.22 +13 55 1.22 +13 56 1.22 +13 57 1.22 +13 58 1.22 +13 59 1.22 +13 60 1.22 +13 61 1.22 +13 62 1.22 +13 63 1.22 +14 0 1.22 +14 1 1.22 +14 2 1.22 +14 3 1.22 +14 4 1.22 +14 5 1.22 +14 6 1.22 +14 7 1.22 +14 8 1.22 +14 9 1.22 +14 10 1.22 +14 11 1.22 +14 12 1.22 +14 13 1.22 +14 14 1.22 +14 15 1.22 +14 16 1.22 +14 17 1.22 +14 18 1.22 +14 19 1.22 +14 20 1.22 +14 21 1.22 +14 22 1.22 +14 23 1.22 +14 24 1.22 +14 25 1.22 +14 26 1.22 +14 27 1.22 +14 28 1.22 +14 29 1.22 +14 30 1.22 +14 31 1.22 +14 32 1.22 +14 33 1.22 +14 34 1.22 +14 35 1.22 +14 36 1.22 +14 37 1.22 +14 38 1.22 +14 39 1.22 +14 40 1.22 +14 41 1.22 +14 42 1.22 +14 43 1.22 +14 44 1.22 +14 45 1.22 +14 46 1.22 +14 47 1.22 +14 48 1.22 +14 49 1.22 +14 50 1.22 +14 51 1.22 +14 52 1.22 +14 53 1.22 +14 54 1.22 +14 55 1.22 +14 56 1.22 +14 57 1.22 +14 58 1.22 +14 59 1.22 +14 60 1.22 +14 61 1.22 +14 62 1.22 +14 63 1.22 +15 0 1.22 +15 1 1.22 +15 2 1.22 +15 3 1.22 +15 4 1.22 +15 5 1.22 +15 6 1.22 +15 7 1.22 +15 8 1.22 +15 9 1.22 +15 10 1.22 +15 11 1.22 +15 12 1.22 +15 13 1.22 +15 14 1.22 +15 15 1.22 +15 16 1.22 +15 17 1.22 +15 18 1.22 +15 19 1.22 +15 20 1.22 +15 21 1.22 +15 22 1.22 +15 23 1.22 +15 24 1.22 +15 25 1.22 +15 26 1.22 +15 27 1.22 +15 28 1.22 +15 29 1.22 +15 30 1.22 +15 31 1.22 +15 32 1.22 +15 33 1.22 +15 34 1.22 +15 35 1.22 +15 36 1.22 +15 37 1.22 +15 38 1.22 +15 39 1.22 +15 40 1.22 +15 41 1.22 +15 42 1.22 +15 43 1.22 +15 44 1.22 +15 45 1.22 +15 46 1.22 +15 47 1.22 +15 48 1.22 +15 49 1.22 +15 50 1.22 +15 51 1.22 +15 52 1.22 +15 53 1.22 +15 54 1.22 +15 55 1.22 +15 56 1.22 +15 57 1.22 +15 58 1.22 +15 59 1.22 +15 60 1.22 +15 61 1.22 +15 62 1.22 +15 63 1.22 +16 0 1.22 +16 1 1.22 +16 2 1.22 +16 3 1.22 +16 4 1.22 +16 5 1.22 +16 6 1.22 +16 7 1.22 +16 8 1.22 +16 9 1.22 +16 10 1.22 +16 11 1.22 +16 12 1.22 +16 13 1.22 +16 14 1.22 +16 15 1.22 +16 16 1.22 +16 17 1.22 +16 18 1.22 +16 19 1.22 +16 20 1.22 +16 21 1.22 +16 22 1.22 +16 23 1.22 +16 24 1.22 +16 25 1.22 +16 26 1.22 +16 27 1.22 +16 28 1.22 +16 29 1.22 +16 30 1.22 +16 31 1.22 +16 32 1.22 +16 33 1.22 +16 34 1.22 +16 35 1.22 +16 36 1.22 +16 37 1.22 +16 38 1.22 +16 39 1.22 +16 40 1.22 +16 41 1.22 +16 42 1.22 +16 43 1.22 +16 44 1.22 +16 45 1.22 +16 46 1.22 +16 47 1.22 +16 48 1.22 +16 49 1.22 +16 50 1.22 +16 51 1.22 +16 52 1.22 +16 53 1.22 +16 54 1.22 +16 55 1.22 +16 56 1.22 +16 57 1.22 +16 58 1.22 +16 59 1.22 +16 60 1.22 +16 61 1.22 +16 62 1.22 +16 63 1.22 +17 0 1.22 +17 1 1.22 +17 2 1.22 +17 3 1.22 +17 4 1.22 +17 5 1.22 +17 6 1.22 +17 7 1.22 +17 8 1.22 +17 9 1.22 +17 10 1.22 +17 11 1.22 +17 12 1.22 +17 13 1.22 +17 14 1.22 +17 15 1.22 +17 16 1.22 +17 17 1.22 +17 18 1.22 +17 19 1.22 +17 20 1.22 +17 21 1.22 +17 22 1.22 +17 23 1.22 +17 24 1.22 +17 25 1.22 +17 26 1.22 +17 27 1.22 +17 28 1.22 +17 29 1.22 +17 30 1.22 +17 31 1.22 +17 32 1.22 +17 33 1.22 +17 34 1.22 +17 35 1.22 +17 36 1.22 +17 37 1.22 +17 38 1.22 +17 39 1.22 +17 40 1.22 +17 41 1.22 +17 42 1.22 +17 43 1.22 +17 44 1.22 +17 45 1.22 +17 46 1.22 +17 47 1.22 +17 48 1.22 +17 49 1.22 +17 50 1.22 +17 51 1.22 +17 52 1.22 +17 53 1.22 +17 54 1.22 +17 55 1.22 +17 56 1.22 +17 57 1.22 +17 58 1.22 +17 59 1.22 +17 60 1.22 +17 61 1.22 +17 62 1.22 +17 63 1.22 +18 0 1.22 +18 1 1.22 +18 2 1.22 +18 3 1.22 +18 4 1.22 +18 5 1.22 +18 6 1.22 +18 7 1.22 +18 8 1.22 +18 9 1.22 +18 10 1.22 +18 11 1.22 +18 12 1.22 +18 13 1.22 +18 14 1.22 +18 15 1.22 +18 16 1.22 +18 17 1.22 +18 18 1.22 +18 19 1.22 +18 20 1.22 +18 21 1.22 +18 22 1.22 +18 23 1.22 +18 24 1.22 +18 25 1.22 +18 26 1.22 +18 27 1.22 +18 28 1.22 +18 29 1.22 +18 30 1.22 +18 31 1.22 +18 32 1.22 +18 33 1.22 +18 34 1.22 +18 35 1.22 +18 36 1.22 +18 37 1.22 +18 38 1.22 +18 39 1.22 +18 40 1.22 +18 41 1.22 +18 42 1.22 +18 43 1.22 +18 44 1.22 +18 45 1.22 +18 46 1.22 +18 47 1.22 +18 48 1.22 +18 49 1.22 +18 50 1.22 +18 51 1.22 +18 52 1.22 +18 53 1.22 +18 54 1.22 +18 55 1.22 +18 56 1.22 +18 57 1.22 +18 58 1.22 +18 59 1.22 +18 60 1.22 +18 61 1.22 +18 62 1.22 +18 63 1.22 +19 0 1.22 +19 1 1.22 +19 2 1.22 +19 3 1.22 +19 4 1.22 +19 5 1.22 +19 6 1.22 +19 7 1.22 +19 8 1.22 +19 9 1.22 +19 10 1.22 +19 11 1.22 +19 12 1.22 +19 13 1.22 +19 14 1.22 +19 15 1.22 +19 16 1.22 +19 17 1.22 +19 18 1.22 +19 19 1.22 +19 20 1.22 +19 21 1.22 +19 22 1.22 +19 23 1.22 +19 24 1.22 +19 25 1.22 +19 26 1.22 +19 27 1.22 +19 28 1.22 +19 29 1.22 +19 30 1.22 +19 31 1.22 +19 32 1.22 +19 33 1.22 +19 34 1.22 +19 35 1.22 +19 36 1.22 +19 37 1.22 +19 38 1.22 +19 39 1.22 +19 40 1.22 +19 41 1.22 +19 42 1.22 +19 43 1.22 +19 44 1.22 +19 45 1.22 +19 46 1.22 +19 47 1.22 +19 48 1.22 +19 49 1.22 +19 50 1.22 +19 51 1.22 +19 52 1.22 +19 53 1.22 +19 54 1.22 +19 55 1.22 +19 56 1.22 +19 57 1.22 +19 58 1.22 +19 59 1.22 +19 60 1.22 +19 61 1.22 +19 62 1.22 +19 63 1.22 +20 0 1.22 +20 1 1.22 +20 2 1.22 +20 3 1.22 +20 4 1.22 +20 5 1.22 +20 6 1.22 +20 7 1.22 +20 8 1.22 +20 9 1.22 +20 10 1.22 +20 11 1.22 +20 12 1.22 +20 13 1.22 +20 14 1.22 +20 15 1.22 +20 16 1.22 +20 17 1.22 +20 18 1.22 +20 19 1.22 +20 20 1.22 +20 21 1.22 +20 22 1.22 +20 23 1.22 +20 24 1.22 +20 25 1.22 +20 26 1.22 +20 27 1.22 +20 28 1.22 +20 29 1.22 +20 30 1.22 +20 31 1.22 +20 32 1.22 +20 33 1.22 +20 34 1.22 +20 35 1.22 +20 36 1.22 +20 37 1.22 +20 38 1.22 +20 39 1.22 +20 40 1.22 +20 41 1.22 +20 42 1.22 +20 43 1.22 +20 44 1.22 +20 45 1.22 +20 46 1.22 +20 47 1.22 +20 48 1.22 +20 49 1.22 +20 50 1.22 +20 51 1.22 +20 52 1.22 +20 53 1.22 +20 54 1.22 +20 55 1.22 +20 56 1.22 +20 57 1.22 +20 58 1.22 +20 59 1.22 +20 60 1.22 +20 61 1.22 +20 62 1.22 +20 63 1.22 +21 0 1.22 +21 1 1.22 +21 2 1.22 +21 3 1.22 +21 4 1.22 +21 5 1.22 +21 6 1.22 +21 7 1.22 +21 8 1.22 +21 9 1.22 +21 10 1.22 +21 11 1.22 +21 12 1.22 +21 13 1.22 +21 14 1.22 +21 15 1.22 +21 16 1.22 +21 17 1.22 +21 18 1.22 +21 19 1.22 +21 20 1.22 +21 21 1.22 +21 22 1.22 +21 23 1.22 +21 24 1.22 +21 25 1.22 +21 26 1.22 +21 27 1.22 +21 28 1.22 +21 29 1.22 +21 30 1.22 +21 31 1.22 +21 32 1.22 +21 33 1.22 +21 34 1.22 +21 35 1.22 +21 36 1.22 +21 37 1.22 +21 38 1.22 +21 39 1.22 +21 40 1.22 +21 41 1.22 +21 42 1.22 +21 43 1.22 +21 44 1.22 +21 45 1.22 +21 46 1.22 +21 47 1.22 +21 48 1.22 +21 49 1.22 +21 50 1.22 +21 51 1.22 +21 52 1.22 +21 53 1.22 +21 54 1.22 +21 55 1.22 +21 56 1.22 +21 57 1.22 +21 58 1.22 +21 59 1.22 +21 60 1.22 +21 61 1.22 +21 62 1.22 +21 63 1.22 +22 0 1.22 +22 1 1.22 +22 2 1.22 +22 3 1.22 +22 4 1.22 +22 5 1.22 +22 6 1.22 +22 7 1.22 +22 8 1.22 +22 9 1.22 +22 10 1.22 +22 11 1.22 +22 12 1.22 +22 13 1.22 +22 14 1.22 +22 15 1.22 +22 16 1.22 +22 17 1.22 +22 18 1.22 +22 19 1.22 +22 20 1.22 +22 21 1.22 +22 22 1.22 +22 23 1.22 +22 24 1.22 +22 25 1.22 +22 26 1.22 +22 27 1.22 +22 28 1.22 +22 29 1.22 +22 30 1.22 +22 31 1.22 +22 32 1.22 +22 33 1.22 +22 34 1.22 +22 35 1.22 +22 36 1.22 +22 37 1.22 +22 38 1.22 +22 39 1.22 +22 40 1.22 +22 41 1.22 +22 42 1.22 +22 43 1.22 +22 44 1.22 +22 45 1.22 +22 46 1.22 +22 47 1.22 +22 48 1.22 +22 49 1.22 +22 50 1.22 +22 51 1.22 +22 52 1.22 +22 53 1.22 +22 54 1.22 +22 55 1.22 +22 56 1.22 +22 57 1.22 +22 58 1.22 +22 59 1.22 +22 60 1.22 +22 61 1.22 +22 62 1.22 +22 63 1.22 +23 0 1.22 +23 1 1.22 +23 2 1.22 +23 3 1.22 +23 4 1.22 +23 5 1.22 +23 6 1.22 +23 7 1.22 +23 8 1.22 +23 9 1.22 +23 10 1.22 +23 11 1.22 +23 12 1.22 +23 13 1.22 +23 14 1.22 +23 15 1.22 +23 16 1.22 +23 17 1.22 +23 18 1.22 +23 19 1.22 +23 20 1.22 +23 21 1.22 +23 22 1.22 +23 23 1.22 +23 24 1.22 +23 25 1.22 +23 26 1.22 +23 27 1.22 +23 28 1.22 +23 29 1.22 +23 30 1.22 +23 31 1.22 +23 32 1.22 +23 33 1.22 +23 34 1.22 +23 35 1.22 +23 36 1.22 +23 37 1.22 +23 38 1.22 +23 39 1.22 +23 40 1.22 +23 41 1.22 +23 42 1.22 +23 43 1.22 +23 44 1.22 +23 45 1.22 +23 46 1.22 +23 47 1.22 +23 48 1.22 +23 49 1.22 +23 50 1.22 +23 51 1.22 +23 52 1.22 +23 53 1.22 +23 54 1.22 +23 55 1.22 +23 56 1.22 +23 57 1.22 +23 58 1.22 +23 59 1.22 +23 60 1.22 +23 61 1.22 +23 62 1.22 +23 63 1.22 diff --git a/calibrations/calo/tower_slope_macro/HCALOUT_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt b/calibrations/calo/tower_slope_macro/HCALOUT_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt new file mode 100644 index 000000000..aba66f7cb --- /dev/null +++ b/calibrations/calo/tower_slope_macro/HCALOUT_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt @@ -0,0 +1,1536 @@ +0 0 1.0 +0 1 1.0 +0 2 1.0 +0 3 1.0 +0 4 1.0 +0 5 1.0 +0 6 1.0 +0 7 1.0 +0 8 1.0 +0 9 1.0 +0 10 1.0 +0 11 1.0 +0 12 1.0 +0 13 1.0 +0 14 1.0 +0 15 1.0 +0 16 1.0 +0 17 1.0 +0 18 1.0 +0 19 1.0 +0 20 1.0 +0 21 1.0 +0 22 1.0 +0 23 1.0 +0 24 1.0 +0 25 1.0 +0 26 1.0 +0 27 1.0 +0 28 1.0 +0 29 1.0 +0 30 1.0 +0 31 1.0 +0 32 1.0 +0 33 1.0 +0 34 1.0 +0 35 1.0 +0 36 1.0 +0 37 1.0 +0 38 1.0 +0 39 1.0 +0 40 1.0 +0 41 1.0 +0 42 1.0 +0 43 1.0 +0 44 1.0 +0 45 1.0 +0 46 1.0 +0 47 1.0 +0 48 1.0 +0 49 1.0 +0 50 1.0 +0 51 1.0 +0 52 1.0 +0 53 1.0 +0 54 1.0 +0 55 1.0 +0 56 1.0 +0 57 1.0 +0 58 1.0 +0 59 1.0 +0 60 1.0 +0 61 1.0 +0 62 1.0 +0 63 1.0 +1 0 1.0 +1 1 1.0 +1 2 1.0 +1 3 1.0 +1 4 1.0 +1 5 1.0 +1 6 1.0 +1 7 1.0 +1 8 1.0 +1 9 1.0 +1 10 1.0 +1 11 1.0 +1 12 1.0 +1 13 1.0 +1 14 1.0 +1 15 1.0 +1 16 1.0 +1 17 1.0 +1 18 1.0 +1 19 1.0 +1 20 1.0 +1 21 1.0 +1 22 1.0 +1 23 1.0 +1 24 1.0 +1 25 1.0 +1 26 1.0 +1 27 1.0 +1 28 1.0 +1 29 1.0 +1 30 1.0 +1 31 1.0 +1 32 1.0 +1 33 1.0 +1 34 1.0 +1 35 1.0 +1 36 1.0 +1 37 1.0 +1 38 1.0 +1 39 1.0 +1 40 1.0 +1 41 1.0 +1 42 1.0 +1 43 1.0 +1 44 1.0 +1 45 1.0 +1 46 1.0 +1 47 1.0 +1 48 1.0 +1 49 1.0 +1 50 1.0 +1 51 1.0 +1 52 1.0 +1 53 1.0 +1 54 1.0 +1 55 1.0 +1 56 1.0 +1 57 1.0 +1 58 1.0 +1 59 1.0 +1 60 1.0 +1 61 1.0 +1 62 1.0 +1 63 1.0 +2 0 1.0 +2 1 1.0 +2 2 1.0 +2 3 1.0 +2 4 1.0 +2 5 1.0 +2 6 1.0 +2 7 1.0 +2 8 1.0 +2 9 1.0 +2 10 1.0 +2 11 1.0 +2 12 1.0 +2 13 1.0 +2 14 1.0 +2 15 1.0 +2 16 1.0 +2 17 1.0 +2 18 1.0 +2 19 1.0 +2 20 1.0 +2 21 1.0 +2 22 1.0 +2 23 1.0 +2 24 1.0 +2 25 1.0 +2 26 1.0 +2 27 1.0 +2 28 1.0 +2 29 1.0 +2 30 1.0 +2 31 1.0 +2 32 1.0 +2 33 1.0 +2 34 1.0 +2 35 1.0 +2 36 1.0 +2 37 1.0 +2 38 1.0 +2 39 1.0 +2 40 1.0 +2 41 1.0 +2 42 1.0 +2 43 1.0 +2 44 1.0 +2 45 1.0 +2 46 1.0 +2 47 1.0 +2 48 1.0 +2 49 1.0 +2 50 1.0 +2 51 1.0 +2 52 1.0 +2 53 1.0 +2 54 1.0 +2 55 1.0 +2 56 1.0 +2 57 1.0 +2 58 1.0 +2 59 1.0 +2 60 1.0 +2 61 1.0 +2 62 1.0 +2 63 1.0 +3 0 1.0 +3 1 1.0 +3 2 1.0 +3 3 1.0 +3 4 1.0 +3 5 1.0 +3 6 1.0 +3 7 1.0 +3 8 1.0 +3 9 1.0 +3 10 1.0 +3 11 1.0 +3 12 1.0 +3 13 1.0 +3 14 1.0 +3 15 1.0 +3 16 1.0 +3 17 1.0 +3 18 1.0 +3 19 1.0 +3 20 1.0 +3 21 1.0 +3 22 1.0 +3 23 1.0 +3 24 1.0 +3 25 1.0 +3 26 1.0 +3 27 1.0 +3 28 1.0 +3 29 1.0 +3 30 1.0 +3 31 1.0 +3 32 1.0 +3 33 1.0 +3 34 1.0 +3 35 1.0 +3 36 1.0 +3 37 1.0 +3 38 1.0 +3 39 1.0 +3 40 1.0 +3 41 1.0 +3 42 1.0 +3 43 1.0 +3 44 1.0 +3 45 1.0 +3 46 1.0 +3 47 1.0 +3 48 1.0 +3 49 1.0 +3 50 1.0 +3 51 1.0 +3 52 1.0 +3 53 1.0 +3 54 1.0 +3 55 1.0 +3 56 1.0 +3 57 1.0 +3 58 1.0 +3 59 1.0 +3 60 1.0 +3 61 1.0 +3 62 1.0 +3 63 1.0 +4 0 1.0 +4 1 1.0 +4 2 1.0 +4 3 1.0 +4 4 1.0 +4 5 1.0 +4 6 1.0 +4 7 1.0 +4 8 1.0 +4 9 1.0 +4 10 1.0 +4 11 1.0 +4 12 1.0 +4 13 1.0 +4 14 1.0 +4 15 1.0 +4 16 1.0 +4 17 1.0 +4 18 1.0 +4 19 1.0 +4 20 1.0 +4 21 1.0 +4 22 1.0 +4 23 1.0 +4 24 1.0 +4 25 1.0 +4 26 1.0 +4 27 1.0 +4 28 1.0 +4 29 1.0 +4 30 1.0 +4 31 1.0 +4 32 1.0 +4 33 1.0 +4 34 1.0 +4 35 1.0 +4 36 1.0 +4 37 1.0 +4 38 1.0 +4 39 1.0 +4 40 1.0 +4 41 1.0 +4 42 1.0 +4 43 1.0 +4 44 1.0 +4 45 1.0 +4 46 1.0 +4 47 1.0 +4 48 1.0 +4 49 1.0 +4 50 1.0 +4 51 1.0 +4 52 1.0 +4 53 1.0 +4 54 1.0 +4 55 1.0 +4 56 1.0 +4 57 1.0 +4 58 1.0 +4 59 1.0 +4 60 1.0 +4 61 1.0 +4 62 1.0 +4 63 1.0 +5 0 1.0 +5 1 1.0 +5 2 1.0 +5 3 1.0 +5 4 1.0 +5 5 1.0 +5 6 1.0 +5 7 1.0 +5 8 1.0 +5 9 1.0 +5 10 1.0 +5 11 1.0 +5 12 1.0 +5 13 1.0 +5 14 1.0 +5 15 1.0 +5 16 1.0 +5 17 1.0 +5 18 1.0 +5 19 1.0 +5 20 1.0 +5 21 1.0 +5 22 1.0 +5 23 1.0 +5 24 1.0 +5 25 1.0 +5 26 1.0 +5 27 1.0 +5 28 1.0 +5 29 1.0 +5 30 1.0 +5 31 1.0 +5 32 1.0 +5 33 1.0 +5 34 1.0 +5 35 1.0 +5 36 1.0 +5 37 1.0 +5 38 1.0 +5 39 1.0 +5 40 1.0 +5 41 1.0 +5 42 1.0 +5 43 1.0 +5 44 1.0 +5 45 1.0 +5 46 1.0 +5 47 1.0 +5 48 1.0 +5 49 1.0 +5 50 1.0 +5 51 1.0 +5 52 1.0 +5 53 1.0 +5 54 1.0 +5 55 1.0 +5 56 1.0 +5 57 1.0 +5 58 1.0 +5 59 1.0 +5 60 1.0 +5 61 1.0 +5 62 1.0 +5 63 1.0 +6 0 1.0 +6 1 1.0 +6 2 1.0 +6 3 1.0 +6 4 1.0 +6 5 1.0 +6 6 1.0 +6 7 1.0 +6 8 1.0 +6 9 1.0 +6 10 1.0 +6 11 1.0 +6 12 1.0 +6 13 1.0 +6 14 1.0 +6 15 1.0 +6 16 1.0 +6 17 1.0 +6 18 1.0 +6 19 1.0 +6 20 1.0 +6 21 1.0 +6 22 1.0 +6 23 1.0 +6 24 1.0 +6 25 1.0 +6 26 1.0 +6 27 1.0 +6 28 1.0 +6 29 1.0 +6 30 1.0 +6 31 1.0 +6 32 1.0 +6 33 1.0 +6 34 1.0 +6 35 1.0 +6 36 1.0 +6 37 1.0 +6 38 1.0 +6 39 1.0 +6 40 1.0 +6 41 1.0 +6 42 1.0 +6 43 1.0 +6 44 1.0 +6 45 1.0 +6 46 1.0 +6 47 1.0 +6 48 1.0 +6 49 1.0 +6 50 1.0 +6 51 1.0 +6 52 1.0 +6 53 1.0 +6 54 1.0 +6 55 1.0 +6 56 1.0 +6 57 1.0 +6 58 1.0 +6 59 1.0 +6 60 1.0 +6 61 1.0 +6 62 1.0 +6 63 1.0 +7 0 1.0 +7 1 1.0 +7 2 1.0 +7 3 1.0 +7 4 1.0 +7 5 1.0 +7 6 1.0 +7 7 1.0 +7 8 1.0 +7 9 1.0 +7 10 1.0 +7 11 1.0 +7 12 1.0 +7 13 1.0 +7 14 1.0 +7 15 1.0 +7 16 1.0 +7 17 1.0 +7 18 1.0 +7 19 1.0 +7 20 1.0 +7 21 1.0 +7 22 1.0 +7 23 1.0 +7 24 1.0 +7 25 1.0 +7 26 1.0 +7 27 1.0 +7 28 1.0 +7 29 1.0 +7 30 1.0 +7 31 1.0 +7 32 1.0 +7 33 1.0 +7 34 1.0 +7 35 1.0 +7 36 1.0 +7 37 1.0 +7 38 1.0 +7 39 1.0 +7 40 1.0 +7 41 1.0 +7 42 1.0 +7 43 1.0 +7 44 1.0 +7 45 1.0 +7 46 1.0 +7 47 1.0 +7 48 1.0 +7 49 1.0 +7 50 1.0 +7 51 1.0 +7 52 1.0 +7 53 1.0 +7 54 1.0 +7 55 1.0 +7 56 1.0 +7 57 1.0 +7 58 1.0 +7 59 1.0 +7 60 1.0 +7 61 1.0 +7 62 1.0 +7 63 1.0 +8 0 1.0 +8 1 1.0 +8 2 1.0 +8 3 1.0 +8 4 1.0 +8 5 1.0 +8 6 1.0 +8 7 1.0 +8 8 1.0 +8 9 1.0 +8 10 1.0 +8 11 1.0 +8 12 1.0 +8 13 1.0 +8 14 1.0 +8 15 1.0 +8 16 1.0 +8 17 1.0 +8 18 1.0 +8 19 1.0 +8 20 1.0 +8 21 1.0 +8 22 1.0 +8 23 1.0 +8 24 1.0 +8 25 1.0 +8 26 1.0 +8 27 1.0 +8 28 1.0 +8 29 1.0 +8 30 1.0 +8 31 1.0 +8 32 1.0 +8 33 1.0 +8 34 1.0 +8 35 1.0 +8 36 1.0 +8 37 1.0 +8 38 1.0 +8 39 1.0 +8 40 1.0 +8 41 1.0 +8 42 1.0 +8 43 1.0 +8 44 1.0 +8 45 1.0 +8 46 1.0 +8 47 1.0 +8 48 1.0 +8 49 1.0 +8 50 1.0 +8 51 1.0 +8 52 1.0 +8 53 1.0 +8 54 1.0 +8 55 1.0 +8 56 1.0 +8 57 1.0 +8 58 1.0 +8 59 1.0 +8 60 1.0 +8 61 1.0 +8 62 1.0 +8 63 1.0 +9 0 1.0 +9 1 1.0 +9 2 1.0 +9 3 1.0 +9 4 1.0 +9 5 1.0 +9 6 1.0 +9 7 1.0 +9 8 1.0 +9 9 1.0 +9 10 1.0 +9 11 1.0 +9 12 1.0 +9 13 1.0 +9 14 1.0 +9 15 1.0 +9 16 1.0 +9 17 1.0 +9 18 1.0 +9 19 1.0 +9 20 1.0 +9 21 1.0 +9 22 1.0 +9 23 1.0 +9 24 1.0 +9 25 1.0 +9 26 1.0 +9 27 1.0 +9 28 1.0 +9 29 1.0 +9 30 1.0 +9 31 1.0 +9 32 1.0 +9 33 1.0 +9 34 1.0 +9 35 1.0 +9 36 1.0 +9 37 1.0 +9 38 1.0 +9 39 1.0 +9 40 1.0 +9 41 1.0 +9 42 1.0 +9 43 1.0 +9 44 1.0 +9 45 1.0 +9 46 1.0 +9 47 1.0 +9 48 1.0 +9 49 1.0 +9 50 1.0 +9 51 1.0 +9 52 1.0 +9 53 1.0 +9 54 1.0 +9 55 1.0 +9 56 1.0 +9 57 1.0 +9 58 1.0 +9 59 1.0 +9 60 1.0 +9 61 1.0 +9 62 1.0 +9 63 1.0 +10 0 1.0 +10 1 1.0 +10 2 1.0 +10 3 1.0 +10 4 1.0 +10 5 1.0 +10 6 1.0 +10 7 1.0 +10 8 1.0 +10 9 1.0 +10 10 1.0 +10 11 1.0 +10 12 1.0 +10 13 1.0 +10 14 1.0 +10 15 1.0 +10 16 1.0 +10 17 1.0 +10 18 1.0 +10 19 1.0 +10 20 1.0 +10 21 1.0 +10 22 1.0 +10 23 1.0 +10 24 1.0 +10 25 1.0 +10 26 1.0 +10 27 1.0 +10 28 1.0 +10 29 1.0 +10 30 1.0 +10 31 1.0 +10 32 1.0 +10 33 1.0 +10 34 1.0 +10 35 1.0 +10 36 1.0 +10 37 1.0 +10 38 1.0 +10 39 1.0 +10 40 1.0 +10 41 1.0 +10 42 1.0 +10 43 1.0 +10 44 1.0 +10 45 1.0 +10 46 1.0 +10 47 1.0 +10 48 1.0 +10 49 1.0 +10 50 1.0 +10 51 1.0 +10 52 1.0 +10 53 1.0 +10 54 1.0 +10 55 1.0 +10 56 1.0 +10 57 1.0 +10 58 1.0 +10 59 1.0 +10 60 1.0 +10 61 1.0 +10 62 1.0 +10 63 1.0 +11 0 1.0 +11 1 1.0 +11 2 1.0 +11 3 1.0 +11 4 1.0 +11 5 1.0 +11 6 1.0 +11 7 1.0 +11 8 1.0 +11 9 1.0 +11 10 1.0 +11 11 1.0 +11 12 1.0 +11 13 1.0 +11 14 1.0 +11 15 1.0 +11 16 1.0 +11 17 1.0 +11 18 1.0 +11 19 1.0 +11 20 1.0 +11 21 1.0 +11 22 1.0 +11 23 1.0 +11 24 1.0 +11 25 1.0 +11 26 1.0 +11 27 1.0 +11 28 1.0 +11 29 1.0 +11 30 1.0 +11 31 1.0 +11 32 1.0 +11 33 1.0 +11 34 1.0 +11 35 1.0 +11 36 1.0 +11 37 1.0 +11 38 1.0 +11 39 1.0 +11 40 1.0 +11 41 1.0 +11 42 1.0 +11 43 1.0 +11 44 1.0 +11 45 1.0 +11 46 1.0 +11 47 1.0 +11 48 1.0 +11 49 1.0 +11 50 1.0 +11 51 1.0 +11 52 1.0 +11 53 1.0 +11 54 1.0 +11 55 1.0 +11 56 1.0 +11 57 1.0 +11 58 1.0 +11 59 1.0 +11 60 1.0 +11 61 1.0 +11 62 1.0 +11 63 1.0 +12 0 1.12 +12 1 1.12 +12 2 1.12 +12 3 1.12 +12 4 1.12 +12 5 1.12 +12 6 1.12 +12 7 1.12 +12 8 1.12 +12 9 1.12 +12 10 1.12 +12 11 1.12 +12 12 1.12 +12 13 1.12 +12 14 1.12 +12 15 1.12 +12 16 1.12 +12 17 1.12 +12 18 1.12 +12 19 1.12 +12 20 1.12 +12 21 1.12 +12 22 1.12 +12 23 1.12 +12 24 1.12 +12 25 1.12 +12 26 1.12 +12 27 1.12 +12 28 1.12 +12 29 1.12 +12 30 1.12 +12 31 1.12 +12 32 1.12 +12 33 1.12 +12 34 1.12 +12 35 1.12 +12 36 1.12 +12 37 1.12 +12 38 1.12 +12 39 1.12 +12 40 1.12 +12 41 1.12 +12 42 1.12 +12 43 1.12 +12 44 1.12 +12 45 1.12 +12 46 1.12 +12 47 1.12 +12 48 1.12 +12 49 1.12 +12 50 1.12 +12 51 1.12 +12 52 1.12 +12 53 1.12 +12 54 1.12 +12 55 1.12 +12 56 1.12 +12 57 1.12 +12 58 1.12 +12 59 1.12 +12 60 1.12 +12 61 1.12 +12 62 1.12 +12 63 1.12 +13 0 1.12 +13 1 1.12 +13 2 1.12 +13 3 1.12 +13 4 1.12 +13 5 1.12 +13 6 1.12 +13 7 1.12 +13 8 1.12 +13 9 1.12 +13 10 1.12 +13 11 1.12 +13 12 1.12 +13 13 1.12 +13 14 1.12 +13 15 1.12 +13 16 1.12 +13 17 1.12 +13 18 1.12 +13 19 1.12 +13 20 1.12 +13 21 1.12 +13 22 1.12 +13 23 1.12 +13 24 1.12 +13 25 1.12 +13 26 1.12 +13 27 1.12 +13 28 1.12 +13 29 1.12 +13 30 1.12 +13 31 1.12 +13 32 1.12 +13 33 1.12 +13 34 1.12 +13 35 1.12 +13 36 1.12 +13 37 1.12 +13 38 1.12 +13 39 1.12 +13 40 1.12 +13 41 1.12 +13 42 1.12 +13 43 1.12 +13 44 1.12 +13 45 1.12 +13 46 1.12 +13 47 1.12 +13 48 1.12 +13 49 1.12 +13 50 1.12 +13 51 1.12 +13 52 1.12 +13 53 1.12 +13 54 1.12 +13 55 1.12 +13 56 1.12 +13 57 1.12 +13 58 1.12 +13 59 1.12 +13 60 1.12 +13 61 1.12 +13 62 1.12 +13 63 1.12 +14 0 1.12 +14 1 1.12 +14 2 1.12 +14 3 1.12 +14 4 1.12 +14 5 1.12 +14 6 1.12 +14 7 1.12 +14 8 1.12 +14 9 1.12 +14 10 1.12 +14 11 1.12 +14 12 1.12 +14 13 1.12 +14 14 1.12 +14 15 1.12 +14 16 1.12 +14 17 1.12 +14 18 1.12 +14 19 1.12 +14 20 1.12 +14 21 1.12 +14 22 1.12 +14 23 1.12 +14 24 1.12 +14 25 1.12 +14 26 1.12 +14 27 1.12 +14 28 1.12 +14 29 1.12 +14 30 1.12 +14 31 1.12 +14 32 1.12 +14 33 1.12 +14 34 1.12 +14 35 1.12 +14 36 1.12 +14 37 1.12 +14 38 1.12 +14 39 1.12 +14 40 1.12 +14 41 1.12 +14 42 1.12 +14 43 1.12 +14 44 1.12 +14 45 1.12 +14 46 1.12 +14 47 1.12 +14 48 1.12 +14 49 1.12 +14 50 1.12 +14 51 1.12 +14 52 1.12 +14 53 1.12 +14 54 1.12 +14 55 1.12 +14 56 1.12 +14 57 1.12 +14 58 1.12 +14 59 1.12 +14 60 1.12 +14 61 1.12 +14 62 1.12 +14 63 1.12 +15 0 1.12 +15 1 1.12 +15 2 1.12 +15 3 1.12 +15 4 1.12 +15 5 1.12 +15 6 1.12 +15 7 1.12 +15 8 1.12 +15 9 1.12 +15 10 1.12 +15 11 1.12 +15 12 1.12 +15 13 1.12 +15 14 1.12 +15 15 1.12 +15 16 1.12 +15 17 1.12 +15 18 1.12 +15 19 1.12 +15 20 1.12 +15 21 1.12 +15 22 1.12 +15 23 1.12 +15 24 1.12 +15 25 1.12 +15 26 1.12 +15 27 1.12 +15 28 1.12 +15 29 1.12 +15 30 1.12 +15 31 1.12 +15 32 1.12 +15 33 1.12 +15 34 1.12 +15 35 1.12 +15 36 1.12 +15 37 1.12 +15 38 1.12 +15 39 1.12 +15 40 1.12 +15 41 1.12 +15 42 1.12 +15 43 1.12 +15 44 1.12 +15 45 1.12 +15 46 1.12 +15 47 1.12 +15 48 1.12 +15 49 1.12 +15 50 1.12 +15 51 1.12 +15 52 1.12 +15 53 1.12 +15 54 1.12 +15 55 1.12 +15 56 1.12 +15 57 1.12 +15 58 1.12 +15 59 1.12 +15 60 1.12 +15 61 1.12 +15 62 1.12 +15 63 1.12 +16 0 1.12 +16 1 1.12 +16 2 1.12 +16 3 1.12 +16 4 1.12 +16 5 1.12 +16 6 1.12 +16 7 1.12 +16 8 1.12 +16 9 1.12 +16 10 1.12 +16 11 1.12 +16 12 1.12 +16 13 1.12 +16 14 1.12 +16 15 1.12 +16 16 1.12 +16 17 1.12 +16 18 1.12 +16 19 1.12 +16 20 1.12 +16 21 1.12 +16 22 1.12 +16 23 1.12 +16 24 1.12 +16 25 1.12 +16 26 1.12 +16 27 1.12 +16 28 1.12 +16 29 1.12 +16 30 1.12 +16 31 1.12 +16 32 1.12 +16 33 1.12 +16 34 1.12 +16 35 1.12 +16 36 1.12 +16 37 1.12 +16 38 1.12 +16 39 1.12 +16 40 1.12 +16 41 1.12 +16 42 1.12 +16 43 1.12 +16 44 1.12 +16 45 1.12 +16 46 1.12 +16 47 1.12 +16 48 1.12 +16 49 1.12 +16 50 1.12 +16 51 1.12 +16 52 1.12 +16 53 1.12 +16 54 1.12 +16 55 1.12 +16 56 1.12 +16 57 1.12 +16 58 1.12 +16 59 1.12 +16 60 1.12 +16 61 1.12 +16 62 1.12 +16 63 1.12 +17 0 1.12 +17 1 1.12 +17 2 1.12 +17 3 1.12 +17 4 1.12 +17 5 1.12 +17 6 1.12 +17 7 1.12 +17 8 1.12 +17 9 1.12 +17 10 1.12 +17 11 1.12 +17 12 1.12 +17 13 1.12 +17 14 1.12 +17 15 1.12 +17 16 1.12 +17 17 1.12 +17 18 1.12 +17 19 1.12 +17 20 1.12 +17 21 1.12 +17 22 1.12 +17 23 1.12 +17 24 1.12 +17 25 1.12 +17 26 1.12 +17 27 1.12 +17 28 1.12 +17 29 1.12 +17 30 1.12 +17 31 1.12 +17 32 1.12 +17 33 1.12 +17 34 1.12 +17 35 1.12 +17 36 1.12 +17 37 1.12 +17 38 1.12 +17 39 1.12 +17 40 1.12 +17 41 1.12 +17 42 1.12 +17 43 1.12 +17 44 1.12 +17 45 1.12 +17 46 1.12 +17 47 1.12 +17 48 1.12 +17 49 1.12 +17 50 1.12 +17 51 1.12 +17 52 1.12 +17 53 1.12 +17 54 1.12 +17 55 1.12 +17 56 1.12 +17 57 1.12 +17 58 1.12 +17 59 1.12 +17 60 1.12 +17 61 1.12 +17 62 1.12 +17 63 1.12 +18 0 1.12 +18 1 1.12 +18 2 1.12 +18 3 1.12 +18 4 1.12 +18 5 1.12 +18 6 1.12 +18 7 1.12 +18 8 1.12 +18 9 1.12 +18 10 1.12 +18 11 1.12 +18 12 1.12 +18 13 1.12 +18 14 1.12 +18 15 1.12 +18 16 1.12 +18 17 1.12 +18 18 1.12 +18 19 1.12 +18 20 1.12 +18 21 1.12 +18 22 1.12 +18 23 1.12 +18 24 1.12 +18 25 1.12 +18 26 1.12 +18 27 1.12 +18 28 1.12 +18 29 1.12 +18 30 1.12 +18 31 1.12 +18 32 1.12 +18 33 1.12 +18 34 1.12 +18 35 1.12 +18 36 1.12 +18 37 1.12 +18 38 1.12 +18 39 1.12 +18 40 1.12 +18 41 1.12 +18 42 1.12 +18 43 1.12 +18 44 1.12 +18 45 1.12 +18 46 1.12 +18 47 1.12 +18 48 1.12 +18 49 1.12 +18 50 1.12 +18 51 1.12 +18 52 1.12 +18 53 1.12 +18 54 1.12 +18 55 1.12 +18 56 1.12 +18 57 1.12 +18 58 1.12 +18 59 1.12 +18 60 1.12 +18 61 1.12 +18 62 1.12 +18 63 1.12 +19 0 1.12 +19 1 1.12 +19 2 1.12 +19 3 1.12 +19 4 1.12 +19 5 1.12 +19 6 1.12 +19 7 1.12 +19 8 1.12 +19 9 1.12 +19 10 1.12 +19 11 1.12 +19 12 1.12 +19 13 1.12 +19 14 1.12 +19 15 1.12 +19 16 1.12 +19 17 1.12 +19 18 1.12 +19 19 1.12 +19 20 1.12 +19 21 1.12 +19 22 1.12 +19 23 1.12 +19 24 1.12 +19 25 1.12 +19 26 1.12 +19 27 1.12 +19 28 1.12 +19 29 1.12 +19 30 1.12 +19 31 1.12 +19 32 1.12 +19 33 1.12 +19 34 1.12 +19 35 1.12 +19 36 1.12 +19 37 1.12 +19 38 1.12 +19 39 1.12 +19 40 1.12 +19 41 1.12 +19 42 1.12 +19 43 1.12 +19 44 1.12 +19 45 1.12 +19 46 1.12 +19 47 1.12 +19 48 1.12 +19 49 1.12 +19 50 1.12 +19 51 1.12 +19 52 1.12 +19 53 1.12 +19 54 1.12 +19 55 1.12 +19 56 1.12 +19 57 1.12 +19 58 1.12 +19 59 1.12 +19 60 1.12 +19 61 1.12 +19 62 1.12 +19 63 1.12 +20 0 1.12 +20 1 1.12 +20 2 1.12 +20 3 1.12 +20 4 1.12 +20 5 1.12 +20 6 1.12 +20 7 1.12 +20 8 1.12 +20 9 1.12 +20 10 1.12 +20 11 1.12 +20 12 1.12 +20 13 1.12 +20 14 1.12 +20 15 1.12 +20 16 1.12 +20 17 1.12 +20 18 1.12 +20 19 1.12 +20 20 1.12 +20 21 1.12 +20 22 1.12 +20 23 1.12 +20 24 1.12 +20 25 1.12 +20 26 1.12 +20 27 1.12 +20 28 1.12 +20 29 1.12 +20 30 1.12 +20 31 1.12 +20 32 1.12 +20 33 1.12 +20 34 1.12 +20 35 1.12 +20 36 1.12 +20 37 1.12 +20 38 1.12 +20 39 1.12 +20 40 1.12 +20 41 1.12 +20 42 1.12 +20 43 1.12 +20 44 1.12 +20 45 1.12 +20 46 1.12 +20 47 1.12 +20 48 1.12 +20 49 1.12 +20 50 1.12 +20 51 1.12 +20 52 1.12 +20 53 1.12 +20 54 1.12 +20 55 1.12 +20 56 1.12 +20 57 1.12 +20 58 1.12 +20 59 1.12 +20 60 1.12 +20 61 1.12 +20 62 1.12 +20 63 1.12 +21 0 1.12 +21 1 1.12 +21 2 1.12 +21 3 1.12 +21 4 1.12 +21 5 1.12 +21 6 1.12 +21 7 1.12 +21 8 1.12 +21 9 1.12 +21 10 1.12 +21 11 1.12 +21 12 1.12 +21 13 1.12 +21 14 1.12 +21 15 1.12 +21 16 1.12 +21 17 1.12 +21 18 1.12 +21 19 1.12 +21 20 1.12 +21 21 1.12 +21 22 1.12 +21 23 1.12 +21 24 1.12 +21 25 1.12 +21 26 1.12 +21 27 1.12 +21 28 1.12 +21 29 1.12 +21 30 1.12 +21 31 1.12 +21 32 1.12 +21 33 1.12 +21 34 1.12 +21 35 1.12 +21 36 1.12 +21 37 1.12 +21 38 1.12 +21 39 1.12 +21 40 1.12 +21 41 1.12 +21 42 1.12 +21 43 1.12 +21 44 1.12 +21 45 1.12 +21 46 1.12 +21 47 1.12 +21 48 1.12 +21 49 1.12 +21 50 1.12 +21 51 1.12 +21 52 1.12 +21 53 1.12 +21 54 1.12 +21 55 1.12 +21 56 1.12 +21 57 1.12 +21 58 1.12 +21 59 1.12 +21 60 1.12 +21 61 1.12 +21 62 1.12 +21 63 1.12 +22 0 1.12 +22 1 1.12 +22 2 1.12 +22 3 1.12 +22 4 1.12 +22 5 1.12 +22 6 1.12 +22 7 1.12 +22 8 1.12 +22 9 1.12 +22 10 1.12 +22 11 1.12 +22 12 1.12 +22 13 1.12 +22 14 1.12 +22 15 1.12 +22 16 1.12 +22 17 1.12 +22 18 1.12 +22 19 1.12 +22 20 1.12 +22 21 1.12 +22 22 1.12 +22 23 1.12 +22 24 1.12 +22 25 1.12 +22 26 1.12 +22 27 1.12 +22 28 1.12 +22 29 1.12 +22 30 1.12 +22 31 1.12 +22 32 1.12 +22 33 1.12 +22 34 1.12 +22 35 1.12 +22 36 1.12 +22 37 1.12 +22 38 1.12 +22 39 1.12 +22 40 1.12 +22 41 1.12 +22 42 1.12 +22 43 1.12 +22 44 1.12 +22 45 1.12 +22 46 1.12 +22 47 1.12 +22 48 1.12 +22 49 1.12 +22 50 1.12 +22 51 1.12 +22 52 1.12 +22 53 1.12 +22 54 1.12 +22 55 1.12 +22 56 1.12 +22 57 1.12 +22 58 1.12 +22 59 1.12 +22 60 1.12 +22 61 1.12 +22 62 1.12 +22 63 1.12 +23 0 1.12 +23 1 1.12 +23 2 1.12 +23 3 1.12 +23 4 1.12 +23 5 1.12 +23 6 1.12 +23 7 1.12 +23 8 1.12 +23 9 1.12 +23 10 1.12 +23 11 1.12 +23 12 1.12 +23 13 1.12 +23 14 1.12 +23 15 1.12 +23 16 1.12 +23 17 1.12 +23 18 1.12 +23 19 1.12 +23 20 1.12 +23 21 1.12 +23 22 1.12 +23 23 1.12 +23 24 1.12 +23 25 1.12 +23 26 1.12 +23 27 1.12 +23 28 1.12 +23 29 1.12 +23 30 1.12 +23 31 1.12 +23 32 1.12 +23 33 1.12 +23 34 1.12 +23 35 1.12 +23 36 1.12 +23 37 1.12 +23 38 1.12 +23 39 1.12 +23 40 1.12 +23 41 1.12 +23 42 1.12 +23 43 1.12 +23 44 1.12 +23 45 1.12 +23 46 1.12 +23 47 1.12 +23 48 1.12 +23 49 1.12 +23 50 1.12 +23 51 1.12 +23 52 1.12 +23 53 1.12 +23 54 1.12 +23 55 1.12 +23 56 1.12 +23 57 1.12 +23 58 1.12 +23 59 1.12 +23 60 1.12 +23 61 1.12 +23 62 1.12 +23 63 1.12 diff --git a/calibrations/calo/tower_slope_macro/HCALOUT_GainsCalib1.22.txt b/calibrations/calo/tower_slope_macro/HCALOUT_GainsCalib1.22.txt new file mode 100644 index 000000000..7138c4c00 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/HCALOUT_GainsCalib1.22.txt @@ -0,0 +1,1536 @@ +0 0 1.22 +0 1 1.22 +0 2 1.22 +0 3 1.22 +0 4 1.22 +0 5 1.22 +0 6 1.22 +0 7 1.22 +0 8 1.22 +0 9 1.22 +0 10 1.22 +0 11 1.22 +0 12 1.22 +0 13 1.22 +0 14 1.22 +0 15 1.22 +0 16 1.22 +0 17 1.22 +0 18 1.22 +0 19 1.22 +0 20 1.22 +0 21 1.22 +0 22 1.22 +0 23 1.22 +0 24 1.22 +0 25 1.22 +0 26 1.22 +0 27 1.22 +0 28 1.22 +0 29 1.22 +0 30 1.22 +0 31 1.22 +0 32 1.22 +0 33 1.22 +0 34 1.22 +0 35 1.22 +0 36 1.22 +0 37 1.22 +0 38 1.22 +0 39 1.22 +0 40 1.22 +0 41 1.22 +0 42 1.22 +0 43 1.22 +0 44 1.22 +0 45 1.22 +0 46 1.22 +0 47 1.22 +0 48 1.22 +0 49 1.22 +0 50 1.22 +0 51 1.22 +0 52 1.22 +0 53 1.22 +0 54 1.22 +0 55 1.22 +0 56 1.22 +0 57 1.22 +0 58 1.22 +0 59 1.22 +0 60 1.22 +0 61 1.22 +0 62 1.22 +0 63 1.22 +1 0 1.22 +1 1 1.22 +1 2 1.22 +1 3 1.22 +1 4 1.22 +1 5 1.22 +1 6 1.22 +1 7 1.22 +1 8 1.22 +1 9 1.22 +1 10 1.22 +1 11 1.22 +1 12 1.22 +1 13 1.22 +1 14 1.22 +1 15 1.22 +1 16 1.22 +1 17 1.22 +1 18 1.22 +1 19 1.22 +1 20 1.22 +1 21 1.22 +1 22 1.22 +1 23 1.22 +1 24 1.22 +1 25 1.22 +1 26 1.22 +1 27 1.22 +1 28 1.22 +1 29 1.22 +1 30 1.22 +1 31 1.22 +1 32 1.22 +1 33 1.22 +1 34 1.22 +1 35 1.22 +1 36 1.22 +1 37 1.22 +1 38 1.22 +1 39 1.22 +1 40 1.22 +1 41 1.22 +1 42 1.22 +1 43 1.22 +1 44 1.22 +1 45 1.22 +1 46 1.22 +1 47 1.22 +1 48 1.22 +1 49 1.22 +1 50 1.22 +1 51 1.22 +1 52 1.22 +1 53 1.22 +1 54 1.22 +1 55 1.22 +1 56 1.22 +1 57 1.22 +1 58 1.22 +1 59 1.22 +1 60 1.22 +1 61 1.22 +1 62 1.22 +1 63 1.22 +2 0 1.22 +2 1 1.22 +2 2 1.22 +2 3 1.22 +2 4 1.22 +2 5 1.22 +2 6 1.22 +2 7 1.22 +2 8 1.22 +2 9 1.22 +2 10 1.22 +2 11 1.22 +2 12 1.22 +2 13 1.22 +2 14 1.22 +2 15 1.22 +2 16 1.22 +2 17 1.22 +2 18 1.22 +2 19 1.22 +2 20 1.22 +2 21 1.22 +2 22 1.22 +2 23 1.22 +2 24 1.22 +2 25 1.22 +2 26 1.22 +2 27 1.22 +2 28 1.22 +2 29 1.22 +2 30 1.22 +2 31 1.22 +2 32 1.22 +2 33 1.22 +2 34 1.22 +2 35 1.22 +2 36 1.22 +2 37 1.22 +2 38 1.22 +2 39 1.22 +2 40 1.22 +2 41 1.22 +2 42 1.22 +2 43 1.22 +2 44 1.22 +2 45 1.22 +2 46 1.22 +2 47 1.22 +2 48 1.22 +2 49 1.22 +2 50 1.22 +2 51 1.22 +2 52 1.22 +2 53 1.22 +2 54 1.22 +2 55 1.22 +2 56 1.22 +2 57 1.22 +2 58 1.22 +2 59 1.22 +2 60 1.22 +2 61 1.22 +2 62 1.22 +2 63 1.22 +3 0 1.22 +3 1 1.22 +3 2 1.22 +3 3 1.22 +3 4 1.22 +3 5 1.22 +3 6 1.22 +3 7 1.22 +3 8 1.22 +3 9 1.22 +3 10 1.22 +3 11 1.22 +3 12 1.22 +3 13 1.22 +3 14 1.22 +3 15 1.22 +3 16 1.22 +3 17 1.22 +3 18 1.22 +3 19 1.22 +3 20 1.22 +3 21 1.22 +3 22 1.22 +3 23 1.22 +3 24 1.22 +3 25 1.22 +3 26 1.22 +3 27 1.22 +3 28 1.22 +3 29 1.22 +3 30 1.22 +3 31 1.22 +3 32 1.22 +3 33 1.22 +3 34 1.22 +3 35 1.22 +3 36 1.22 +3 37 1.22 +3 38 1.22 +3 39 1.22 +3 40 1.22 +3 41 1.22 +3 42 1.22 +3 43 1.22 +3 44 1.22 +3 45 1.22 +3 46 1.22 +3 47 1.22 +3 48 1.22 +3 49 1.22 +3 50 1.22 +3 51 1.22 +3 52 1.22 +3 53 1.22 +3 54 1.22 +3 55 1.22 +3 56 1.22 +3 57 1.22 +3 58 1.22 +3 59 1.22 +3 60 1.22 +3 61 1.22 +3 62 1.22 +3 63 1.22 +4 0 1.22 +4 1 1.22 +4 2 1.22 +4 3 1.22 +4 4 1.22 +4 5 1.22 +4 6 1.22 +4 7 1.22 +4 8 1.22 +4 9 1.22 +4 10 1.22 +4 11 1.22 +4 12 1.22 +4 13 1.22 +4 14 1.22 +4 15 1.22 +4 16 1.22 +4 17 1.22 +4 18 1.22 +4 19 1.22 +4 20 1.22 +4 21 1.22 +4 22 1.22 +4 23 1.22 +4 24 1.22 +4 25 1.22 +4 26 1.22 +4 27 1.22 +4 28 1.22 +4 29 1.22 +4 30 1.22 +4 31 1.22 +4 32 1.22 +4 33 1.22 +4 34 1.22 +4 35 1.22 +4 36 1.22 +4 37 1.22 +4 38 1.22 +4 39 1.22 +4 40 1.22 +4 41 1.22 +4 42 1.22 +4 43 1.22 +4 44 1.22 +4 45 1.22 +4 46 1.22 +4 47 1.22 +4 48 1.22 +4 49 1.22 +4 50 1.22 +4 51 1.22 +4 52 1.22 +4 53 1.22 +4 54 1.22 +4 55 1.22 +4 56 1.22 +4 57 1.22 +4 58 1.22 +4 59 1.22 +4 60 1.22 +4 61 1.22 +4 62 1.22 +4 63 1.22 +5 0 1.22 +5 1 1.22 +5 2 1.22 +5 3 1.22 +5 4 1.22 +5 5 1.22 +5 6 1.22 +5 7 1.22 +5 8 1.22 +5 9 1.22 +5 10 1.22 +5 11 1.22 +5 12 1.22 +5 13 1.22 +5 14 1.22 +5 15 1.22 +5 16 1.22 +5 17 1.22 +5 18 1.22 +5 19 1.22 +5 20 1.22 +5 21 1.22 +5 22 1.22 +5 23 1.22 +5 24 1.22 +5 25 1.22 +5 26 1.22 +5 27 1.22 +5 28 1.22 +5 29 1.22 +5 30 1.22 +5 31 1.22 +5 32 1.22 +5 33 1.22 +5 34 1.22 +5 35 1.22 +5 36 1.22 +5 37 1.22 +5 38 1.22 +5 39 1.22 +5 40 1.22 +5 41 1.22 +5 42 1.22 +5 43 1.22 +5 44 1.22 +5 45 1.22 +5 46 1.22 +5 47 1.22 +5 48 1.22 +5 49 1.22 +5 50 1.22 +5 51 1.22 +5 52 1.22 +5 53 1.22 +5 54 1.22 +5 55 1.22 +5 56 1.22 +5 57 1.22 +5 58 1.22 +5 59 1.22 +5 60 1.22 +5 61 1.22 +5 62 1.22 +5 63 1.22 +6 0 1.22 +6 1 1.22 +6 2 1.22 +6 3 1.22 +6 4 1.22 +6 5 1.22 +6 6 1.22 +6 7 1.22 +6 8 1.22 +6 9 1.22 +6 10 1.22 +6 11 1.22 +6 12 1.22 +6 13 1.22 +6 14 1.22 +6 15 1.22 +6 16 1.22 +6 17 1.22 +6 18 1.22 +6 19 1.22 +6 20 1.22 +6 21 1.22 +6 22 1.22 +6 23 1.22 +6 24 1.22 +6 25 1.22 +6 26 1.22 +6 27 1.22 +6 28 1.22 +6 29 1.22 +6 30 1.22 +6 31 1.22 +6 32 1.22 +6 33 1.22 +6 34 1.22 +6 35 1.22 +6 36 1.22 +6 37 1.22 +6 38 1.22 +6 39 1.22 +6 40 1.22 +6 41 1.22 +6 42 1.22 +6 43 1.22 +6 44 1.22 +6 45 1.22 +6 46 1.22 +6 47 1.22 +6 48 1.22 +6 49 1.22 +6 50 1.22 +6 51 1.22 +6 52 1.22 +6 53 1.22 +6 54 1.22 +6 55 1.22 +6 56 1.22 +6 57 1.22 +6 58 1.22 +6 59 1.22 +6 60 1.22 +6 61 1.22 +6 62 1.22 +6 63 1.22 +7 0 1.22 +7 1 1.22 +7 2 1.22 +7 3 1.22 +7 4 1.22 +7 5 1.22 +7 6 1.22 +7 7 1.22 +7 8 1.22 +7 9 1.22 +7 10 1.22 +7 11 1.22 +7 12 1.22 +7 13 1.22 +7 14 1.22 +7 15 1.22 +7 16 1.22 +7 17 1.22 +7 18 1.22 +7 19 1.22 +7 20 1.22 +7 21 1.22 +7 22 1.22 +7 23 1.22 +7 24 1.22 +7 25 1.22 +7 26 1.22 +7 27 1.22 +7 28 1.22 +7 29 1.22 +7 30 1.22 +7 31 1.22 +7 32 1.22 +7 33 1.22 +7 34 1.22 +7 35 1.22 +7 36 1.22 +7 37 1.22 +7 38 1.22 +7 39 1.22 +7 40 1.22 +7 41 1.22 +7 42 1.22 +7 43 1.22 +7 44 1.22 +7 45 1.22 +7 46 1.22 +7 47 1.22 +7 48 1.22 +7 49 1.22 +7 50 1.22 +7 51 1.22 +7 52 1.22 +7 53 1.22 +7 54 1.22 +7 55 1.22 +7 56 1.22 +7 57 1.22 +7 58 1.22 +7 59 1.22 +7 60 1.22 +7 61 1.22 +7 62 1.22 +7 63 1.22 +8 0 1.22 +8 1 1.22 +8 2 1.22 +8 3 1.22 +8 4 1.22 +8 5 1.22 +8 6 1.22 +8 7 1.22 +8 8 1.22 +8 9 1.22 +8 10 1.22 +8 11 1.22 +8 12 1.22 +8 13 1.22 +8 14 1.22 +8 15 1.22 +8 16 1.22 +8 17 1.22 +8 18 1.22 +8 19 1.22 +8 20 1.22 +8 21 1.22 +8 22 1.22 +8 23 1.22 +8 24 1.22 +8 25 1.22 +8 26 1.22 +8 27 1.22 +8 28 1.22 +8 29 1.22 +8 30 1.22 +8 31 1.22 +8 32 1.22 +8 33 1.22 +8 34 1.22 +8 35 1.22 +8 36 1.22 +8 37 1.22 +8 38 1.22 +8 39 1.22 +8 40 1.22 +8 41 1.22 +8 42 1.22 +8 43 1.22 +8 44 1.22 +8 45 1.22 +8 46 1.22 +8 47 1.22 +8 48 1.22 +8 49 1.22 +8 50 1.22 +8 51 1.22 +8 52 1.22 +8 53 1.22 +8 54 1.22 +8 55 1.22 +8 56 1.22 +8 57 1.22 +8 58 1.22 +8 59 1.22 +8 60 1.22 +8 61 1.22 +8 62 1.22 +8 63 1.22 +9 0 1.22 +9 1 1.22 +9 2 1.22 +9 3 1.22 +9 4 1.22 +9 5 1.22 +9 6 1.22 +9 7 1.22 +9 8 1.22 +9 9 1.22 +9 10 1.22 +9 11 1.22 +9 12 1.22 +9 13 1.22 +9 14 1.22 +9 15 1.22 +9 16 1.22 +9 17 1.22 +9 18 1.22 +9 19 1.22 +9 20 1.22 +9 21 1.22 +9 22 1.22 +9 23 1.22 +9 24 1.22 +9 25 1.22 +9 26 1.22 +9 27 1.22 +9 28 1.22 +9 29 1.22 +9 30 1.22 +9 31 1.22 +9 32 1.22 +9 33 1.22 +9 34 1.22 +9 35 1.22 +9 36 1.22 +9 37 1.22 +9 38 1.22 +9 39 1.22 +9 40 1.22 +9 41 1.22 +9 42 1.22 +9 43 1.22 +9 44 1.22 +9 45 1.22 +9 46 1.22 +9 47 1.22 +9 48 1.22 +9 49 1.22 +9 50 1.22 +9 51 1.22 +9 52 1.22 +9 53 1.22 +9 54 1.22 +9 55 1.22 +9 56 1.22 +9 57 1.22 +9 58 1.22 +9 59 1.22 +9 60 1.22 +9 61 1.22 +9 62 1.22 +9 63 1.22 +10 0 1.22 +10 1 1.22 +10 2 1.22 +10 3 1.22 +10 4 1.22 +10 5 1.22 +10 6 1.22 +10 7 1.22 +10 8 1.22 +10 9 1.22 +10 10 1.22 +10 11 1.22 +10 12 1.22 +10 13 1.22 +10 14 1.22 +10 15 1.22 +10 16 1.22 +10 17 1.22 +10 18 1.22 +10 19 1.22 +10 20 1.22 +10 21 1.22 +10 22 1.22 +10 23 1.22 +10 24 1.22 +10 25 1.22 +10 26 1.22 +10 27 1.22 +10 28 1.22 +10 29 1.22 +10 30 1.22 +10 31 1.22 +10 32 1.22 +10 33 1.22 +10 34 1.22 +10 35 1.22 +10 36 1.22 +10 37 1.22 +10 38 1.22 +10 39 1.22 +10 40 1.22 +10 41 1.22 +10 42 1.22 +10 43 1.22 +10 44 1.22 +10 45 1.22 +10 46 1.22 +10 47 1.22 +10 48 1.22 +10 49 1.22 +10 50 1.22 +10 51 1.22 +10 52 1.22 +10 53 1.22 +10 54 1.22 +10 55 1.22 +10 56 1.22 +10 57 1.22 +10 58 1.22 +10 59 1.22 +10 60 1.22 +10 61 1.22 +10 62 1.22 +10 63 1.22 +11 0 1.22 +11 1 1.22 +11 2 1.22 +11 3 1.22 +11 4 1.22 +11 5 1.22 +11 6 1.22 +11 7 1.22 +11 8 1.22 +11 9 1.22 +11 10 1.22 +11 11 1.22 +11 12 1.22 +11 13 1.22 +11 14 1.22 +11 15 1.22 +11 16 1.22 +11 17 1.22 +11 18 1.22 +11 19 1.22 +11 20 1.22 +11 21 1.22 +11 22 1.22 +11 23 1.22 +11 24 1.22 +11 25 1.22 +11 26 1.22 +11 27 1.22 +11 28 1.22 +11 29 1.22 +11 30 1.22 +11 31 1.22 +11 32 1.22 +11 33 1.22 +11 34 1.22 +11 35 1.22 +11 36 1.22 +11 37 1.22 +11 38 1.22 +11 39 1.22 +11 40 1.22 +11 41 1.22 +11 42 1.22 +11 43 1.22 +11 44 1.22 +11 45 1.22 +11 46 1.22 +11 47 1.22 +11 48 1.22 +11 49 1.22 +11 50 1.22 +11 51 1.22 +11 52 1.22 +11 53 1.22 +11 54 1.22 +11 55 1.22 +11 56 1.22 +11 57 1.22 +11 58 1.22 +11 59 1.22 +11 60 1.22 +11 61 1.22 +11 62 1.22 +11 63 1.22 +12 0 1.22 +12 1 1.22 +12 2 1.22 +12 3 1.22 +12 4 1.22 +12 5 1.22 +12 6 1.22 +12 7 1.22 +12 8 1.22 +12 9 1.22 +12 10 1.22 +12 11 1.22 +12 12 1.22 +12 13 1.22 +12 14 1.22 +12 15 1.22 +12 16 1.22 +12 17 1.22 +12 18 1.22 +12 19 1.22 +12 20 1.22 +12 21 1.22 +12 22 1.22 +12 23 1.22 +12 24 1.22 +12 25 1.22 +12 26 1.22 +12 27 1.22 +12 28 1.22 +12 29 1.22 +12 30 1.22 +12 31 1.22 +12 32 1.22 +12 33 1.22 +12 34 1.22 +12 35 1.22 +12 36 1.22 +12 37 1.22 +12 38 1.22 +12 39 1.22 +12 40 1.22 +12 41 1.22 +12 42 1.22 +12 43 1.22 +12 44 1.22 +12 45 1.22 +12 46 1.22 +12 47 1.22 +12 48 1.22 +12 49 1.22 +12 50 1.22 +12 51 1.22 +12 52 1.22 +12 53 1.22 +12 54 1.22 +12 55 1.22 +12 56 1.22 +12 57 1.22 +12 58 1.22 +12 59 1.22 +12 60 1.22 +12 61 1.22 +12 62 1.22 +12 63 1.22 +13 0 1.22 +13 1 1.22 +13 2 1.22 +13 3 1.22 +13 4 1.22 +13 5 1.22 +13 6 1.22 +13 7 1.22 +13 8 1.22 +13 9 1.22 +13 10 1.22 +13 11 1.22 +13 12 1.22 +13 13 1.22 +13 14 1.22 +13 15 1.22 +13 16 1.22 +13 17 1.22 +13 18 1.22 +13 19 1.22 +13 20 1.22 +13 21 1.22 +13 22 1.22 +13 23 1.22 +13 24 1.22 +13 25 1.22 +13 26 1.22 +13 27 1.22 +13 28 1.22 +13 29 1.22 +13 30 1.22 +13 31 1.22 +13 32 1.22 +13 33 1.22 +13 34 1.22 +13 35 1.22 +13 36 1.22 +13 37 1.22 +13 38 1.22 +13 39 1.22 +13 40 1.22 +13 41 1.22 +13 42 1.22 +13 43 1.22 +13 44 1.22 +13 45 1.22 +13 46 1.22 +13 47 1.22 +13 48 1.22 +13 49 1.22 +13 50 1.22 +13 51 1.22 +13 52 1.22 +13 53 1.22 +13 54 1.22 +13 55 1.22 +13 56 1.22 +13 57 1.22 +13 58 1.22 +13 59 1.22 +13 60 1.22 +13 61 1.22 +13 62 1.22 +13 63 1.22 +14 0 1.22 +14 1 1.22 +14 2 1.22 +14 3 1.22 +14 4 1.22 +14 5 1.22 +14 6 1.22 +14 7 1.22 +14 8 1.22 +14 9 1.22 +14 10 1.22 +14 11 1.22 +14 12 1.22 +14 13 1.22 +14 14 1.22 +14 15 1.22 +14 16 1.22 +14 17 1.22 +14 18 1.22 +14 19 1.22 +14 20 1.22 +14 21 1.22 +14 22 1.22 +14 23 1.22 +14 24 1.22 +14 25 1.22 +14 26 1.22 +14 27 1.22 +14 28 1.22 +14 29 1.22 +14 30 1.22 +14 31 1.22 +14 32 1.22 +14 33 1.22 +14 34 1.22 +14 35 1.22 +14 36 1.22 +14 37 1.22 +14 38 1.22 +14 39 1.22 +14 40 1.22 +14 41 1.22 +14 42 1.22 +14 43 1.22 +14 44 1.22 +14 45 1.22 +14 46 1.22 +14 47 1.22 +14 48 1.22 +14 49 1.22 +14 50 1.22 +14 51 1.22 +14 52 1.22 +14 53 1.22 +14 54 1.22 +14 55 1.22 +14 56 1.22 +14 57 1.22 +14 58 1.22 +14 59 1.22 +14 60 1.22 +14 61 1.22 +14 62 1.22 +14 63 1.22 +15 0 1.22 +15 1 1.22 +15 2 1.22 +15 3 1.22 +15 4 1.22 +15 5 1.22 +15 6 1.22 +15 7 1.22 +15 8 1.22 +15 9 1.22 +15 10 1.22 +15 11 1.22 +15 12 1.22 +15 13 1.22 +15 14 1.22 +15 15 1.22 +15 16 1.22 +15 17 1.22 +15 18 1.22 +15 19 1.22 +15 20 1.22 +15 21 1.22 +15 22 1.22 +15 23 1.22 +15 24 1.22 +15 25 1.22 +15 26 1.22 +15 27 1.22 +15 28 1.22 +15 29 1.22 +15 30 1.22 +15 31 1.22 +15 32 1.22 +15 33 1.22 +15 34 1.22 +15 35 1.22 +15 36 1.22 +15 37 1.22 +15 38 1.22 +15 39 1.22 +15 40 1.22 +15 41 1.22 +15 42 1.22 +15 43 1.22 +15 44 1.22 +15 45 1.22 +15 46 1.22 +15 47 1.22 +15 48 1.22 +15 49 1.22 +15 50 1.22 +15 51 1.22 +15 52 1.22 +15 53 1.22 +15 54 1.22 +15 55 1.22 +15 56 1.22 +15 57 1.22 +15 58 1.22 +15 59 1.22 +15 60 1.22 +15 61 1.22 +15 62 1.22 +15 63 1.22 +16 0 1.22 +16 1 1.22 +16 2 1.22 +16 3 1.22 +16 4 1.22 +16 5 1.22 +16 6 1.22 +16 7 1.22 +16 8 1.22 +16 9 1.22 +16 10 1.22 +16 11 1.22 +16 12 1.22 +16 13 1.22 +16 14 1.22 +16 15 1.22 +16 16 1.22 +16 17 1.22 +16 18 1.22 +16 19 1.22 +16 20 1.22 +16 21 1.22 +16 22 1.22 +16 23 1.22 +16 24 1.22 +16 25 1.22 +16 26 1.22 +16 27 1.22 +16 28 1.22 +16 29 1.22 +16 30 1.22 +16 31 1.22 +16 32 1.22 +16 33 1.22 +16 34 1.22 +16 35 1.22 +16 36 1.22 +16 37 1.22 +16 38 1.22 +16 39 1.22 +16 40 1.22 +16 41 1.22 +16 42 1.22 +16 43 1.22 +16 44 1.22 +16 45 1.22 +16 46 1.22 +16 47 1.22 +16 48 1.22 +16 49 1.22 +16 50 1.22 +16 51 1.22 +16 52 1.22 +16 53 1.22 +16 54 1.22 +16 55 1.22 +16 56 1.22 +16 57 1.22 +16 58 1.22 +16 59 1.22 +16 60 1.22 +16 61 1.22 +16 62 1.22 +16 63 1.22 +17 0 1.22 +17 1 1.22 +17 2 1.22 +17 3 1.22 +17 4 1.22 +17 5 1.22 +17 6 1.22 +17 7 1.22 +17 8 1.22 +17 9 1.22 +17 10 1.22 +17 11 1.22 +17 12 1.22 +17 13 1.22 +17 14 1.22 +17 15 1.22 +17 16 1.22 +17 17 1.22 +17 18 1.22 +17 19 1.22 +17 20 1.22 +17 21 1.22 +17 22 1.22 +17 23 1.22 +17 24 1.22 +17 25 1.22 +17 26 1.22 +17 27 1.22 +17 28 1.22 +17 29 1.22 +17 30 1.22 +17 31 1.22 +17 32 1.22 +17 33 1.22 +17 34 1.22 +17 35 1.22 +17 36 1.22 +17 37 1.22 +17 38 1.22 +17 39 1.22 +17 40 1.22 +17 41 1.22 +17 42 1.22 +17 43 1.22 +17 44 1.22 +17 45 1.22 +17 46 1.22 +17 47 1.22 +17 48 1.22 +17 49 1.22 +17 50 1.22 +17 51 1.22 +17 52 1.22 +17 53 1.22 +17 54 1.22 +17 55 1.22 +17 56 1.22 +17 57 1.22 +17 58 1.22 +17 59 1.22 +17 60 1.22 +17 61 1.22 +17 62 1.22 +17 63 1.22 +18 0 1.22 +18 1 1.22 +18 2 1.22 +18 3 1.22 +18 4 1.22 +18 5 1.22 +18 6 1.22 +18 7 1.22 +18 8 1.22 +18 9 1.22 +18 10 1.22 +18 11 1.22 +18 12 1.22 +18 13 1.22 +18 14 1.22 +18 15 1.22 +18 16 1.22 +18 17 1.22 +18 18 1.22 +18 19 1.22 +18 20 1.22 +18 21 1.22 +18 22 1.22 +18 23 1.22 +18 24 1.22 +18 25 1.22 +18 26 1.22 +18 27 1.22 +18 28 1.22 +18 29 1.22 +18 30 1.22 +18 31 1.22 +18 32 1.22 +18 33 1.22 +18 34 1.22 +18 35 1.22 +18 36 1.22 +18 37 1.22 +18 38 1.22 +18 39 1.22 +18 40 1.22 +18 41 1.22 +18 42 1.22 +18 43 1.22 +18 44 1.22 +18 45 1.22 +18 46 1.22 +18 47 1.22 +18 48 1.22 +18 49 1.22 +18 50 1.22 +18 51 1.22 +18 52 1.22 +18 53 1.22 +18 54 1.22 +18 55 1.22 +18 56 1.22 +18 57 1.22 +18 58 1.22 +18 59 1.22 +18 60 1.22 +18 61 1.22 +18 62 1.22 +18 63 1.22 +19 0 1.22 +19 1 1.22 +19 2 1.22 +19 3 1.22 +19 4 1.22 +19 5 1.22 +19 6 1.22 +19 7 1.22 +19 8 1.22 +19 9 1.22 +19 10 1.22 +19 11 1.22 +19 12 1.22 +19 13 1.22 +19 14 1.22 +19 15 1.22 +19 16 1.22 +19 17 1.22 +19 18 1.22 +19 19 1.22 +19 20 1.22 +19 21 1.22 +19 22 1.22 +19 23 1.22 +19 24 1.22 +19 25 1.22 +19 26 1.22 +19 27 1.22 +19 28 1.22 +19 29 1.22 +19 30 1.22 +19 31 1.22 +19 32 1.22 +19 33 1.22 +19 34 1.22 +19 35 1.22 +19 36 1.22 +19 37 1.22 +19 38 1.22 +19 39 1.22 +19 40 1.22 +19 41 1.22 +19 42 1.22 +19 43 1.22 +19 44 1.22 +19 45 1.22 +19 46 1.22 +19 47 1.22 +19 48 1.22 +19 49 1.22 +19 50 1.22 +19 51 1.22 +19 52 1.22 +19 53 1.22 +19 54 1.22 +19 55 1.22 +19 56 1.22 +19 57 1.22 +19 58 1.22 +19 59 1.22 +19 60 1.22 +19 61 1.22 +19 62 1.22 +19 63 1.22 +20 0 1.22 +20 1 1.22 +20 2 1.22 +20 3 1.22 +20 4 1.22 +20 5 1.22 +20 6 1.22 +20 7 1.22 +20 8 1.22 +20 9 1.22 +20 10 1.22 +20 11 1.22 +20 12 1.22 +20 13 1.22 +20 14 1.22 +20 15 1.22 +20 16 1.22 +20 17 1.22 +20 18 1.22 +20 19 1.22 +20 20 1.22 +20 21 1.22 +20 22 1.22 +20 23 1.22 +20 24 1.22 +20 25 1.22 +20 26 1.22 +20 27 1.22 +20 28 1.22 +20 29 1.22 +20 30 1.22 +20 31 1.22 +20 32 1.22 +20 33 1.22 +20 34 1.22 +20 35 1.22 +20 36 1.22 +20 37 1.22 +20 38 1.22 +20 39 1.22 +20 40 1.22 +20 41 1.22 +20 42 1.22 +20 43 1.22 +20 44 1.22 +20 45 1.22 +20 46 1.22 +20 47 1.22 +20 48 1.22 +20 49 1.22 +20 50 1.22 +20 51 1.22 +20 52 1.22 +20 53 1.22 +20 54 1.22 +20 55 1.22 +20 56 1.22 +20 57 1.22 +20 58 1.22 +20 59 1.22 +20 60 1.22 +20 61 1.22 +20 62 1.22 +20 63 1.22 +21 0 1.22 +21 1 1.22 +21 2 1.22 +21 3 1.22 +21 4 1.22 +21 5 1.22 +21 6 1.22 +21 7 1.22 +21 8 1.22 +21 9 1.22 +21 10 1.22 +21 11 1.22 +21 12 1.22 +21 13 1.22 +21 14 1.22 +21 15 1.22 +21 16 1.22 +21 17 1.22 +21 18 1.22 +21 19 1.22 +21 20 1.22 +21 21 1.22 +21 22 1.22 +21 23 1.22 +21 24 1.22 +21 25 1.22 +21 26 1.22 +21 27 1.22 +21 28 1.22 +21 29 1.22 +21 30 1.22 +21 31 1.22 +21 32 1.22 +21 33 1.22 +21 34 1.22 +21 35 1.22 +21 36 1.22 +21 37 1.22 +21 38 1.22 +21 39 1.22 +21 40 1.22 +21 41 1.22 +21 42 1.22 +21 43 1.22 +21 44 1.22 +21 45 1.22 +21 46 1.22 +21 47 1.22 +21 48 1.22 +21 49 1.22 +21 50 1.22 +21 51 1.22 +21 52 1.22 +21 53 1.22 +21 54 1.22 +21 55 1.22 +21 56 1.22 +21 57 1.22 +21 58 1.22 +21 59 1.22 +21 60 1.22 +21 61 1.22 +21 62 1.22 +21 63 1.22 +22 0 1.22 +22 1 1.22 +22 2 1.22 +22 3 1.22 +22 4 1.22 +22 5 1.22 +22 6 1.22 +22 7 1.22 +22 8 1.22 +22 9 1.22 +22 10 1.22 +22 11 1.22 +22 12 1.22 +22 13 1.22 +22 14 1.22 +22 15 1.22 +22 16 1.22 +22 17 1.22 +22 18 1.22 +22 19 1.22 +22 20 1.22 +22 21 1.22 +22 22 1.22 +22 23 1.22 +22 24 1.22 +22 25 1.22 +22 26 1.22 +22 27 1.22 +22 28 1.22 +22 29 1.22 +22 30 1.22 +22 31 1.22 +22 32 1.22 +22 33 1.22 +22 34 1.22 +22 35 1.22 +22 36 1.22 +22 37 1.22 +22 38 1.22 +22 39 1.22 +22 40 1.22 +22 41 1.22 +22 42 1.22 +22 43 1.22 +22 44 1.22 +22 45 1.22 +22 46 1.22 +22 47 1.22 +22 48 1.22 +22 49 1.22 +22 50 1.22 +22 51 1.22 +22 52 1.22 +22 53 1.22 +22 54 1.22 +22 55 1.22 +22 56 1.22 +22 57 1.22 +22 58 1.22 +22 59 1.22 +22 60 1.22 +22 61 1.22 +22 62 1.22 +22 63 1.22 +23 0 1.22 +23 1 1.22 +23 2 1.22 +23 3 1.22 +23 4 1.22 +23 5 1.22 +23 6 1.22 +23 7 1.22 +23 8 1.22 +23 9 1.22 +23 10 1.22 +23 11 1.22 +23 12 1.22 +23 13 1.22 +23 14 1.22 +23 15 1.22 +23 16 1.22 +23 17 1.22 +23 18 1.22 +23 19 1.22 +23 20 1.22 +23 21 1.22 +23 22 1.22 +23 23 1.22 +23 24 1.22 +23 25 1.22 +23 26 1.22 +23 27 1.22 +23 28 1.22 +23 29 1.22 +23 30 1.22 +23 31 1.22 +23 32 1.22 +23 33 1.22 +23 34 1.22 +23 35 1.22 +23 36 1.22 +23 37 1.22 +23 38 1.22 +23 39 1.22 +23 40 1.22 +23 41 1.22 +23 42 1.22 +23 43 1.22 +23 44 1.22 +23 45 1.22 +23 46 1.22 +23 47 1.22 +23 48 1.22 +23 49 1.22 +23 50 1.22 +23 51 1.22 +23 52 1.22 +23 53 1.22 +23 54 1.22 +23 55 1.22 +23 56 1.22 +23 57 1.22 +23 58 1.22 +23 59 1.22 +23 60 1.22 +23 61 1.22 +23 62 1.22 +23 63 1.22 diff --git a/calibrations/calo/tower_slope_macro/README.md b/calibrations/calo/tower_slope_macro/README.md new file mode 100644 index 000000000..ab587a6b3 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/README.md @@ -0,0 +1,84 @@ +Various macros and files for running tower slope modules in various situations: + +macros/correction files for running tower slope method on MDC2 files, +OR using various decalibration/calibration updates to the sim and reco frameworks in coresoftware, +including the database accessor wrapper class for accessing calibrations "conditions DB" files. + +Macro/script for running over MDC2 Hits files (Production 4 only) +------------------------------------------- +run_calo_fromMDC2Hits_towslope_Fun4All_G4_Calo.C +do_run_calo_fromMd2Hits_towslope.csh + +Notes: does not need filelist input (e.g. from CreateFileList.pl), see comments inside, takes single +integer input, assuming filenames of Production 4 MDC2 Hits files. For other production +runs beginning of macro/filename parsing part my need up dated. Note that per usual MDC2 +and presumably all sphenix default production/sim file access, only the filename is specified +and lustre system/dcache finds the file and decides/provides appropriate "full path" access method. +Valid filenames can be obtained from CreateFileLists.pl +This macro does not need any other files found in this folder to run, +but can be run in with others present to modify behavior. +Runs all three slope method modules one for each calorimeter +system in central barrel (Emc & Hcal's both) + + +Alternative G4_Setup / "common" macros for +Applying Decal/Cal through Simple Calo calibration +Databse File API's : +------------------------------------------- +G4_CEmc_Spacal.C +G4_HcalIn_ref.C +G4_HcalOut_ref.C + +Notes: place any or all of these in running directory to override those in +$OFFLINE_MAIN/root_macros (originally from sphenix "macros" repository, common/ +In order to specify calibrations and decalibrations using RawTowerCalibration/RawTowerDigitizer +as described in Calo Calibrations meetings Jan-March 2022 +See comments especially many detailed comments in G4_CEmc_Spacal.C +about how to do this. Files needed in most cases can be found below: + + +Example Simple Database Files for Decal/Cal : +------------------------------------------- +HCALIN_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt +HCALIN_GainsCalib1.22.txt +HCALOUT_GainsCalib1.22.txt +HCALOUT_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt +emc_corr_files/*root *.C + +Notes: see inside G4_Setup macros in previous section. +The last emc_corr_files/ subdirectory also contains macros +(for Emc which uses a root file format as opposed to Hcal +which uses a text file format) for generating new decal or calibration +correction patterns for testing + +Macros for doing the actual fitting step +---------------------- +do_eta_fit.C +do_eta_fit2.C + +The fitting step (timeslice1 --> timeslice 2 --see above) +should generally be after merging of tower energy distribution +histogram files (the output of the tower slope module over the +mdc2/production data files). The last function called in the +macro LiteCaloEval::Fit_RelativeShift outputs the +correction which can be read as input in place of the "Example +Simple Database" files above. For CEMC, this is output +into the root file output containing all the other root +output (various graphs, etc.) into a tree with in that file +with the correct name ("emc_corr_tree"). For the Hcals, +for which the correction files should be simple text file +formats, the correction text file is outputted to: +[output_root_filename].HCAL[IN|OUT]_CORR_TXTFILE.txt as +an additional output file besides the usual output_root_file. + + +Older/out of date: (from mdc1 running) +---------------------- +Fun4All_G4_SlopeCal.C +run_f4a.csh + + + do_run_calo_fromMd2Hits_towslope.csh + + + diff --git a/calibrations/calo/tower_slope_macro/do_eta_fit.C b/calibrations/calo/tower_slope_macro/do_eta_fit.C new file mode 100644 index 000000000..6b5810355 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/do_eta_fit.C @@ -0,0 +1,21 @@ + +//double fitf(Double_t * f, Double_t *p); +//TGraph * grff = 0; +#include + +#include "LiteCaloEval.h" +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + +void do_eta_fit(const char * reffile, const char * modfile) +{ + gSystem->Load("libLiteCaloEvalTowSlope.so"); + LiteCaloEval reflce, modlce; + reflce.CaloType(LiteCaloEval::HCALOUT); + modlce.CaloType(LiteCaloEval::HCALOUT); + reflce.Get_Histos(reffile); + modlce.Get_Histos(modfile); + modlce.FitRelativeShifts(&reflce,21); + +} + + diff --git a/calibrations/calo/tower_slope_macro/do_eta_fit2.C b/calibrations/calo/tower_slope_macro/do_eta_fit2.C new file mode 100644 index 000000000..cdd4ea137 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/do_eta_fit2.C @@ -0,0 +1,25 @@ + +//double fitf(Double_t * f, Double_t *p); +//TGraph * grff = 0; +#include + +#include "LiteCaloEval.h" +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + +void do_eta_fit2(const char * reffile, const char * infile, const char * modfile) +{ + gSystem->Load("libLiteCaloEvalTowSlope.so"); + LiteCaloEval reflce, modlce; + reflce.CaloType(LiteCaloEval::CEMC); + modlce.CaloType(LiteCaloEval::CEMC); + reflce.Get_Histos(reffile); + modlce.Get_Histos(infile,modfile); + modlce.fitmin = 0.12; + modlce.fitmax = 0.7; + modlce.FitRelativeShifts(&reflce,1); + + + +} + + diff --git a/calibrations/calo/tower_slope_macro/do_run_calo_fromMd2Hits_towslope.csh b/calibrations/calo/tower_slope_macro/do_run_calo_fromMd2Hits_towslope.csh new file mode 100755 index 000000000..e229f1f07 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/do_run_calo_fromMd2Hits_towslope.csh @@ -0,0 +1,66 @@ +#!/bin/csh +echo ' ' +echo 'START: '`date` +#setenv HOME /phenix/u/$LOGNAME +#source /etc/csh.login +#source $HOME/.login +#source /opt/phenix/bin/phenix_setup.c + + +#@ z = $1 + 500 +@ z = $1 + 0 + +echo hi justin doing job num $z + +source /opt/sphenix/core/bin/sphenix_setup.csh -n new + +setenv JFINSTALL /phenix/scratch/jfrantz/install/sphenix_bt_mdc2 +ls $JFINSTALL/include + +source /opt/sphenix/core/bin/setup_local.csh $JFINSTALL + +#//setenv JFINSTALL /sphenix/user/jfrantz/newgeom/install +#//setenv LD_LIBRARY_PATH $MYINSTALL/lib:$LD_LIBRARY_PATH +#//set PATH = ($MYINSTALL/bin $path) +#source ~/setldpath.csh . +#//echo $LD_LIBRARY_PATH +#//echo $MYINSTALL +echo $PATH + +#setenv CALIBRATIONROOT $JFINSTALL/share/calibrations/ +#setenv CALIBRATIONROOT /phenix/scratch/jfrantz/install/sphenix_ynewy/share/calibrations/ + +#cd /direct/phenix+u/apun/sphenixabi/macros/macros/g4simulations_embed +#cd /gpfs/mnt/gpfs04/sphenix/user/apun/gitfork/macros/macros/g4simulations +#cd /direct/phenix+u/apun/sphenixabi/macros/macros/g4simulations +#cd /direct/phenix+u/apun/Island/macros/g4simulations +cd /sphenix/user/jfrantz/caloCalib/framew/calotest/ + + root.exe -b < 2 && ket < 5) + corr = 0.88+3.5*0.04; + + if (ket == 9) + corr = 0.88+8*0.04; + + // int ket = + + /* + corr = 1.0/(0.9+ll*0.2); + // corr = 0.9+ll*0.2; + //corr = 0.3000000; + */ + if (i%8==0&& j%128==0) + cout << "towid" << towid << " corr " << corr << endl; + t1.Fill(); + + } + } + + f.Write(); + // f.Close(); + + +} diff --git a/calibrations/calo/tower_slope_macro/run_calo_fromMDC2Hits_towslope_Fun4All_G4_Calo.C b/calibrations/calo/tower_slope_macro/run_calo_fromMDC2Hits_towslope_Fun4All_G4_Calo.C new file mode 100644 index 000000000..9422a7820 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/run_calo_fromMDC2Hits_towslope_Fun4All_G4_Calo.C @@ -0,0 +1,494 @@ +#ifndef MACRO_FUN4ALLG4CALO_C +#define MACRO_FUN4ALLG4CALO_C + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + + +#include +#include + +#include +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libcaloCalibDBFile.so) +R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + + +// For HepMC Hijing +// try inputFile = /sphenix/sim/sim01/sphnxpro/sHijing_HepMC/sHijing_0-12fm.dat + +int run_calo_fromMDC2Hits_towslope_Fun4All_G4_Calo( + const int nEvents = 2, + // const string &inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root", + //const string &inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root", + const int mdc2_4_file_num = 1, + const string &outputFile = "newoutput1_calo1", + // const string &inputFile0 = "/gpfs/mnt/gpfs02/sphenix/sim/sim01/sphnxpro/MDC2/sHijing_HepMC/fm_0_20/pileup/DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000003-00001.root", //"DST_CALO_G4HIT_sHijing_0_12fm-0000000001-00000.root", + // const string &inputFile1 = "/gpfs/mnt/gpfs02/sphenix/sim/sim01/sphnxpro/MDC2/sHijing_HepMC/fm_0_20/pileup/DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000003-00001.root", //"DST_VERTEX_sHijing_0_12fm-0000000001-00000.root", + // const string &outputFile = "G4sPHENIX_calo1", + const string &outdir = ".") +{ + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(0); + + + // string inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root"; + // string inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root"; + + //There are 40,000 mdc2 production 4 files. + // this piece of code allows you to simply specify which of the 40k files + // by the single integer input (from 0-40k) mdc2_4_file_num + + string inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-"; + string inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-"; + + + int ynum_int = 100000+ mdc2_4_file_num; + TString yn_tstr = ""; + yn_tstr += ynum_int; + yn_tstr.Remove(0,1); + inputFile0 += yn_tstr.Data(); + inputFile1 += yn_tstr.Data(); + + inputFile0 += ".root"; + inputFile1 += ".root"; + + cout << "running over these files" << endl; + cout << inputFile0 << endl; + cout << inputFile1 << endl; + + //const string &outputFile = "newoutput1_calo1", + + + //Opt to print all random seed used for debugging reproducibility. Comment out to reduce stdout prints. + PHRandomSeed::Verbosity(1); + /* + long mtime = gSystem->Now(); + TString fileOut = outputFile.c_str(); + fileOut += (mtime / 100000 - 8542922)/3; + string outputFile2 = fileOut.Data(); + */ + string outputFile2 = outputFile.c_str(); + outputFile2 = outputFile2 + ".root"; + + // just if we set some flags somewhere in this macro + recoConsts *rc = recoConsts::instance(); + // By default every random number generator uses + // PHRandomSeed() which reads /dev/urandom to get its seed + // if the RANDOMSEED flag is set its value is taken as seed + // You can either set this to a random value using PHRandomSeed() + // which will make all seeds identical (not sure what the point of + // this would be: + // rc->set_IntFlag("RANDOMSEED",PHRandomSeed()); + // or set it to a fixed value so you can debug your code + // rc->set_IntFlag("RANDOMSEED", 12345); + + //=============== + // Input options + //=============== + // verbosity setting (applies to all input managers) + Input::VERBOSITY = 1; + // First enable the input generators + // Either: + // read previously generated g4-hits files, in this case it opens a DST and skips + // the simulations step completely. The G4Setup macro is only loaded to get information + // about the number of layers used for the cell reco code + Input::READHITS = true; + INPUTREADHITS::filename[0] = inputFile0; + INPUTREADHITS::filename[1] = inputFile1; + + //----------------- + // Initialize the selected Input/Event generation + //----------------- + // This creates the input generator(s) + InputInit(); + + // register all input generators with Fun4All + InputRegister(); + + // set up production relatedstuff + Enable::PRODUCTION = true; + + //====================== + // Write the DST + //====================== + + Enable::DSTOUT = false; + Enable::DSTOUT_COMPRESS = false; + DstOut::OutputDir = outdir; +// DstOut::OutputFile = outputFile; + DstOut::OutputFile = outputFile2; + + + //Option to convert DST to human command readable TTree for quick poke around the outputs + // Enable::DSTREADER = true; + + // turn the display on (default off) + Enable::DISPLAY = false; + + //====================== + // What to run + //====================== + // Global options (enabled for all enables subsystems - if implemented) + // Enable::ABSORBER = true; + // Enable::OVERLAPCHECK = true; + // Enable::VERBOSITY = 1; + + Enable::CEMC = true; + Enable::CEMC_CELL = Enable::CEMC && true; + Enable::CEMC_TOWER = Enable::CEMC_CELL && true; + Enable::CEMC_CLUSTER = Enable::CEMC_TOWER && true; +// Enable::CEMC_EVAL = Enable::CEMC_CLUSTER && true; + + Enable::HCALIN = true; + Enable::HCALIN_CELL = Enable::HCALIN && true; + Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true; + // Enable::HCALIN_CLUSTER = Enable::HCALIN_TOWER && true; +// Enable::HCALIN_EVAL = Enable::HCALIN_CLUSTER && true; + + Enable::HCALOUT = true; + Enable::HCALOUT_CELL = Enable::HCALOUT && true; + Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true; + // Enable::HCALOUT_CLUSTER = Enable::HCALOUT_TOWER && true; +// Enable::HCALOUT_EVAL = Enable::HCALOUT_CLUSTER && true; + + +// Enable::EPD = false; + +// Enable::GLOBAL_RECO = true; + // Enable::GLOBAL_FASTSIM = true; + +// Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; + +// Enable::JETS = true; +// Enable::JETS_EVAL = Enable::JETS && true; + + // HI Jet Reco for p+Au / Au+Au collisions (default is false for + // single particle / p+p-only simulations, or for p+Au / Au+Au + // simulations which don't particularly care about jets) +// Enable::HIJETS = false && Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + + // 3-D topoCluster reconstruction, potentially in all calorimeter layers +// Enable::TOPOCLUSTER = true && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + // particle flow jet reconstruction - needs topoClusters! +// Enable::PARTICLEFLOW = true && Enable::TOPOCLUSTER; + + //--------------- + // Magnet Settings + //--------------- + + // const string magfield = "1.5"; // alternatively to specify a constant magnetic field, give a float number, which will be translated to solenoidal field in T, if string use as fieldmap name (including path) + // G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database +// G4MAGNET::magfield_rescale = 1; // make consistent with expected Babar field strength of 1.4T + + //--------------- + // Pythia Decayer + //--------------- + // list of decay types in + // $OFFLINE_MAIN/include/g4decayer/EDecayType.hh + // default is All: + // G4P6DECAYER::decayType = EDecayType::kAll; + + // Initialize the selected subsystems + G4Init(); + + //--------------------- + // GEANT4 Detector description + //--------------------- + if (!Input::READHITS) + { + G4Setup(); + } + + //------------------ + // Detector Division + //------------------ + + if (Enable::BBC || Enable::BBCFAKE) Bbc_Reco(); + + if (Enable::MVTX_CELL) Mvtx_Cells(); + if (Enable::INTT_CELL) Intt_Cells(); + if (Enable::TPC_CELL) TPC_Cells(); + if (Enable::MICROMEGAS_CELL) Micromegas_Cells(); + + if (Enable::CEMC_CELL) CEMC_Cells(); + + if (Enable::HCALIN_CELL) HCALInner_Cells(); + + if (Enable::HCALOUT_CELL) HCALOuter_Cells(); + + //----------------------------- + // CEMC towering and clustering + //----------------------------- + + if (Enable::CEMC_TOWER) CEMC_Towers(); + if (Enable::CEMC_CLUSTER) CEMC_Clusters(); + + //----------------------------- + // HCAL towering and clustering + //----------------------------- + + if (Enable::HCALIN_TOWER) HCALInner_Towers(); + if (Enable::HCALIN_CLUSTER) HCALInner_Clusters(); + + if (Enable::HCALOUT_TOWER) HCALOuter_Towers(); + if (Enable::HCALOUT_CLUSTER) HCALOuter_Clusters(); + + // if enabled, do topoClustering early, upstream of any possible jet reconstruction + if (Enable::TOPOCLUSTER) TopoClusterReco(); + + if (Enable::DSTOUT_COMPRESS) ShowerCompress(); + + //-------------- + // SVTX tracking + //-------------- + if (Enable::MVTX_CLUSTER) Mvtx_Clustering(); + if (Enable::INTT_CLUSTER) Intt_Clustering(); + if (Enable::TPC_CLUSTER) TPC_Clustering(); + if (Enable::MICROMEGAS_CLUSTER) Micromegas_Clustering(); + + if (Enable::TRACKING_TRACK) + { + TrackingInit(); + Tracking_Reco(); + } + //----------------- + // Global Vertexing + //----------------- + + if (Enable::GLOBAL_RECO && Enable::GLOBAL_FASTSIM) + { + cout << "You can only enable Enable::GLOBAL_RECO or Enable::GLOBAL_FASTSIM, not both" << endl; + gSystem->Exit(1); + } + if (Enable::GLOBAL_RECO) + { + Global_Reco(); + } + else if (Enable::GLOBAL_FASTSIM) + { + Global_FastSim(); + } + + //----------------- + // Calo Trigger Simulation + //----------------- + + if (Enable::CALOTRIGGER) + { + CaloTrigger_Sim(); + } + + //--------- + // Jet reco + //--------- + + if (Enable::JETS) Jet_Reco(); + if (Enable::HIJETS) HIJetReco(); + + if (Enable::PARTICLEFLOW) ParticleFlow(); + + //---------------------- + // Simulation evaluation + //---------------------- + string outputroot = outputFile; + string remove_this = ".root"; + size_t pos = outputroot.find(remove_this); + if (pos != string::npos) + { + outputroot.erase(pos, remove_this.length()); + } + + //-------------- + // Set up Input Managers + //-------------- + + InputManagers(); + + if (Enable::PRODUCTION) + { + Production_CreateOutputDir(); + } + + if (Enable::DSTOUT) + { + string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile; + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile); + out->AddNode("Sync"); + out->AddNode("EventHeader"); + out->AddNode("TOWER_SIM_HCALIN"); + out->AddNode("TOWER_RAW_HCALIN"); + out->AddNode("TOWER_CALIB_HCALIN"); + out->AddNode("CLUSTER_HCALIN"); + out->AddNode("TOWER_SIM_HCALOUT"); + out->AddNode("TOWER_RAW_HCALOUT"); + out->AddNode("TOWER_CALIB_HCALOUT"); + out->AddNode("CLUSTER_HCALOUT"); + out->AddNode("TOWER_SIM_CEMC"); + out->AddNode("TOWER_RAW_CEMC"); + out->AddNode("TOWER_CALIB_CEMC"); + out->AddNode("CLUSTER_CEMC"); + out->AddNode("CLUSTER_POS_COR_CEMC"); +// leave the topo cluster here in case we run this during pass3 + out->AddNode("TOPOCLUSTER_ALLCALO"); + out->AddNode("TOPOCLUSTER_EMCAL"); + out->AddNode("TOPOCLUSTER_HCAL"); + out->AddNode("GlobalVertexMap"); + if (Enable::DSTOUT_COMPRESS) DstCompress(out); + se->registerOutputManager(out); + } + //----------------- + // Event processing + //----------------- + if (Enable::DISPLAY) + { + DisplayOn(); + + gROOT->ProcessLine("Fun4AllServer *se = Fun4AllServer::instance();"); + gROOT->ProcessLine("PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");"); + + cout << "-------------------------------------------------" << endl; + cout << "You are in event display mode. Run one event with" << endl; + cout << "se->run(1)" << endl; + cout << "Run Geant4 command with following examples" << endl; + gROOT->ProcessLine("displaycmd()"); + + return 0; + } + + string outputfile = outputFile2 + "_g4hcin_eval.root"; + string outputfile2 = outputFile2 + "_hout.root"; + string outputfile3 = outputFile2 + "_hin_eval_mod.root"; + string outputfile4 = outputFile2 + "_hout_mod.root"; + string outputfile5 = outputFile2 + "_cemc_eval.root"; + string outputfile6 = outputFile2 + "_cemceval_mod.root"; + + + LiteCaloEval *eval = new LiteCaloEval("HOUTEVALUATOR0", "HCALOUT", outputfile2.c_str()); + //"CEMCEVALUATOR2", "CEMC", outputfile.c_str()); + // eval->Verbosity(verbosity); + eval->CaloType(LiteCaloEval::HCALOUT); + se->registerSubsystem(eval); + + + // LiteCaloEval *eval3a = new LiteCaloEval("HOUTEVALUATOR", "HCALOUT", outputfile4.c_str()); + // // eval->Verbosity(verbosity); + // eval3a->CaloType(LiteCaloEval::HCALOUT); // eval->Verbosity(verbosity); + // eval3a->set_mode(1); + // se->registerSubsystem(eval3a); + + + LiteCaloEval *eval2 = new LiteCaloEval("HINEVALUATOR2", "HCALIN", outputfile.c_str()); + // eval->Verbosity(verbosity); + eval2->CaloType(LiteCaloEval::HCALIN); + se->registerSubsystem(eval2); + + + // LiteCaloEval *eval4a = new LiteCaloEval("HINEVALUATOR4", "HCALIN", outputfile3.c_str()); + // // eval->Verbosity(verbosity); + // eval4a->CaloType(LiteCaloEval::HCALIN); // eval->Verbosity(verbosity); + // eval4a->set_mode(1); + // se->registerSubsystem(eval4a); + + + + LiteCaloEval *eval5 = new LiteCaloEval("CEMCEVALUATOR2", "CEMC", outputfile5.c_str()); + // eval->Verbosity(verbosity); + eval5->CaloType(LiteCaloEval::CEMC); + se->registerSubsystem(eval5); + + + // LiteCaloEval *eval6 = new LiteCaloEval("CEMCEVALUATOR", "CEMC", outputfile6.c_str()); + // // eval->Verbosity(verbosity); + // eval6->CaloType(LiteCaloEval::CEMC); + // eval6->set_mode(1); + // se->registerSubsystem(eval6); + + + + /* + LiteCaloEval *eval = new LiteCaloEval("CEMCEVALUATOR2", "CEMC", outputfile.c_str()); + // eval->Verbosity(verbosity); + eval->CaloType(LiteCaloEval::CEMC); + se->registerSubsystem(eval); + + */ + /* + CaloCalibEmc_Pi0 *eval_pi1 = new CaloCalibEmc_Pi0("CEMC_CALIB_PI0", outputfile2); + // eval_pi1->set_mode(1); + // eval->Verbosity(verbosity); + se->registerSubsystem(eval_pi1); + */ + + /* + CaloCalibEmc_Pi0 *eval_pi2 = new CaloCalibEmc_Pi0("CEMC_CALIB_PI02", outputfile4); + eval_pi2->set_mode(1); + // eval->Verbosity(verbosity); + se->registerSubsystem(eval_pi2); + */ + + /* + LiteCaloEval *eval3 = new LiteCaloEval("HOUTEVALUATOR", "HCALOUT", outputfile3.c_str()); + // eval->Verbosity(verbosity); + eval3->CaloType(LiteCaloEval::HCALOUT); + // se->registerSubsystem(eval3); + */ + + // if we use a negative number of events we go back to the command line here + if (nEvents < 0) + { + return 0; + } + // if we run the particle generator and use 0 it'll run forever + if (nEvents == 0 && !Input::HEPMC && !Input::READHITS) + { + cout << "using 0 for number of events is a bad idea when using particle generators" << endl; + cout << "it will run forever, so I just return without running anything" << endl; + return 0; + } + + se->run(nEvents); + + //----- + // Exit + //----- + + se->End(); + // se->PrintTimer(); + //se->PrintMemoryTracker(); + std::cout << "All done" << std::endl; + gSystem->Exit(0); + delete se; + /* + if (Enable::PRODUCTION) + { + Production_MoveOutput(); + } + */ + + return 0; +} +#endif diff --git a/calibrations/calo/tower_slope_macro/run_f4a.csh b/calibrations/calo/tower_slope_macro/run_f4a.csh new file mode 100755 index 000000000..46491b90b --- /dev/null +++ b/calibrations/calo/tower_slope_macro/run_f4a.csh @@ -0,0 +1,15 @@ +#!/bin/csh +echo ' ' +echo 'START: '`date` +source ~/setup_sphenix.sh +source ~/setldpath.csh sphenix +source /opt/sphenix/core/bin/setup_local.csh $JFINSTALL +echo $LD_LIBRARY_PATH +root.exe -b < + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4testbench.so) + +namespace Enable +{ + bool DISPLAY = false; +} + +// This starts the QT based G4 gui which takes control +// when x'ed out it will return a pointer to PHG4Reco so +// the gui can be startrd again +PHG4Reco *QTGui() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); + g4->InitRun(se->topNode()); + g4->ApplyDisplayAction(); + g4->StartGui(); + return g4; +} + // stupid macro to turn on the geant4 display // we ask Fun4All for a pointer to PHG4Reco // using the ApplyCommand will start up the @@ -6,12 +34,13 @@ // start up the visualization, the next event will // be displayed. Do not execute this macro // before PHG4Reco was registered with Fun4All -PHG4Reco * DisplayOn(const char *mac = "vis.mac") +PHG4Reco *DisplayOn(const char *mac = "vis.mac") { char cmd[100]; Fun4AllServer *se = Fun4AllServer::instance(); PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); g4->InitRun(se->topNode()); + g4->ApplyDisplayAction(); sprintf(cmd, "/control/execute %s", mac); g4->ApplyCommand(cmd); return g4; @@ -32,3 +61,4 @@ void displaycmd() cout << "set background color:" << endl; cout << " g4->ApplyCommand(\"/vis/viewer/set/background white\")" << endl; } +#endif diff --git a/common/G4_ActsGeom.C b/common/G4_ActsGeom.C new file mode 100644 index 000000000..a145d75f1 --- /dev/null +++ b/common/G4_ActsGeom.C @@ -0,0 +1,54 @@ +#ifndef MACRO_G4ACTSGEOM_C +#define MACRO_G4ACTSGEOM_C + +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libtrack_reco.so) +R__LOAD_LIBRARY(libtpccalib.so) +R__LOAD_LIBRARY(libqa_modules.so) + +#include + +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wundefined-internal" +#include +#pragma GCC diagnostic pop + +#include + + +namespace ACTSGEOM +{ + void ActsGeomInit() + { + static bool wasCalled = false; + if (wasCalled) + { + return; + } + wasCalled = true; + + if (!Enable::MICROMEGAS) + { + G4MICROMEGAS::n_micromegas_layer = 0; + } + + // Build the Acts geometry + auto se = Fun4AllServer::instance(); + int verbosity = Enable::VERBOSITY; + + // Geometry must be built before any Acts modules + MakeActsGeometry* geom = new MakeActsGeometry(); + geom->set_drift_velocity(G4TPC::tpc_drift_velocity_reco); + geom->Verbosity(verbosity); + + geom->loadMagField(G4TRACKING::init_acts_magfield); + geom->setMagField(G4MAGNET::magfield); + geom->setMagFieldRescale(G4MAGNET::magfield_rescale); + geom->build_mm_surfaces(Enable::MICROMEGAS); + se->registerSubsystem(geom); + } +} // namespace ACTSGEOM + +#endif diff --git a/common/G4_Bbc.C b/common/G4_Bbc.C new file mode 100644 index 000000000..1b75e083b --- /dev/null +++ b/common/G4_Bbc.C @@ -0,0 +1,90 @@ +#ifndef MACRO_G4BBC_C +#define MACRO_G4BBC_C + +#include + +#include + +#include +#include + +#include + + +R__LOAD_LIBRARY(libg4bbc.so) +R__LOAD_LIBRARY(libg4detectors.so) + +namespace Enable +{ + bool BBC = false; // Actual BBC detector + bool BBC_SUPPORT = false; // BBC Supports + bool BBCFAKE = false; // Just generate fake bbc vtx, t0 + int BBC_VERBOSITY = 0; +} // namespace Enable + +namespace G4BBC +{ + double z_smearing = 0.; // should be 6 mm, temporarily perfect for TPC initial vertexing + double t_smearing = 0.02; // 20ps timing resolution +} // namespace G4BBC + +void BbcInit() +{ + if (Enable::BBC && Enable::BBCFAKE) + { + cout << "Enable::BBC and Enable::BBCFAKE cannot be true at the same time" << endl; + gSystem->Exit(1); + } + // Set boundary of tracked particles to include BBC (values in cm) + if (Enable::BBC) + { + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 300.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -300.); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 125.0); + } +} + +void Bbc(PHG4Reco* g4Reco) +{ + bool SupportActive = Enable::SUPPORT || Enable::BBC_SUPPORT; + if (Enable::BBC) + { + PHG4BbcSubsystem* bbc = new PHG4BbcSubsystem("BBC"); + bbc->SuperDetector("BBC"); + bbc->OverlapCheck( Enable::OVERLAPCHECK ); + bbc->SetActive(); + if (SupportActive) + { + bbc->SetSupportActive(SupportActive); + } + g4Reco->registerSubsystem(bbc); + } + return; +} + +void Bbc_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::BBC_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + if (Enable::BBCFAKE) + { + if (verbosity > 0) + { + cout << "BBCFAKE: Using smeared vtx and t0 resolutions of " + << G4BBC::z_smearing << " cm and " << G4BBC::t_smearing * 1000 << " ps" << endl; + } + BbcVertexFastSimReco* bbcvertex = new BbcVertexFastSimReco(); + bbcvertex->set_z_smearing(G4BBC::z_smearing); + bbcvertex->set_t_smearing(G4BBC::t_smearing); + se->registerSubsystem(bbcvertex); + } + + return; +} +#endif diff --git a/common/G4_BeamLine.C b/common/G4_BeamLine.C new file mode 100644 index 000000000..61f44a3bf --- /dev/null +++ b/common/G4_BeamLine.C @@ -0,0 +1,342 @@ +#ifndef MACRO_G4BEAMLINE_C +#define MACRO_G4BEAMLINE_C + +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +float PosFlip(float pos); +float AngleFlip(float angle); +float MagFieldFlip(float Bfield); + +// This creates the Enable Flag to be used in the main steering macro +namespace Enable +{ + bool BEAMLINE = false; + bool BEAMLINE_ABSORBER = false; + bool BEAMLINE_BLACKHOLE = false; + bool BEAMLINE_OVERLAPCHECK = false; + int BEAMLINE_VERBOSITY = 0; + +} // namespace Enable + +namespace G4BEAMLINE +{ + // the beampipes seem to add 2 no_overlaps - needs to be looked at + // but this z position takes care of our current overlap issues + double starting_z = G4PIPE::max_z + 2*no_overlapp; + double enclosure_z_max = 2050. + (700-starting_z); + double enclosure_r_max = 30.; // 30cm radius to cover magnets + double enclosure_center = 0.5 * (starting_z + enclosure_z_max); + double skin_thickness = 0.; // if center of magnet iron is black hole - thickness of Fe surrounding it + int pipe_id_offset = 100; + int roman_pot_pipe_id_offset = 200; + PHG4CylinderSubsystem *ForwardBeamLineEnclosure(nullptr); + PHG4CylinderSubsystem *BackwardBeamLineEnclosure(nullptr); + +} // namespace BeamLine + +void BeamLineInit() +{ + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4BEAMLINE::enclosure_z_max); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4BEAMLINE::enclosure_z_max); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4BEAMLINE::enclosure_r_max); +} + +void BeamLineDefineMagnets(PHG4Reco *g4Reco) +{ + bool overlapCheck = Enable::OVERLAPCHECK || Enable::BEAMLINE_OVERLAPCHECK; + bool AbsorberActive = Enable::ABSORBER || Enable::BEAMLINE_ABSORBER; + + int verbosity = std::max(Enable::VERBOSITY, Enable::BEAMLINE_VERBOSITY); + + G4BEAMLINE::ForwardBeamLineEnclosure = new PHG4CylinderSubsystem("ForwardBeamLineEnclosure"); + G4BEAMLINE::ForwardBeamLineEnclosure->set_double_param("place_z", G4BEAMLINE::enclosure_center ); + G4BEAMLINE::ForwardBeamLineEnclosure->set_double_param("radius", 0); + G4BEAMLINE::ForwardBeamLineEnclosure->set_double_param("thickness", G4BEAMLINE::enclosure_r_max); + G4BEAMLINE::ForwardBeamLineEnclosure->set_double_param("length", G4BEAMLINE::enclosure_z_max - G4BEAMLINE::starting_z); + G4BEAMLINE::ForwardBeamLineEnclosure->set_string_param("material", "G4_Galactic"); + G4BEAMLINE::ForwardBeamLineEnclosure->set_color(.5, .5, .5, 0.2); + G4BEAMLINE::ForwardBeamLineEnclosure->OverlapCheck(overlapCheck); + if (verbosity) G4BEAMLINE::ForwardBeamLineEnclosure->Verbosity(verbosity); + g4Reco->registerSubsystem(G4BEAMLINE::ForwardBeamLineEnclosure); + + G4BEAMLINE::BackwardBeamLineEnclosure = new PHG4CylinderSubsystem("BackwardBeamLineEnclosure"); + G4BEAMLINE::BackwardBeamLineEnclosure->set_double_param("place_z", -G4BEAMLINE::enclosure_center); + G4BEAMLINE::BackwardBeamLineEnclosure->set_double_param("radius", 0); + G4BEAMLINE::BackwardBeamLineEnclosure->set_double_param("thickness", G4BEAMLINE::enclosure_r_max); // This is intentionally made large 25cm radius + G4BEAMLINE::BackwardBeamLineEnclosure->set_double_param("length", G4BEAMLINE::enclosure_z_max - G4BEAMLINE::starting_z); + G4BEAMLINE::BackwardBeamLineEnclosure->set_string_param("material", "G4_Galactic"); + G4BEAMLINE::BackwardBeamLineEnclosure->set_color(.5, .5, .5, 0.2); + G4BEAMLINE::BackwardBeamLineEnclosure->OverlapCheck(overlapCheck); + if (verbosity) G4BEAMLINE::BackwardBeamLineEnclosure->Verbosity(verbosity); + g4Reco->registerSubsystem(G4BEAMLINE::BackwardBeamLineEnclosure); + + string magFile; + magFile = string(getenv("CALIBRATIONROOT")) + "/Beam/D0DXMagnets.dat"; + + // if you insert numbers it only displays those magnets, do not comment out the set declaration + set magnetlist; + //magnetlist.insert(7); + + BeamLineMagnetSubsystem *bl = nullptr; + std::ifstream infile(magFile); + if (infile.is_open()) + { + double biggest_z = 0.; + int imagnet = 0; + std::string line; + while (std::getline(infile, line)) + { + if (!line.compare(0, 1, "B") || + !line.compare(0, 1, "Q") || + !line.compare(0, 1, "S")) + { + std::istringstream iss(line); + string magname; + double x; + double y; + double z; + double inner_radius_zin; + double inner_radius_zout; + double outer_magnet_diameter; + double length; + double angle; + double dipole_field_x; + double fieldgradient; + if (!(iss >> magname >> x >> y >> z >> inner_radius_zin >> inner_radius_zout >> outer_magnet_diameter >> length >> angle >> dipole_field_x >> fieldgradient)) + { + cout << "could not decode " << line << endl; + gSystem->Exit(1); + } + else + { + //------------------------ + + string magtype; + if (inner_radius_zin != inner_radius_zout) + { + cout << "inner radius at front of magnet " << inner_radius_zin + << " not equal radius at back of magnet " << inner_radius_zout + << " needs change in code (replace tube by cone for beamline)" << endl; + gSystem->Exit(1); + } + if (verbosity > 0) + { + cout << endl + << endl + << "\tID number " << imagnet << endl; + cout << "magname: " << magname << endl; + cout << "x: " << x << endl; + cout << "y: " << y << endl; + cout << "z: " << z << endl; + cout << "inner_radius_zin: " << inner_radius_zin << endl; + cout << "inner_radius_zout: " << inner_radius_zout << endl; + cout << "outer_magnet_diameter: " << outer_magnet_diameter << endl; + cout << "length: " << length << endl; + cout << "angle: " << angle << endl; + cout << "dipole_field_x: " << dipole_field_x << endl; + cout << "fieldgradient: " << fieldgradient << endl; + } + if (!magname.compare(0, 1, "B")) + { + magtype = "DIPOLE"; + } + else if (!magname.compare(0, 1, "Q")) + { + magtype = "QUADRUPOLE"; + } + else if (!magname.compare(0, 1, "S")) + { + magtype = "SEXTUPOLE"; + } + else + { + cout << "cannot decode magnet name " << magname << endl; + gSystem->Exit(1); + } + // convert to our units (cm, deg) + x *= 100.; + y *= 100.; + z *= 100.; + length *= 100.; + inner_radius_zin *= 100.; + outer_magnet_diameter *= 100.; + angle = (angle / M_PI * 180.) / 1000.; // given in mrad + + //------------------------ + + if (magnetlist.empty() || magnetlist.find(imagnet) != magnetlist.end()) + { + bl = new BeamLineMagnetSubsystem("BEAMLINEMAGNET", imagnet); + bl->set_double_param("field_y", MagFieldFlip(dipole_field_x)); + bl->set_double_param("fieldgradient", MagFieldFlip(fieldgradient)); + bl->set_string_param("magtype", magtype); + bl->set_double_param("length", length); + bl->set_double_param("place_x", PosFlip(x)); // relative position to mother vol. + bl->set_double_param("place_y", y); // relative position to mother vol. + if (z > 0) + { + bl->set_double_param("place_z", z - G4BEAMLINE::enclosure_center); // relative position to mother vol. + } + else + { + bl->set_double_param("place_z", z + G4BEAMLINE::enclosure_center); // relative position to mother vol. + } + bl->set_double_param("field_global_position_x", PosFlip(x)); // abs. position to world for field manager + bl->set_double_param("field_global_position_y", y); // abs. position to world for field manager + bl->set_double_param("field_global_position_z", z); // abs. position to world for field manager + bl->set_double_param("rot_y", AngleFlip(angle)); + bl->set_double_param("field_global_rot_y", AngleFlip(angle)); // abs. rotation to world for field manager + bl->set_double_param("inner_radius", inner_radius_zin); + bl->set_double_param("outer_radius", outer_magnet_diameter / 2.); + bl->set_double_param("skin_thickness",G4BEAMLINE::skin_thickness); + bl->SetActive(AbsorberActive); + bl->SetAbsorberActive(AbsorberActive); + if (Enable::BEAMLINE_BLACKHOLE) bl->BlackHole(); // turn magnets into black holes + if (z > 0) + { + bl->SetMotherSubsystem(G4BEAMLINE::ForwardBeamLineEnclosure); + } + else + { + bl->SetMotherSubsystem(G4BEAMLINE::BackwardBeamLineEnclosure); + } + bl->OverlapCheck(overlapCheck); + bl->SuperDetector("BEAMLINEMAGNET"); + if (verbosity) bl->Verbosity(verbosity); + g4Reco->registerSubsystem(bl); + } + imagnet++; + if (fabs(z) + length > biggest_z) + { + biggest_z = fabs(z) + length; + } + } + } + } + infile.close(); + } +} + +void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) +{ + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::BEAMLINE_OVERLAPCHECK; + bool AbsorberActive = Enable::ABSORBER || Enable::BEAMLINE_ABSORBER; + int verbosity = std::max(Enable::VERBOSITY, Enable::BEAMLINE_VERBOSITY); + + const int ntube = 10; + const string nm[ntube] = {"B00", "B01", "B10", "B11", "B20", "B21", "B30", "B31", "B32", "B33"}; + const double qlen[ntube] = {233.8, 233.8, 118.7, 118.7, 217.16, 217.16, 182.5, 182.5, 182.5, 182.5}; + const double qir[ntube] = {6.08, 6.08, 14.60, 14.60, 20.0, 20.0, 6.07, 6.07, 6.07, 6.07}; + const double qor[ntube] = {6.35, 6.35, 15.24, 15.24, 20.96, 20.96, 6.35, 6.35, 6.35, 6.35}; + const double qrot[ntube] = {0, 0, 0, 0, 0, 0, 1.074, -1.074, -1.074, 1.074}; //degree + const double qxC[ntube] = {0, 0, 0, 0, 0, 0, 12.820, -12.820, 12.820, -12.820}; + const double qyC[ntube] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + const double qzC[ntube] = {863.1, -863.1, 1474.470, -1474.470, 1642.4, -1642.4, 1843.2, 1843.2, -1843.2, -1843.2}; + for (int i = 0; i < ntube; i++) + { + string name = "beamPipe" + nm[i]; + PHG4CylinderSubsystem *pipe = new PHG4CylinderSubsystem(name, G4BEAMLINE::pipe_id_offset + i); + pipe->set_double_param("radius", qir[i]); + pipe->set_double_param("thickness", qor[i] - qir[i]); + pipe->set_double_param("length", qlen[i]); + pipe->set_double_param("rot_y", qrot[i]); + pipe->set_string_param("material", "G4_STAINLESS-STEEL"); + pipe->set_double_param("place_x", PosFlip(qxC[i])); + pipe->set_double_param("place_y", qyC[i]); + if (qzC[i] > 0) + { + pipe->set_double_param("place_z", qzC[i] - G4BEAMLINE::enclosure_center); // relative position to mother vol. + } + else + { + pipe->set_double_param("place_z", qzC[i] + G4BEAMLINE::enclosure_center); // relative position to mother vol. + } + if (AbsorberActive) pipe->SetActive(); + pipe->SuperDetector("PIPE"); + if (qzC[i] > 0) + { + pipe->SetMotherSubsystem(G4BEAMLINE::ForwardBeamLineEnclosure); + } + else + { + pipe->SetMotherSubsystem(G4BEAMLINE::BackwardBeamLineEnclosure); + } + + pipe->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(pipe); + } + + //Roman Pot pipe + const int nSec = 2; + const double len[nSec] = {20.87, 20.87}; + const double ir1[nSec] = {7.14, 14.60}; + const double or1[nSec] = {7.77, 15.24}; + const double ir2[nSec] = {14.60, 7.14}; + const double or2[nSec] = {15.24, 7.77}; + const double xC[nSec] = {0, 0}; + const double yC[nSec] = {0, 0}; + const double zC[nSec] = {1394.25, -1394.25}; + for (int i = 0; i < nSec; i++) + { + string name = "beamPipeRP" + to_string(i); + PHG4ConeSubsystem *pipe = new PHG4ConeSubsystem(name, G4BEAMLINE::roman_pot_pipe_id_offset + i); + pipe->set_string_param("material", "G4_STAINLESS-STEEL"); + pipe->set_double_param("place_x", PosFlip(xC[i])); + pipe->set_double_param("place_y", yC[i]); + if (zC[i] > 0) + { + pipe->set_double_param("place_z", zC[i] - G4BEAMLINE::enclosure_center); + } + else + { + pipe->set_double_param("place_z", zC[i] + G4BEAMLINE::enclosure_center); + } + pipe->set_double_param("length", len[i]); + pipe->set_double_param("rmin1", ir1[i]); + pipe->set_double_param("rmin2", ir2[i]); + pipe->set_double_param("rmax1", or1[i]); + pipe->set_double_param("rmax2", or2[i]); + if (zC[i] > 0) + { + pipe->SetMotherSubsystem(G4BEAMLINE::ForwardBeamLineEnclosure); + } + else + { + pipe->SetMotherSubsystem(G4BEAMLINE::BackwardBeamLineEnclosure); + } + if (AbsorberActive) pipe->SetActive(); + pipe->SuperDetector("PIPE"); + pipe->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(pipe); + } +} + +float PosFlip(float pos) +{ + return pos; +}; +float AngleFlip(float angle) +{ + return angle; +}; +float MagFieldFlip(float Bfield) +{ + return Bfield; +}; + +#endif diff --git a/common/G4_BlackHole.C b/common/G4_BlackHole.C new file mode 100644 index 000000000..12bc26c2f --- /dev/null +++ b/common/G4_BlackHole.C @@ -0,0 +1,98 @@ +#ifndef MACRO_G4BLACKHOLE_C +#define MACRO_G4BLACKHOLE_C + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +namespace Enable +{ + bool BLACKHOLE = false; + bool BLACKHOLE_SAVEHITS = true; + bool BLACKHOLE_FORWARD_SAVEHITS = true; +} // namespace Enable + +void BlackHoleInit() {} + +void BlackHole(PHG4Reco *g4Reco, double radius) +{ + // swallow all particles coming out of our detector + if (radius < BlackHoleGeometry::max_radius) + { + radius = BlackHoleGeometry::max_radius; + } + double blackhole_length = (BlackHoleGeometry::max_z - BlackHoleGeometry::min_z) + 2 * BlackHoleGeometry::gap; + double blackhole_zpos = BlackHoleGeometry::min_z - BlackHoleGeometry::gap + blackhole_length / 2.; + double blackhole_radius = radius + BlackHoleGeometry::gap; // make the black hole slightly larger than the radius + PHG4CylinderSubsystem *blackhole = new PHG4CylinderSubsystem("BH", 1); + blackhole->set_double_param("radius", blackhole_radius); + blackhole->set_double_param("length", blackhole_length); // make it cover the world in length + blackhole->set_double_param("place_z", blackhole_zpos); + blackhole->set_double_param("thickness", BlackHoleGeometry::gap / 2.); // it needs some thickness + if (BlackHoleGeometry::visible) + { + blackhole->set_color(1, 0, 0, 0.7); + } + blackhole->BlackHole(); + if (Enable::BLACKHOLE_SAVEHITS) + { + blackhole->SetActive(); // see what leaks out + } + blackhole->OverlapCheck(true); + g4Reco->registerSubsystem(blackhole); + + //---------------------------------------- + // FORWARD/BACKWARD BLACKHOLEs (thin disks, thickness is radius, length is thickness) + // +Z + // if min/max z is not symmetric, the cylinder is not centered around z=0 + // to find the offset we start with the middle of the barrel at blackhole_zpos, then add its length/2. which + // gets us to the end of the cylinder, then we add another gap so the endcap does not overlap + // the endcap itself is BlackHoleGeometry::gap/2 thick, leaving BlackHoleGeometry::gap/4 on each side of the + // center. Basically we have a gap of BlackHoleGeometry::gap/4 between the barrel and the endplates + // therefore we add BlackHoleGeometry::gap to the radius of the endcap so particles trying to go through + // the tiny gap between barren and endplate will hit the endplate + double blackhole_forward_zpos = blackhole_zpos + blackhole_length / 2. + BlackHoleGeometry::gap / 2.; + blackhole = new PHG4CylinderSubsystem("BH_FORWARD_PLUS", 1); + blackhole->SuperDetector("BH_FORWARD_PLUS"); + blackhole->set_double_param("radius", 0.); + blackhole->set_double_param("thickness", blackhole_radius + BlackHoleGeometry::gap); // add a bit so we cover the microscopic gap (BlackHoleGeometry::gap) between barrel and endplate + blackhole->set_double_param("length", BlackHoleGeometry::gap / 2.); // it needs some thickness but not go outside world + blackhole->set_double_param("place_z", blackhole_forward_zpos); // put at the end of the world + if (BlackHoleGeometry::visible) + { + blackhole->set_color(1, 0, 0, 0.7); + } + blackhole->BlackHole(); + if (Enable::BLACKHOLE_SAVEHITS && Enable::BLACKHOLE_FORWARD_SAVEHITS) + { + blackhole->SetActive(); // see what leaks out + } + blackhole->OverlapCheck(true); + g4Reco->registerSubsystem(blackhole); + + // -Z + double blackhole_backward_zpos = blackhole_zpos - (blackhole_length / 2. + BlackHoleGeometry::gap / 2.); + + blackhole = new PHG4CylinderSubsystem("BH_FORWARD_NEG", 1); + blackhole->SuperDetector("BH_FORWARD_NEG"); + blackhole->set_double_param("radius", 0); // add 10 cm + blackhole->set_double_param("thickness", blackhole_radius + BlackHoleGeometry::gap); // add a bit so we cover the microscopic gap (BlackHoleGeometry::gap) between barrel and endplate + blackhole->set_double_param("length", BlackHoleGeometry::gap / 2.); // it needs some thickness but not go outside world + blackhole->set_double_param("place_z", blackhole_backward_zpos); + if (BlackHoleGeometry::visible) + { + blackhole->set_color(1, 0, 0, 0.7); + } + blackhole->BlackHole(); + if (Enable::BLACKHOLE_SAVEHITS && Enable::BLACKHOLE_FORWARD_SAVEHITS) + { + blackhole->SetActive(); // always see what leaks out + } + blackhole->OverlapCheck(true); + g4Reco->registerSubsystem(blackhole); + return; +} +#endif diff --git a/common/G4_CEmc_Albedo.C b/common/G4_CEmc_Albedo.C new file mode 100644 index 000000000..0614e4ee3 --- /dev/null +++ b/common/G4_CEmc_Albedo.C @@ -0,0 +1,48 @@ +#ifndef MACRO_G4CEMCALBEDO_C +#define MACRO_G4CEMCALBEDO_C + +#include + +#include + +#include + +namespace Enable +{ + bool CEMCALBEDO = false; + bool CEMCALBEDO_ABSORBER = false; +} // namespace Enable + +namespace G4CEMCALBEDO +{ + double teflon_cylinder_thickness = 1.5; + double inner_radius = 95. - teflon_cylinder_thickness; // inner radius emc, 1.5cm electronics subtracted + double albedo_thickness = 2.; +} // namespace G4CEMCALBEDO + +void CEmcAlbedoInit() +{ + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 149.47); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -149.47); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4CEMCALBEDO::inner_radius + G4CEMCALBEDO::teflon_cylinder_thickness + G4CEMCALBEDO::albedo_thickness); +} + +void CEmcAlbedo(PHG4Reco *g4Reco) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::CEMCALBEDO_ABSORBER; + PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); + cyl->SuperDetector("CEMC_MOCKUP"); + cyl->set_double_param("radius", G4CEMCALBEDO::inner_radius); + cyl->set_string_param("material", "G4_TEFLON"); + cyl->set_double_param("thickness", G4CEMCALBEDO::teflon_cylinder_thickness); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + cyl = new PHG4CylinderSubsystem("CEMC_ALBEDO", 1); + cyl->SuperDetector("CEMC_MOCKUP"); + cyl->set_double_param("radius", G4CEMCALBEDO::inner_radius + G4CEMCALBEDO::teflon_cylinder_thickness); + cyl->set_string_param("material", "Spacal_W_Epoxy"); + cyl->set_double_param("thickness", G4CEMCALBEDO::albedo_thickness); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); +} +#endif diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C new file mode 100644 index 000000000..e0e7b0dda --- /dev/null +++ b/common/G4_CEmc_Spacal.C @@ -0,0 +1,379 @@ +#ifndef MACRO_G4CEMCSPACAL_C +#define MACRO_G4CEMCSPACAL_C + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +double +CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings); + +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool CEMC = false; + bool CEMC_ABSORBER = false; + bool CEMC_OVERLAPCHECK = false; + bool CEMC_CELL = false; + bool CEMC_TOWER = false; + bool CEMC_CLUSTER = false; + bool CEMC_EVAL = false; + bool CEMC_QA = false; + int CEMC_VERBOSITY = 0; +} // namespace Enable + +namespace G4CEMC +{ + int Min_cemc_layer = 1; + int Max_cemc_layer = 1; + + // Digitization (default photon digi): + RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kSimple_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 + + // 2D azimuthal projective SPACAL (slow) + int Cemc_spacal_configuration = PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal; + + enum enu_Cemc_clusterizer + { + kCemcGraphClusterizer, + + kCemcTemplateClusterizer + }; + + //! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky + enu_Cemc_clusterizer Cemc_clusterizer = kCemcTemplateClusterizer; + //! graph clusterizer, RawClusterBuilderGraph + //enu_Cemc_clusterizer Cemc_clusterizer = kCemcGraphClusterizer; + +} // namespace G4CEMC + +// black hole parameters are set in CEmc function +// needs a dummy argument to play with current G4Setup_sPHENIX.C +void CEmcInit(const int i = 0) +{ +} + +//! EMCal main setup macro +double +CEmc(PHG4Reco *g4Reco, double radius, const int crossings) +{ + return CEmc_2DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ crossings); +} + +//! 2D full projective SPACAL +double +CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::CEMC_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::CEMC_OVERLAPCHECK; + + double emc_inner_radius = 92; // emc inner radius from engineering drawing + double cemcthickness = 24.00000 - no_overlapp; + + //max radius is 116 cm; + double emc_outer_radius = emc_inner_radius + cemcthickness; // outer radius + assert(emc_outer_radius < 116); + + if (radius > emc_inner_radius) + { + cout << "inconsistency: preshower radius+thickness: " << radius + << " larger than emc inner radius: " << emc_inner_radius << endl; + gSystem->Exit(-1); + } + + // the radii are only to determined the thickness of the cemc + radius = emc_inner_radius; + + // 1.5cm thick teflon as an approximation for EMCAl light collection + electronics (10% X0 total estimated) + PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); + cyl->set_double_param("radius", radius); + cyl->set_string_param("material", "G4_TEFLON"); + cyl->set_double_param("thickness", 1.5 - no_overlapp); + cyl->SuperDetector("CEMC_ELECTRONICS"); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + + radius += 1.5; + cemcthickness -= 1.5 + no_overlapp; + + // 0.5cm thick Stainless Steel as an approximation for EMCAl support system + cyl = new PHG4CylinderSubsystem("CEMC_SPT", 0); + cyl->SuperDetector("CEMC_SPT"); + cyl->set_double_param("radius", radius + cemcthickness - 0.5); + cyl->set_string_param("material", "SS310"); // SS310 Stainless Steel + cyl->set_double_param("thickness", 0.5 - no_overlapp); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + + // this is the z extend and outer radius of the support structure and therefore the z extend + // and radius of the surrounding black holes + double sptlen = PHG4Utils::GetLengthForRapidityCoverage(radius + cemcthickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, sptlen); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -sptlen); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius + cemcthickness); + + cemcthickness -= 0.5 + no_overlapp; + + int ilayer = 0; + PHG4SpacalSubsystem *cemc; + + cemc = new PHG4SpacalSubsystem("CEMC", ilayer); + + cemc->set_int_param("virualize_fiber", 0); + cemc->set_int_param("azimuthal_seg_visible", 1); + cemc->set_int_param("construction_verbose", 0); + cemc->Verbosity(0); + if (Enable::XPLOAD) + { + cemc->UseCDB("CEMC_GEOMETRY"); + } + else + { + cemc->UseCalibFiles(PHG4DetectorSubsystem::xml); + cemc->SetCalibrationFileDir(string(getenv("CALIBRATIONROOT")) + string("/CEMC/Geometry_2018ProjTilted/")); + } + cemc->set_double_param("radius", radius); // overwrite minimal radius + cemc->set_double_param("thickness", cemcthickness); // overwrite thickness + + cemc->SetActive(); + cemc->SuperDetector("CEMC"); + if (AbsorberActive) cemc->SetAbsorberActive(); + cemc->OverlapCheck(OverlapCheck); + + g4Reco->registerSubsystem(cemc); + + if (ilayer > G4CEMC::Max_cemc_layer) + { + cout << "layer discrepancy, current layer " << ilayer + << " max cemc layer: " << G4CEMC::Max_cemc_layer << endl; + } + + radius += cemcthickness; + radius += no_overlapp; + + return radius; +} + +void CEMC_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) + { + PHG4CylinderCellReco *cemc_cells = new PHG4CylinderCellReco("CEMCCYLCELLRECO"); + cemc_cells->Detector("CEMC"); + cemc_cells->Verbosity(verbosity); + for (int i = G4CEMC::Min_cemc_layer; i <= G4CEMC::Max_cemc_layer; i++) + { + // cemc_cells->etaphisize(i, 0.024, 0.024); + const double radius = 95; + cemc_cells->cellsize(i, 2 * M_PI / 256. * radius, 2 * M_PI / 256. * radius); + } + se->registerSubsystem(cemc_cells); + } + else if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) + { + PHG4FullProjSpacalCellReco *cemc_cells = new PHG4FullProjSpacalCellReco("CEMCCYLCELLRECO"); + cemc_cells->Detector("CEMC"); + cemc_cells->Verbosity(verbosity); + cemc_cells->get_light_collection_model().load_data_file( + string(getenv("CALIBRATIONROOT")) + string("/CEMC/LightCollection/Prototype3Module.xml"), + "data_grid_light_guide_efficiency", "data_grid_fiber_trans"); + se->registerSubsystem(cemc_cells); + } + else + { + cout << "G4_CEmc_Spacal.C::CEmc - Fatal Error - unrecognized SPACAL configuration #" + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << endl; + gSystem->Exit(-1); + return; + } + + return; +} + +void CEMC_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + RawTowerBuilder *TowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); + TowerBuilder->Detector("CEMC"); + TowerBuilder->set_sim_tower_node_prefix("SIM"); + TowerBuilder->Verbosity(verbosity); + se->registerSubsystem(TowerBuilder); + + double sampling_fraction = 1; + // sampling_fraction = 0.02244; //from production: /gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.3/single_particle/spacal2d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root + // sampling_fraction = 2.36081e-02; //from production: /gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.5/single_particle/spacal2d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root + // sampling_fraction = 1.90951e-02; // 2017 Tilt porjective SPACAL, 8 GeV photon, eta = 0.3 - 0.4 + sampling_fraction = 2e-02; // 2017 Tilt porjective SPACAL, tower-by-tower calibration + const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition + + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); + TowerDigitizer->Detector("CEMC"); + TowerDigitizer->Verbosity(verbosity); + TowerDigitizer->set_digi_algorithm(G4CEMC::TowerDigi); + TowerDigitizer->set_variable_pedestal(true); //read ped central and width from calibrations file comment next 2 lines if true + // TowerDigitizer->set_pedstal_central_ADC(0); + // TowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting + TowerDigitizer->set_photonelec_ADC(1); //not simulating ADC discretization error + TowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); + TowerDigitizer->set_variable_zero_suppression(true); //read zs values from calibrations file comment next line if true + // TowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting + if (Enable::XPLOAD) + { + TowerDigitizer->GetParameters().ReadFromCDB("EMCTOWERCALIB"); + } + else + { + TowerDigitizer->GetParameters().ReadFromFile("CEMC", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/CEMC/TowerCalibCombinedParams_2020/")); // calibration database + } + se->registerSubsystem(TowerDigitizer); + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); + TowerCalibration->Detector("CEMC"); + TowerCalibration->Verbosity(verbosity); + + if (G4CEMC::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + // just use sampling fraction set previously + TowerCalibration->set_calib_const_GeV_ADC(1.0 / sampling_fraction); + } + else + { + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kTower_by_tower_calibration); + if (Enable::XPLOAD) + { + TowerCalibration->GetCalibrationParameters().ReadFromCDB("EMCTOWERCALIB"); + } + else + { + TowerCalibration->GetCalibrationParameters().ReadFromFile("CEMC", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/CEMC/TowerCalibCombinedParams_2020/")); // calibration database + } + TowerCalibration->set_variable_GeV_ADC(true); //read GeV per ADC from calibrations file comment next line if true + // TowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / 0.9715); // overall energy scale based on 4-GeV photon simulations + TowerCalibration->set_variable_pedestal(true); //read pedestals from calibrations file comment next line if true + // TowerCalibration->set_pedstal_ADC(0); + } + se->registerSubsystem(TowerCalibration); + + return; +} + +void CEMC_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below + std::string emc_prof = getenv("CALIBRATIONROOT"); + emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder->LoadProfile(emc_prof); + se->registerSubsystem(ClusterBuilder); + } + else if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcGraphClusterizer) + { + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "CEMC_Clusters - unknown clusterizer setting!" << endl; + exit(1); + } + + RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC"); + if (Enable::XPLOAD) + { + clusterCorrection->Get_eclus_CalibrationParameters().ReadFromCDB("CEMCRECALIB"); + clusterCorrection->Get_ecore_CalibrationParameters().ReadFromCDB("CEMC_ECORE_RECALIB"); + } + else + { + clusterCorrection->Get_eclus_CalibrationParameters().ReadFromFile("CEMC_RECALIB", "xml", 0, 0, + //raw location + string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + clusterCorrection->Get_ecore_CalibrationParameters().ReadFromFile("CEMC_ECORE_RECALIB", "xml", 0, 0, + //raw location + string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + } + + clusterCorrection->Verbosity(verbosity); + se->registerSubsystem(clusterCorrection); + + return; +} +void CEMC_Eval(const std::string &outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("CEMCEVALUATOR", "CEMC", outputfile); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + +void CEMC_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + QAG4SimulationCalorimeter *qa = new QAG4SimulationCalorimeter("CEMC"); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + return; +} + +#endif diff --git a/common/G4_CaloTrigger.C b/common/G4_CaloTrigger.C new file mode 100644 index 000000000..0f8d85d4e --- /dev/null +++ b/common/G4_CaloTrigger.C @@ -0,0 +1,34 @@ +#ifndef MACRO_G4CALOTRIGGER_C +#define MACRO_G4CALOTRIGGER_C + +#include + +#include + +#include + +R__LOAD_LIBRARY(libcalotrigger.so) + +namespace Enable +{ + bool CALOTRIGGER = false; + int CALOTRIGGER_VERBOSITY = 0; +} // namespace Enable + +void CaloTrigger_Sim() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CALOTRIGGER_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + CaloTriggerSim* calotriggersim = new CaloTriggerSim(); + calotriggersim->Verbosity(verbosity); + se->registerSubsystem(calotriggersim); + + return; +} +#endif diff --git a/common/G4_Centrality.C b/common/G4_Centrality.C new file mode 100644 index 000000000..855c6c31d --- /dev/null +++ b/common/G4_Centrality.C @@ -0,0 +1,43 @@ +#ifndef MACRO_G4CENTRALITY_C +#define MACRO_G4CENTRALITY_C + +#include + +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libcentrality_io.so) +R__LOAD_LIBRARY(libg4centrality.so) + +namespace Enable +{ + bool CENTRALITY = false; + int CENTRALITY_VERBOSITY = 0; +} // namespace Enable + +void Centrality() +{ + int verbosity = max(Enable::VERBOSITY, Enable::CENTRALITY_VERBOSITY); + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4CentralityReco *cent = new PHG4CentralityReco(); + cent->Verbosity(verbosity); + if (Enable::XPLOAD) + { + cent->GetCalibrationParameters().ReadFromCDB("CENTRALITY"); + } + else + { + cent->GetCalibrationParameters().ReadFromFile("centrality", "xml", 0, 0, string(getenv("CALIBRATIONROOT")) + string("/Centrality/")); + } + se->registerSubsystem( cent ); + + return; +} +#endif diff --git a/common/G4_DSTReader.C b/common/G4_DSTReader.C new file mode 100644 index 000000000..66e009d7d --- /dev/null +++ b/common/G4_DSTReader.C @@ -0,0 +1,164 @@ +#ifndef MACRO_G4DSTREADER_C +#define MACRO_G4DSTREADER_C + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4eval.so) + +////////////////////////////////////////////////////////////////// +/*! + \file G4_DSTReader.C + \brief Convert DST to human command readable TTree for quick poke around the outputs + \author Jin Huang + \version $Revision: $ + \date $Date: $ + */ +////////////////////////////////////////////////////////////////// + +namespace Enable +{ + bool DSTREADER = false; + int DSTREADER_VERBOSITY = 0; +} // namespace Enable + +namespace G4DSTREADER +{ + bool save_g4_raw = true; + double tower_zero_supp = 1.e-6; +} // namespace G4DSTREADER + +void G4DSTreaderInit() {} + +void G4DSTreader(const string &outputFile = "G4sPHENIXCells.root") +{ + int verbosity = max(Enable::VERBOSITY, Enable::DSTREADER_VERBOSITY); + + // save a comprehensive evaluation file + PHG4DSTReader *ana = new PHG4DSTReader(outputFile); + ana->set_save_particle(true); + ana->set_load_all_particle(false); + ana->set_load_active_particle(true); + ana->set_save_vertex(true); + + ana->Verbosity(verbosity); + + if (G4DSTREADER::save_g4_raw) + { + if (Enable::MVTX) + { + ana->AddNode("MVTX"); + } + if (Enable::INTT) + { + ana->AddNode("INTT"); + } + if (Enable::TPC) + { + ana->AddNode("TPC"); + } + + if (Enable::BBC) + { + ana->AddNode("BBC"); + } + + if (Enable::CEMC) + { + ana->AddNode("CEMC"); + if (Enable::ABSORBER || Enable::CEMC_ABSORBER) + { + ana->AddNode("ABSORBER_CEMC"); + ana->AddNode("CEMC_ELECTRONICS"); + ana->AddNode("CEMC_SPT"); + } + } + + if (Enable::HCALIN) + { + ana->AddNode("HCALIN"); + if (Enable::ABSORBER || Enable::HCALIN_ABSORBER) + { + ana->AddNode("ABSORBER_HCALIN"); + } + } + + if (Enable::MAGNET) + { + if (Enable::ABSORBER || Enable::MAGNET_ABSORBER) + { + ana->AddNode("MAGNET"); + } + } + + if (Enable::HCALOUT) + { + ana->AddNode("HCALOUT"); + if (Enable::ABSORBER || Enable::HCALOUT_ABSORBER) + { + ana->AddNode("ABSORBER_HCALOUT"); + } + } + + if (Enable::EPD) + { + ana->AddNode("EPD"); + } + + if (Enable::BLACKHOLE) + { + ana->AddNode("BH_1"); + ana->AddNode("BH_FORWARD_PLUS"); + ana->AddNode("BH_FORWARD_NEG"); + } + } + + ana->set_tower_zero_sup(G4DSTREADER::tower_zero_supp); + if (Enable::CEMC_TOWER) + { + ana->AddTower("SIM_CEMC"); + ana->AddTower("RAW_CEMC"); + ana->AddTower("CALIB_CEMC"); + } + if (Enable::HCALIN_TOWER) + { + ana->AddTower("SIM_HCALIN"); + ana->AddTower("RAW_HCALIN"); + ana->AddTower("CALIB_HCALIN"); + } + if (Enable::HCALOUT_TOWER) + { + ana->AddTower("SIM_HCALOUT"); + ana->AddTower("RAW_HCALOUT"); + ana->AddTower("CALIB_HCALOUT"); + } + // Jets disabled for now + // if (do_jet_reco) + // { + // + // ana->AddJet("AntiKt06JetsInPerfect"); + // ana->AddJet("G4TowerJets_6"); + // } + // if (embed_input_file && do_jet_reco) + // { + // ana->AddJet("G4TowerJets_combined_6"); + // } + + Fun4AllServer *se = Fun4AllServer::instance(); + se->registerSubsystem(ana); +} +#endif diff --git a/common/G4_EPD.C b/common/G4_EPD.C new file mode 100644 index 000000000..52c6d7839 --- /dev/null +++ b/common/G4_EPD.C @@ -0,0 +1,40 @@ +#ifndef COMMON_G4EPD_C +#define COMMON_G4EPD_C + +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4epd.so) + +namespace Enable +{ + bool EPD = false; + bool EPD_SUPPORT = false; + bool EPD_OVERLAPCHECK = false; +} // namespace Enable + +void EPDInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 90.); + // using default z-position and add 10 cm for tile thickness + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -310.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 310.); +} + +void EPD(PHG4Reco* g4Reco) +{ + bool overlap_check = Enable::OVERLAPCHECK || Enable::EPD_OVERLAPCHECK; + + PHG4EPDSubsystem* epd = new PHG4EPDSubsystem("EPD"); + + epd->SuperDetector("EPD"); + epd->OverlapCheck(overlap_check); + epd->SetActive(); + + g4Reco->registerSubsystem(epd); +} + +#endif /* COMMON_G4EPD_C */ diff --git a/common/G4_Global.C b/common/G4_Global.C new file mode 100644 index 000000000..78940082a --- /dev/null +++ b/common/G4_Global.C @@ -0,0 +1,58 @@ +#ifndef MACRO_G4GLOBAL_C +#define MACRO_G4GLOBAL_C + +#include +#include + +#include + +R__LOAD_LIBRARY(libg4vertex.so) + +namespace Enable +{ + bool GLOBAL_RECO = false; + bool GLOBAL_FASTSIM = false; +} // namespace Enable + +namespace G4GLOBAL +{ + double x_smearing = 0.01; // 100 um + double y_smearing = 0.01; // 100 um + double z_smearing = 0.015; // 150um + double t_smearing = 0.002; // 20ps +} // namespace G4GLOBAL + +void GlobalInit() {} + +void Global_Reco() +{ + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + GlobalVertexReco* gblvertex = new GlobalVertexReco(); + se->registerSubsystem(gblvertex); + + return; +} + +void Global_FastSim() +{ + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + GlobalVertexFastSimReco* gblvertex = new GlobalVertexFastSimReco(); + gblvertex->set_x_smearing(G4GLOBAL::x_smearing); + gblvertex->set_y_smearing(G4GLOBAL::y_smearing); + gblvertex->set_z_smearing(G4GLOBAL::z_smearing); + gblvertex->set_t_smearing(G4GLOBAL::t_smearing); + se->registerSubsystem(gblvertex); + + return; +} +#endif diff --git a/common/G4_HIJetReco.C b/common/G4_HIJetReco.C new file mode 100644 index 000000000..a71d208cb --- /dev/null +++ b/common/G4_HIJetReco.C @@ -0,0 +1,137 @@ +#ifndef MACRO_G4HIJETRECO_C +#define MACRO_G4HIJETRECO_C + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libg4jets.so) +R__LOAD_LIBRARY(libjetbackground.so) + +namespace Enable +{ + bool HIJETS = false; + int HIJETS_VERBOSITY = 0; +} // namespace Enable + +namespace G4HIJETS +{ + bool do_flow = false; + bool do_CS = false; +} // namespace G4HIJETS + +void HIJetReco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HIJETS_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + JetReco *truthjetreco = new JetReco(); + TruthJetInput *tji = new TruthJetInput(Jet::PARTICLE); + tji->add_embedding_flag(0); // changes depending on signal vs. embedded + truthjetreco->add_input(tji); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Truth_r02"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_Truth_r03"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Truth_r04"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Truth_r05"); + truthjetreco->set_algo_node("ANTIKT"); + truthjetreco->set_input_node("TRUTH"); + truthjetreco->Verbosity(verbosity); + se->registerSubsystem(truthjetreco); + + RetowerCEMC *rcemc = new RetowerCEMC(); + rcemc->Verbosity(verbosity); + se->registerSubsystem(rcemc); + + JetReco *towerjetreco = new JetReco(); + towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWER_RETOWER)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWER)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWER)); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Tower_HIRecoSeedsRaw_r02"); + towerjetreco->set_algo_node("ANTIKT"); + towerjetreco->set_input_node("TOWER"); + towerjetreco->Verbosity(verbosity); + se->registerSubsystem(towerjetreco); + + DetermineTowerBackground *dtb = new DetermineTowerBackground(); + dtb->SetBackgroundOutputName("TowerBackground_Sub1"); + dtb->SetFlow(G4HIJETS::do_flow); + dtb->SetSeedType(0); + dtb->SetSeedJetD(3); + dtb->Verbosity(verbosity); + se->registerSubsystem(dtb); + + CopyAndSubtractJets *casj = new CopyAndSubtractJets(); + casj->SetFlowModulation(G4HIJETS::do_flow); + casj->Verbosity(verbosity); + se->registerSubsystem(casj); + + DetermineTowerBackground *dtb2 = new DetermineTowerBackground(); + dtb2->SetBackgroundOutputName("TowerBackground_Sub2"); + dtb2->SetFlow(G4HIJETS::do_flow); + dtb2->SetSeedType(1); + dtb2->SetSeedJetPt(7); + dtb2->Verbosity(verbosity); + se->registerSubsystem(dtb2); + + SubtractTowers *st = new SubtractTowers(); + st->SetFlowModulation(G4HIJETS::do_flow); + st->Verbosity(verbosity); + se->registerSubsystem(st); + + towerjetreco = new JetReco(); + towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWER_SUB1)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWER_SUB1)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWER_SUB1)); + towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.2, verbosity), "AntiKt_Tower_r02_Sub1"); + towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.3, verbosity), "AntiKt_Tower_r03_Sub1"); + towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.4, verbosity), "AntiKt_Tower_r04_Sub1"); + towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.5, verbosity), "AntiKt_Tower_r05_Sub1"); + towerjetreco->set_algo_node("ANTIKT"); + towerjetreco->set_input_node("TOWER"); + towerjetreco->Verbosity(verbosity); + se->registerSubsystem(towerjetreco); + + if (G4HIJETS::do_CS) + { + SubtractTowersCS *stCS = new SubtractTowersCS(); + stCS->SetFlowModulation(G4HIJETS::do_flow); + stCS->SetAlpha(1); + stCS->SetDeltaRmax(0.3); + stCS->Verbosity(verbosity); + se->registerSubsystem(stCS); + + JetReco *towerjetrecoCS = new JetReco(); + towerjetrecoCS->add_input(new TowerJetInput(Jet::CEMC_TOWER_SUB1CS)); + towerjetrecoCS->add_input(new TowerJetInput(Jet::HCALIN_TOWER_SUB1CS)); + towerjetrecoCS->add_input(new TowerJetInput(Jet::HCALOUT_TOWER_SUB1CS)); + // note that CS can use the regular FastJetAlgo without extra modifications for negative-E inputs + towerjetrecoCS->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2, verbosity), "AntiKt_Tower_r02_Sub1CS"); + towerjetrecoCS->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3, verbosity), "AntiKt_Tower_r03_Sub1CS"); + towerjetrecoCS->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4, verbosity), "AntiKt_Tower_r04_Sub1CS"); + towerjetrecoCS->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5, verbosity), "AntiKt_Tower_r05_Sub1CS"); + towerjetrecoCS->set_algo_node("ANTIKT"); + towerjetrecoCS->set_input_node("TOWER"); + towerjetrecoCS->Verbosity(verbosity); + se->registerSubsystem(towerjetrecoCS); + } + + return; +} +#endif diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C new file mode 100644 index 000000000..b0ad182da --- /dev/null +++ b/common/G4_HcalIn_ref.C @@ -0,0 +1,387 @@ +//Inner HCal reconstruction macro +#ifndef MACRO_G4HCALINREF_C +#define MACRO_G4HCALINREF_C + +#include +#include + +#include +#include + +#include + +#include +#include +#include + +#include + +#include + +#include +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4ihcal.so) +R__LOAD_LIBRARY(libqa_modules.so) + +void HCalInner_SupportRing(PHG4Reco *g4Reco); + +namespace Enable +{ + bool HCALIN = false; + bool HCALIN_ABSORBER = false; + bool HCALIN_OVERLAPCHECK = false; + bool HCALIN_CELL = false; + bool HCALIN_TOWER = false; + bool HCALIN_CLUSTER = false; + bool HCALIN_EVAL = false; + bool HCALIN_QA = false; + bool HCALIN_SUPPORT = false; + bool HCALIN_OLD = false; + int HCALIN_VERBOSITY = 0; +} // namespace Enable + +namespace G4HCALIN +{ + double support_ring_outer_radius = 178.0 - 0.001; + double support_ring_z_ring2 = (2150 + 2175) / 2. / 10.; + double dz = 25. / 10.; + double phistart = NAN; + double tower_emin = NAN; + int light_scint_model = -1; + int tower_energy_source = -1; + + //Inner HCal absorber material selector: + //false - old version, absorber material is SS310 + //true - default Choose if you want Aluminum + bool inner_hcal_material_Al = true; + + int inner_hcal_eic = 0; + + // Digitization (default photon digi): + RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kSimple_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 + + enum enu_HCalIn_clusterizer + { + kHCalInGraphClusterizer, + + kHCalInTemplateClusterizer + }; + + //! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky + enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInTemplateClusterizer; + //! graph clusterizer, RawClusterBuilderGraph + //enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInGraphClusterizer; +} // namespace G4HCALIN + +// Init is called by G4Setup.C +void HCalInnerInit(const int iflag = 0) +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4HCALIN::support_ring_outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4HCALIN::support_ring_z_ring2 + G4HCALIN::dz / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4HCALIN::support_ring_z_ring2 - G4HCALIN::dz / 2.); + if (iflag == 1) + { + G4HCALIN::inner_hcal_eic = 1; + } +} + +double HCalInner(PHG4Reco *g4Reco, + double radius, + const int crossings) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::HCALIN_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::HCALIN_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + + PHG4DetectorSubsystem *hcal; + // all sizes are in cm! + if (Enable::HCALIN_OLD) + { + hcal = new PHG4InnerHcalSubsystem("HCALIN"); + // these are the parameters you can change with their default settings + // hcal->set_string_param("material","SS310"); + if (G4HCALIN::inner_hcal_material_Al) + { + if (verbosity > 0) + { + cout << "HCalInner - construct inner HCal absorber with G4_Al" << endl; + } + hcal->set_string_param("material", "G4_Al"); + } + else + { + if (verbosity > 0) + { + cout << "HCalInner - construct inner HCal absorber with SS310" << endl; + } + hcal->set_string_param("material", "SS310"); + } + // hcal->set_double_param("inner_radius", 117.27); + //----------------------------------------- + // the light correction can be set in a single call + // hcal->set_double_param("light_balance_inner_corr", NAN); + // hcal->set_double_param("light_balance_inner_radius", NAN); + // hcal->set_double_param("light_balance_outer_corr", NAN); + // hcal->set_double_param("light_balance_outer_radius", NAN); + // hcal->SetLightCorrection(NAN,NAN,NAN,NAN); + //----------------------------------------- + // hcal->set_double_param("outer_radius", 134.42); + // hcal->set_double_param("place_x", 0.); + // hcal->set_double_param("place_y", 0.); + // hcal->set_double_param("place_z", 0.); + // hcal->set_double_param("rot_x", 0.); + // hcal->set_double_param("rot_y", 0.); + // hcal->set_double_param("rot_z", 0.); + // hcal->set_double_param("scinti_eta_coverage", 1.1); + // hcal->set_double_param("scinti_gap_neighbor", 0.1); + // hcal->set_double_param("scinti_inner_gap", 0.85); + // hcal->set_double_param("scinti_outer_gap", 1.22 * (5.0 / 4.0)); + // hcal->set_double_param("scinti_outer_radius", 133.3); + // hcal->set_double_param("scinti_tile_thickness", 0.7); + // hcal->set_double_param("size_z", 175.94 * 2); + // hcal->set_double_param("steplimits", NAN); + // hcal->set_double_param("tilt_angle", 36.15); + + // hcal->set_int_param("light_scint_model", 1); + // hcal->set_int_param("ncross", 0); + // hcal->set_int_param("n_towers", 64); + // hcal->set_int_param("n_scinti_plates_per_tower", 4); + // hcal->set_int_param("n_scinti_tiles", 12); + + // hcal->set_string_param("material", "SS310"); + } + else + { + hcal = new PHG4IHCalSubsystem("HCALIN"); + std::string hcaltiles = std::string(getenv("CALIBRATIONROOT")) + "/HcalGeo/InnerHCalAbsorberTiles_merged.gdml"; + hcal->set_string_param("GDMPath",hcaltiles); + } + if (G4HCALIN::light_scint_model >= 0) + { + hcal->set_int_param("light_scint_model", G4HCALIN::light_scint_model); + } + hcal->SetActive(); + hcal->SuperDetector("HCALIN"); + if (AbsorberActive) + { + hcal->SetAbsorberActive(); + } + hcal->OverlapCheck(OverlapCheck); + + g4Reco->registerSubsystem(hcal); + + radius = hcal->get_double_param("outer_radius"); + + HCalInner_SupportRing(g4Reco); + + radius += no_overlapp; + return radius; +} + +//! A rough version of the inner HCal support ring, from Richie's CAD drawing. - Jin +void HCalInner_SupportRing(PHG4Reco *g4Reco) +{ + bool AbsorberActive = Enable::SUPPORT || Enable::HCALIN_SUPPORT; + + const double z_ring1 = (2025 + 2050) / 2. / 10.; + const double innerradius_sphenix = 116.; + const double innerradius_ephenix_hadronside = 138.; + const double z_rings[] = + {-G4HCALIN::support_ring_z_ring2, -z_ring1, z_ring1, G4HCALIN::support_ring_z_ring2}; + + PHG4CylinderSubsystem *cyl; + + for (int i = 0; i < 4; i++) + { + double innerradius = innerradius_sphenix; + if (z_rings[i] > 0 && G4HCALIN::inner_hcal_eic == 1) + { + innerradius = innerradius_ephenix_hadronside; + } + cyl = new PHG4CylinderSubsystem("HCALIN_SPT_N1", i); + cyl->set_double_param("place_z", z_rings[i]); + cyl->SuperDetector("HCALIN_SPT"); + cyl->set_double_param("radius", innerradius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4HCALIN::dz); + cyl->set_string_param("material", "SS310"); + cyl->set_double_param("thickness", G4HCALIN::support_ring_outer_radius - innerradius); + if (AbsorberActive) + { + cyl->SetActive(); + } + g4Reco->registerSubsystem(cyl); + } + + return; +} + +void HCALInner_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALIN_CELLRECO"); + hc->Detector("HCALIN"); + hc->Verbosity(verbosity); + // check for energy conservation - needs modified "infinite" timing cuts + // 0-999999999 + // hc->checkenergy(); + // timing cuts with their default settings + // hc->set_double_param("tmin",0.); + // hc->set_double_param("tmax",60.0); + // or all at once: + // hc->set_timing_window(0.0,60.0); + // this sets all cells to a fixed energy for debugging + // hc->set_fixed_energy(1.); + se->registerSubsystem(hc); + + return; +} + +void HCALInner_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalInRawTowerBuilder"); + TowerBuilder->Detector("HCALIN"); + TowerBuilder->set_sim_tower_node_prefix("SIM"); + if (! isfinite(G4HCALIN::phistart)) + { + if (Enable::HCALIN_OLD) + { + G4HCALIN::phistart = 0.0328877688; // offet in phi (from zero) extracted from geantinos + } + else + { + G4HCALIN::phistart = 0.0295080867; // extracted from geantinos + } + } + TowerBuilder->set_double_param("phistart",G4HCALIN::phistart); + if (isfinite(G4HCALIN::tower_emin)) + { + TowerBuilder->set_double_param("emin",G4HCALIN::tower_emin); + } + if (G4HCALIN::tower_energy_source >= 0) + { + TowerBuilder->set_int_param("tower_energy_source",G4HCALIN::tower_energy_source); + } + // this sets specific decalibration factors + // for a given cell + // TowerBuilder->set_cell_decal_factor(1,10,0.1); + // for a whole tower + // TowerBuilder->set_tower_decal_factor(0,10,0.2); + TowerBuilder->Verbosity(verbosity); + se->registerSubsystem(TowerBuilder); + + // From 2016 Test beam sim + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HcalInRawTowerDigitizer"); + TowerDigitizer->Detector("HCALIN"); + // TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); + TowerDigitizer->set_digi_algorithm(G4HCALIN::TowerDigi); + TowerDigitizer->set_pedstal_central_ADC(0); + TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update + TowerDigitizer->set_photonelec_ADC(32. / 5.); + TowerDigitizer->set_photonelec_yield_visible_GeV(32. / 5 / (0.4e-3)); + TowerDigitizer->set_zero_suppression_ADC(-0); // no-zero suppression + TowerDigitizer->Verbosity(verbosity); + se->registerSubsystem(TowerDigitizer); + + //Default sampling fraction for SS310 + double visible_sample_fraction_HCALIN = 0.0631283; //, /gpfs/mnt/gpfs04/sphenix/user/jinhuang/prod_analysis/hadron_shower_res_nightly/./G4Hits_sPHENIX_pi-_eta0_16GeV-0000.root_qa.rootQA_Draw_HCALIN_G4Hit.pdf + + if (G4HCALIN::inner_hcal_material_Al) visible_sample_fraction_HCALIN = 0.162166; //for "G4_Al", Abhisek Sen + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HcalInRawTowerCalibration"); + TowerCalibration->Detector("HCALIN"); + // TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); + // TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + if (G4HCALIN::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + // 0.176 extracted from electron sims (edep(scintillator)/edep(total)) + TowerCalibration->set_calib_const_GeV_ADC(1. / 0.176); + } + else + { + TowerCalibration->set_calib_const_GeV_ADC(0.4e-3 / visible_sample_fraction_HCALIN); + } + TowerCalibration->set_pedstal_ADC(0); + TowerCalibration->Verbosity(verbosity); + se->registerSubsystem(TowerCalibration); + + return; +} + +void HCALInner_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4HCALIN::HCalIn_clusterizer == G4HCALIN::kHCalInTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); + ClusterBuilder->Detector("HCALIN"); + ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else if (G4HCALIN::HCalIn_clusterizer == G4HCALIN::kHCalInGraphClusterizer) + { + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("HcalInRawClusterBuilderGraph"); + ClusterBuilder->Detector("HCALIN"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "HCalIn_Clusters - unknown clusterizer setting!" << endl; + exit(1); + } + return; +} + +void HCALInner_Eval(const std::string &outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("HCALINEVALUATOR", "HCALIN", outputfile); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + +void HCALInner_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::HCALIN_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + QAG4SimulationCalorimeter *qa = new QAG4SimulationCalorimeter("HCALIN"); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + return; +} + +#endif diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C new file mode 100644 index 000000000..7049f39dc --- /dev/null +++ b/common/G4_HcalOut_ref.C @@ -0,0 +1,316 @@ +#ifndef MACRO_G4HCALOUTREF_C +#define MACRO_G4HCALOUTREF_C + +#include +#include + +#include +#include + +#include + +#include +#include + +#include + +#include + +#include +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4ohcal.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool HCALOUT = false; + bool HCALOUT_ABSORBER = false; + bool HCALOUT_OVERLAPCHECK = false; + bool HCALOUT_CELL = false; + bool HCALOUT_TOWER = false; + bool HCALOUT_CLUSTER = false; + bool HCALOUT_EVAL = false; + bool HCALOUT_QA = false; + bool HCALOUT_OLD = false; + int HCALOUT_VERBOSITY = 0; +} // namespace Enable + +namespace G4HCALOUT +{ + double outer_radius = 264.71; + double size_z = 304.91 * 2; + double phistart = NAN; + double tower_emin = NAN; + int light_scint_model = -1; + int tower_energy_source = -1; + + // Digitization (default photon digi): + RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kSimple_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 + + enum enu_HCalOut_clusterizer + { + kHCalOutGraphClusterizer, + kHCalOutTemplateClusterizer + }; + + //! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky + enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutTemplateClusterizer; + //! graph clusterizer, RawClusterBuilderGraph + //enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutGraphClusterizer; +} // namespace G4HCALOUT + +// Init is called by G4Setup.C +void HCalOuterInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4HCALOUT::outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4HCALOUT::size_z / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4HCALOUT::size_z / 2.); +} + +double HCalOuter(PHG4Reco *g4Reco, + double radius, + const int crossings) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::HCALOUT_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::HCALOUT_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + PHG4DetectorSubsystem *hcal; + if (Enable::HCALOUT_OLD) + { + hcal = new PHG4OuterHcalSubsystem("HCALOUT"); + // hcal->set_double_param("inner_radius", 183.3); + //----------------------------------------- + // the light correction can be set in a single call + // hcal->set_double_param("light_balance_inner_corr", NAN); + // hcal->set_double_param("light_balance_inner_radius", NAN); + // hcal->set_double_param("light_balance_outer_corr", NAN); + // hcal->set_double_param("light_balance_outer_radius", NAN); + // hcal->set_double_param("magnet_cutout_radius", 195.31); + // hcal->set_double_param("magnet_cutout_scinti_radius", 195.96); + // hcal->SetLightCorrection(NAN,NAN,NAN,NAN); + //----------------------------------------- + // hcal->set_double_param("outer_radius", G4HCALOUT::outer_radius); + // hcal->set_double_param("place_x", 0.); + // hcal->set_double_param("place_y", 0.); + // hcal->set_double_param("place_z", 0.); + // hcal->set_double_param("rot_x", 0.); + // hcal->set_double_param("rot_y", 0.); + // hcal->set_double_param("rot_z", 0.); + // hcal->set_double_param("scinti_eta_coverage", 1.1); + // hcal->set_double_param("scinti_gap", 0.85); + // hcal->set_double_param("scinti_gap_neighbor", 0.1); + // hcal->set_double_param("scinti_inner_radius",183.89); + // hcal->set_double_param("scinti_outer_radius",263.27); + // hcal->set_double_param("scinti_tile_thickness", 0.7); + // hcal->set_double_param("size_z", G4HCALOUT::size_z); + // hcal->set_double_param("steplimits", NAN); + // hcal->set_double_param("tilt_angle", -11.23); + + // hcal->set_int_param("light_scint_model", 1); + // hcal->set_int_param("magnet_cutout_first_scinti", 8); + // hcal->set_int_param("ncross", 0); + // hcal->set_int_param("n_towers", 64); + // hcal->set_int_param("n_scinti_plates_per_tower", 5); + // hcal->set_int_param("n_scinti_tiles", 12); + + // hcal->set_string_param("material", "Steel_1006"); + } + else + { + hcal = new PHG4OHCalSubsystem("HCALOUT"); +std::string hcaltiles = std::string(getenv("CALIBRATIONROOT")) + "/HcalGeo/OuterHCalAbsorberTiles_merged.gdml"; + hcal->set_string_param("GDMPath",hcaltiles); + } + + if (G4HCALOUT::light_scint_model >= 0) + { + hcal->set_int_param("light_scint_model", G4HCALOUT::light_scint_model); + } + hcal->SetActive(); + hcal->SuperDetector("HCALOUT"); + if (AbsorberActive) + { + hcal->SetAbsorberActive(); + } + hcal->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(hcal); + + radius = hcal->get_double_param("outer_radius"); + + radius += no_overlapp; + + return radius; +} + +void HCALOuter_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALOUT_CELLRECO"); + hc->Detector("HCALOUT"); + hc->Verbosity(verbosity); + // check for energy conservation - needs modified "infinite" timing cuts + // 0-999999999 + // hc->checkenergy(); + // timing cuts with their default settings + // hc->set_double_param("tmin",0.); + // hc->set_double_param("tmax",60.0); + // or all at once: + // hc->set_timing_window(0.0,60.0); + // this sets all cells to a fixed energy for debugging + // hc->set_fixed_energy(1.); + se->registerSubsystem(hc); + + return; +} + +void HCALOuter_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalOutRawTowerBuilder"); + TowerBuilder->Detector("HCALOUT"); + TowerBuilder->set_sim_tower_node_prefix("SIM"); + if (! isfinite(G4HCALOUT::phistart)) + { + if (Enable::HCALOUT_OLD) + { + G4HCALOUT::phistart = 0.026598397; // offet in phi (from zero) extracted from geantinos + } + else + { + G4HCALOUT::phistart = -0.024960211; // offet in phi (from zero) extracted from geantinos + } + } + TowerBuilder->set_double_param("phistart",G4HCALOUT::phistart); + if (isfinite(G4HCALOUT::tower_emin)) + { + TowerBuilder->set_double_param("emin",G4HCALOUT::tower_emin); + } + if (G4HCALOUT::tower_energy_source >= 0) + { + TowerBuilder->set_int_param("tower_energy_source",G4HCALOUT::tower_energy_source); + } + // this sets specific decalibration factors + // for a given cell + // TowerBuilder->set_cell_decal_factor(1,10,0.1); + // for a whole tower + // TowerBuilder->set_tower_decal_factor(0,10,0.2); + // TowerBuilder->set_cell_decal_factor(1,10,0.1); + // TowerBuilder->set_tower_decal_factor(0,10,0.2); + TowerBuilder->Verbosity(verbosity); + se->registerSubsystem(TowerBuilder); + + // From 2016 Test beam sim + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HcalOutRawTowerDigitizer"); + TowerDigitizer->Detector("HCALOUT"); + // TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); + TowerDigitizer->set_digi_algorithm(G4HCALOUT::TowerDigi); + TowerDigitizer->set_pedstal_central_ADC(0); + TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update + TowerDigitizer->set_photonelec_ADC(16. / 5.); + TowerDigitizer->set_photonelec_yield_visible_GeV(16. / 5 / (0.2e-3)); + TowerDigitizer->set_zero_suppression_ADC(-0); // no-zero suppression + TowerDigitizer->Verbosity(verbosity); + se->registerSubsystem(TowerDigitizer); + + const double visible_sample_fraction_HCALOUT = 3.38021e-02; // /gpfs/mnt/gpfs04/sphenix/user/jinhuang/prod_analysis/hadron_shower_res_nightly/./G4Hits_sPHENIX_pi-_eta0_16GeV.root_qa.rootQA_Draw_HCALOUT_G4Hit.pdf + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HcalOutRawTowerCalibration"); + TowerCalibration->Detector("HCALOUT"); + // TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); + // TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + if (G4HCALOUT::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + // 0.033 extracted from electron sims (edep(scintillator)/edep(total)) + TowerCalibration->set_calib_const_GeV_ADC(1. / 0.033); + } + else + { + TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / visible_sample_fraction_HCALOUT); + } + TowerCalibration->set_pedstal_ADC(0); + TowerCalibration->Verbosity(verbosity); + se->registerSubsystem(TowerCalibration); + + return; +} + +void HCALOuter_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4HCALOUT::HCalOut_clusterizer == G4HCALOUT::kHCalOutTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalOutRawClusterBuilderTemplate"); + ClusterBuilder->Detector("HCALOUT"); + ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else if (G4HCALOUT::HCalOut_clusterizer == G4HCALOUT::kHCalOutGraphClusterizer) + { + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("HcalOutRawClusterBuilderGraph"); + ClusterBuilder->Detector("HCALOUT"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "HCALOuter_Clusters - unknown clusterizer setting!" << endl; + exit(1); + } + + return; +} + +void HCALOuter_Eval(const std::string &outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("HCALOUTEVALUATOR", "HCALOUT", outputfile); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + +void HCALOuter_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + QAG4SimulationCalorimeter *qa = new QAG4SimulationCalorimeter("HCALOUT"); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + return; +} + +#endif diff --git a/common/G4_Input.C b/common/G4_Input.C new file mode 100644 index 000000000..56ef4f2bd --- /dev/null +++ b/common/G4_Input.C @@ -0,0 +1,615 @@ +#ifndef MACRO_G4INPUT_C +#define MACRO_G4INPUT_C + +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4testbench.so) +R__LOAD_LIBRARY(libPHPythia6.so) +R__LOAD_LIBRARY(libPHPythia8.so) +R__LOAD_LIBRARY(libPHSartre.so) +R__LOAD_LIBRARY(libFermimotionAfterburner.so) + +namespace Input +{ + // Real Event generators + bool PYTHIA6 = false; + int PYTHIA6_EmbedId = 0; + + bool PYTHIA8 = false; + int PYTHIA8_EmbedId = 0; + + bool SARTRE = false; + int SARTRE_EmbedId = 0; + + // Single/multiple particle generators + bool DZERO = false; + int DZERO_NUMBER = 1; + int DZERO_VERBOSITY = 0; + std::set DZERO_EmbedIds; + + bool GUN = false; + int GUN_NUMBER = 1; + int GUN_VERBOSITY = 0; + std::set GUN_EmbedIds; + + bool IONGUN = false; + int IONGUN_NUMBER = 1; + int IONGUN_VERBOSITY = 0; + std::set IONGUN_EmbedIds; + + bool PGEN = false; + int PGEN_NUMBER = 1; + int PGEN_VERBOSITY = 0; + std::set PGEN_EmbedIds; + + bool SIMPLE = false; + int SIMPLE_NUMBER = 1; + int SIMPLE_VERBOSITY = 0; + + int UPSILON_NUMBER = 1; + int UPSILON_VERBOSITY = 0; + // other UPSILON settings which are also used elsewhere are in GlobalVariables.C + + double PILEUPRATE = 0.; + bool READHITS = false; + int VERBOSITY = 0; + int EmbedId = 1; + + //! apply sPHENIX nominal beam parameter with 2mrad crossing as defined in sPH-TRG-2020-001 + //! \param[in] HepMCGen any HepMC generator, e.g. Fun4AllHepMCInputManager, Fun4AllHepMCPileupInputManager, PHPythia8, PHPythia6, PHSartre, ReadEICFiles + void ApplysPHENIXBeamParameter(PHHepMCGenHelper *HepMCGen) + { + if (HepMCGen == nullptr) + { + std::cout << "ApplysPHENIXBeamParameter(): Fatal Error - null input pointer HepMCGen" << std::endl; + exit(1); + } + HepMCGen->set_beam_direction_theta_phi(1e-3, 0, M_PI - 1e-3, 0); //2mrad x-ing of sPHENIX per sPH-TRG-2020-001 + + HepMCGen->set_vertex_distribution_width( + 100e-4, // approximation from past RICH data + 100e-4, // approximation from past RICH data + 7, // sPH-TRG-2020-001. Fig 3.2 + 20 / 29.9792); // 20cm collision length / speed of light in cm/ns + HepMCGen->set_vertex_distribution_function( + PHHepMCGenHelper::Gaus, + PHHepMCGenHelper::Gaus, + PHHepMCGenHelper::Gaus, + PHHepMCGenHelper::Gaus); + } + + //! apply EIC beam parameter to any HepMC generator following EIC CDR, + //! including in-time collision's space time shift, beam crossing angle and angular divergence + //! \param[in] HepMCGen any HepMC generator, e.g. Fun4AllHepMCInputManager, Fun4AllHepMCPileupInputManager, PHPythia8, PHPythia6, PHSartre, ReadEICFiles + void ApplyEICBeamParameter(PHHepMCGenHelper *HepMCGen) + { + if (HepMCGen == nullptr) + { + std::cout << "ApplyEICBeamParameter(): Fatal Error - null input pointer HepMCGen" << std::endl; + exit(1); + } + + //25mrad x-ing as in EIC CDR + const double EIC_hadron_crossing_angle = 25e-3; + + HepMCGen->set_beam_direction_theta_phi( + EIC_hadron_crossing_angle, // beamA_theta + 0, // beamA_phi + M_PI, // beamB_theta + 0 // beamB_phi + ); + HepMCGen->set_beam_angular_divergence_hv( + 119e-6, 119e-6, // proton beam divergence horizontal & vertical, as in EIC CDR Table 1.1 + 211e-6, 152e-6 // electron beam divergence horizontal & vertical, as in EIC CDR Table 1.1 + ); + + // angular kick within a bunch as result of crab cavity + // using an naive assumption of transfer matrix from the cavity to IP, + // which is NOT yet validated with accelerator optics simulations! + const double z_hadron_cavity = 52e2; // CDR Fig 3.3 + const double z_e_cavity = 38e2; // CDR Fig 3.2 + HepMCGen->set_beam_angular_z_coefficient_hv( + -EIC_hadron_crossing_angle / 2. / z_hadron_cavity, 0, + -EIC_hadron_crossing_angle / 2. / z_e_cavity, 0); + + // calculate beam sigma width at IP as in EIC CDR table 1.1 + const double sigma_p_h = sqrt(80 * 11.3e-7); + const double sigma_p_v = sqrt(7.2 * 1.0e-7); + const double sigma_p_l = 6; + const double sigma_e_h = sqrt(45 * 20.0e-7); + const double sigma_e_v = sqrt(5.6 * 1.3e-7); + const double sigma_e_l = 2; + + // combine two beam gives the collision sigma in z + const double collision_sigma_z = sqrt(sigma_p_l * sigma_p_l + sigma_e_l * sigma_e_l) / 2; + const double collision_sigma_t = collision_sigma_z / 29.9792; // speed of light in cm/ns + + HepMCGen->set_vertex_distribution_width( + sigma_p_h * sigma_e_h / sqrt(sigma_p_h * sigma_p_h + sigma_e_h * sigma_e_h), //x + sigma_p_v * sigma_e_v / sqrt(sigma_p_v * sigma_p_v + sigma_e_v * sigma_e_v), //y + collision_sigma_z, //z + collision_sigma_t); //t + HepMCGen->set_vertex_distribution_function( + PHHepMCGenHelper::Gaus, //x + PHHepMCGenHelper::Gaus, //y + PHHepMCGenHelper::Gaus, //z + PHHepMCGenHelper::Gaus); //t + } +} // namespace Input + +namespace INPUTHEPMC +{ + string filename; + string listfile; + bool FLOW = false; + int FLOW_VERBOSITY = 0; + bool FERMIMOTION = false; + +} // namespace INPUTHEPMC + +namespace INPUTREADEIC +{ + string filename; +} // namespace INPUTREADEIC + +namespace INPUTREADHITS +{ + map filename; + map listfile; +} // namespace INPUTREADHITS + +namespace INPUTEMBED +{ + map filename; + map listfile; + bool REPEAT = true; +} // namespace INPUTEMBED + +namespace PYTHIA6 +{ + string config_file = string(getenv("CALIBRATIONROOT")) + "/Generators/phpythia6.cfg"; +} + +namespace PYTHIA8 +{ + string config_file = string(getenv("CALIBRATIONROOT")) + "/Generators/phpythia8.cfg"; +} + +namespace SARTRE +{ + string config_file = string(getenv("CALIBRATIONROOT")) + "/Generators/sartre.cfg"; +} + +namespace PILEUP +{ + string pileupfile = "/sphenix/sim/sim01/sphnxpro/MDC1/sHijing_HepMC/data/sHijing_0_20fm-0000000001-00000.dat"; + double TpcDriftVelocity = G4TPC::tpc_drift_velocity_sim; +} // namespace PILEUP + +// collection of pointers to particle generators we can grab in the Fun4All macro +namespace INPUTGENERATOR +{ + std::vector IonGun; + std::vector ParticleGenerator; + std::vector DZeroMesonGenerator; + std::vector VectorMesonGenerator; + std::vector SimpleEventGenerator; + std::vector Gun; + PHPythia6 *Pythia6 = nullptr; + PHPythia8 *Pythia8 = nullptr; + PHSartre *Sartre = nullptr; + PHSartreParticleTrigger *SartreTrigger = nullptr; + ReadEICFiles *EICFileReader = nullptr; +} // namespace INPUTGENERATOR + +namespace INPUTMANAGER +{ + Fun4AllHepMCInputManager *HepMCInputManager = nullptr; + Fun4AllHepMCPileupInputManager *HepMCPileupInputManager = nullptr; +} // namespace INPUTMANAGER + +void InputInit() +{ + // for pileup sims embed id is 1, to distinguish particles + // which will be embedded (when Input::EMBED = true) into pileup sims + // we need to start at embedid = 2 + if (Input::EMBED) + { + Input::EmbedId = 2; + } + // first consistency checks - not all input generators play nice + // with each other + if (Input::READHITS && Input::EMBED) + { + cout << "Reading Hits and Embedding into background at the same time is not supported" << endl; + gSystem->Exit(1); + } + if (Input::READHITS && (Input::PYTHIA6 || Input::PYTHIA8 || Input::SARTRE || Input::SIMPLE || Input::GUN || Input::UPSILON || Input::HEPMC)) + { + cout << "Reading Hits and running G4 simultanously is not supported" << endl; + gSystem->Exit(1); + } + if (Input::PYTHIA6 && Input::PYTHIA8) + { + cout << "Pythia6 and Pythia8 cannot be run together - might be possible but needs R&D" << endl; + gSystem->Exit(1); + } + + if (INPUTHEPMC::FLOW && Input::PILEUPRATE > 0) + { + cout << "Flow Afterburner and Pileup cannot be run simultanously" << endl; + gSystem->Exit(1); + } + // done with consistency checks, create generators in no specific order + + Fun4AllServer *se = Fun4AllServer::instance(); + if (Input::PYTHIA6) + { + INPUTGENERATOR::Pythia6 = new PHPythia6(); + INPUTGENERATOR::Pythia6->set_config_file(PYTHIA6::config_file); + + INPUTGENERATOR::Pythia6->set_embedding_id(Input::EmbedId); + Input::PYTHIA6_EmbedId = Input::EmbedId; + Input::EmbedId++; + } + if (Input::PYTHIA8) + { + INPUTGENERATOR::Pythia8 = new PHPythia8(); + // see coresoftware/generators/PHPythia8 for example config + INPUTGENERATOR::Pythia8->set_config_file(PYTHIA8::config_file); + + INPUTGENERATOR::Pythia8->set_embedding_id(Input::EmbedId); + Input::PYTHIA8_EmbedId = Input::EmbedId; + Input::EmbedId++; + } + if (Input::SARTRE) + { + gSystem->Load("libPHSartre.so"); + INPUTGENERATOR::Sartre = new PHSartre(); + INPUTGENERATOR::Sartre->set_config_file(SARTRE::config_file); + // particle trigger to enhance forward J/Psi -> ee + INPUTGENERATOR::SartreTrigger = new PHSartreParticleTrigger("MySartreTrigger"); + INPUTGENERATOR::SartreTrigger->AddParticles(-11); + //INPUTGENERATOR::SartreTrigger->SetEtaHighLow(4.0,1.4); + INPUTGENERATOR::SartreTrigger->SetEtaHighLow(1.0, -1.1); // central arm + INPUTGENERATOR::SartreTrigger->PrintConfig(); + + INPUTGENERATOR::Sartre->set_embedding_id(Input::EmbedId); + Input::SARTRE_EmbedId = Input::EmbedId; + Input::EmbedId++; + } + // single particle generators + if (Input::DZERO) + { + for (int i = 0; i < Input::DZERO_NUMBER; ++i) + { + std::string name = "DZERO_" + std::to_string(i); + PHG4ParticleGeneratorD0 *dzero = new PHG4ParticleGeneratorD0(name); + dzero->Embed(Input::EmbedId); + Input::DZERO_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + INPUTGENERATOR::DZeroMesonGenerator.push_back(dzero); + } + } + if (Input::GUN) + { + for (int i = 0; i < Input::GUN_NUMBER; ++i) + { + std::string name = "GUN_" + std::to_string(i); + PHG4ParticleGun *gun = new PHG4ParticleGun(name); + gun->Embed(Input::EmbedId); + Input::GUN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + INPUTGENERATOR::Gun.push_back(gun); + } + } + if (Input::IONGUN) + { + for (int i = 0; i < Input::IONGUN_NUMBER; ++i) + { + std::string name = "IONGUN_" + std::to_string(i); + PHG4IonGun *iongun = new PHG4IonGun(name); + iongun->Embed(Input::EmbedId); + Input::IONGUN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + INPUTGENERATOR::IonGun.push_back(iongun); + } + } + if (Input::PGEN) + { + for (int i = 0; i < Input::PGEN_NUMBER; ++i) + { + std::string name = "PGEN_" + std::to_string(i); + PHG4ParticleGenerator *pgen = new PHG4ParticleGenerator(name); + pgen->Embed(Input::EmbedId); + Input::PGEN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + INPUTGENERATOR::ParticleGenerator.push_back(pgen); + } + } + if (Input::SIMPLE) + { + for (int i = 0; i < Input::SIMPLE_NUMBER; ++i) + { + std::string name = "EVTGENERATOR_" + std::to_string(i); + PHG4SimpleEventGenerator *simple = new PHG4SimpleEventGenerator(name); + simple->Embed(Input::EmbedId); + Input::PGEN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + INPUTGENERATOR::SimpleEventGenerator.push_back(simple); + } + } + if (Input::UPSILON) + { + for (int i = 0; i < Input::UPSILON_NUMBER; ++i) + { + std::string name = "UPSILON_" + std::to_string(i); + PHG4ParticleGeneratorVectorMeson *upsilon = new PHG4ParticleGeneratorVectorMeson(name); + upsilon->Embed(Input::EmbedId); + Input::UPSILON_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + INPUTGENERATOR::VectorMesonGenerator.push_back(upsilon); + } + } + + // input managers for which we might need to set options + if (Input::HEPMC) + { + INPUTMANAGER::HepMCInputManager = new Fun4AllHepMCInputManager("HEPMCin"); + } + if (Input::PILEUPRATE > 0) + { + INPUTMANAGER::HepMCPileupInputManager = new Fun4AllHepMCPileupInputManager("HepMCPileupInput"); + } +} + +void InputRegister() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + if (Input::PYTHIA6) + { + se->registerSubsystem(INPUTGENERATOR::Pythia6); + } + if (Input::PYTHIA8) + { + se->registerSubsystem(INPUTGENERATOR::Pythia8); + } + if (Input::SARTRE) + { + INPUTGENERATOR::Sartre->register_trigger((PHSartreGenTrigger *) INPUTGENERATOR::SartreTrigger); + se->registerSubsystem(INPUTGENERATOR::Sartre); + } + if (Input::DZERO) + { + int verbosity = max(Input::DZERO_VERBOSITY, Input::VERBOSITY); + for (size_t icnt = 0; icnt < INPUTGENERATOR::DZeroMesonGenerator.size(); ++icnt) + { + INPUTGENERATOR::DZeroMesonGenerator[icnt]->Verbosity(verbosity); + se->registerSubsystem(INPUTGENERATOR::DZeroMesonGenerator[icnt]); + } + } + if (Input::GUN) + { + int verbosity = max(Input::GUN_VERBOSITY, Input::VERBOSITY); + for (size_t icnt = 0; icnt < INPUTGENERATOR::Gun.size(); ++icnt) + { + INPUTGENERATOR::Gun[icnt]->Verbosity(verbosity); + se->registerSubsystem(INPUTGENERATOR::Gun[icnt]); + } + } + if (Input::IONGUN) + { + int verbosity = max(Input::IONGUN_VERBOSITY, Input::VERBOSITY); + for (size_t icnt = 0; icnt < INPUTGENERATOR::IonGun.size(); ++icnt) + { + INPUTGENERATOR::IonGun[icnt]->Verbosity(verbosity); + se->registerSubsystem(INPUTGENERATOR::IonGun[icnt]); + } + } + if (Input::PGEN) + { + int verbosity = max(Input::PGEN_VERBOSITY, Input::VERBOSITY); + for (size_t icnt = 0; icnt < INPUTGENERATOR::ParticleGenerator.size(); ++icnt) + { + INPUTGENERATOR::ParticleGenerator[icnt]->Verbosity(verbosity); + se->registerSubsystem(INPUTGENERATOR::ParticleGenerator[icnt]); + } + } + if (Input::SIMPLE) + { + int verbosity = max(Input::SIMPLE_VERBOSITY, Input::VERBOSITY); + for (size_t icnt = 0; icnt < INPUTGENERATOR::SimpleEventGenerator.size(); ++icnt) + { + INPUTGENERATOR::SimpleEventGenerator[icnt]->Verbosity(verbosity); + se->registerSubsystem(INPUTGENERATOR::SimpleEventGenerator[icnt]); + } + } + if (Input::UPSILON) + { + for (size_t icnt = 0; icnt < INPUTGENERATOR::VectorMesonGenerator.size(); ++icnt) + { + int verbosity = max(Input::UPSILON_VERBOSITY, Input::VERBOSITY); + if (Input::HEPMC || Input::SIMPLE) + { + INPUTGENERATOR::VectorMesonGenerator[icnt]->set_reuse_existing_vertex(true); + } + INPUTGENERATOR::VectorMesonGenerator[icnt]->Verbosity(verbosity); + se->registerSubsystem(INPUTGENERATOR::VectorMesonGenerator[icnt]); + } + } + if (Input::READEIC) + { + INPUTGENERATOR::EICFileReader = new ReadEICFiles(); + INPUTGENERATOR::EICFileReader->OpenInputFile(INPUTREADEIC::filename); + INPUTGENERATOR::EICFileReader->Verbosity(Input::VERBOSITY); + se->registerSubsystem(INPUTGENERATOR::EICFileReader); + } + // here are the various utility modules which read particles and + // put them onto the G4 particle stack + if (Input::HEPMC or Input::PYTHIA8 or Input::PYTHIA6 or Input::SARTRE or Input::READEIC) + { + if (Input::HEPMC) + { + // these need to be applied before the HepMCNodeReader since they + // work on the hepmc records + if (INPUTHEPMC::FLOW) + { + HepMCFlowAfterBurner *burn = new HepMCFlowAfterBurner(); + burn->Verbosity(INPUTHEPMC::FLOW_VERBOSITY); + se->registerSubsystem(burn); + } + if (INPUTHEPMC::FERMIMOTION) + { + FermimotionAfterburner *fermi = new FermimotionAfterburner(); + se->registerSubsystem(fermi); + } + } + // copy HepMC records into G4 + HepMCNodeReader *hr = new HepMCNodeReader(); + se->registerSubsystem(hr); + } +} + +void InputManagers() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + if (Input::EMBED) + { + gSystem->Load("libg4dst.so"); + if (!INPUTEMBED::filename.empty() && !INPUTEMBED::listfile.empty()) + { + cout << "only filenames or filelists are supported, not mixtures" << endl; + gSystem->Exit(1); + } + if (INPUTEMBED::filename.empty() && INPUTEMBED::listfile.empty()) + { + cout << "you need to give an input filenames or filelist" << endl; + gSystem->Exit(1); + } + for (auto iter = INPUTEMBED::filename.begin(); iter != INPUTEMBED::filename.end(); ++iter) + { + string mgrname = "DSTin" + to_string(iter->first); + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); + hitsin->fileopen(iter->second); + hitsin->Verbosity(Input::VERBOSITY); + if (INPUTEMBED::REPEAT) + { + hitsin->Repeat(); + } + se->registerInputManager(hitsin); + } + for (auto iter = INPUTEMBED::listfile.begin(); iter != INPUTEMBED::listfile.end(); ++iter) + { + string mgrname = "DSTin" + to_string(iter->first); + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); + hitsin->AddListFile(iter->second); + hitsin->Verbosity(Input::VERBOSITY); + if (INPUTEMBED::REPEAT) + { + hitsin->Repeat(); + } + se->registerInputManager(hitsin); + } + } + if (Input::HEPMC) + { + INPUTMANAGER::HepMCInputManager->Verbosity(Input::VERBOSITY); + se->registerInputManager(INPUTMANAGER::HepMCInputManager); + if (!INPUTHEPMC::filename.empty() && INPUTHEPMC::listfile.empty()) + { + INPUTMANAGER::HepMCInputManager->fileopen(INPUTHEPMC::filename); + } + else if (!INPUTHEPMC::listfile.empty()) + { + INPUTMANAGER::HepMCInputManager->AddListFile(INPUTHEPMC::listfile); + } + else + { + cout << "no filename INPUTHEPMC::filename or listfile INPUTHEPMC::listfile given" << endl; + gSystem->Exit(1); + } + } + else if (Input::READHITS) + { + gSystem->Load("libg4dst.so"); + if (!INPUTREADHITS::filename.empty() && !INPUTREADHITS::listfile.empty()) + { + cout << "only filenames or filelists are supported, not mixtures" << endl; + gSystem->Exit(1); + } + if (INPUTREADHITS::filename.empty() && INPUTREADHITS::listfile.empty()) + { + cout << "you need to give an input filenames or filelist" << endl; + gSystem->Exit(1); + } + for (auto iter = INPUTREADHITS::filename.begin(); iter != INPUTREADHITS::filename.end(); ++iter) + { + string mgrname = "DSTin" + to_string(iter->first); + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); + hitsin->fileopen(iter->second); + hitsin->Verbosity(Input::VERBOSITY); + se->registerInputManager(hitsin); + } + for (auto iter = INPUTREADHITS::listfile.begin(); iter != INPUTREADHITS::listfile.end(); ++iter) + { + string mgrname = "DSTin" + to_string(iter->first); + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); + hitsin->AddListFile(iter->second); + hitsin->Verbosity(Input::VERBOSITY); + se->registerInputManager(hitsin); + } + } + else + { + Fun4AllInputManager *in = new Fun4AllDummyInputManager("JADE"); + in->Verbosity(Input::VERBOSITY); + se->registerInputManager(in); + } + if (Input::PILEUPRATE > 0) + { + INPUTMANAGER::HepMCPileupInputManager->SignalInputManager(INPUTMANAGER::HepMCInputManager); + INPUTMANAGER::HepMCPileupInputManager->Verbosity(Input::VERBOSITY); + INPUTMANAGER::HepMCPileupInputManager->AddFile(PILEUP::pileupfile); + INPUTMANAGER::HepMCPileupInputManager->set_collision_rate(Input::PILEUPRATE); + double time_window = 105.5 / PILEUP::TpcDriftVelocity; + double extended_readout_time = 0.0; + if(TRACKING::pp_mode) extended_readout_time = TRACKING::pp_extended_readout_time; + INPUTMANAGER::HepMCPileupInputManager->set_time_window(-time_window, time_window + extended_readout_time); + cout << "Pileup window is from " << -time_window << " to " << time_window + extended_readout_time << endl; + se->registerInputManager(INPUTMANAGER::HepMCPileupInputManager); + } +} +#endif diff --git a/common/G4_Intt.C b/common/G4_Intt.C new file mode 100644 index 000000000..cda0028fe --- /dev/null +++ b/common/G4_Intt.C @@ -0,0 +1,254 @@ +#ifndef MACRO_G4INTT_C +#define MACRO_G4INTT_C + +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4intt.so) +R__LOAD_LIBRARY(libintt.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool INTT = false; + bool INTT_ABSORBER = false; + bool INTT_OVERLAPCHECK = false; + bool INTT_CELL = false; + bool INTT_CLUSTER = false; + bool INTT_QA = false; + bool INTT_SUPPORT = false; + int INTT_VERBOSITY = 0; +} // namespace Enable + +namespace G4INTT +{ + int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely + double intt_radius_max = 140.; // including stagger radius (mm) + int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI}; + int nladder[4] = {12, 12, 16, 16}; + double sensor_radius[4] = {7.188 - 36e-4, 7.732 - 36e-4, 9.680 - 36e-4, 10.262 - 36e-4}; + + double offsetphi[4] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder[3]}; + + enum enu_InttDeadMapType // Dead map options for INTT + { + kInttNoDeadMap = 0, // All channel in Intt is alive + kInttDeadMap = 1, // with dead channel + }; + //enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here + enu_InttDeadMapType InttDeadMapOption = kInttDeadMap; // Choose Intt deadmap here + +} // namespace G4INTT + +void InttInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 20.); // estimated from display, can be made smaller but good enough + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 410. / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -410. / 2.); + // the mvtx is not called if disabled but the default number of layers is set to 3, so we need to set it + // to zero + if (!Enable::MVTX) + { + G4MVTX::n_maps_layer = 0; + } +} + +double Intt(PHG4Reco* g4Reco, double radius, + const int absorberactive = 0) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); + bool intt_overlapcheck = Enable::OVERLAPCHECK || Enable::INTT_OVERLAPCHECK; + + // instantiate the INTT subsystem and register it + // We make one instance of PHG4INTTSubsystem for all four layers of tracker + // dimensions are in mm, angles are in radians + + // PHG4InttSubsystem creates the detetor layer using PHG4InttDetector + // and instantiates the appropriate PHG4SteppingAction + + // The length of vpair is used to determine the number of layers + std::vector> vpair; // (sphxlayer, inttlayer) + for (int i = 0; i < G4INTT::n_intt_layer; i++) + { + // We want the sPHENIX layer numbers for the Intt to be from n_maps_layer to n_maps_layer+n_intt_layer - 1 + vpair.push_back(std::make_pair(G4MVTX::n_maps_layer + i, i)); // sphxlayer=n_maps_layer+i corresponding to inttlayer=i + if (verbosity) cout << "Create strip tracker layer " << vpair[i].second << " as sphenix layer " << vpair[i].first << endl; + } + + PHG4InttSubsystem* sitrack = new PHG4InttSubsystem("INTT", vpair); + sitrack->Verbosity(verbosity); + sitrack->SetActive(1); + sitrack->OverlapCheck(intt_overlapcheck); + if (Enable::INTT_ABSORBER) + { + sitrack->SetAbsorberActive(); + } + if (Enable::INTT_SUPPORT) + { + sitrack->set_int_param(PHG4InttDefs::SUPPORTPARAMS, "supportactive", 1); + } + g4Reco->registerSubsystem(sitrack); + + // Set the laddertype and ladder spacing configuration + + cout << "Intt has " << G4INTT::n_intt_layer << " layers with layer setup:" << endl; + for (int i = 0; i < G4INTT::n_intt_layer; i++) + { + cout << " Intt layer " << i << " laddertype " << G4INTT::laddertype[i] << " nladders " << G4INTT::nladder[i] + << " sensor radius " << G4INTT::sensor_radius[i] << " offsetphi " << G4INTT::offsetphi[i] << endl; + sitrack->set_int_param(i, "laddertype", G4INTT::laddertype[i]); + sitrack->set_int_param(i, "nladder", G4INTT::nladder[i]); + sitrack->set_double_param(i, "sensor_radius", G4INTT::sensor_radius[i]); // expecting cm + sitrack->set_double_param(i, "offsetphi", G4INTT::offsetphi[i]); // expecting degrees + } + + // outer radius marker (translation back to cm) + radius = G4INTT::intt_radius_max * 0.1; + return radius; +} + +// Central detector cell reco is disabled as EIC setup use the fast tracking sim for now +void Intt_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + + if (G4INTT::InttDeadMapOption != G4INTT::kInttNoDeadMap) + { + // Load pre-defined deadmaps + PHG4InttDeadMapLoader* deadMapINTT = new PHG4InttDeadMapLoader("INTT"); + + for (int i = 0; i < G4INTT::n_intt_layer; i++) + { + string DeadMapConfigName = Form("intt_layer%d/", i); + + if (G4INTT::InttDeadMapOption == G4INTT::kInttDeadMap) + { + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap/"); + //string DeadMapPath = "/sphenix/u/wxie/sphnx_software/INTT" + string("/DeadMap/"); + + DeadMapPath += DeadMapConfigName; + + deadMapINTT->deadMapPath(G4MVTX::n_maps_layer + i, DeadMapPath); + } + else + { + cout << "G4_Intt.C - fatal error - invalid InttDeadMapOption = " << G4INTT::InttDeadMapOption << endl; + exit(1); + } + } + + deadMapINTT->Verbosity(verbosity); + //deadMapINTT -> Verbosity(1); + se->registerSubsystem(deadMapINTT); + } + // new storage containers + PHG4InttHitReco* reco = new PHG4InttHitReco(); + + // The timing window defaults are set in the INTT ladder model, they can be overridden here + double extended_readout_time = 0.0; + if(TRACKING::pp_mode) extended_readout_time = TRACKING::pp_extended_readout_time; + reco->set_double_param("tmax", 80.0 + extended_readout_time); + reco->set_double_param("tmin", -20.0); + std::cout << "INTT readout window is set to -20 to " << 80.0 + extended_readout_time << std::endl; + reco->Verbosity(verbosity); + se->registerSubsystem(reco); + + // Intt digitization + //=========== + // these should be used for the Intt + /* + How threshold are calculated based on default FPHX settings + Four part information goes to the threshold calculation: + 1. In 320 um thick silicon, the MIP e-h pair for a nominally indenting tracking is 3.87 MeV/cm * 320 um / 3.62 eV/e-h = 3.4e4 e-h pairs + 2. From DOI: 10.1016/j.nima.2014.04.017, FPHX integrator amplifier gain is 100mV / fC. That translate MIP voltage to 550 mV. + 3. From [FPHX Final Design Document](https://www.phenix.bnl.gov/WWW/fvtx/DetectorHardware/FPHX/FPHX2_June2009Revision.doc), the DAC0-7 setting for 8-ADC thresholds above the V_ref, as in Table 2 - Register Addresses and Defaults + 4, From [FPHX Final Design Document](https://www.phenix.bnl.gov/WWW/fvtx/DetectorHardware/FPHX/FPHX2_June2009Revision.doc) section Front-end Program Bits, the formula to translate DAC setting to comparitor voltages. + The result threshold table based on FPHX default value is as following + | FPHX Register Address | Name | Default value | Voltage - Vref (mV) | To electrons based on calibration | Electrons | Fraction to MIP | + |-----------------------|-----------------|---------------|---------------------|-----------------------------------|-----------|-----------------| + | 4 | Threshold DAC 0 | 8 | 32 | 2500 | 2000 | 5.85E-02 | + | 5 | Threshold DAC 1 | 16 | 64 | 5000 | 4000 | 1.17E-01 | + | 6 | Threshold DAC 2 | 32 | 128 | 10000 | 8000 | 2.34E-01 | + | 7 | Threshold DAC 3 | 48 | 192 | 15000 | 12000 | 3.51E-01 | + | 8 | Threshold DAC 4 | 80 | 320 | 25000 | 20000 | 5.85E-01 | + | 9 | Threshold DAC 5 | 112 | 448 | 35000 | 28000 | 8.18E-01 | + | 10 | Threshold DAC 6 | 144 | 576 | 45000 | 36000 | 1.05E+00 | + | 11 | Threshold DAC 7 | 176 | 704 | 55000 | 44000 | 1.29E+00 | + DAC0-7 threshold as fraction to MIP voltage are set to PHG4InttDigitizer::set_adc_scale as 3-bit ADC threshold as fractions to MIP energy deposition. + */ + std::vector userrange; // 3-bit ADC threshold relative to the mip_e at each layer. + userrange.push_back(0.0584625322997416); + userrange.push_back(0.116925064599483); + userrange.push_back(0.233850129198966); + userrange.push_back(0.35077519379845); + userrange.push_back(0.584625322997416); + userrange.push_back(0.818475452196383); + userrange.push_back(1.05232558139535); + userrange.push_back(1.28617571059432); + + // new containers + PHG4InttDigitizer* digiintt = new PHG4InttDigitizer(); + digiintt->Verbosity(verbosity); + //digiintt->Verbosity(3); + for (int i = 0; i < G4INTT::n_intt_layer; i++) + { + digiintt->set_adc_scale(G4MVTX::n_maps_layer + i, userrange); + } + se->registerSubsystem(digiintt); + + return; +} + +void Intt_Clustering() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + + InttClusterizer* inttclusterizer = new InttClusterizer("InttClusterizer", G4MVTX::n_maps_layer, G4MVTX::n_maps_layer + G4INTT::n_intt_layer - 1); + inttclusterizer->Verbosity(verbosity); + // no Z clustering for Intt type 1 layers (we DO want Z clustering for type 0 layers) + // turning off phi clustering for type 0 layers is not necessary, there is only one strip + // per sensor in phi + for (int i = G4MVTX::n_maps_layer; i < G4MVTX::n_maps_layer + G4INTT::n_intt_layer; i++) + { + if (G4INTT::laddertype[i - G4MVTX::n_maps_layer] == PHG4InttDefs::SEGMENTATION_PHI) + { + inttclusterizer->set_z_clustering(i, false); + } + } + se->registerSubsystem(inttclusterizer); +} + +void Intt_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::INTT_VERBOSITY); + + Fun4AllServer* se = Fun4AllServer::instance(); + QAG4SimulationIntt* qa = new QAG4SimulationIntt; + qa->Verbosity(verbosity); + se->registerSubsystem(qa); +} + +#endif diff --git a/common/G4_Jets.C b/common/G4_Jets.C new file mode 100644 index 000000000..f4640f615 --- /dev/null +++ b/common/G4_Jets.C @@ -0,0 +1,157 @@ +#ifndef MACRO_G4JETS_C +#define MACRO_G4JETS_C + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +R__LOAD_LIBRARY(libg4jets.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool JETS = false; + bool JETS_EVAL = false; + bool JETS_QA = false; + int JETS_VERBOSITY = 0; +} // namespace Enable + +void JetInit() {} + +void Jet_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::JETS_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + // truth particle level jets + JetReco *truthjetreco = new JetReco("TRUTHJETRECO"); + truthjetreco->add_input(new TruthJetInput(Jet::PARTICLE)); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Truth_r02"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_Truth_r03"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Truth_r04"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Truth_r05"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.6), "AntiKt_Truth_r06"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Truth_r07"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Truth_r08"); + truthjetreco->set_algo_node("ANTIKT"); + truthjetreco->set_input_node("TRUTH"); + truthjetreco->Verbosity(verbosity); + se->registerSubsystem(truthjetreco); + + // tower jets + JetReco *towerjetreco = new JetReco("TOWERJETRECO"); + towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWER)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWER)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWER)); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Tower_r02"); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_Tower_r03"); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Tower_r04"); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Tower_r05"); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.6), "AntiKt_Tower_r06"); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Tower_r07"); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Tower_r08"); + towerjetreco->set_algo_node("ANTIKT"); + towerjetreco->set_input_node("TOWER"); + towerjetreco->Verbosity(verbosity); + se->registerSubsystem(towerjetreco); + + // cluster jets + JetReco *clusterjetreco = new JetReco("CLUSTERJETRECO"); + clusterjetreco->add_input(new ClusterJetInput(Jet::CEMC_CLUSTER)); + clusterjetreco->add_input(new ClusterJetInput(Jet::HCALIN_CLUSTER)); + clusterjetreco->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Cluster_r02"); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_Cluster_r03"); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Cluster_r04"); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Cluster_r05"); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.6), "AntiKt_Cluster_r06"); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Cluster_r07"); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Cluster_r08"); + clusterjetreco->set_algo_node("ANTIKT"); + clusterjetreco->set_input_node("CLUSTER"); + clusterjetreco->Verbosity(verbosity); + se->registerSubsystem(clusterjetreco); + + // track jets + JetReco *trackjetreco = new JetReco("TRACKJETRECO"); + trackjetreco->add_input(new TrackJetInput(Jet::TRACK, TRACKING::TrackNodeName)); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Track_r02"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_Track_r03"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Track_r04"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Track_r05"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.6), "AntiKt_Track_r06"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Track_r07"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Track_r08"); + trackjetreco->set_algo_node("ANTIKT"); + trackjetreco->set_input_node("TRACK"); + trackjetreco->Verbosity(verbosity); + se->registerSubsystem(trackjetreco); + + return; +} + +void Jet_Eval(const std::string &outfilename = "g4jets_eval.root") +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::JETS_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + JetEvaluator *eval = new JetEvaluator("JETEVALUATOR", + "AntiKt_Tower_r03", + "AntiKt_Truth_r03", + outfilename); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + + +void Jet_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::JETS_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + QAG4SimulationJet *calo_jet7 = new QAG4SimulationJet( + "AntiKt_Truth_r07"); + calo_jet7->add_reco_jet("AntiKt_Tower_r07"); + calo_jet7->add_reco_jet("AntiKt_Cluster_r07"); + calo_jet7->add_reco_jet("AntiKt_Track_r07"); + calo_jet7->Verbosity(verbosity); + se->registerSubsystem(calo_jet7); + + QAG4SimulationJet *calo_jet4 = new QAG4SimulationJet( + "AntiKt_Truth_r04"); + calo_jet4->add_reco_jet("AntiKt_Tower_r04"); + calo_jet4->add_reco_jet("AntiKt_Cluster_r04"); + calo_jet4->add_reco_jet("AntiKt_Track_r04"); + calo_jet4->Verbosity(verbosity); + se->registerSubsystem(calo_jet4); + + QAG4SimulationJet *calo_jet2 = new QAG4SimulationJet( + "AntiKt_Truth_r02"); + calo_jet2->add_reco_jet("AntiKt_Tower_r02"); + calo_jet2->add_reco_jet("AntiKt_Cluster_r02"); + calo_jet2->add_reco_jet("AntiKt_Track_r02"); + calo_jet2->Verbosity(verbosity); + se->registerSubsystem(calo_jet2); + + return; +} + + +#endif diff --git a/common/G4_KFParticle.C b/common/G4_KFParticle.C new file mode 100644 index 000000000..8bfd8a49b --- /dev/null +++ b/common/G4_KFParticle.C @@ -0,0 +1,238 @@ +#ifndef MACRO_G4KFPARTICLE_C +#define MACRO_G4KFPARTICLE_C + +#include + +#define HomogeneousField +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libkfparticle_sphenix.so) +R__LOAD_LIBRARY(libqa_kfparticle.so) +R__LOAD_LIBRARY(libdecayfinder.so) + +namespace Enable +{ + bool KFPARTICLE = false; + bool KFPARTICLE_SAVE_NTUPLE = false; + bool KFPARTICLE_APPEND_TO_DST = true; + bool KFPARTICLE_TRUTH_MATCH = false; + bool KFPARTICLE_DETECTOR_INFO = false; + int KFPARTICLE_VERBOSITY = 0; + std::string KFPARTICLE_TRACKMAP = "SvtxTrackMap"; + std::string KFPARTICLE_VERTEXMAP = "SvtxVertexMap"; +} // namespace Enable + +namespace KFPARTICLE +{ + bool QA = false; + + bool runUpsilonReco = false; + std::string UpsilonName = "Upsilon"; + std::string UpsilonDecayDescriptor = UpsilonName + " -> e^+ e^-"; + std::pair UpsilonMassRange(8, 11); + bool UpsilonTrigger = false; + + bool runD0Reco = false; + std::string D0Name = "D0"; + std::string D0DecayDescriptor = "[" + D0Name + " -> K^- pi^+]cc"; + std::pair D0MassRange(1.75, 1.95); + bool D0Trigger = false; + + bool runLambdacReco = false; + std::string LambdacName = "Lambdac"; + std::string LambdacDecayDescriptor = "[" + LambdacName + " -> proton^+ K^- pi^+]cc"; + std::pair LambdacMassRange(2.15, 2.45); + bool LambdacTrigger = false; +} //namesppace KFPARTICLE + +namespace KFParticleBaseCut +{ + float minTrackPT = 0.5; // GeV + float maxTrackchi2nDoF = 2; + float minTrackIPchi2 = 15; // IP = DCA of track with vertex + float maxVertexchi2nDoF = 2; + float maxTrackTrackDCA = 0.05; // cm + float minMotherPT = 0; // GeV +} // namespace KFParticleBaseCut + +void KFParticle_Upsilon_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + KFPARTICLE::UpsilonName + "_Reco"); + kfparticle->Verbosity(verbosity); + kfparticle->setDecayDescriptor(KFPARTICLE::UpsilonDecayDescriptor); + + kfparticle->saveDST(Enable::KFPARTICLE_APPEND_TO_DST); + kfparticle->saveOutput(Enable::KFPARTICLE_SAVE_NTUPLE); + kfparticle->doTruthMatching(Enable::KFPARTICLE_TRUTH_MATCH); + kfparticle->getDetectorInfo(Enable::KFPARTICLE_DETECTOR_INFO); + + kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); + kfparticle->setMinimumTrackIPchi2(0); // Upsilon decays are prompt, tracks are more likely to point to vertex + kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); + + kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); + kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); + + kfparticle->setMinimumMass(KFPARTICLE::UpsilonMassRange.first); + kfparticle->setMaximumMass(KFPARTICLE::UpsilonMassRange.second); + kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); + kfparticle->constrainToPrimaryVertex(false); + + kfparticle->setContainerName(KFPARTICLE::UpsilonName); + kfparticle->setOutputName("KFParticleOutput_" + KFPARTICLE::UpsilonName + "_reconstruction.root"); + + se->registerSubsystem(kfparticle); + + KFPARTICLE::runUpsilonReco = true; + + return; +} + + +void KFParticle_D0_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + KFPARTICLE::D0Name + "_Reco"); + kfparticle->Verbosity(verbosity); + kfparticle->setDecayDescriptor(KFPARTICLE::D0DecayDescriptor); + + kfparticle->saveDST(Enable::KFPARTICLE_APPEND_TO_DST); + kfparticle->saveOutput(Enable::KFPARTICLE_SAVE_NTUPLE); + kfparticle->doTruthMatching(Enable::KFPARTICLE_TRUTH_MATCH); + kfparticle->getDetectorInfo(Enable::KFPARTICLE_DETECTOR_INFO); + + kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); + kfparticle->setMinimumTrackIPchi2(KFParticleBaseCut::minTrackIPchi2); + kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); + + kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); + kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); + + kfparticle->setMinimumMass(KFPARTICLE::D0MassRange.first); + kfparticle->setMaximumMass(KFPARTICLE::D0MassRange.second); + kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); + kfparticle->constrainToPrimaryVertex(false); + + kfparticle->setContainerName(KFPARTICLE::D0Name); + kfparticle->setOutputName("KFParticleOutput_" + KFPARTICLE::D0Name + "_reconstruction.root"); + + se->registerSubsystem(kfparticle); + + KFPARTICLE::runD0Reco = true; + + return; +} + + +void KFParticle_Lambdac_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + KFPARTICLE::LambdacName + "_Reco"); + kfparticle->Verbosity(verbosity); + kfparticle->setDecayDescriptor(KFPARTICLE::LambdacDecayDescriptor); + + kfparticle->saveDST(Enable::KFPARTICLE_APPEND_TO_DST); + kfparticle->saveOutput(Enable::KFPARTICLE_SAVE_NTUPLE); + kfparticle->doTruthMatching(Enable::KFPARTICLE_TRUTH_MATCH); + kfparticle->getDetectorInfo(Enable::KFPARTICLE_DETECTOR_INFO); + + kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); + kfparticle->setMinimumTrackIPchi2(KFParticleBaseCut::minTrackIPchi2); + kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); + + kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); + kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); + + kfparticle->setMinimumMass(KFPARTICLE::LambdacMassRange.first); + kfparticle->setMaximumMass(KFPARTICLE::LambdacMassRange.second); + kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); + kfparticle->constrainToPrimaryVertex(false); + + kfparticle->setContainerName(KFPARTICLE::LambdacName); + kfparticle->setOutputName("KFParticleOutput_" + KFPARTICLE::LambdacName + "_reconstruction.root"); + + se->registerSubsystem(kfparticle); + + KFPARTICLE::runLambdacReco = true; + + return; +} + +void KFParticle_QA() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (KFPARTICLE::runUpsilonReco) + { + DecayFinder *UpsilonFinder = new DecayFinder("DecayFinder_" + KFPARTICLE::UpsilonName); + UpsilonFinder->Verbosity(verbosity); + UpsilonFinder->setDecayDescriptor(KFPARTICLE::UpsilonDecayDescriptor); + UpsilonFinder->triggerOnDecay(KFPARTICLE::UpsilonTrigger); + UpsilonFinder->saveDST(true); + UpsilonFinder->allowPi0(true); + UpsilonFinder->allowPhotons(true); + se->registerSubsystem(UpsilonFinder); + + QAG4SimulationKFParticle *UpsilonQA = new QAG4SimulationKFParticle("QA_" + KFPARTICLE::UpsilonName, + KFPARTICLE::UpsilonName, + KFPARTICLE::UpsilonMassRange.first, + KFPARTICLE::UpsilonMassRange.second); + se->registerSubsystem(UpsilonQA); + } + + if (KFPARTICLE::runD0Reco) + { + DecayFinder *D0Finder = new DecayFinder("DecayFinder_" + KFPARTICLE::D0Name); + D0Finder->Verbosity(verbosity); + D0Finder->setDecayDescriptor(KFPARTICLE::D0DecayDescriptor); + D0Finder->triggerOnDecay(KFPARTICLE::D0Trigger); + D0Finder->saveDST(true); + D0Finder->allowPi0(true); + D0Finder->allowPhotons(true); + se->registerSubsystem(D0Finder); + + QAG4SimulationKFParticle *D0QA = new QAG4SimulationKFParticle("QA_" + KFPARTICLE::D0Name, + KFPARTICLE::D0Name, + KFPARTICLE::D0MassRange.first, + KFPARTICLE::D0MassRange.second); + se->registerSubsystem(D0QA); + } + + if (KFPARTICLE::runLambdacReco) + { + DecayFinder *LambdacFinder = new DecayFinder("DecayFinder_" + KFPARTICLE::LambdacName); + LambdacFinder->Verbosity(verbosity); + LambdacFinder->setDecayDescriptor(KFPARTICLE::LambdacDecayDescriptor); + LambdacFinder->triggerOnDecay(KFPARTICLE::LambdacTrigger); + LambdacFinder->saveDST(true); + LambdacFinder->allowPi0(true); + LambdacFinder->allowPhotons(true); + se->registerSubsystem(LambdacFinder); + + QAG4SimulationKFParticle *LambdacQA = new QAG4SimulationKFParticle("QA_" + KFPARTICLE::LambdacName, + KFPARTICLE::LambdacName, + KFPARTICLE::LambdacMassRange.first, + KFPARTICLE::LambdacMassRange.second); + se->registerSubsystem(LambdacQA); + } + + return; +} + +#endif diff --git a/common/G4_Magnet.C b/common/G4_Magnet.C new file mode 100644 index 000000000..53d703769 --- /dev/null +++ b/common/G4_Magnet.C @@ -0,0 +1,116 @@ +#ifndef MACRO_G4MAGNET_C +#define MACRO_G4MAGNET_C + +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +namespace Enable +{ + bool MAGNET = false; + bool MAGNET_ABSORBER = false; + bool MAGNET_OVERLAPCHECK = false; + int MAGNET_VERBOSITY = 0; +} // namespace Enable + +namespace G4MAGNET +{ + double magnet_outer_cryostat_wall_radius = 174.5; + double magnet_outer_cryostat_wall_thickness = 2.5; + double magnet_length = 379.; +} // namespace G4MAGNET + +void MagnetFieldInit() +{ + if (!isfinite(G4MAGNET::magfield_rescale)) + { + G4MAGNET::magfield_rescale = 1.; + } + if (G4MAGNET::magfield.empty()) + { + G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sphenix3dbigmapxyz.root"); + } +} + +void MagnetInit() +{ + MagnetFieldInit(); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4MAGNET::magnet_outer_cryostat_wall_radius + G4MAGNET::magnet_outer_cryostat_wall_thickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4MAGNET::magnet_length / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4MAGNET::magnet_length / 2.); +} + +double Magnet(PHG4Reco* g4Reco, double radius) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::MAGNET_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::MAGNET_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::MAGNET_VERBOSITY); + + double magnet_inner_cryostat_wall_radius = 142; + double magnet_inner_cryostat_wall_thickness = 1; + double magnet_coil_radius = 150.8; + double magnet_coil_thickness = 9.38; + double magnet_length = 379.; + double coil_length = 361.5; + if (radius > magnet_inner_cryostat_wall_radius) + { + cout << "inconsistency: radius: " << radius + << " larger than Magnet inner radius: " << magnet_inner_cryostat_wall_radius << endl; + gSystem->Exit(-1); + } + + radius = magnet_inner_cryostat_wall_radius; + PHG4CylinderSubsystem* cyl = new PHG4CylinderSubsystem("MAGNET", 0); + cyl->set_double_param("radius", magnet_inner_cryostat_wall_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4MAGNET::magnet_length); + cyl->set_double_param("thickness", magnet_inner_cryostat_wall_thickness); + cyl->set_string_param("material", "Al5083"); // use 1 radiation length Al for magnet thickness + cyl->SuperDetector("MAGNET"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + cyl = new PHG4CylinderSubsystem("MAGNET", 1); + cyl->set_double_param("radius", magnet_coil_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", coil_length); + cyl->set_double_param("thickness", magnet_coil_thickness); + cyl->set_string_param("material", "Al5083"); // use 1 radiation length Al for magnet thickness + cyl->SuperDetector("MAGNET"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + cyl = new PHG4CylinderSubsystem("MAGNET", 2); + cyl->set_double_param("radius", G4MAGNET::magnet_outer_cryostat_wall_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4MAGNET::magnet_length); + cyl->set_double_param("thickness", G4MAGNET::magnet_outer_cryostat_wall_thickness); + cyl->set_string_param("material", "Al5083"); // use 1 radiation length Al for magnet thickness + cyl->SuperDetector("MAGNET"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + radius = G4MAGNET::magnet_outer_cryostat_wall_radius + G4MAGNET::magnet_outer_cryostat_wall_thickness; // outside of magnet + + if (verbosity > 0) + { + cout << "========================= G4_Magnet.C::Magnet() ===========================" << endl; + cout << " MAGNET Material Description:" << endl; + cout << " inner radius = " << magnet_inner_cryostat_wall_radius << " cm" << endl; + cout << " outer radius = " << G4MAGNET::magnet_outer_cryostat_wall_radius + G4MAGNET::magnet_outer_cryostat_wall_thickness << " cm" << endl; + cout << " length = " << G4MAGNET::magnet_length << " cm" << endl; + cout << "===========================================================================" << endl; + } + + radius += no_overlapp; + + return radius; +} +#endif diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C new file mode 100644 index 000000000..4dca16095 --- /dev/null +++ b/common/G4_Micromegas.C @@ -0,0 +1,94 @@ +#ifndef MACRO_G4MICROMEGAS_C +#define MACRO_G4MICROMEGAS_C + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include + +R__LOAD_LIBRARY(libmicromegas.so) +R__LOAD_LIBRARY(libg4micromegas.so) + +// some of the micromegas variables have been moved to GlobalVariables.C: +// bool MICROMEGAS = false; // moved to GlobalVariables.C +// int n_micromegas_layer = 2; +// because they are also needed in other macros + +namespace Enable +{ + bool MICROMEGAS_CELL = false; + bool MICROMEGAS_CLUSTER = false; + bool MICROMEGAS_QA = false; +} // namespace Enable + +void MicromegasInit() +{ + if (!Enable::MVTX) + { + G4MVTX::n_maps_layer = 0; + } + // same for the INTT + if (!Enable::INTT) + { + G4INTT::n_intt_layer = 0; + } + if (!Enable::TPC) + { + G4TPC::n_gas_layer = 0; + } + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 88.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 220. / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -220. / 2.); +} + +void Micromegas(PHG4Reco* g4Reco) +{ + const int mm_layer = G4MVTX::n_maps_layer + G4INTT::n_intt_layer + G4TPC::n_gas_layer; + auto mm = new PHG4MicromegasSubsystem("MICROMEGAS", mm_layer); + mm->OverlapCheck( Enable::OVERLAPCHECK ); + mm->SetActive(); + g4Reco->registerSubsystem(mm); +} + +void Micromegas_Cells() +{ +// the acts geometry needs to go here since it will be used by the PHG4MicromegasHitReco + ACTSGEOM::ActsGeomInit(); + auto se = Fun4AllServer::instance(); + // micromegas + auto reco = new PHG4MicromegasHitReco; + reco->Verbosity(0); + se->registerSubsystem(reco); + + se->registerSubsystem(new PHG4MicromegasDigitizer); +} + +void Micromegas_Clustering() +{ + auto se = Fun4AllServer::instance(); + se->registerSubsystem(new MicromegasClusterizer); +} + +void Micromegas_QA() +{ + auto se = Fun4AllServer::instance(); + auto qa = new QAG4SimulationMicromegas; + qa->Verbosity(Enable::QA_VERBOSITY); + se->registerSubsystem(qa); +} + +#endif diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C new file mode 100644 index 000000000..961fa6fe3 --- /dev/null +++ b/common/G4_Mvtx.C @@ -0,0 +1,143 @@ +#ifndef MACRO_G4MVTX_C +#define MACRO_G4MVTX_C + +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4mvtx.so) +R__LOAD_LIBRARY(libmvtx.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool MVTX = false; + bool MVTX_OVERLAPCHECK = false; + bool MVTX_CELL = false; + bool MVTX_CLUSTER = false; + bool MVTX_QA = false; + bool MVTX_ABSORBER = false; + int MVTX_VERBOSITY = 0; + +} // namespace Enable + +namespace G4MVTX +{ + int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers + double radius_offset = 0.7; // clearance around radius +} // namespace G4MVTX + +namespace G4MVTXAlignment +{ + std::string alignment_path = string(getenv("CALIBRATIONROOT")) + "/Tracking/MVTX/alignment"; + double z_offset[] = {0.0, 0.0, 200.0}; +} + +void MvtxInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 12.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -165.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 24.); +} + +double Mvtx(PHG4Reco* g4Reco, double radius, + const int absorberactive = 0) +{ + bool maps_overlapcheck = Enable::OVERLAPCHECK || Enable::MVTX_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); + + PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); + mvtx->Verbosity(verbosity); + + for (int ilayer = 0; ilayer < G4MVTX::n_maps_layer; ilayer++) + { + double radius_lyr = PHG4MvtxDefs::mvtxdat[ilayer][PHG4MvtxDefs::kRmd]; + mvtx->set_double_param(ilayer, "layer_z_offset", G4MVTXAlignment::z_offset[ilayer]); + if (verbosity) + { + cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; + } + radius = radius_lyr / 10.; + } + mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "alignment_path", G4MVTXAlignment::alignment_path); + mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); + + mvtx->SetActive(); + mvtx->OverlapCheck(maps_overlapcheck); + g4Reco->registerSubsystem(mvtx); + radius += G4MVTX::radius_offset; + return radius; +} + +// Central detector cell reco is disabled as EIC setup use the fast tracking sim for now +void Mvtx_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + // new storage containers + PHG4MvtxHitReco* maps_hits = new PHG4MvtxHitReco("MVTX"); + maps_hits->Verbosity(verbosity); + + double maps_readout_window = 5000.0; // ns + double extended_readout_time = 0.0; + if(TRACKING::pp_mode) extended_readout_time = TRACKING::pp_extended_readout_time; + // override the default timing window - default is +/- 5000 ns + maps_hits->set_double_param("mvtx_tmin", -maps_readout_window); + maps_hits->set_double_param("mvtx_tmax", maps_readout_window + extended_readout_time); + + std::cout << "PHG4MvtxHitReco: readout window is from " << -maps_readout_window << " to " << maps_readout_window + extended_readout_time << std::endl; + se->registerSubsystem(maps_hits); + + PHG4MvtxDigitizer* digimvtx = new PHG4MvtxDigitizer(); + digimvtx->Verbosity(verbosity); + // energy deposit in 25 microns = 9.6 KeV = 1000 electrons collected after recombination + //digimvtx->set_adc_scale(0.95e-6); // default set in code is 0.95e-06, which is 99 electrons + se->registerSubsystem(digimvtx); + + return; +} + +void Mvtx_Clustering() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + + // prune the extra MVTX hits due to multiple strobes per hit + MvtxHitPruner* mvtxhitpruner = new MvtxHitPruner(); + mvtxhitpruner->Verbosity(verbosity); + se->registerSubsystem(mvtxhitpruner); + + // For the Mvtx layers + //================ + MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); + mvtxclusterizer->Verbosity(verbosity); + se->registerSubsystem(mvtxclusterizer); +} + +void Mvtx_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::MVTX_VERBOSITY); + + Fun4AllServer* se = Fun4AllServer::instance(); + QAG4SimulationMvtx* qa = new QAG4SimulationMvtx; + qa->Verbosity(verbosity); + se->registerSubsystem(qa); +} + +#endif diff --git a/common/G4_PSTOF.C b/common/G4_PSTOF.C new file mode 100644 index 000000000..faa3a9ee4 --- /dev/null +++ b/common/G4_PSTOF.C @@ -0,0 +1,37 @@ +#ifndef MACRO_G4PSTOF_C +#define MACRO_G4PSTOF_C + +#include +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +// $Id$ + +/*! + * \file ${file_name} + * \brief Macro setting up the barrel mRPC psTOF + * \author Mickey Chiu + * \version $Revision$ + * \date $Date$ + */ +namespace Enable +{ + bool PSTOF = false; +} + +void PSTOFInit() +{ +} + +double PSTOF(PHG4Reco* g4Reco, double radius) +{ + PHG4PSTOFSubsystem* pstof = new PHG4PSTOFSubsystem("PSTOF"); + pstof->SuperDetector("PSTOF"); + // pstof->SetActive(-1,1); // set all modules active + g4Reco->registerSubsystem(pstof); + + // returns the outer radius to check for overlaps with next detector + return 90.; +} +#endif diff --git a/common/G4_ParticleFlow.C b/common/G4_ParticleFlow.C new file mode 100644 index 000000000..d069fdb48 --- /dev/null +++ b/common/G4_ParticleFlow.C @@ -0,0 +1,52 @@ +#ifndef MACRO_G4PARTICLEFLOW_C +#define MACRO_G4PARTICLEFLOW_C + +#include + +#include +#include + +#include +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4jets.so) +R__LOAD_LIBRARY(libparticleflow.so) + +namespace Enable +{ + bool PARTICLEFLOW = false; + int PARTICLEFLOW_VERBOSITY = 0; +} // namespace Enable + +void ParticleFlow() +{ + int verbosity = max(Enable::VERBOSITY, Enable::PARTICLEFLOW_VERBOSITY); + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + // note: assumes topoCluster input already configured + ParticleFlowReco *pfr = new ParticleFlowReco(); + pfr->set_energy_match_Nsigma(1.5); + pfr->Verbosity(verbosity); + se->registerSubsystem(pfr); + + JetReco *particleflowjetreco = new JetReco("PARTICLEFLOWJETRECO"); + particleflowjetreco->add_input(new ParticleFlowJetInput()); + particleflowjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_ParticleFlow_r02"); + particleflowjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_ParticleFlow_r03"); + particleflowjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_ParticleFlow_r04"); + particleflowjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_ParticleFlow_r03"); + particleflowjetreco->set_algo_node("ANTIKT"); + particleflowjetreco->set_input_node("PARTICLEFLOW"); + particleflowjetreco->Verbosity(verbosity); + se->registerSubsystem(particleflowjetreco); + + return; +} +#endif diff --git a/common/G4_Pipe.C b/common/G4_Pipe.C new file mode 100644 index 000000000..8279513dd --- /dev/null +++ b/common/G4_Pipe.C @@ -0,0 +1,493 @@ +#ifndef MACRO_G4PIPE_C +#define MACRO_G4PIPE_C + +#include + +#include +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +namespace Enable +{ + bool PIPE = false; + bool PIPE_ABSORBER = false; + bool PIPE_OVERLAPCHECK = false; + int PIPE_VERBOSITY = 0; +} // namespace Enable + +namespace G4PIPE +{ + // STAR Beampipe for sPHENIX - based on STAR DWG 30006 + double be_pipe_radius = 2.00025; // 4.0005 cm inner diameter + double be_pipe_thickness = 0.0762; // 0.762 mm + double be_pipe_length = 120.015; // 120 cm or 47.25" + double be_pipe_zshift = -41.1639; // amount Be pipe is shifted south + + double al_pipe_radius = 2.00025; // same as Be pipe + double al_pipe_thickness = 0.1397; // 1.397 mm or 0.055" + double al_pipe_south_length = 101.486; // Al extension south (from Dan's drawing, slight diff from STAR drawing) + double al_pipe_north_length = 61.51; // Al extension north (from Dan's drawing, slight diff from STAR drawing) + double al_pipe_north_ext_length = 123.393; // additional north extension + + double flange_thickness = 6.934/2 - (al_pipe_radius + al_pipe_thickness); // Atlas 2.75" flange, radial thickness + double flange_length = 1.2825; // Atlas 2.75" flange + + double outer_pipe_precone_length = 1.613; + double outer_pipe_precone_radius = 2.00025; // same as Be pipe + double outer_pipe_thickness = 0.1397; // 1.397 mm or 0.055" + double outer_pipe_cone_length = 38.1; + double outer_pipe_ext_radius = 3.81; // past the cone + double outer_pipe_ext_length = 67.087; // extension beyond conical part + + // maximum extent of the central part of beampipe (the forward regions are implemented in G4_Beamline.C) + double max_z = be_pipe_zshift + be_pipe_length / 2. + al_pipe_north_length + al_pipe_north_ext_length + + outer_pipe_precone_length + outer_pipe_cone_length + outer_pipe_ext_length; + +} // namespace G4PIPE + +void PipeInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::outer_pipe_ext_radius + G4PIPE::outer_pipe_thickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::max_z + no_overlapp ); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -(G4PIPE::max_z + no_overlapp) ); +} + +double Pipe(PHG4Reco* g4Reco, double radius) +{ +cout << "**** STAR PIPE ***************" << endl; + bool AbsorberActive = Enable::ABSORBER || Enable::PIPE_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PIPE_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::PIPE_VERBOSITY); + + if (radius > G4PIPE::be_pipe_radius) + { + cout << "inconsistency: radius: " << radius + << " larger than pipe inner radius: " << G4PIPE::be_pipe_radius << endl; + gSystem->Exit(-1); + } + + int ilayer = 0; + + // mid-rapidity beryllium pipe + PHG4CylinderSubsystem* cyl = new PHG4CylinderSubsystem("VAC_BE_PIPE", ilayer++); + cyl->set_double_param("place_z", G4PIPE::be_pipe_zshift); + cyl->set_double_param("radius", 0.0); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::be_pipe_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::be_pipe_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + cyl = new PHG4CylinderSubsystem("BE_PIPE", ilayer++); + cyl->set_double_param("place_z", G4PIPE::be_pipe_zshift); + cyl->set_double_param("radius", G4PIPE::be_pipe_radius); // inner radius + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::be_pipe_length); + cyl->set_string_param("material", "G4_Be"); + cyl->set_double_param("thickness", G4PIPE::be_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // north aluminum pipe + double north_pipe_place_z = G4PIPE::be_pipe_zshift + 0.5 * G4PIPE::be_pipe_length + 0.5 * (G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length); + cyl = new PHG4CylinderSubsystem("VAC_N_AL_PIPE", ilayer++); + cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp); + cyl->set_double_param("radius", 0.0); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::al_pipe_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + cyl = new PHG4CylinderSubsystem("N_AL_PIPE", ilayer++); + cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::al_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // north flange 1A + double flange_place_z = G4PIPE::be_pipe_zshift + 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_north_length; // center of flange coupling + // Al half, towards IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_1A_AL", ilayer++); + cyl->set_double_param("place_z", flange_place_z - 0.75*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // SS half, away from IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_1A_SS", ilayer++); + cyl->set_double_param("place_z", flange_place_z - 0.25*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_STAINLESS-STEEL"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // north flange 1B + // Ti half, towards IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_1B_TI", ilayer++); + cyl->set_double_param("place_z", flange_place_z + 0.25*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Ti"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // Al half, away from IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_1B_Al", ilayer++); + cyl->set_double_param("place_z", flange_place_z + 0.75*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // north flange 2A + flange_place_z = G4PIPE::be_pipe_zshift + 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length; + // Al half, towards IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_2A_Al", ilayer++); + cyl->set_double_param("place_z", flange_place_z - 0.75*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // Ti half, away from IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_2A_TI", ilayer++); + cyl->set_double_param("place_z", flange_place_z - 0.25*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Ti"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // north flange 2B + // Ti half, towards IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_2B_TI", ilayer++); + cyl->set_double_param("place_z", flange_place_z + 0.25*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Ti"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // Al half, away from IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_2B_Al", ilayer++); + cyl->set_double_param("place_z", flange_place_z + 0.75*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // south aluminum pipe + double south_pipe_place_z = G4PIPE::be_pipe_zshift - 0.5 * G4PIPE::be_pipe_length - 0.5 * G4PIPE::al_pipe_south_length; + cyl = new PHG4CylinderSubsystem("VAC_S_AL_PIPE", ilayer++); + cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp); + cyl->set_double_param("radius", 0.0); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_south_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::al_pipe_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + cyl = new PHG4CylinderSubsystem("S_AL_PIPE", ilayer++); + cyl->set_double_param("place_z", south_pipe_place_z + no_overlapp); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_south_length); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::al_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // south flange 1A + flange_place_z = G4PIPE::be_pipe_zshift - 0.5 * G4PIPE::be_pipe_length - G4PIPE::al_pipe_south_length; + // Al half, towards IP + cyl = new PHG4CylinderSubsystem("S_FLANGE_1A_Al", ilayer++); + cyl->set_double_param("place_z", flange_place_z + 0.75*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // SS half, away from IP + cyl = new PHG4CylinderSubsystem("S_FLANGE_1A_SS", ilayer++); + cyl->set_double_param("place_z", flange_place_z + 0.25*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_STAINLESS-STEEL"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // south flange 1B + // Ti half, towards IP + cyl = new PHG4CylinderSubsystem("S_FLANGE_1B_TI", ilayer++); + cyl->set_double_param("place_z", flange_place_z - 0.25*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Ti"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // Al half, away from IP + cyl = new PHG4CylinderSubsystem("S_FLANGE_1B_AL", ilayer++); + cyl->set_double_param("place_z", flange_place_z - 0.75*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* north outermost pipe (extension) [vacuum] */ + north_pipe_place_z += 0.5 * (G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length) + 0.5 * G4PIPE::outer_pipe_precone_length; + cyl = new PHG4CylinderSubsystem("VAC_N_OUTER_PIPE_PRECONE", ilayer++); + cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp); + cyl->set_double_param("radius", 0.); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_precone_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_precone_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* north outermost pipe (pre-conical part) */ + cyl = new PHG4CylinderSubsystem("N_OUTER_PIPE_PRECONE", ilayer++); + cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp); + cyl->set_double_param("radius", G4PIPE::outer_pipe_precone_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_precone_length); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + PHG4ConeSubsystem* cone = nullptr; + + /* north outermost pipe (conical part) [vacuum] */ + north_pipe_place_z += 0.5 * G4PIPE::outer_pipe_precone_length + 0.5 * G4PIPE::outer_pipe_cone_length; + cone = new PHG4ConeSubsystem("VAC_N_OUTER_PIPE_CONE", ilayer++); + cone->SetR1(0., G4PIPE::outer_pipe_precone_radius); + cone->SetR2(0., G4PIPE::outer_pipe_ext_radius); + cone->SetZlength(G4PIPE::outer_pipe_cone_length / 2); + cone->SetPlaceZ(north_pipe_place_z + no_overlapp); + cone->SetMaterial("G4_Galactic"); + cone->SuperDetector("PIPE"); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + + /* north outermost pipe (conical part) */ + cone = new PHG4ConeSubsystem("N_OUTER_PIPE_CONE", ilayer++); + cone->SetR1(G4PIPE::outer_pipe_precone_radius, G4PIPE::outer_pipe_precone_radius + G4PIPE::outer_pipe_thickness); + cone->SetR2(G4PIPE::outer_pipe_ext_radius, G4PIPE::outer_pipe_ext_radius + G4PIPE::outer_pipe_thickness); + cone->SetZlength(G4PIPE::outer_pipe_cone_length / 2); + cone->SetPlaceZ(north_pipe_place_z + no_overlapp); + cone->SetMaterial("G4_Al"); + cone->SuperDetector("PIPE"); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + + /* north outermost pipe (extension) [vacuum] */ + north_pipe_place_z += 0.5 * G4PIPE::outer_pipe_cone_length + 0.5 * G4PIPE::outer_pipe_ext_length; + cyl = new PHG4CylinderSubsystem("VAC_N_OUTER_PIPE_EXT", ilayer++); + cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp); + cyl->set_double_param("radius", 0.); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_ext_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_ext_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* north outermost pipe (extension) */ + cyl = new PHG4CylinderSubsystem("N_OUTER_PIPE_EXT", ilayer++); + cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp); + cyl->set_double_param("radius", G4PIPE::outer_pipe_ext_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_ext_length); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* south outermost pipe (pre-conical part) [vacuum] */ + south_pipe_place_z -= (0.5 * G4PIPE::al_pipe_south_length + 0.5 * G4PIPE::outer_pipe_precone_length); + cyl = new PHG4CylinderSubsystem("VAC_S_OUTER_PIPE_PRECONE", ilayer++); + cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp); + cyl->set_double_param("radius", 0.); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_precone_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_precone_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* south outermost pipe (pre-conical part) */ + cyl = new PHG4CylinderSubsystem("S_OUTER_PIPE_PRECONE", ilayer++); + cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp); + cyl->set_double_param("radius", G4PIPE::outer_pipe_precone_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_precone_length); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* south outermost pipe (conical part) [vacuum] */ + south_pipe_place_z -= (0.5 * G4PIPE::outer_pipe_precone_length + 0.5 * G4PIPE::outer_pipe_cone_length); + cone = new PHG4ConeSubsystem("VAC_S_AL_PIPE_CONE", ilayer++); + cone->SetR1(0., G4PIPE::outer_pipe_ext_radius); + cone->SetR2(0., G4PIPE::outer_pipe_precone_radius); + cone->SetZlength(G4PIPE::outer_pipe_cone_length / 2); + cone->SetPlaceZ(south_pipe_place_z - no_overlapp); + cone->SetMaterial("G4_Galactic"); + cone->SuperDetector("PIPE"); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + + /* south outermost pipe (conical part) */ + cone = new PHG4ConeSubsystem("S_OUTER_PIPE_CONE", ilayer++); + cone->SetR1(G4PIPE::outer_pipe_ext_radius, G4PIPE::outer_pipe_ext_radius + G4PIPE::outer_pipe_thickness); + cone->SetR2(G4PIPE::outer_pipe_precone_radius, G4PIPE::outer_pipe_precone_radius + G4PIPE::outer_pipe_thickness); + cone->SetZlength(G4PIPE::outer_pipe_cone_length / 2); + cone->SetPlaceZ(south_pipe_place_z - no_overlapp); + cone->SetMaterial("G4_Al"); + cone->SuperDetector("PIPE"); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + + /* south outermost pipe (extension) [vacuum] */ + south_pipe_place_z -= (0.5 * G4PIPE::outer_pipe_cone_length + 0.5 * G4PIPE::outer_pipe_ext_length); + cyl = new PHG4CylinderSubsystem("VAC_S_OUTER_PIPE_EXT", ilayer++); + cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp); + cyl->set_double_param("radius", 0.); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_ext_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_ext_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* south outermost pipe (extension) */ + cyl = new PHG4CylinderSubsystem("S_OUTER_PIPE_EXT", ilayer++); + cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp); + cyl->set_double_param("radius", G4PIPE::outer_pipe_ext_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_ext_length); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + radius = G4PIPE::outer_pipe_ext_radius + G4PIPE::outer_pipe_thickness; + + if (verbosity > 0) + { + cout << "=========================== G4_Pipe.C::Pipe() =============================" << endl; + cout << " PIPE Material Description:" << endl; + cout << " inner radius = " << G4PIPE::be_pipe_radius << " cm" << endl; + cout << " thickness = " << G4PIPE::be_pipe_thickness << " cm" << endl; + cout << " outer radius = " << G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness << " cm" << endl; + cout << " length = " << G4PIPE::be_pipe_length << " cm" << endl; + cout << "===========================================================================" << endl; + } + + radius += no_overlapp; + + return radius; +} +#endif diff --git a/common/G4_PlugDoor.C b/common/G4_PlugDoor.C new file mode 100644 index 000000000..c0f9170c3 --- /dev/null +++ b/common/G4_PlugDoor.C @@ -0,0 +1,175 @@ +#ifndef MACRO_G4PLUGDOOR_C +#define MACRO_G4PLUGDOOR_C + +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +void common_color(PHG4CylinderSubsystem *subsys); + +namespace Enable +{ + bool PLUGDOOR = false; + bool PLUGDOOR_ABSORBER = false; + bool PLUGDOOR_OVERLAPCHECK = false; + bool PLUGDOOR_BLACKHOLE = false; +} // namespace Enable + +namespace G4PLUGDOOR +{ + // sPHENIX forward flux return(s) + // define via four corners in the engineering drawing + double z_1 = 330.81; + double z_2 = 360.81; + double r_1 = 30; + double r_2 = 263.5; + + double length = z_2 - z_1; + double place_z = (z_1 + z_2) / 2.; + double thickness = 2.; // 2 cm thick +} // namespace G4PLUGDOOR + +void PlugDoorInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PLUGDOOR::r_2); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PLUGDOOR::place_z + G4PLUGDOOR::length / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -(G4PLUGDOOR::place_z + G4PLUGDOOR::length / 2.)); + if (Enable::PLUGDOOR_BLACKHOLE) + { + if (G4PLUGDOOR::thickness >= G4PLUGDOOR::z_2 - G4PLUGDOOR::z_1) + { + cout << "G4_PlugDoor::PlugDoorInit(): thickness " << G4PLUGDOOR::thickness + << " exceeds door thickness " << G4PLUGDOOR::z_2 - G4PLUGDOOR::z_1 + << endl; + gSystem->Exit(1); + } + } +} +void PlugDoor(PHG4Reco *g4Reco) +{ + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PLUGDOOR_OVERLAPCHECK; + bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; + + const string material("Steel_1006"); + + if (Enable::PLUGDOOR_BLACKHOLE) + { + double place_z_plate = G4PLUGDOOR::z_1 + G4PLUGDOOR::thickness / 2.; + double place_z_cyl = (G4PLUGDOOR::z_1 + G4PLUGDOOR::z_2 + G4PLUGDOOR::thickness) / 2.; + PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FLUXRET_ETA_PLUS", 0); + flux_return_plus->set_double_param("length", G4PLUGDOOR::thickness); + flux_return_plus->set_double_param("radius", G4PLUGDOOR::r_1); + flux_return_plus->set_double_param("place_z", place_z_plate); + flux_return_plus->set_double_param("thickness", G4PLUGDOOR::r_2 - G4PLUGDOOR::r_1); + flux_return_plus->set_string_param("material", material); + flux_return_plus->SetActive(flux_door_active); + flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); + flux_return_plus->OverlapCheck(OverlapCheck); + common_color(flux_return_plus); + g4Reco->registerSubsystem(flux_return_plus); + + flux_return_plus = new PHG4CylinderSubsystem("FLUXRET_ETA_PLUS", 1); + flux_return_plus->set_double_param("length", G4PLUGDOOR::length - G4PLUGDOOR::thickness); + flux_return_plus->set_double_param("radius", G4PLUGDOOR::r_1); + flux_return_plus->set_double_param("place_z", place_z_cyl); + flux_return_plus->set_double_param("thickness", G4PLUGDOOR::thickness); + flux_return_plus->set_string_param("material", material); + flux_return_plus->SetActive(flux_door_active); + flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); + flux_return_plus->OverlapCheck(OverlapCheck); + common_color(flux_return_plus); + g4Reco->registerSubsystem(flux_return_plus); + + // Black hole behind door with thickness G4PLUGDOOR::thickness + // same color as door - you will not distinguish it in the display + flux_return_plus = new PHG4CylinderSubsystem("FLUXRET_ETA_PLUS", 2); + flux_return_plus->set_double_param("length", G4PLUGDOOR::length - G4PLUGDOOR::thickness); + flux_return_plus->set_double_param("radius", G4PLUGDOOR::r_1 + G4PLUGDOOR::thickness); + flux_return_plus->set_double_param("place_z", place_z_cyl); + flux_return_plus->set_double_param("thickness", G4PLUGDOOR::r_2 - G4PLUGDOOR::r_1 - G4PLUGDOOR::thickness); + flux_return_plus->set_string_param("material", material); + flux_return_plus->SetActive(flux_door_active); + flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); + flux_return_plus->OverlapCheck(OverlapCheck); + flux_return_plus->BlackHole(); + common_color(flux_return_plus); + g4Reco->registerSubsystem(flux_return_plus); + + PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 0); + flux_return_minus->set_double_param("length", G4PLUGDOOR::thickness); + flux_return_minus->set_double_param("radius", G4PLUGDOOR::r_1); + flux_return_minus->set_double_param("place_z", -place_z_plate); + flux_return_minus->set_double_param("thickness", G4PLUGDOOR::r_2 - G4PLUGDOOR::r_1); + flux_return_minus->set_string_param("material", material); + flux_return_minus->SetActive(flux_door_active); + flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); + flux_return_minus->OverlapCheck(OverlapCheck); + common_color(flux_return_minus); + g4Reco->registerSubsystem(flux_return_minus); + + flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 1); + flux_return_minus->set_double_param("length", G4PLUGDOOR::length - G4PLUGDOOR::thickness); + flux_return_minus->set_double_param("radius", G4PLUGDOOR::r_1); + flux_return_minus->set_double_param("place_z", -place_z_cyl); + flux_return_minus->set_double_param("thickness", G4PLUGDOOR::thickness); + flux_return_minus->set_string_param("material", material); + flux_return_minus->SetActive(flux_door_active); + flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); + flux_return_minus->OverlapCheck(OverlapCheck); + common_color(flux_return_minus); + g4Reco->registerSubsystem(flux_return_minus); + + // Black hole behind door with thickness G4PLUGDOOR::thickness + // same color as door - you will not distinguish it in the display + flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 2); + flux_return_minus->set_double_param("length", G4PLUGDOOR::length - G4PLUGDOOR::thickness); + flux_return_minus->set_double_param("radius", G4PLUGDOOR::r_1 + G4PLUGDOOR::thickness); + flux_return_minus->set_double_param("place_z", -place_z_cyl); + flux_return_minus->set_double_param("thickness", G4PLUGDOOR::r_2 - G4PLUGDOOR::r_1 - G4PLUGDOOR::thickness); + flux_return_minus->set_string_param("material", material); + flux_return_minus->SetActive(flux_door_active); + flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); + flux_return_minus->OverlapCheck(OverlapCheck); + flux_return_minus->BlackHole(); + common_color(flux_return_minus); + g4Reco->registerSubsystem(flux_return_minus); + } + else + { + PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FLUXRET_ETA_PLUS", 3); + flux_return_plus->set_double_param("length", G4PLUGDOOR::length); + flux_return_plus->set_double_param("radius", G4PLUGDOOR::r_1); + flux_return_plus->set_double_param("place_z", G4PLUGDOOR::place_z); + flux_return_plus->set_double_param("thickness", G4PLUGDOOR::r_2 - G4PLUGDOOR::r_1); + flux_return_plus->set_string_param("material", material); + flux_return_plus->SetActive(flux_door_active); + flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); + flux_return_plus->OverlapCheck(OverlapCheck); + common_color(flux_return_plus); + g4Reco->registerSubsystem(flux_return_plus); + + PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 3); + flux_return_minus->set_double_param("length", G4PLUGDOOR::length); + flux_return_minus->set_double_param("radius", G4PLUGDOOR::r_1); + flux_return_minus->set_double_param("place_z", -G4PLUGDOOR::place_z); + flux_return_minus->set_double_param("thickness", G4PLUGDOOR::r_2 - G4PLUGDOOR::r_1); + flux_return_minus->set_string_param("material", material); + flux_return_minus->SetActive(flux_door_active); + flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); + flux_return_minus->OverlapCheck(OverlapCheck); + common_color(flux_return_minus); + g4Reco->registerSubsystem(flux_return_minus); + } + + return; +} + +void common_color(PHG4CylinderSubsystem *subsys) +{ + subsys->set_color(0.29, 0.44, 0.54); +} +#endif diff --git a/common/G4_Production.C b/common/G4_Production.C new file mode 100644 index 000000000..85e7801a7 --- /dev/null +++ b/common/G4_Production.C @@ -0,0 +1,33 @@ +#ifndef MACRO_G4PRODUCTION_C +#define MACRO_G4PRODUCTION_C + +#include + +namespace Enable +{ + bool PRODUCTION = false; +} + +namespace PRODUCTION +{ + string SaveOutputDir = "./"; +} + +void Production_CreateOutputDir() +{ + PRODUCTION::SaveOutputDir = DstOut::OutputDir; + DstOut::OutputDir = PRODUCTION::SaveOutputDir + "/ongoing"; + string mkdircmd = "mkdir -p " + DstOut::OutputDir; + gSystem->Exec(mkdircmd.c_str()); +} + +void Production_MoveOutput() +{ + if (Enable::DSTOUT) + { + string fulloutfile = DstOut::OutputDir + "/" + DstOut::OutputFile; + string mvcmd = "mv " + fulloutfile + " " + PRODUCTION::SaveOutputDir; + gSystem->Exec(mvcmd.c_str()); + } +} +#endif diff --git a/common/G4_TPC.C b/common/G4_TPC.C new file mode 100644 index 000000000..e7fda8e72 --- /dev/null +++ b/common/G4_TPC.C @@ -0,0 +1,347 @@ +#ifndef MACRO_G4TPC_C +#define MACRO_G4TPC_C + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wundefined-internal" +#include +#include +#include +#pragma GCC diagnostic pop + +#include + +#include +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4tpc.so) +R__LOAD_LIBRARY(libtpc.so) +R__LOAD_LIBRARY(libtpccalib.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool TPC = false; + bool TPC_ABSORBER = false; + bool TPC_OVERLAPCHECK = false; + bool TPC_CELL = false; + bool TPC_CLUSTER = false; + bool TPC_QA = false; + + bool TPC_ENDCAP = true; + + int TPC_VERBOSITY = 0; +} // namespace Enable + +namespace G4TPC +{ + int n_tpc_layer_inner = 16; + int tpc_layer_rphi_count_inner = 1152; + int n_tpc_layer_mid = 16; + int n_tpc_layer_outer = 16; + int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; + double tpc_outer_radius = 77. + 2.; + + // drift velocity is set here for all relevant modules + double tpc_drift_velocity_sim= 8.0 / 1000.0; // cm/ns // this is the Ne version of the gas +// double tpc_drift_velocity_reco now set in GlobalVariables.C +// double tpc_drift_velocity_reco= 8.0 / 1000.0; // cm/ns // this is the Ne version of the gas + + // use simple clusterizer + bool USE_SIMPLE_CLUSTERIZER = false; + + // distortions + bool ENABLE_STATIC_DISTORTIONS = false; + auto static_distortion_filename = std::string(getenv("CALIBRATIONROOT")) + "/distortion_maps/static_only.distortion_map.hist.root"; + + bool ENABLE_TIME_ORDERED_DISTORTIONS = false; + std::string time_ordered_distortion_filename = std::string(getenv("CALIBRATIONROOT")) + "/distortion_maps/TimeOrderedDistortions.root"; + + // distortion corrections + bool ENABLE_CORRECTIONS = false; + auto correction_filename = std::string(getenv("CALIBRATIONROOT")) + "/distortion_maps/static_only_inverted_10-new.root"; + + // enable central membrane g4hits generation + bool ENABLE_CENTRAL_MEMBRANE_HITS = false; + + // enable direct laser g4hits generation + bool ENABLE_DIRECT_LASER_HITS = false; + + // save histograms + bool DIRECT_LASER_SAVEHISTOGRAMS = false; + + // do cluster <-> hit association + bool DO_HIT_ASSOCIATION = true; + + // space charge calibration output file + std::string DIRECT_LASER_ROOTOUTPUT_FILENAME = "TpcSpaceChargeMatrices.root"; + std::string DIRECT_LASER_HISTOGRAMOUTPUT_FILENAME = "TpcDirectLaserReconstruction.root"; + +} // namespace G4TPC + +void TPCInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4TPC::tpc_outer_radius); + + if (Enable::TPC_ENDCAP) + { + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 130.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -130.); + } + else + { + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 211. / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -211. / 2.); + } + + // the mvtx is not called if disabled but the default number of layers is set to 3, + // so we need to set it to zero + if (!Enable::MVTX) + { + G4MVTX::n_maps_layer = 0; + } + // same for the INTT + if (!Enable::INTT) + { + G4INTT::n_intt_layer = 0; + } + + // Set the (static) drift velocity in the cluster Z crossing correction module + TpcClusterZCrossingCorrection::_vdrift = G4TPC::tpc_drift_velocity_reco; +} + +//! TPC end cap, wagon wheel, electronics +void TPC_Endcaps(PHG4Reco* g4Reco) +{ + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TPC_OVERLAPCHECK; + bool AbsorberActive = Enable::ABSORBER || Enable::TPC_ABSORBER; + + PHG4TpcEndCapSubsystem* tpc_endcap = new PHG4TpcEndCapSubsystem("TPC_ENDCAP"); + tpc_endcap->SuperDetector("TPC_ENDCAP"); + + if (AbsorberActive) tpc_endcap->SetActive(); + tpc_endcap->OverlapCheck(OverlapCheck); + + // tpc_endcap->set_int_param("construction_verbosity", 2); + + g4Reco->registerSubsystem(tpc_endcap); + + return; +} + +double TPC(PHG4Reco* g4Reco, + double radius) +{ + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TPC_OVERLAPCHECK; + bool AbsorberActive = Enable::ABSORBER || Enable::TPC_ABSORBER; + + PHG4TpcSubsystem* tpc = new PHG4TpcSubsystem("TPC"); + tpc->SetActive(); + tpc->SuperDetector("TPC"); + tpc->set_double_param("steplimits", 1); // 1cm steps + + if (AbsorberActive) + { + tpc->SetAbsorberActive(); + } + tpc->OverlapCheck(OverlapCheck); + + g4Reco->registerSubsystem(tpc); + + if (Enable::TPC_ENDCAP) + { + TPC_Endcaps(g4Reco); + } + + radius = G4TPC::tpc_outer_radius; + + radius += no_overlapp; + + return radius; +} + +void TPC_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); + auto se = Fun4AllServer::instance(); + + // central membrane G4Hit generation + if( G4TPC::ENABLE_CENTRAL_MEMBRANE_HITS ) + { + auto centralMembrane = new PHG4TpcCentralMembrane; + centralMembrane->setCentralMembraneDelay(0); + se->registerSubsystem(centralMembrane); + } + + // direct laser G4Hit generation + if( G4TPC::ENABLE_DIRECT_LASER_HITS ) + { + auto directLaser = new PHG4TpcDirectLaser; + + // setup phi and theta steps + /* use 5deg steps */ + static constexpr double deg_to_rad = M_PI/180.; + directLaser->SetPhiStepping( 72, 0*deg_to_rad, 360*deg_to_rad ); + directLaser->SetThetaStepping( 17, 5*deg_to_rad, 90*deg_to_rad ); + directLaser->SetDirectLaserAuto( true ); + directLaser->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity_sim); + se->registerSubsystem(directLaser); + } + + //========================= + // setup Tpc readout for filling cells + // g4tpc/PHG4TpcElectronDrift uses + // g4tpc/PHG4TpcPadPlaneReadout + //========================= + + auto padplane = new PHG4TpcPadPlaneReadout; + padplane->Verbosity(verbosity); + + auto edrift = new PHG4TpcElectronDrift; + edrift->Detector("TPC"); + edrift->Verbosity(verbosity); + if( G4TPC::ENABLE_STATIC_DISTORTIONS || G4TPC::ENABLE_TIME_ORDERED_DISTORTIONS ) + { + auto distortionMap = new PHG4TpcDistortion; + distortionMap->set_do_static_distortions( G4TPC::ENABLE_STATIC_DISTORTIONS ); + distortionMap->set_static_distortion_filename( G4TPC::static_distortion_filename ); + + distortionMap->set_do_time_ordered_distortions( G4TPC::ENABLE_TIME_ORDERED_DISTORTIONS ); + distortionMap->set_time_ordered_distortion_filename( G4TPC::time_ordered_distortion_filename ); + + distortionMap->Init(); + edrift->setTpcDistortion( distortionMap ); + } + + double tpc_readout_time = 105.5/ G4TPC::tpc_drift_velocity_sim; // ns + double extended_readout_time = 0.0; + if(TRACKING::pp_mode) extended_readout_time = TRACKING::pp_extended_readout_time; + edrift->set_double_param("max_time", tpc_readout_time + extended_readout_time); + std::cout << "PHG4TpcElectronDrift readout window is from 0 to " << tpc_readout_time + extended_readout_time << std::endl; + + // override the default drift velocity parameter specification + edrift->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity_sim); + padplane->SetDriftVelocity(G4TPC::tpc_drift_velocity_sim); + + // fudge factors to get drphi 150 microns (in mid and outer Tpc) and dz 500 microns cluster resolution + // They represent effects not due to ideal gas properties and ideal readout plane behavior + // defaults are 0.085 and 0.105, they can be changed here to get a different resolution + edrift->registerPadPlane(padplane); + se->registerSubsystem(edrift); + + // The pad plane readout default is set in PHG4TpcPadPlaneReadout + + // We may want to change the number of inner layers, and can do that here + padplane->set_int_param("tpc_minlayer_inner", G4MVTX::n_maps_layer + G4INTT::n_intt_layer); // sPHENIX layer number of first Tpc readout layer + padplane->set_int_param("ntpc_layers_inner", G4TPC::n_tpc_layer_inner); + padplane->set_int_param("ntpc_phibins_inner", G4TPC::tpc_layer_rphi_count_inner); + + // Tpc digitizer + //========= + PHG4TpcDigitizer* digitpc = new PHG4TpcDigitizer(); + digitpc->SetTpcMinLayer(G4MVTX::n_maps_layer + G4INTT::n_intt_layer); + double ENC = 670.0; // standard + digitpc->SetENC(ENC); + double ADC_threshold = 4.0 * ENC; + digitpc->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK + digitpc->Verbosity(verbosity); + cout << " Tpc digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold + << " maps+Intt layers set to " << G4MVTX::n_maps_layer + G4INTT::n_intt_layer << endl; + + se->registerSubsystem(digitpc); + +} + +void TPC_Clustering() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); + ACTSGEOM::ActsGeomInit(); + Fun4AllServer* se = Fun4AllServer::instance(); + + //------------- + // Cluster Hits + //------------- + + // For the Tpc + //========== + if( G4TPC::USE_SIMPLE_CLUSTERIZER ) + { + + auto tpcclusterizer = new TpcSimpleClusterizer; + tpcclusterizer->Verbosity(verbosity); + se->registerSubsystem(tpcclusterizer); + + } else { + + auto tpcclusterizer = new TpcClusterizer; + tpcclusterizer->Verbosity(verbosity); + tpcclusterizer->set_do_hit_association( G4TPC::DO_HIT_ASSOCIATION ); + se->registerSubsystem(tpcclusterizer); + + } + + if( !G4TPC::ENABLE_DIRECT_LASER_HITS ) + { + auto tpcclustercleaner = new TpcClusterCleaner; + tpcclustercleaner->Verbosity(verbosity); + se->registerSubsystem(tpcclustercleaner); + } + + // direct laser reconstruction + if( G4TPC::ENABLE_DIRECT_LASER_HITS ) + { + auto directLaserReconstruction = new TpcDirectLaserReconstruction; + directLaserReconstruction->set_outputfile( G4TPC::DIRECT_LASER_ROOTOUTPUT_FILENAME ); + directLaserReconstruction->set_savehistograms( G4TPC::DIRECT_LASER_SAVEHISTOGRAMS ); + directLaserReconstruction->set_histogram_outputfile( G4TPC::DIRECT_LASER_HISTOGRAMOUTPUT_FILENAME ); + se->registerSubsystem(directLaserReconstruction); + } + + // central membrane reconstruction + if( G4TPC::ENABLE_CENTRAL_MEMBRANE_HITS ) + { + // central membrane clusterizer + se->registerSubsystem(new PHTpcCentralMembraneClusterizer); + + // match central membrane clusters to pads and generate distortion correction + auto centralMembraneMatcher = new PHTpcCentralMembraneMatcher; + se->registerSubsystem(centralMembraneMatcher); + } +} + + +void TPC_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::TPC_VERBOSITY); + + Fun4AllServer* se = Fun4AllServer::instance(); + QAG4SimulationTpc * qa = new QAG4SimulationTpc; + qa->Verbosity(verbosity); + se->registerSubsystem(qa); +} + + +#endif diff --git a/common/G4_TopoClusterReco.C b/common/G4_TopoClusterReco.C new file mode 100644 index 000000000..293911e9a --- /dev/null +++ b/common/G4_TopoClusterReco.C @@ -0,0 +1,72 @@ +#ifndef MACRO_G4TOPOCLUSTERRECO_C +#define MACRO_G4TOPOCLUSTERRECO_C + +#include + +#include + +#include + +R__LOAD_LIBRARY(libcalo_reco.so) + +namespace Enable +{ + bool TOPOCLUSTER = false; + int TOPOCLUSTER_VERBOSITY = 0; +} // namespace Enable + +void TopoClusterReco() +{ + int verbosity = max(Enable::VERBOSITY, Enable::TOPOCLUSTER_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + // topoClustering in all three layers + RawClusterBuilderTopo* ClusterBuilder = new RawClusterBuilderTopo("HcalRawClusterBuilderTopo"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_nodename("TOPOCLUSTER_ALLCALO"); + ClusterBuilder->set_enable_HCal(true); + ClusterBuilder->set_enable_EMCal(true); + ClusterBuilder->set_noise(0.0025, 0.006, 0.03); + ClusterBuilder->set_significance(4.0, 2.0, 0.0); + ClusterBuilder->allow_corner_neighbor(true); + ClusterBuilder->set_do_split(true); + ClusterBuilder->set_minE_local_max(1.0, 2.0, 0.5); + ClusterBuilder->set_R_shower(0.025); + se->registerSubsystem(ClusterBuilder); + + // topoClustering only in EMCal (needed for particle flow) + RawClusterBuilderTopo* ClusterBuilder1 = new RawClusterBuilderTopo("HcalRawClusterBuilderTopo1"); + ClusterBuilder1->Verbosity(verbosity); + ClusterBuilder1->set_nodename("TOPOCLUSTER_EMCAL"); + ClusterBuilder1->set_enable_HCal(false); + ClusterBuilder1->set_enable_EMCal(true); + ClusterBuilder1->set_noise(0.0025, 0.006, 0.03); + ClusterBuilder1->set_significance(4.0, 2.0, 0.0); + ClusterBuilder1->allow_corner_neighbor(true); + ClusterBuilder1->set_do_split(true); + ClusterBuilder1->set_minE_local_max(1.0, 2.0, 0.5); + ClusterBuilder1->set_R_shower(0.025); + se->registerSubsystem(ClusterBuilder1); + + // topoClustering only in I+OHCal (needed for particle flow) + RawClusterBuilderTopo* ClusterBuilder2 = new RawClusterBuilderTopo("HcalRawClusterBuilderTopo2"); + ClusterBuilder2->Verbosity(verbosity); + ClusterBuilder2->set_nodename("TOPOCLUSTER_HCAL"); + ClusterBuilder2->set_enable_HCal(true); + ClusterBuilder2->set_enable_EMCal(false); + ClusterBuilder2->set_noise(0.0025, 0.006, 0.03); + ClusterBuilder2->set_significance(4.0, 2.0, 0.0); + ClusterBuilder2->allow_corner_neighbor(true); + ClusterBuilder2->set_do_split(true); + ClusterBuilder2->set_minE_local_max(1.0, 2.0, 0.5); + ClusterBuilder2->set_R_shower(0.025); + se->registerSubsystem(ClusterBuilder2); + + return; +} +#endif diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C new file mode 100644 index 000000000..9d3361f5d --- /dev/null +++ b/common/G4_Tracking.C @@ -0,0 +1,455 @@ +#ifndef MACRO_G4TRACKING_C +#define MACRO_G4TRACKING_C + +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libtrack_reco.so) +R__LOAD_LIBRARY(libtpccalib.so) +R__LOAD_LIBRARY(libqa_modules.so) + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +namespace Enable +{ + bool TRACKING_TRACK = false; + bool TRACKING_EVAL = false; + int TRACKING_VERBOSITY = 0; + bool TRACKING_QA = false; +} // namespace Enable + +namespace G4TRACKING +{ + // Space Charge calibration flag + bool SC_CALIBMODE = false; // this is anded with G4TPC::ENABLE_DISTORTIONS in TrackingInit() + bool SC_USE_MICROMEGAS = true; + bool SC_SAVEHISTOGRAMS = false; + double SC_COLLISIONRATE = 50e3; // leave at 50 KHz for now, scaling of distortion map not implemented yet + std::string SC_ROOTOUTPUT_FILENAME = "TpcSpaceChargeMatrices.root"; // space charge calibration output file + std::string SC_HISTOGRAMOUTPUT_FILENAME = "TpcResiduals.root"; // space charge calibration output file + + // Vertexing + bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit + + // Truth seeding options for diagnostics (can use any or all) + bool use_truth_silicon_seeding = false; // if true runs truth silicon seeding instead of acts silicon seeding + bool use_truth_tpc_seeding = false; // if true runs truth silicon seeding instead of reco TPC seeding + bool use_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only + // Full truth track seeding + bool use_full_truth_track_seeding = false; // makes track seeds using truth info, used for both Acts and Genfit + bool use_truth_vertexing = false; // if true runs truth vertexing, if false runs PHSimpleVertexFinder + + // Runs a converter from TrackSeed object to SvtxTrack object to enable + // use of the various evaluation tools already available + bool convert_seeds_to_svtxtracks = false; + +} // namespace G4TRACKING + +void TrackingInit() +{ + ACTSGEOM::ActsGeomInit(); + // space charge correction + /* corrections are applied in the track finding, and via TpcClusterMover before the final track fit */ + if( G4TPC::ENABLE_CORRECTIONS ) + { + auto se = Fun4AllServer::instance(); + auto tpcLoadDistortionCorrection = new TpcLoadDistortionCorrection; + tpcLoadDistortionCorrection->set_distortion_filename( G4TPC::correction_filename ); + se->registerSubsystem(tpcLoadDistortionCorrection); + } + +} + +void Tracking_Reco_TrackSeed() +{ + // !!!! THIS IS TEMPORARY, UNTIL CA SEEDER CAN HANDLE TRACKS FROM LARGE Z !!!!! + if(TRACKING::pp_mode) G4TRACKING::use_truth_tpc_seeding = true; + + // set up verbosity + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + // get fun4all server instance + auto se = Fun4AllServer::instance(); + + if (!G4TRACKING::use_full_truth_track_seeding) + { + // Assemble silicon clusters into track stubs + if (G4TRACKING::use_truth_silicon_seeding) + { + // For the silicon, for each truth particle, create a track and associate clusters with it using truth information, write to silicon track map + // track stubs are given the location of the truth vertex in this module + auto pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingSilicon"); + pat_rec->Verbosity(verbosity); + pat_rec->set_track_map_name("SiliconTrackSeedContainer"); + pat_rec->set_min_layer(0); + pat_rec->set_max_layer(G4MVTX::n_maps_layer + G4INTT::n_intt_layer); + se->registerSubsystem(pat_rec); + } else { + auto silicon_Seeding = new PHActsSiliconSeeding; + silicon_Seeding->Verbosity(verbosity); + silicon_Seeding->fieldMapName(G4MAGNET::magfield); + se->registerSubsystem(silicon_Seeding); + + auto merger = new PHSiliconSeedMerger; + merger->Verbosity(verbosity); + se->registerSubsystem(merger); + } + + // Assemble TPC clusters into track stubs + if (G4TRACKING::use_truth_tpc_seeding) + { + // For the TPC, for each truth particle, create a track and associate clusters with it using truth information, write to Svtx track map + // track stubs are given the position odf the truth vertex in this module + auto pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingTpc"); + pat_rec->Verbosity(verbosity); + pat_rec->set_track_map_name("TpcTrackSeedContainer"); + pat_rec->set_min_layer(G4MVTX::n_maps_layer + G4INTT::n_intt_layer); + pat_rec->set_max_layer(G4MVTX::n_maps_layer + G4INTT::n_intt_layer + G4TPC::n_gas_layer); + se->registerSubsystem(pat_rec); + + } else { + + auto seeder = new PHCASeeding("PHCASeeding"); + seeder->set_field_dir(G4MAGNET::magfield_rescale); // to get charge sign right + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + seeder->set_field_dir(-1 * G4MAGNET::magfield_rescale); + } + seeder->Verbosity(verbosity); + seeder->SetLayerRange(7, 55); + seeder->SetSearchWindow(0.01, 0.02); // (eta width, phi width) + seeder->SetMinHitsPerCluster(0); + seeder->SetMinClustersPerTrack(3); + seeder->useConstBField(false); + seeder->useFixedClusterError(true); + se->registerSubsystem(seeder); + + // expand stubs in the TPC using simple kalman filter + auto cprop = new PHSimpleKFProp("PHSimpleKFProp"); + cprop->set_field_dir(G4MAGNET::magfield_rescale); + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + cprop->set_field_dir(-1 * G4MAGNET::magfield_rescale); + } + cprop->useConstBField(false); + cprop->useFixedClusterError(true); + cprop->set_max_window(5.); + cprop->Verbosity(verbosity); + se->registerSubsystem(cprop); + } + + // match silicon track seeds to TPC track seeds + if (G4TRACKING::use_truth_si_matching) + { + std::cout << "Tracking_Reco_TrackSeed - Using truth Si matching " << std::endl; + // use truth particle matching in TPC to assign clusters in silicon to TPC tracks from CA seeder + auto silicon_assoc = new PHTruthSiliconAssociation; + silicon_assoc->Verbosity(verbosity); + se->registerSubsystem(silicon_assoc); + } else { + std::cout << "Tracking_Reco_TrackSeed - Using stub matching for Si matching " << std::endl; + // The normal silicon association methods + // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding + auto silicon_match = new PHSiliconTpcTrackMatching; + silicon_match->Verbosity(verbosity); + silicon_match->set_field(G4MAGNET::magfield); + silicon_match->set_field_dir(G4MAGNET::magfield_rescale); + silicon_match->set_pp_mode(TRACKING::pp_mode); + std::cout << "PHSiliconTpcTrackMatching pp_mode set to " << TRACKING::pp_mode << std::endl; + if (G4TRACKING::SC_CALIBMODE) + { + // search windows for initial matching with distortions + // tuned values are 0.04 and 0.008 in distorted events + silicon_match->set_phi_search_window(0.04); + silicon_match->set_eta_search_window(0.008); + } else { + // after distortion corrections and rerunning clustering, default tuned values are 0.02 and 0.004 in low occupancy events + silicon_match->set_phi_search_window(0.03); + silicon_match->set_eta_search_window(0.005); + } + silicon_match->set_test_windows_printout(false); // used for tuning search windows + se->registerSubsystem(silicon_match); + } + + // Associate Micromegas clusters with the tracks + if( Enable::MICROMEGAS ) + { + std::cout << "Tracking_Reco_TrackSeed - Using Micromegas matching " << std::endl; + + // Match TPC track stubs from CA seeder to clusters in the micromegas layers + auto mm_match = new PHMicromegasTpcTrackMatching; + mm_match->Verbosity(verbosity); + mm_match->set_sc_calib_mode(G4TRACKING::SC_CALIBMODE); + if (G4TRACKING::SC_CALIBMODE) + { + // calibration pass with distorted tracks + mm_match->set_collision_rate(G4TRACKING::SC_COLLISIONRATE); + // configuration is potentially with different search windows + mm_match->set_rphi_search_window_lyr1(0.2); + mm_match->set_rphi_search_window_lyr2(13.0); + mm_match->set_z_search_window_lyr1(26.0); + mm_match->set_z_search_window_lyr2(0.2); + } else { + // baseline configuration is (0.2, 13.0, 26, 0.2) and is the default + mm_match->set_rphi_search_window_lyr1(0.2); + mm_match->set_rphi_search_window_lyr2(13.0); + mm_match->set_z_search_window_lyr1(26.0); + mm_match->set_z_search_window_lyr2(0.2); + } + mm_match->set_min_tpc_layer(38); // layer in TPC to start projection fit + mm_match->set_test_windows_printout(false); // used for tuning search windows only + se->registerSubsystem(mm_match); + } + + } else { + + // full truth track finding + std::cout << "Tracking_Reco_TrackSeed - Using full truth track seeding" << std::endl; + + // For each truth particle, create a track and associate clusters with it using truth information, write to Svtx track map + // track stubs are given the position of the truth vertex in this module, but Genfit does not care + // Includes clusters for TPC, silicon and MM's + auto pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingFull"); + pat_rec->Verbosity(verbosity); + pat_rec->set_track_map_name("SvtxTrackSeedContainer"); + se->registerSubsystem(pat_rec); + + } + + /* + * all done + * at this stage tracks are fully assembled. They contain clusters spaning Silicon detectors, TPC and Micromegas + * they are ready to be fit. + */ + if(G4TRACKING::convert_seeds_to_svtxtracks) + { + TrackSeedTrackMapConverter *converter = new TrackSeedTrackMapConverter(); + // Default set to full SvtxTrackSeeds. Can be set to + // SiliconTrackSeedContainer or TpcTrackSeedContainer + converter->setTrackSeedName("SvtxTrackSeedContainer"); + converter->Verbosity(verbosity); + se->registerSubsystem(converter); + } + + +} + +void Tracking_Reco_TrackFit() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + auto se = Fun4AllServer::instance(); + + // correct clusters for particle propagation in TPC + auto deltazcorr = new PHTpcDeltaZCorrection; + deltazcorr->Verbosity(verbosity); + se->registerSubsystem(deltazcorr); + + + // perform final track fit with ACTS + auto actsFit = new PHActsTrkFitter; + actsFit->Verbosity(verbosity); + + // in calibration mode, fit only Silicons and Micromegas hits + actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); + actsFit->setUseMicromegas(G4TRACKING::SC_USE_MICROMEGAS); + se->registerSubsystem(actsFit); + + if (G4TRACKING::SC_CALIBMODE) + { + /* + * in calibration mode, calculate residuals between TPC and fitted tracks, + * store in dedicated structure for distortion correction + */ + auto residuals = new PHTpcResiduals; + residuals->setOutputfile(G4TRACKING::SC_ROOTOUTPUT_FILENAME); + residuals->setSavehistograms( G4TRACKING::SC_SAVEHISTOGRAMS ); + residuals->setHistogramOutputfile( G4TRACKING::SC_HISTOGRAMOUTPUT_FILENAME ); + residuals->setUseMicromegas(G4TRACKING::SC_USE_MICROMEGAS); + residuals->Verbosity(verbosity); + se->registerSubsystem(residuals); + } else { + + /* + * in full tracking mode, run track cleaner, vertex finder, + * propagete tracks to vertex + * propagate tracks to EMCAL + */ + + if( !G4TRACKING::use_full_truth_track_seeding ) + { + // Choose the best silicon matched track for each TPC track seed + /* this breaks in truth_track seeding mode because there is no TpcSeed */ + auto cleaner = new PHTrackCleaner; + cleaner->Verbosity(verbosity); + se->registerSubsystem(cleaner); + } + + if (G4TRACKING::use_truth_vertexing) + { + auto vtxing = new PHTruthVertexing; + vtxing->associate_tracks(true); + std::string trackmapnamef = "SvtxTrackMap"; + vtxing->set_track_map_name(trackmapnamef); + se->registerSubsystem(vtxing); + } else { + auto vtxfinder = new PHSimpleVertexFinder; + vtxfinder->Verbosity(verbosity); + se->registerSubsystem(vtxfinder); + } + + // Propagate track positions to the vertex position + auto vtxProp = new PHActsVertexPropagator; + vtxProp->Verbosity(verbosity); + se->registerSubsystem(vtxProp); + + // project tracks to EMCAL + auto projection = new PHActsTrackProjection; + projection->Verbosity(verbosity); + se->registerSubsystem(projection); + } + +} + +void Tracking_Reco() +{ + /* + * just a wrapper around track seeding and track fitting methods, + * to minimize disruption to existing steering macros + */ + Tracking_Reco_TrackSeed(); + Tracking_Reco_TrackFit(); +} + +void build_truthreco_tables() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + + // this module builds high level truth track association table. + // If this module is used, this table should be called before any evaluator calls. + // Removing this module, evaluation will still work but trace truth association through the layers of G4-hit-cluster + SvtxTruthRecoTableEval *tables = new SvtxTruthRecoTableEval(); + tables->Verbosity(verbosity); + se->registerSubsystem(tables); + + return; +} + +void Tracking_Eval(const std::string& outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + build_truthreco_tables(); + + //---------------- + // Tracking evaluation + //---------------- + SvtxEvaluator* eval; + eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile, "SvtxTrackMap", + G4MVTX::n_maps_layer, + G4INTT::n_intt_layer, + G4TPC::n_gas_layer, + G4MICROMEGAS::n_micromegas_layer); + eval->do_cluster_eval(true); + eval->do_g4hit_eval(true); + eval->do_hit_eval(true); // enable to see the hits that includes the chamber physics... + eval->do_gpoint_eval(true); + eval->do_vtx_eval_light(true); + eval->do_eval_light(true); + eval->set_use_initial_vertex(G4TRACKING::g4eval_use_initial_vertex); + bool embed_scan = true; + if(TRACKING::pp_mode) embed_scan = false; + eval->scan_for_embedded(embed_scan); // take all tracks if false - take only embedded tracks if true + eval->scan_for_primaries(embed_scan); // defaults to only thrown particles for ntp_gtrack + std::cout << "SvtxEvaluator: pp_mode set to " << TRACKING::pp_mode << " and scan_for_embedded set to " << embed_scan << std::endl; + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + +void Tracking_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::TRACKING_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + build_truthreco_tables(); + + QAG4SimulationTracking* qa = new QAG4SimulationTracking(); + // qa->addEmbeddingID(2); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + QAG4SimulationVertex* qa2 = new QAG4SimulationVertex(); + // qa2->addEmbeddingID(2); + qa2->Verbosity(verbosity); + se->registerSubsystem(qa2); + + // Acts Kalman Filter vertex finder + //================================= + QAG4SimulationVertex* qav = new QAG4SimulationVertex(); + // qav->addEmbeddingID(2); + qav->Verbosity(verbosity); + qav->setVertexMapName("SvtxVertexMapActs"); + se->registerSubsystem(qav); + + if (Input::UPSILON) + { + QAG4SimulationUpsilon* qa = new QAG4SimulationUpsilon(); + + for (int id : Input::UPSILON_EmbedIds) + { + qa->addEmbeddingID(id); + } + se->registerSubsystem(qa); + } +} + +#endif diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C new file mode 100644 index 000000000..edcb5a66a --- /dev/null +++ b/common/G4_TrackingService.C @@ -0,0 +1,262 @@ +#ifndef MACRO_G4TrackingService_C +#define MACRO_G4TrackingService_C + +#include +#include + +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include + +//MVTX Tracking Services + +//WARNING!!! DEPRECATED +//The service material has been replaced by the compiled class in coresoftware for the MVTX +//This is kept as reference only + +using namespace std; + +class ServiceStructure +{ + public: + ServiceStructure(); + + explicit ServiceStructure(const string &name, + const float &thickness_copper, + const float &thickness_water, + const float &thickness_plastic, + const float &thickness_carbon, + const float &zSouth, + const float &zNorth, + const float &rSouth, + const float &rNorth); + + virtual ~ServiceStructure(){}; + + const string get_name(); + const float get_thickness_copper(); + const float get_thickness_water(); + const float get_thickness_plastic(); + const float get_thickness_carbon(); + const float get_zSouth(); + const float get_zNorth(); + const float get_rSouth(); + const float get_rNorth(); + + private: + const string m_name = "service"; + const float m_thickness_copper = 0.0; + const float m_thickness_water = 0.0; + const float m_thickness_plastic = 0.0; + const float m_thickness_carbon = 0.0; + const float m_zSouth = 0.0; + const float m_zNorth = 0.0; + const float m_rSouth = 0.0; + const float m_rNorth = 0.0; +}; + +ServiceStructure::ServiceStructure(const string &name, + const float &thickness_copper, + const float &thickness_water, + const float &thickness_plastic, + const float &thickness_carbon, + const float &zSouth, + const float &zNorth, + const float &rSouth, + const float &rNorth) + : m_name(name) + , m_thickness_copper(thickness_copper) + , m_thickness_water(thickness_water) + , m_thickness_plastic(thickness_plastic) + , m_thickness_carbon(thickness_carbon) + , m_zSouth(zSouth) + , m_zNorth(zNorth) + , m_rSouth(rSouth) + , m_rNorth(rNorth) +{ +} + +const string ServiceStructure::get_name() { return m_name; } +const float ServiceStructure::get_thickness_copper() { return m_thickness_copper; } +const float ServiceStructure::get_thickness_water() { return m_thickness_water; } +const float ServiceStructure::get_thickness_plastic() { return m_thickness_plastic; } +const float ServiceStructure::get_thickness_carbon() { return m_thickness_carbon; } +const float ServiceStructure::get_zSouth() { return m_zSouth; } +const float ServiceStructure::get_zNorth() { return m_zNorth; } +const float ServiceStructure::get_rSouth() { return m_rSouth; } +const float ServiceStructure::get_rNorth() { return m_rNorth; } + +namespace Enable +{ + bool TrackingService = false; + bool TrackingService_ABSORBER = false; + bool TrackingService_OVERLAPCHECK = false; + int TrackingService_VERBOSITY = 0; + +} // namespace Enable + +namespace G4TrackingService +{ //List materials and radiation length in cm + string materials[] = {"G4_Cu", "G4_WATER", "G4_POLYETHYLENE", "PEEK"}; + const int nMaterials = sizeof(materials)/sizeof(materials[0]); + + float GlobalOffset = -15.0; + float BarrelOffset = 18.679; + float BarrelRadius = 10.33; //Inner radious of service barrel + float BarrelThickness = 0.436; //Thickness in cm + float BarrelLength = 121.24; //Length of cylinder in cm + float LayerThickness = 0.1; // + float CYSSConeThickness = 0.216; + float CYSSRibThickness = 0.170; + int subsysID = 0; + std::vector grey = {0.4, 0.4, 0.4}; +} // namespace G4TrackingService + +using namespace G4TrackingService; + +vector get_thickness(ServiceStructure *object) +{ + vector thickness = { object->get_thickness_copper() + , object->get_thickness_water() + , object->get_thickness_plastic() + , object->get_thickness_carbon()}; + return thickness; +} + +void TrackingServiceInit() +{ + double serviceRad = BarrelRadius + BarrelThickness; + double serviceMinZ = GlobalOffset - BarrelOffset - BarrelLength; + double serviceMaxZ = GlobalOffset; + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, serviceRad); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, serviceMinZ); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, serviceMaxZ); +} + +float TrackingServiceCone(ServiceStructure *object, PHG4Reco *g4Reco, float radius) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::TrackingService_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TrackingService_OVERLAPCHECK; + int verbosity = max(Enable::VERBOSITY, Enable::TrackingService_VERBOSITY); + + PHG4ConeSubsystem *cone; + + float innerRadiusSouth = object->get_rSouth(); + float innerRadiusNorth = object->get_rNorth(); + float length = abs(object->get_zNorth() - object->get_zSouth()); + vector thickness = get_thickness(object); + + for (int i = 0; i < nMaterials; ++i) + { + if (thickness[i] == 0) continue; + cone = new PHG4ConeSubsystem(object->get_name(), subsysID); + cone->Verbosity(verbosity); + cone->SetR1(innerRadiusSouth, innerRadiusSouth + thickness[i]); + cone->SetR2(innerRadiusNorth, innerRadiusNorth + thickness[i]); + cone->SetPlaceZ(object->get_zSouth() + length / 2 + GlobalOffset); + cone->SetZlength(length / 2); + cone->SetMaterial(materials[i]); + cone->SuperDetector("TrackingService"); + if (materials[i] == "PEEK") cone->set_color(grey[0], grey[1], grey[2], 1.); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + ++subsysID; + innerRadiusSouth += thickness[i] + 5e-7; + innerRadiusNorth += thickness[i] + 5e-7; + } + radius = max(innerRadiusSouth, innerRadiusNorth); + + return radius; +} + +float TrackingServiceCylinder(ServiceStructure *object, PHG4Reco *g4Reco, float radius) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::TrackingService_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TrackingService_OVERLAPCHECK; + int verbosity = max(Enable::VERBOSITY, Enable::TrackingService_VERBOSITY); + + PHG4CylinderSubsystem *cyl; + + float innerRadius = object->get_rSouth(); + float length = abs(object->get_zNorth() - object->get_zSouth()); + vector thickness = get_thickness(object); + + for (int i = 0; i < nMaterials; ++i) + { + if (thickness[i] == 0) continue; + cyl = new PHG4CylinderSubsystem(object->get_name(), subsysID); + cyl->Verbosity(verbosity); + cyl->set_double_param("place_z", object->get_zSouth() + length / 2 + GlobalOffset); + cyl->set_double_param("radius", innerRadius); + cyl->set_double_param("length", length); + cyl->set_string_param("material", materials[i]); + cyl->set_double_param("thickness", thickness[i]); + cyl->SuperDetector("TrackingService"); + if (materials[i] == "PEEK") cyl->set_color(grey[0], grey[1], grey[2], 1.); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + ++subsysID; + innerRadius += thickness[i] + 5e-7; + } + radius = innerRadius; + + return radius; +} + +float TrackingService(PHG4Reco *g4Reco, float radius) +{ + vector cylinders, cones; + + //Service Barrel + cylinders.push_back(new ServiceStructure("MVTXServiceBarrel_0", 0.05, 0.007, 0.313, BarrelThickness, -1. * (BarrelLength + BarrelOffset), -27.0, BarrelRadius, 0)); + cylinders.push_back(new ServiceStructure("MVTXServiceBarrel_1", 0, 0, 0, BarrelThickness, -27.0, -1. * BarrelOffset, 10.70 + CYSSConeThickness, 0)); + + cones.push_back(new ServiceStructure("connectL0", 0.005, 0., 0.066, 0, -26.9, -18.680, 10.10, 5.050)); + cones.push_back(new ServiceStructure("connectL1", 0.004, 0., 0.061, 0, -26.9, -18.000, 10.20, 7.338)); + cones.push_back(new ServiceStructure("connectL2", 0.004, 0., 0.058, 0, -26.9, -22.300, 10.30, 9.580)); + + //MVTX Layers + cylinders.push_back(new ServiceStructure("L0_0", 0.005, 0., 0.066, LayerThickness, -18.680, -16.579, 5.050, 0)); + cones.push_back(new ServiceStructure("L0_1", 0.006, 0., 0.088, LayerThickness, -16.578, -9.186, 5.050, 2.997)); + //cylinders.push_back(new ServiceStructure("L0_2", 0.008, 0., 0.110, LayerThickness, -9.185, 0, 2.997, 0)); + + cylinders.push_back(new ServiceStructure("L1_0", 0.004, 0., 0.061, LayerThickness, -17.970, -15.851, 7.338, 0)); + cones.push_back(new ServiceStructure("L1_1", 0.006, 0., 0.085, LayerThickness, -15.850, -8.938, 7.338, 3.799)); + //cylinders.push_back(new ServiceStructure("L1_2", 0.008, 0., 0.116, LayerThickness, -8.937, 0, 3.799, 0)); + + cylinders.push_back(new ServiceStructure("L2_0", 0.004, 0., 0.058, LayerThickness, -22.300, -15.206, 9.580, 0)); + cones.push_back(new ServiceStructure("L2_1", 0.006, 0., 0.09, LayerThickness, -15.205, -8.538, 9.650, 4.574)); + //cylinders.push_back(new ServiceStructure("L2_2", 0.009, 0., 0.121, LayerThickness, -8.537, 0, 4.574, 0)); + + //CYSS + cylinders.push_back(new ServiceStructure("CYSS_Cone_0", 0, 0, 0, CYSSConeThickness, -26.208, -15.68, 10.55, 0)); + cones.push_back(new ServiceStructure("CYSS_Cone_1", 0, 0, 0, CYSSConeThickness, -15.679, -8.619, 10.55, 5.302)); + cylinders.push_back(new ServiceStructure("CYSS_Cone_2", 0, 0, 0, CYSSConeThickness, -8.618, -6.18, 5.302, 0)); + + cylinders.push_back(new ServiceStructure("CYSS_Rib_0", 0, 0, 0, CYSSRibThickness, -21.719, -20.949, 9.762, 0)); + cones.push_back(new ServiceStructure("CYSS_Rib_1", 0, 0, 0, CYSSRibThickness, -20.948, -20.159, 9.762, 10.36)); + cylinders.push_back(new ServiceStructure("CYSS_Rib_2", 0, 0, 0, CYSSRibThickness, -20.158, -17.749, 10.36, 0)); + cones.push_back(new ServiceStructure("CYSS_Rib_3", 0, 0, 0, CYSSRibThickness, -17.748, -16.959, 10.36, 9.762)); + cylinders.push_back(new ServiceStructure("CYSS_Rib_4", 0, 0, 0, CYSSRibThickness, -16.958, -16.196, 9.762, 0)); + + cylinders.push_back(new ServiceStructure("CYSS_Cylinder", 0, 0, 0, 0.112, -8.619, 36.153, 5.15, 0)); + + for (ServiceStructure *cylinder : cylinders) radius += TrackingServiceCylinder(cylinder, g4Reco, radius); + for (ServiceStructure *cone : cones) radius += TrackingServiceCone(cone, g4Reco, radius); + + return radius; +} + +#endif diff --git a/common/G4_Tracking_Genfit.C b/common/G4_Tracking_Genfit.C new file mode 100644 index 000000000..fda93b33b --- /dev/null +++ b/common/G4_Tracking_Genfit.C @@ -0,0 +1,735 @@ +#ifndef MACRO_G4TRACKING_C +#define MACRO_G4TRACKING_C + +#include +#include + +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include +#include +#include + +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libtrack_reco.so) +R__LOAD_LIBRARY(libtpccalib.so) +R__LOAD_LIBRARY(libPHTpcTracker.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool TRACKING_TRACK = false; + bool TRACKING_EVAL = false; + int TRACKING_VERBOSITY = 0; + bool TRACKING_QA = false; +} // namespace Enable + +namespace G4TRACKING +{ + // Space Charge calibration flag + bool SC_CALIBMODE = true; // this is anded with G4TPC::ENABLE_DISTORTIONS in TrackingInit() + double SC_COLLISIONRATE = 50e3; // leave at 50 KHz for now, scaling of distortion map not implemented yet + std::string SC_ROOTOUTPUT_FILENAME = "TpcSpaceChargeMatrices.root"; // space charge calibration output file + + // Tracking reconstruction setup parameters and flags + //===================================== + + // The normal (default) Acts tracking chain is: + // PHActsSiliconSeeding // make silicon track seeds + // PHCASeeding // TPC track seeds + // PHTpcTrackSeedVertexAssoc // Associates TPC track seeds with a vertex, refines phi and eta + // PHSiliconTpcTrackMatching // match TPC track seeds to silicon track seeds + // PHMicromegasTpcTrackMatching // associate Micromegas clusters with TPC track stubs + // PHActsTrkFitter (1) // Kalman fitter makes fit to assembled tracks + // PHSimpleVertexFinder // final vertexing using fitted Acts tracks + // PHActsVertexPropagator // propagates track parameters to vertex position to get final dca + + // Possible variations + //==================================== + //Fittting + bool use_genfit = false; // if false, acts KF is run on proto tracks. If true, use Genfit track propagation and fitting + + // Vertexing + bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit + + // TPC seeding options + bool use_PHTpcTracker_seeding = false; // false for using the default PHCASeeding to get TPC track seeds, true to use PHTpcTracker + bool use_hybrid_seeding = false; // false for using the default PHCASeeding, true to use PHHybridSeeding (STAR core, ALICE KF) + bool use_propagator = true; // use PHSimpleKFProp for CA seeding if true + + // set to false to disable adding fake surfaces (TPC, Micromegas) to MakeActsGeom + bool add_fake_surfaces = true; + + // Truth seeding options (can use any or all) + bool use_truth_silicon_seeding = false; // if true runs truth silicon seeding instead of acts silicon seeding + bool use_truth_tpc_seeding = false; // if true runs truth silicon seeding instead of reco TPC seeding + bool use_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only + // Full truth track seeding + bool use_full_truth_track_seeding = false; // makes track seeds using truth info, used for both Acts and Genfit + bool use_truth_vertexing = false; // if true runs truth vertexing, if false runs PHSimpleVertexFinder + + // Rave final vertexing (for QA) + bool use_rave_vertexing = true; // Use Rave to find and fit for vertex after track fitting - used for QA only + // This is the setup we have been using - smeared truth vertex for a single collision per event. Make it the default for now. + std::string vmethod("avf-smoothing:1"); // only good for 1 vertex events // vmethod is a string used to set the Rave final-vertexing method: + +} // namespace G4TRACKING + +void TrackingInit() +{ +#if __cplusplus < 201703L + std::cout << std::endl; + std::cout << "Cannot run tracking without gcc-8.3 (c++17) environment. Please run:" << std::endl; + // + // the following gymnastics is needed to print out the correct shell script to source + // We have three cvmfs volumes: + // /cvmfs/sphenix.sdcc.bnl.gov (BNL internal) + // /cvmfs/sphenix.opensciencegrid.org (worldwide readable) + // /cvmfs/eic.opensciencegrid.org (Fun4All@EIC) + // We support tcsh and bash + // + std::string current_opt = getenv("OPT_SPHENIX"); + std::string x8664_sl7 = "x8664_sl7"; + std::string gcc83 = "gcc-8.3"; + size_t x8664pos = current_opt.find(x8664_sl7); + current_opt.replace(x8664pos, x8664_sl7.size(), gcc83); + std::string setupscript = "sphenix_setup"; + std::string setupscript_ext = ".csh"; + if (current_opt.find("eic") != string::npos) + setupscript = "eic_setup"; + std::string shell = getenv("SHELL"); + if (shell.find("tcsh") == string::npos) + setupscript_ext = ".sh"; + std::cout << "source " << current_opt << "/bin/" + << setupscript << setupscript_ext << " -n" << std::endl; + std::cout << "to set it up and try again" << std::endl; + gSystem->Exit(1); +#endif + + if (!Enable::MICROMEGAS) + { + G4MICROMEGAS::n_micromegas_layer = 0; + } + + // SC_CALIBMODE makes no sense if distortions are not present + G4TRACKING::SC_CALIBMODE = (G4TPC::ENABLE_STATIC_DISTORTIONS || G4TPC::ENABLE_TIME_ORDERED_DISTORTIONS ) && G4TRACKING::SC_CALIBMODE; + + // For now the TpcSpaceChargeCorrection module only works with the GenFit tracking chain + if (G4TPC::ENABLE_CORRECTIONS && !G4TRACKING::use_genfit) + { + std::cout << "Cannot enable space charge correction if not using GenFit tracking chain" << std::endl; + G4TPC::ENABLE_CORRECTIONS = false; + } + + // Check for colliding switches + if(G4TRACKING::use_hybrid_seeding && G4TRACKING::use_PHTpcTracker_seeding) + { + std::cerr << "***WARNING: MULTIPLE SEEDER OPTIONS SELECTED!***" << std::endl; + std::cerr << " Current config selects both PHTpcTracker and PHHybridSeeding." << std::endl; + std::cerr << " Revert to default...." << std::endl; + G4TRACKING::use_hybrid_seeding = false; + G4TRACKING::use_PHTpcTracker_seeding = false; + } + + /// Built the Acts geometry + Fun4AllServer* se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + #if __cplusplus >= 201703L + /// Geometry must be built before any Acts modules + MakeActsGeometry* geom = new MakeActsGeometry(); + geom->Verbosity(verbosity); + geom->setMagField(G4MAGNET::magfield); + geom->setMagFieldRescale(G4MAGNET::magfield_rescale); + geom->add_fake_surfaces( G4TRACKING::add_fake_surfaces ); + + /// Need a flip of the sign for constant field in tpc tracker + if(G4TRACKING::use_PHTpcTracker_seeding && + G4MAGNET::magfield.find(".root") == std::string::npos) + { + geom->setMagFieldRescale(-1 * G4MAGNET::magfield_rescale); + } + se->registerSubsystem(geom); + #endif + +} + +void Tracking_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + // processes the TrkrHits to make clusters, then reconstruct tracks and vertices + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + //---------------------------------------------------------------------------- + // Tracking + // Sections 1, 2 and 3 are alternatives to each other + // Section 1: Normal Acts tracking chain, with options for truth seeding + // Section 2: Truth track seeding with Acts fitting + // Section 3: Genfit tracking chain with option for truth track seeding + //------------------------------------------------------------------------------ + + //==================== + // Common to all sections + // Silicon seeding + //===================== + + // Assemble silicon clusters into track stubs - needed for initial vertex finding + //============================================================ + if(G4TRACKING::use_truth_silicon_seeding) + { + + // For the silicon, for each truth particle, create a track and associate clusters with it using truth information, write to silicon track map + // track stubs are given the location of the truth vertex in this module + PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingSilicon"); + pat_rec->Verbosity(verbosity); + pat_rec->set_track_map_name("SvtxSiliconTrackMap"); + pat_rec->set_min_layer(0); + pat_rec->set_max_layer( G4MVTX::n_maps_layer + G4INTT::n_intt_layer); + + se->registerSubsystem(pat_rec); + } + else + { + PHActsSiliconSeeding* silicon_Seeding = new PHActsSiliconSeeding(); + silicon_Seeding->Verbosity(verbosity); + silicon_Seeding->fieldMapName(G4MAGNET::magfield); + se->registerSubsystem(silicon_Seeding); + } + + //================================================ + // Section 1: Acts chain of track propagation and final fitting + //================================================ + if(!G4TRACKING::use_genfit && !G4TRACKING::use_full_truth_track_seeding) + { + // TPC track seeding (finds all clusters in TPC for tracks) + //============================================ + if(G4TRACKING::use_truth_tpc_seeding) + { + // For the TPC, for each truth particle, create a track and associate clusters with it using truth information, write to Svtx track map + // track stubs are given the position odf the truth vertex in this module + PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingTpc"); + pat_rec->Verbosity(verbosity); + pat_rec->set_track_map_name("SvtxTrackMap"); + pat_rec->set_min_layer( G4MVTX::n_maps_layer + G4INTT::n_intt_layer); + pat_rec->set_max_layer( G4MVTX::n_maps_layer + G4INTT::n_intt_layer + G4TPC::n_gas_layer); + + se->registerSubsystem(pat_rec); + } + else + { + std::cout << "Using normal TPC track seeding " << std::endl; + + // TPC track seeding from data + if (G4TRACKING::use_PHTpcTracker_seeding && !G4TRACKING::use_hybrid_seeding) + { + std::cout << " Using PHTpcTracker track seeding " << std::endl; + + PHTpcTracker* tracker = new PHTpcTracker("PHTpcTracker"); + tracker->set_seed_finder_options(3.0, M_PI / 8, 10, 6.0, M_PI / 8, 5, 1); // two-pass CA seed params + tracker->set_seed_finder_optimization_remove_loopers(true, 20.0, 10000.0); // true if loopers not needed + tracker->set_track_follower_optimization_helix(true); // false for quality, true for speed + tracker->set_track_follower_optimization_precise_fit(false); // true for quality, false for speed + tracker->enable_json_export(false); // save event as json, filename is automatic and stamped by current time in ms + tracker->enable_vertexing(false); // rave vertexing is pretty slow at large multiplicities... + tracker->Verbosity(verbosity); + se->registerSubsystem(tracker); + } + else if(G4TRACKING::use_hybrid_seeding && !G4TRACKING::use_PHTpcTracker_seeding) + { + std::cout << " Using PHHybridSeeding track seeding " << std::endl; + + PHHybridSeeding* hseeder = new PHHybridSeeding("PHHybridSeeding"); + hseeder->set_field_dir(G4MAGNET::magfield_rescale); + hseeder->setSearchRadius(3.,6.); // mm (iter1, iter2) + hseeder->setSearchAngle(M_PI/8.,M_PI/8.); // radians (iter1, iter2) + hseeder->setMinTrackSize(10,5); // (iter1, iter2) + hseeder->setNThreads(1); + hseeder->Verbosity(verbosity); + se->registerSubsystem(hseeder); + } + else + { + std::cout << " Using PHCASeeding track seeding " << std::endl; + + auto seeder = new PHCASeeding("PHCASeeding"); + seeder->set_field_dir(G4MAGNET::magfield_rescale); // to get charge sign right + if(G4MAGNET::magfield.find("3d") != std::string::npos) + { seeder->set_field_dir(-1*G4MAGNET::magfield_rescale); } + seeder->Verbosity(verbosity); + seeder->SetLayerRange(7, 55); + seeder->SetSearchWindow(0.01, 0.02); // (eta width, phi width) + seeder->SetMinHitsPerCluster(0); + if(G4TRACKING::use_propagator) seeder->SetMinClustersPerTrack(3); + else seeder->SetMinClustersPerTrack(20); + seeder->useConstBField(false); + seeder->useFixedClusterError(true); + se->registerSubsystem(seeder); + + if(G4TRACKING::use_propagator) + { + PHTpcTrackSeedCircleFit* vtxassoc2 = new PHTpcTrackSeedCircleFit("PrePropagatorPHTpcTrackSeedCircleFit"); + vtxassoc2->Verbosity(verbosity); + se->registerSubsystem(vtxassoc2); + + std::cout << " Using PHSimpleKFProp propagator " << std::endl; + PHSimpleKFProp* cprop = new PHSimpleKFProp("PHSimpleKFProp"); + cprop->set_field_dir(G4MAGNET::magfield_rescale); + if(G4MAGNET::magfield.find("3d") != std::string::npos) + { cprop->set_field_dir(-1*G4MAGNET::magfield_rescale); } + cprop->useConstBField(false); + cprop->useFixedClusterError(true); + cprop->set_max_window(5.); + cprop->Verbosity(verbosity); + se->registerSubsystem(cprop); + } + } + } + + // Associate TPC track stubs with silicon and Micromegas + //============================================= + + // This does not care which seeder is used + // It refines the phi and eta of the TPC tracklet prior to matching with the silicon tracklet + PHTpcTrackSeedCircleFit *vtxassoc = new PHTpcTrackSeedCircleFit(); + vtxassoc->Verbosity(verbosity); + se->registerSubsystem(vtxassoc); + + // Choose the best duplicate TPC track seed + PHGhostRejection *ghosts= new PHGhostRejection(); + ghosts->Verbosity(verbosity); + se->registerSubsystem(ghosts); + + // Silicon cluster matching to TPC track seeds + if (G4TRACKING::use_truth_si_matching) + { + std::cout << " Using truth Si matching " << std::endl; + // use truth particle matching in TPC to assign clusters in silicon to TPC tracks from CA seeder + // intended only for diagnostics + PHTruthSiliconAssociation* silicon_assoc = new PHTruthSiliconAssociation(); + silicon_assoc->Verbosity(verbosity); + se->registerSubsystem(silicon_assoc); + } + else + { + std::cout << " Using stub matching for Si matching " << std::endl; + + // The normal silicon association methods + // start with a complete TPC track seed from one of the CA seeders + + // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding + PHSiliconTpcTrackMatching* silicon_match = new PHSiliconTpcTrackMatching(); + silicon_match->Verbosity(verbosity); + silicon_match->set_field(G4MAGNET::magfield); + silicon_match->set_field_dir(G4MAGNET::magfield_rescale); + silicon_match->set_sc_calib_mode(G4TRACKING::SC_CALIBMODE); + if (G4TRACKING::SC_CALIBMODE) + { + silicon_match->set_collision_rate(G4TRACKING::SC_COLLISIONRATE); + // search windows for initial matching with distortions + // tuned values are 0.04 and 0.008 in distorted events + silicon_match->set_phi_search_window(0.04); + silicon_match->set_eta_search_window(0.008); + } + else + { + // after distortion corrections and rerunning clustering, default tuned values are 0.02 and 0.004 in low occupancy events + silicon_match->set_phi_search_window(0.03); + silicon_match->set_eta_search_window(0.005); + } + silicon_match->set_test_windows_printout(false); // used for tuning search windows only + se->registerSubsystem(silicon_match); + } + + // Associate Micromegas clusters with the tracks + if (G4MICROMEGAS::n_micromegas_layer > 0) + { + std::cout << " Using Micromegas matching " << std::endl; + + // Match TPC track stubs from CA seeder to clusters in the micromegas layers + PHMicromegasTpcTrackMatching* mm_match = new PHMicromegasTpcTrackMatching(); + mm_match->Verbosity(verbosity); + mm_match->set_sc_calib_mode(G4TRACKING::SC_CALIBMODE); + if (G4TRACKING::SC_CALIBMODE) + { + // calibration pass with distorted tracks + mm_match->set_collision_rate(G4TRACKING::SC_COLLISIONRATE); + // configuration is potentially with different search windows + mm_match->set_rphi_search_window_lyr1(0.2); + mm_match->set_rphi_search_window_lyr2(13.0); + mm_match->set_z_search_window_lyr1(26.0); + mm_match->set_z_search_window_lyr2(0.2); + } + else + { + // baseline configuration is (0.2, 13.0, 26, 0.2) and is the default + mm_match->set_rphi_search_window_lyr1(0.2); + mm_match->set_rphi_search_window_lyr2(13.0); + mm_match->set_z_search_window_lyr1(26.0); + mm_match->set_z_search_window_lyr2(0.2); + } + mm_match->set_min_tpc_layer(38); // layer in TPC to start projection fit + mm_match->set_test_windows_printout(false); // used for tuning search windows only + se->registerSubsystem(mm_match); + } + + // Final fitting of tracks using Acts Kalman Filter + //===================================== + + std::cout << " Using Acts track fitting " << std::endl; + + PHActsTrkFitter* actsFit = new PHActsTrkFitter("PHActsFirstTrkFitter"); + actsFit->Verbosity(verbosity); + actsFit->doTimeAnalysis(false); + /// If running with distortions, fit only the silicon+MMs first + actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); + se->registerSubsystem(actsFit); + + if (G4TRACKING::SC_CALIBMODE) + { + /// run tpc residual determination with silicon+MM track fit + auto residuals = new PHTpcResiduals; + residuals->setOutputfile( G4TRACKING::SC_ROOTOUTPUT_FILENAME ); + residuals->Verbosity(verbosity); + se->registerSubsystem(residuals); + } + + // Choose the best silicon matched track for each TPC track seed + PHTrackCleaner *cleaner= new PHTrackCleaner(); + cleaner->Verbosity(verbosity); + se->registerSubsystem(cleaner); + + if(G4TRACKING::use_truth_vertexing) + { + PHTruthVertexing *vtxing = new PHTruthVertexing(); + vtxing->associate_tracks(true); + std::string trackmapnamef = "SvtxTrackMap"; + vtxing->set_track_map_name(trackmapnamef); + se->registerSubsystem(vtxing); + } + else + { + PHSimpleVertexFinder *vtxfinder = new PHSimpleVertexFinder(); + vtxfinder->Verbosity(verbosity); + se->registerSubsystem(vtxfinder); + } + + /// Propagate track positions to the vertex position + PHActsVertexPropagator *vtxProp = new PHActsVertexPropagator(); + vtxProp->Verbosity(verbosity); + se->registerSubsystem(vtxProp); + + } + + //========================================================= + // Section 2: Full truth track finding with Acts final fitting + //========================================================= + if( !G4TRACKING::use_genfit && G4TRACKING::use_full_truth_track_seeding) + { + std::cout << " Using full truth track seeding for Acts" << std::endl; + + // For each truth particle, create a track and associate clusters with it using truth information, write to Svtx track map + // track stubs are given the position of the truth vertex in this module, but Genfit does not care + // Includes clusters for TPC, silicon and MM's + PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingFull"); + pat_rec->Verbosity(verbosity); + pat_rec->set_track_map_name("SvtxTrackMap"); + se->registerSubsystem(pat_rec); + + // Fitting of tracks using Acts Kalman Filter + //================================== + + std::cout << " Using Acts track fitting " << std::endl; + + PHActsTrkFitter* actsFit = new PHActsTrkFitter("PHActsFirstTrkFitter"); + actsFit->Verbosity(verbosity); + actsFit->doTimeAnalysis(false); + /// If running with distortions, fit only the silicon+MMs first + actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); + se->registerSubsystem(actsFit); + + if (G4TRACKING::SC_CALIBMODE) + { + /// run tpc residual determination with silicon+MM track fit + auto residuals = new PHTpcResiduals; + residuals->setOutputfile( G4TRACKING::SC_ROOTOUTPUT_FILENAME ); + residuals->Verbosity(verbosity); + se->registerSubsystem(residuals); + } + + PHSimpleVertexFinder *finder = new PHSimpleVertexFinder(); + finder->Verbosity(verbosity); + se->registerSubsystem(finder); + + } + + //========================================================= + // Section 3: Genfit track propagation and final fitting + // Silicon association is by track propagation + //======================================================== + if (G4TRACKING::use_genfit) + { + // Track seeding + //============ + if(G4TRACKING::use_full_truth_track_seeding) + { + std::cout << " Using truth track seeding for Genfit" << std::endl; + + // For each truth particle, create a track and associate clusters with it using truth information, write to Svtx track map + // tracks are given the position of the truth particle vertex in this module, but Genfit does not care + // Includes clusters for TPC, silicon and MM's + PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingFull"); + pat_rec->Verbosity(verbosity); + pat_rec->set_track_map_name("SvtxTrackMap"); + se->registerSubsystem(pat_rec); + } + else + { + // need TPC track seeds to give to GenfitTrkProp + + // TPC track seeding from data + if (G4TRACKING::use_PHTpcTracker_seeding && !G4TRACKING::use_hybrid_seeding) + { + std::cout << " Using PHTpcTracker track seeding " << std::endl; + + PHTpcTracker* tracker = new PHTpcTracker("PHTpcTracker"); + tracker->set_seed_finder_options(3.0, M_PI / 8, 10, 6.0, M_PI / 8, 5, 1); // two-pass CA seed params + tracker->set_seed_finder_optimization_remove_loopers(true, 20.0, 10000.0); // true if loopers not needed + tracker->set_track_follower_optimization_helix(true); // false for quality, true for speed + tracker->set_track_follower_optimization_precise_fit(false); // true for quality, false for speed + tracker->enable_json_export(false); // save event as json, filename is automatic and stamped by current time in ms + tracker->enable_vertexing(false); // rave vertexing is pretty slow at large multiplicities... + tracker->Verbosity(verbosity); + se->registerSubsystem(tracker); + } + else if(G4TRACKING::use_hybrid_seeding && !G4TRACKING::use_PHTpcTracker_seeding) + { + std::cout << " Using PHHybridSeeding track seeding " << std::endl; + PHHybridSeeding* hseeder = new PHHybridSeeding("PHHybridSeeding"); + hseeder->set_field_dir(G4MAGNET::magfield_rescale); + hseeder->setSearchRadius(3.,6.); // mm (iter1, iter2) + hseeder->setSearchAngle(M_PI/8.,M_PI/8.); // radians (iter1, iter2) + hseeder->setMinTrackSize(10,5); // (iter1, iter2) + hseeder->setNThreads(1); + hseeder->Verbosity(verbosity); + se->registerSubsystem(hseeder); + } + else + { + std::cout << " Using PHCASeeding track seeding " << std::endl; + + auto seeder = new PHCASeeding("PHCASeeding"); + seeder->set_field_dir(G4MAGNET::magfield_rescale); // to get charge sign right + seeder->Verbosity(verbosity); + seeder->SetLayerRange(7, 55); + seeder->SetSearchWindow(0.01, 0.02); // (eta width, phi width) + seeder->SetMinHitsPerCluster(2); + seeder->SetMinClustersPerTrack(20); + se->registerSubsystem(seeder); + } + + std::cout << " Using PHGenFitTrkProp " << std::endl; + + // Association of TPC track seeds with all TPC layers, silicon layers and Micromegas layers + // Find all clusters associated with each seed track + auto track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", + G4MVTX::n_maps_layer, + G4INTT::n_intt_layer, + G4TPC::n_gas_layer, + G4MICROMEGAS::n_micromegas_layer); + track_prop->Verbosity(verbosity); + se->registerSubsystem(track_prop); + for (int i = 0; i < G4INTT::n_intt_layer; i++) + { + // strip length is along theta + track_prop->set_max_search_win_theta_intt(i, 0.200); + track_prop->set_min_search_win_theta_intt(i, 0.200); + track_prop->set_max_search_win_phi_intt(i, 0.0050); + track_prop->set_min_search_win_phi_intt(i, 0.000); + } + } + + std::cout << " Using Genfit track fitting " << std::endl; + + auto kalman = new PHGenFitTrkFitter; + kalman->Verbosity(verbosity); + kalman->set_vertexing_method(G4TRACKING::vmethod); + kalman->set_use_truth_vertex(false); + + // in space charge calibration mode, disable the tpc + if( G4TRACKING::SC_CALIBMODE ) + { + std::cout << "Tracking_reco - Disabling TPC layers from kalman filter" << std::endl; + for( int layer = 7; layer < 23; ++layer ) { kalman->disable_layer( layer ); } + for( int layer = 23; layer < 39; ++layer ) { kalman->disable_layer( layer ); } + for( int layer = 39; layer < 55; ++layer ) { kalman->disable_layer( layer ); } + } + + se->registerSubsystem(kalman); + + if( G4TRACKING::SC_CALIBMODE ) + { + // Genfit based Tpc space charge Reconstruction + auto tpcSpaceChargeReconstruction = new TpcSpaceChargeReconstruction; + tpcSpaceChargeReconstruction->set_outputfile( G4TRACKING::SC_ROOTOUTPUT_FILENAME ); + se->registerSubsystem(tpcSpaceChargeReconstruction); + } + + } + + //================================== + // Common to all sections + //================================== + + // Final vertex finding and fitting with RAVE + //================================== + if (G4TRACKING::use_rave_vertexing) + { + PHRaveVertexing* rave = new PHRaveVertexing(); + // rave->set_vertexing_method("kalman-smoothing:1"); + rave->set_over_write_svtxvertexmap(false); + rave->set_svtxvertexmaprefit_node_name("SvtxVertexMapRave"); + rave->Verbosity(verbosity); + se->registerSubsystem(rave); + } + + // Track Projections + //=============== + PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); + projection->Verbosity(verbosity); + se->registerSubsystem(projection); + + return; +} + +void Tracking_Eval(const std::string& outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + //---------------- + // Tracking evaluation + //---------------- + SvtxEvaluator* eval; + eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile, "SvtxTrackMap", + G4MVTX::n_maps_layer, + G4INTT::n_intt_layer, + G4TPC::n_gas_layer, + G4MICROMEGAS::n_micromegas_layer); + eval->do_cluster_eval(true); + eval->do_g4hit_eval(true); + eval->do_hit_eval(true); // enable to see the hits that includes the chamber physics... + eval->do_gpoint_eval(true); + eval->do_vtx_eval_light(true); + eval->do_eval_light(true); + eval->set_use_initial_vertex(G4TRACKING::g4eval_use_initial_vertex); + eval->set_use_genfit_vertex(G4TRACKING::use_genfit); + eval->scan_for_embedded(true); // take all tracks if false - take only embedded tracks if true + eval->scan_for_primaries(true); // defaults to only thrown particles for ntp_gtrack + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + +void Tracking_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::TRACKING_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + QAG4SimulationTracking* qa = new QAG4SimulationTracking(); + // qa->addEmbeddingID(2); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + QAG4SimulationVertex* qa2 = new QAG4SimulationVertex(); + // qa2->addEmbeddingID(2); + qa2->Verbosity(verbosity); + se->registerSubsystem(qa2); + + if (G4TRACKING::use_rave_vertexing) + { + QAG4SimulationVertex* qav = new QAG4SimulationVertex(); + // qav->addEmbeddingID(2); + qav->Verbosity(verbosity); + qav->setVertexMapName("SvtxVertexMapRave"); + se->registerSubsystem(qav); + } + + // Acts Kalman Filter vertex finder + //================================= + if (!G4TRACKING::use_genfit) + { +#if __cplusplus >= 201703L + + QAG4SimulationVertex* qav = new QAG4SimulationVertex(); + // qav->addEmbeddingID(2); + qav->Verbosity(verbosity); + qav->setVertexMapName("SvtxVertexMapActs"); + se->registerSubsystem(qav); +#endif + } + + if (Input::UPSILON) + { + QAG4SimulationUpsilon* qa = new QAG4SimulationUpsilon(); + + for (int id : Input::UPSILON_EmbedIds) + { + qa->addEmbeddingID(id); + } + se->registerSubsystem(qa); + } +} + +#endif diff --git a/common/G4_User.C b/common/G4_User.C new file mode 100644 index 000000000..2bf718d04 --- /dev/null +++ b/common/G4_User.C @@ -0,0 +1,53 @@ +#ifndef MACRO_G4USER_C +#define MACRO_G4USER_C + +#include + +R__LOAD_LIBRARY(libfun4all.so) + +class PHG4Reco; + +namespace Enable +{ +// if you want this to run by default, initialize this to true +// Otherwise you have to use Enable::USER = true; in your macro + bool USER = false; + int USER_VERBOSITY = 0; +} + +namespace G4USER +{ +// here you can set parameters in your macro via +// G4USER::myparam = 1; +// add as many as you need + int myparam = 0; +} + +// This initializes the G4 part if you have a detector implemented +// You need to tell its dimensions to the surrounding black hole +void UserInit() +{ + // set the black hole dimensions surrounding the detector + // XXX: maximum radius of your detector + // YYY: maximum extension in z + // ZZZ: maximum extension in -z (use -ZZZ) + //BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, XXX); + //BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, YYY); + //BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, ZZZ); +} + +// If you have a detector - here goes the setup +void UserDetector(PHG4Reco *g4Reco) +{ + return; +} + +// Any analysis goes here (registering your module with Fun4All) +void UserAnalysisInit() +{ + Fun4AllServer* se = Fun4AllServer::instance(); + + return; +} + +#endif diff --git a/common/G4_World.C b/common/G4_World.C new file mode 100644 index 000000000..eacb53a83 --- /dev/null +++ b/common/G4_World.C @@ -0,0 +1,34 @@ +#ifndef MACRO_G4WORLD_C +#define MACRO_G4WORLD_C + +#include + +#include + +R__LOAD_LIBRARY(libg4testbench.so) + +namespace G4WORLD +{ + double AddSpace = 100.; // add this much space in cm around edge of detector + string WorldMaterial = "G4_AIR"; // default world material, use G4_Galactic for material scan + string PhysicsList = "FTFP_BERT"; // for calorimeters use HP lists +} // namespace G4WORLD + +void WorldInit(PHG4Reco *g4Reco) +{ + g4Reco->SetWorldMaterial(G4WORLD::WorldMaterial); + g4Reco->SetPhysicsList(G4WORLD::PhysicsList); +} + +void WorldSize(PHG4Reco *g4Reco, double radius) +{ + double world_radius = std::max((BlackHoleGeometry::max_radius + BlackHoleGeometry::gap), radius); + g4Reco->SetWorldSizeY(std::max(g4Reco->GetWorldSizeY(), world_radius + G4WORLD::AddSpace)); + // our world is a symmetric cylinder so the center is at 0/0/0, pick the largest of abs(min_z) || abs(max_z) + double min_zval = std::min((BlackHoleGeometry::min_z - BlackHoleGeometry::gap), -((g4Reco->GetWorldSizeZ() - 100) / 2.)); + double max_zval = std::max((BlackHoleGeometry::max_z + BlackHoleGeometry::gap), (g4Reco->GetWorldSizeZ() - 100) / 2.); + double final_zval = std::max(fabs(min_zval), fabs(max_zval) + G4WORLD::AddSpace); + g4Reco->SetWorldSizeZ(std::max(g4Reco->GetWorldSizeZ(), 2 * (final_zval))); + return; +} +#endif diff --git a/common/G4_ZDC.C b/common/G4_ZDC.C new file mode 100644 index 000000000..abbae7c21 --- /dev/null +++ b/common/G4_ZDC.C @@ -0,0 +1,149 @@ +#ifndef MACRO_G4ZDC_C +#define MACRO_G4ZDC_C + +#include + +#include + +#include +#include + +#include +#include +#include + +#include + +#include + +#include + +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) + +namespace Enable +{ + bool ZDC = false; + bool ZDC_ABSORBER = false; + bool ZDC_SUPPORT = false; + bool ZDC_TOWER = false; + bool ZDC_EVAL = false; + bool ZDC_OVERLAPCHECK = false; + int ZDC_VERBOSITY = 0; +} // namespace Enable + +namespace G4ZDC +{ + double Gz0 = 1900.; + double outer_radius = 180.; + string calibfile = "ZDC/mapping/towerMap_ZDC.txt"; + double ZDCPlaceZ = 1843.0; + +} // namespace G4ZDC + +void ZDCInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4ZDC::outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4ZDC::Gz0); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4ZDC::Gz0); +} + +void ZDCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::ZDC_ABSORBER || (absorberactive > 0); + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::ZDC_OVERLAPCHECK; + + bool SupportActive = Enable::SUPPORT || Enable::ZDC_SUPPORT; + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4ZDCSubsystem *zdc = new PHG4ZDCSubsystem("ZDC",PHG4ZDCDefs::NORTH); +// place zdc in beam enclosure + zdc->set_double_param("place_z", G4ZDC::ZDCPlaceZ - G4BEAMLINE::enclosure_center); + zdc->OverlapCheck(OverlapCheck); + zdc->SetActive(); + zdc->SuperDetector("ZDC"); + if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); + if (SupportActive) zdc->SetSupportActive(SupportActive); + zdc->SetMotherSubsystem(G4BEAMLINE::ForwardBeamLineEnclosure); + g4Reco->registerSubsystem(zdc); + + zdc = new PHG4ZDCSubsystem("ZDC", PHG4ZDCDefs::SOUTH); +// place zdc in beam enclosure + zdc->set_double_param("place_z", G4ZDC::ZDCPlaceZ - G4BEAMLINE::enclosure_center); + zdc->OverlapCheck(OverlapCheck); + zdc->SetActive(); + zdc->SuperDetector("ZDC"); + if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); + if (SupportActive) zdc->SetSupportActive(SupportActive); + zdc->SetMotherSubsystem(G4BEAMLINE::BackwardBeamLineEnclosure); + g4Reco->registerSubsystem(zdc); +} + +void ZDC_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::ZDC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + string mapping_zdc = string(getenv("CALIBRATIONROOT")) + "/" + G4ZDC::calibfile; + + RawTowerBuilderByHitIndex *tower_ZDC = new RawTowerBuilderByHitIndex("TowerBuilder_ZDC"); + tower_ZDC->Detector("ZDC"); + tower_ZDC->set_sim_tower_node_prefix("SIM"); + tower_ZDC->GeometryTableFile(mapping_zdc); + se->registerSubsystem(tower_ZDC); + + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("ZDCRawTowerDigitizer"); + TowerDigitizer->Detector("ZDC"); + TowerDigitizer->TowerType(0); + TowerDigitizer->Verbosity(verbosity); + TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem(TowerDigitizer); + //SMD + RawTowerDigitizer *TowerDigitizer1 = new RawTowerDigitizer("ZDCRawTowerDigitizer1"); + TowerDigitizer1->Detector("ZDC"); + TowerDigitizer1->TowerType(1); + TowerDigitizer1->Verbosity(verbosity); + TowerDigitizer1->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem(TowerDigitizer1); + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("ZDCRawTowerCalibration"); + TowerCalibration->Detector("ZDC"); + TowerCalibration->TowerType(0); + TowerCalibration->Verbosity(verbosity); + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration->set_calib_const_GeV_ADC(1.0); // sampling fraction = 0.010 + TowerCalibration->set_pedstal_ADC(0); + se->registerSubsystem(TowerCalibration); + + RawTowerCalibration *TowerCalibration1 = new RawTowerCalibration("ZDCRawTowerCalibration1"); + TowerCalibration1->Detector("ZDC"); + TowerCalibration1->TowerType(1); + TowerCalibration1->Verbosity(verbosity); + TowerCalibration1->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration1->set_calib_const_GeV_ADC(1.0); + TowerCalibration1->set_pedstal_ADC(0); + se->registerSubsystem(TowerCalibration1); +} + +void ZDC_Eval(std::string outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::ZDC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("ZDCEVALUATOR", "ZDC", outputfile); + eval->set_do_cluster_eval(false); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} +#endif diff --git a/common/GlobalVariables.C b/common/GlobalVariables.C new file mode 100644 index 000000000..13c6b90f7 --- /dev/null +++ b/common/GlobalVariables.C @@ -0,0 +1,102 @@ +#ifndef MACRO_GLOBALVARIABLES_C +#define MACRO_GLOBALVARIABLES_C + +#include +#include + +double no_overlapp = 0.0001; + +// These Input settings are needed in multiple Input selections +// Putting those here avoids include file ordering problems +namespace Input +{ + bool HEPMC = false; + bool EMBED = false; + bool READEIC = false; + + bool UPSILON = false; + std::set UPSILON_EmbedIds; +} // namespace Input + +namespace DstOut +{ + std::string OutputDir = "."; + std::string OutputFile = "test.root"; +} // namespace DstOut + +// Global settings affecting multiple subsystems +namespace Enable +{ + bool ABSORBER = false; + bool DSTOUT = false; + bool DSTOUT_COMPRESS = false; + bool OVERLAPCHECK = false; + bool SUPPORT = false; + bool XPLOAD = false; + int VERBOSITY = 0; +} // namespace Enable + +// every G4 subsystem needs to implement this +// rather than forcing another include file, +// let's put this into the GlobalVariables.C +namespace BlackHoleGeometry +{ + double max_radius = 0.; // this is needed for the overall dimension of the black hole + double min_z = 0.; + double max_z = 0.; + double gap = no_overlapp; + bool visible = false; +}; // namespace BlackHoleGeometry + +namespace G4P6DECAYER +{ + EDecayType decayType = EDecayType::kAll; +} + +// our various tracking macro +namespace TRACKING +{ + std::string TrackNodeName = "SvtxTrackMap"; + bool pp_mode = false; + double pp_extended_readout_time = 7000.0; // ns +} + +namespace G4MAGNET +{ + // initialize to garbage values - the override is done in the respective + // MagnetInit() functions. If used standalone (without the G4_Magnet include) + // like in the tracking - those need to be set in the Fun4All macro + double magfield_rescale = NAN; + std::string magfield; +} // namespace G4MAGNET + +namespace XPLOAD +{ + std::string config = "sPHENIX_cdb"; + std::string tag = "TEST"; + uint64_t timestamp = 12345678912345; +} // namespace XPLOAD + +namespace Enable +{ + bool MICROMEGAS = false; +} + +namespace G4MICROMEGAS +{ + // number of micromegas layers + int n_micromegas_layer = 2; +} // namespace G4MICROMEGAS + +namespace G4TPC +{ + double tpc_drift_velocity_reco= 8.0 / 1000.0; // cm/ns // this is the Ne version of the gas +} + +namespace G4TRACKING +{ + bool init_acts_magfield = true; +} + + +#endif diff --git a/common/QA.C b/common/QA.C new file mode 100644 index 000000000..594a4ca5f --- /dev/null +++ b/common/QA.C @@ -0,0 +1,42 @@ +#ifndef MACRO_QA_C +#define MACRO_QA_C + +#include +#include +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + // if you want this to run by default, initialize this to true + // Otherwise you have to use Enable::USER = true; in your macro + bool QA = false; + int QA_VERBOSITY = 0; +} // namespace Enable + +namespace QA +{ + // int myparam = 0; +} // namespace QA + +// QA moduel combining tracking and calorimeters +void QA_G4CaloTracking() +{ + Fun4AllServer* se = Fun4AllServer::instance(); + QAG4SimulationCalorimeterSum* calo_qa = new QAG4SimulationCalorimeterSum(); + calo_qa->Verbosity(Enable::QA_VERBOSITY); + se->registerSubsystem(calo_qa); + return; +} + +// run this after se->run() to output QA histogram file for all QA modules +void QA_Output(const std::string& qaOutputFileName) +{ + Fun4AllServer* se = Fun4AllServer::instance(); + QAHistManagerDef::saveQARootFile(qaOutputFileName); + return; +} + +#endif diff --git a/common/sPhenixStyle.C b/common/sPhenixStyle.C new file mode 100644 index 000000000..f958e92cc --- /dev/null +++ b/common/sPhenixStyle.C @@ -0,0 +1,115 @@ +// +// sPHENIX Style, based on a style file from BaBar, v0.1 +// + +#include + +#include +#include + +#include + +void SetsPhenixStyle() +{ + static TStyle* sphenixStyle = 0; + std::cout << "sPhenixStyle: Applying nominal settings." << std::endl; + if (sphenixStyle == 0) sphenixStyle = sPhenixStyle(); + gROOT->SetStyle("sPHENIX"); + gROOT->ForceStyle(); +} + +TStyle* sPhenixStyle() +{ + TStyle* sphenixStyle = new TStyle("sPHENIX", "sPHENIX style"); + + // use plain black on white colors + Int_t icol = 0; // WHITE + sphenixStyle->SetFrameBorderMode(icol); + sphenixStyle->SetFrameFillColor(icol); + sphenixStyle->SetCanvasBorderMode(icol); + sphenixStyle->SetCanvasColor(icol); + sphenixStyle->SetPadBorderMode(icol); + sphenixStyle->SetPadColor(icol); + sphenixStyle->SetStatColor(icol); + //sphenixStyle->SetFillColor(icol); // don't use: white fill color for *all* objects + + // set the paper & margin sizes + sphenixStyle->SetPaperSize(20, 26); + + // set margin sizes + sphenixStyle->SetPadTopMargin(0.05); + sphenixStyle->SetPadRightMargin(0.05); + sphenixStyle->SetPadBottomMargin(0.16); + sphenixStyle->SetPadLeftMargin(0.16); + + // set title offsets (for axis label) + sphenixStyle->SetTitleXOffset(1.4); + sphenixStyle->SetTitleYOffset(1.4); + + // use large fonts + //Int_t font=72; // Helvetica italics + Int_t font = 42; // Helvetica + Double_t tsize = 0.05; + sphenixStyle->SetTextFont(font); + + sphenixStyle->SetTextSize(tsize); + sphenixStyle->SetLabelFont(font, "x"); + sphenixStyle->SetTitleFont(font, "x"); + sphenixStyle->SetLabelFont(font, "y"); + sphenixStyle->SetTitleFont(font, "y"); + sphenixStyle->SetLabelFont(font, "z"); + sphenixStyle->SetTitleFont(font, "z"); + + sphenixStyle->SetLabelSize(tsize, "x"); + sphenixStyle->SetTitleSize(tsize, "x"); + sphenixStyle->SetLabelSize(tsize, "y"); + sphenixStyle->SetTitleSize(tsize, "y"); + sphenixStyle->SetLabelSize(tsize, "z"); + sphenixStyle->SetTitleSize(tsize, "z"); + + // use bold lines and markers + sphenixStyle->SetMarkerStyle(20); + sphenixStyle->SetMarkerSize(1.2); + sphenixStyle->SetHistLineWidth(2.); + sphenixStyle->SetLineStyleString(2, "[12 12]"); // postscript dashes + + // get rid of X error bars + //sphenixStyle->SetErrorX(0.001); + // get rid of error bar caps + sphenixStyle->SetEndErrorSize(0.); + + // do not display any of the standard histogram decorations + sphenixStyle->SetOptTitle(0); + //sphenixStyle->SetOptStat(1111); + sphenixStyle->SetOptStat(0); + //sphenixStyle->SetOptFit(1111); + sphenixStyle->SetOptFit(0); + + // put tick marks on top and RHS of plots + sphenixStyle->SetPadTickX(1); + sphenixStyle->SetPadTickY(1); + + // legend modificatin + sphenixStyle->SetLegendBorderSize(0); + sphenixStyle->SetLegendFillColor(0); + sphenixStyle->SetLegendFont(font); + +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) + std::cout << "sPhenixStyle: ROOT6 mode" << std::endl; + sphenixStyle->SetLegendTextSize(tsize); + sphenixStyle->SetPalette(kBird); +#else + std::cout << "sPhenixStyle: ROOT5 mode" << std::endl; + // color palette - manually define 'kBird' palette only available in ROOT 6 + Int_t alpha = 0; + Double_t stops[9] = {0.0000, 0.1250, 0.2500, 0.3750, 0.5000, 0.6250, 0.7500, 0.8750, 1.0000}; + Double_t red[9] = {0.2082, 0.0592, 0.0780, 0.0232, 0.1802, 0.5301, 0.8186, 0.9956, 0.9764}; + Double_t green[9] = {0.1664, 0.3599, 0.5041, 0.6419, 0.7178, 0.7492, 0.7328, 0.7862, 0.9832}; + Double_t blue[9] = {0.5293, 0.8684, 0.8385, 0.7914, 0.6425, 0.4662, 0.3499, 0.1968, 0.0539}; + TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha); +#endif + + sphenixStyle->SetNumberContours(80); + + return sphenixStyle; +} diff --git a/common/sPhenixStyle.h b/common/sPhenixStyle.h new file mode 100644 index 000000000..859eb2fa1 --- /dev/null +++ b/common/sPhenixStyle.h @@ -0,0 +1,51 @@ +// +// @file sPhenixStyle.h +// +// sPHENIX Style, based on a style file from ATLAS +// +// +// @author Peter Steinberg +// +// Copyright (C) 2017 sPhenix Collaboration +// +// Version 0.1 + +#ifndef __SPHENIXSTYLE_H +#define __SPHENIXSTYLE_H + +#include + +//! \brief sPHENIX Style, based on a style file from ATLAS by Peter Steinberg +/* +Please find instruction at https://wiki.bnl.gov/sPHENIX/index.php/Plot_template . Here is a snapshot: + +# How to use + +To ensure some consistency among plots produced by different sPHENIX members, a candidate style file is being proposed (May 2017), based on the ATLAS style file. Please click here for the gzipped tar file. +For general use, copy or link the ``sPHENIXStyle.h`` and ``sPHENIXStyle.C`` files somewhere, either locally or in your macro path (``gROOT->GetMacroPath()`` will tell you, and add it in ``.rootrc`` if you need one). +Then do +`` +[0] gROOT->LoadMacro("sPhenixStyle.C") +[1] SetsPhenixStyle() +`` +and you're good to go (even better, add this all into your ``.rootlogon.C`` file) + +# Rules of the sPHENIX style + +* Don't talk about the style file. +* Always use the style file. +* Units should always be indicated in brackets "[ ]", while counts will typically specify the bin width "Events / 2 GeV" or "Events / 0.13 rad". +* Every plot should have a legend indicating "sPHENIX", "sPHENIX Preliminary", "sPHENIX Simulation", etc. +* sPHENIX should be bold, italic +* Where possible, indicate the system being considered and it's energy +* "MC" predictions should be filled, with distinguishable colors +* Data or pseudodata should always be histograms or graphs with error bars +* Elements should never overlap, with each other or with the axis + + * + */ +void SetsPhenixStyle(); + +TStyle* sPhenixStyle(); + +#endif // __SPHENIXSTYLE_H diff --git a/macros/prototype3/DisplayOn.C b/detectors/sPHENIX/DisplayOn.C similarity index 63% rename from macros/prototype3/DisplayOn.C rename to detectors/sPHENIX/DisplayOn.C index cb75b1cbc..c2d112523 100644 --- a/macros/prototype3/DisplayOn.C +++ b/detectors/sPHENIX/DisplayOn.C @@ -1,3 +1,30 @@ +#pragma once + +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4testbench.so) + +namespace Enable +{ + bool DISPLAY = false; +} + +// This starts the QT based G4 gui which takes control +// when x'ed out it will return a pointer to PHG4Reco so +// the gui can be startrd again +PHG4Reco *QTGui() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); + g4->InitRun(se->topNode()); + g4->ApplyDisplayAction(); + g4->StartGui(); + return g4; +} + // stupid macro to turn on the geant4 display // we ask Fun4All for a pointer to PHG4Reco // using the ApplyCommand will start up the @@ -6,12 +33,13 @@ // start up the visualization, the next event will // be displayed. Do not execute this macro // before PHG4Reco was registered with Fun4All -PHG4Reco * DisplayOn(const char *mac = "vis_prototype3.mac") +PHG4Reco *DisplayOn(const char *mac = "vis.mac") { char cmd[100]; Fun4AllServer *se = Fun4AllServer::instance(); PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); g4->InitRun(se->topNode()); + g4->ApplyDisplayAction(); sprintf(cmd, "/control/execute %s", mac); g4->ApplyCommand(cmd); return g4; @@ -31,4 +59,6 @@ void displaycmd() cout << " g4->ApplyCommand(\"/vis/ogl/printEPS\")" << endl; cout << "set background color:" << endl; cout << " g4->ApplyCommand(\"/vis/viewer/set/background white\")" << endl; + cout << "Overlap check:" << endl; + cout << " g4->ApplyCommand(\"/geometry/test/run\")" << endl; } diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C new file mode 100644 index 000000000..7bdc82150 --- /dev/null +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -0,0 +1,690 @@ +#ifndef MACRO_FUN4ALLG4SPHENIX_C +#define MACRO_FUN4ALLG4SPHENIX_C + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libffamodules.so) + +// For HepMC Hijing +// try inputFile = /sphenix/sim/sim01/sphnxpro/sHijing_HepMC/sHijing_0-12fm.dat + +int Fun4All_G4_sPHENIX( + const int nEvents = 1, + const string &inputFile = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/sPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root", + const string &outputFile = "G4sPHENIX.root", + const string &embed_input_file = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/sPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root", + const int skip = 0, + const string &outdir = ".") +{ + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(0); + + //Opt to print all random seed used for debugging reproducibility. Comment out to reduce stdout prints. + PHRandomSeed::Verbosity(1); + + // just if we set some flags somewhere in this macro + recoConsts *rc = recoConsts::instance(); + // By default every random number generator uses + // PHRandomSeed() which reads /dev/urandom to get its seed + // if the RANDOMSEED flag is set its value is taken as seed + // You can either set this to a random value using PHRandomSeed() + // which will make all seeds identical (not sure what the point of + // this would be: + // rc->set_IntFlag("RANDOMSEED",PHRandomSeed()); + // or set it to a fixed value so you can debug your code + rc->set_IntFlag("RANDOMSEED", TString(outputFile).Hash()); + + //=============== + // Input options + //=============== + // verbosity setting (applies to all input managers) + Input::VERBOSITY = 0; + // First enable the input generators + // Either: + // read previously generated g4-hits files, in this case it opens a DST and skips + // the simulations step completely. The G4Setup macro is only loaded to get information + // about the number of layers used for the cell reco code + // Input::READHITS = true; + INPUTREADHITS::filename[0] = inputFile; + // if you use a filelist + // INPUTREADHITS::listfile[0] = inputFile; + // Or: + // Use particle generator + // And + // Further choose to embed newly simulated events to a previous simulation. Not compatible with `readhits = true` + // In case embedding into a production output, please double check your G4Setup_sPHENIX.C and G4_*.C consistent with those in the production macro folder + // E.g. /sphenix/sim//sim01/production/2016-07-21/single_particle/spacal2d/ + // Input::EMBED = true; + INPUTEMBED::filename[0] = embed_input_file; + // if you use a filelist + //INPUTEMBED::listfile[0] = embed_input_file; + + Input::SIMPLE = true; + Input::SIMPLE_NUMBER = 3; // if you need 2 of them + // Input::SIMPLE_VERBOSITY = 1; + + // Input::PYTHIA6 = true; + + // Input::PYTHIA8 = true; + + // Input::GUN = true; + // Input::GUN_NUMBER = 3; // if you need 3 of them + // Input::GUN_VERBOSITY = 1; + + //D0 generator + //Input::DZERO = false; + //Input::DZERO_VERBOSITY = 0; + //Lambda_c generator //Not ready yet + //Input::LAMBDAC = false; + //Input::LAMBDAC_VERBOSITY = 0; + // Upsilon generator + Input::UPSILON = false; + Input::UPSILON_NUMBER = 1; // if you need 3 of them + //Input::UPSILON_VERBOSITY = 0; + + // Input::HEPMC = true; + INPUTHEPMC::filename = inputFile; + + // Event pile up simulation with collision rate in Hz MB collisions. + //Input::PILEUPRATE = 100e3; + + //----------------- + // Initialize the selected Input/Event generation + //----------------- + // This creates the input generator(s) + InputInit(); + + //-------------- + // Set generator specific options + //-------------- + // can only be set after InputInit() is called + + // Simple Input generator: + // if you run more than one of these Input::SIMPLE_NUMBER > 1 + // add the settings for other with [1], next with [2]... + if (Input::SIMPLE) + { + // 10.1103/PhysRevC.83.024913 : 0-10%AuAu 200 GeV dNch_deta = 609. + static const double target_dNch_deta = 609; + // eta range + static const double deta_dphi = .5; + static const double eta_start = .2; + static const int n_pion = int(target_dNch_deta * deta_dphi * deta_dphi / 4);//number particle per 1/4 batch + + + // low pT pions + INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", n_pion); + INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi+", n_pion); + if (Input::HEPMC || Input::EMBED) + { + INPUTGENERATOR::SimpleEventGenerator[0]->set_reuse_existing_vertex(true); + INPUTGENERATOR::SimpleEventGenerator[0]->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); + } + else + { + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_function(PHG4SimpleEventGenerator::Gaus, + PHG4SimpleEventGenerator::Gaus, + PHG4SimpleEventGenerator::Gaus); + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_mean(0., 0., 0.); + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_width(0.01, 0.01, 5.); + } + INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(eta_start, eta_start + deta_dphi); + INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(0, deta_dphi); + INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.1, 2.); + + // high pT pions + INPUTGENERATOR::SimpleEventGenerator[1]->add_particles("pi-", n_pion); + INPUTGENERATOR::SimpleEventGenerator[1]->add_particles("pi+", n_pion); + INPUTGENERATOR::SimpleEventGenerator[1]->set_reuse_existing_vertex(true); + INPUTGENERATOR::SimpleEventGenerator[1]->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); + INPUTGENERATOR::SimpleEventGenerator[1]->set_eta_range(eta_start, eta_start + deta_dphi); + INPUTGENERATOR::SimpleEventGenerator[1]->set_phi_range(0, deta_dphi); + INPUTGENERATOR::SimpleEventGenerator[1]->set_pt_range(2, 50.); + + // wide angle tracks for vertex finding + INPUTGENERATOR::SimpleEventGenerator[2]->add_particles("pi-", 3); + INPUTGENERATOR::SimpleEventGenerator[2]->add_particles("pi+", 3); + INPUTGENERATOR::SimpleEventGenerator[2]->set_reuse_existing_vertex(true); + INPUTGENERATOR::SimpleEventGenerator[2]->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); + INPUTGENERATOR::SimpleEventGenerator[2]->set_eta_range(-1, 1); + INPUTGENERATOR::SimpleEventGenerator[2]->set_phi_range(-M_PI, M_PI); + INPUTGENERATOR::SimpleEventGenerator[2]->set_pt_range(60, 80.); + } + // Upsilons + // if you run more than one of these Input::UPSILON_NUMBER > 1 + // add the settings for other with [1], next with [2]... + if (Input::UPSILON) + { + INPUTGENERATOR::VectorMesonGenerator[0]->add_decay_particles("e", 0); + INPUTGENERATOR::VectorMesonGenerator[0]->set_rapidity_range(-1, 1); + INPUTGENERATOR::VectorMesonGenerator[0]->set_pt_range(0., 10.); + // Y species - select only one, last one wins + INPUTGENERATOR::VectorMesonGenerator[0]->set_upsilon_1s(); + if (Input::HEPMC || Input::EMBED) + { + INPUTGENERATOR::VectorMesonGenerator[0]->set_reuse_existing_vertex(true); + INPUTGENERATOR::VectorMesonGenerator[0]->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); + } + } + // particle gun + // if you run more than one of these Input::GUN_NUMBER > 1 + // add the settings for other with [1], next with [2]... + if (Input::GUN) + { + INPUTGENERATOR::Gun[0]->AddParticle("pi-", 0, 1, 0); + INPUTGENERATOR::Gun[0]->set_vtx(0, 0, 0); + } + + // pythia6 + if (Input::PYTHIA6) + { + //! apply sPHENIX nominal beam parameter with 2mrad crossing as defined in sPH-TRG-2020-001 + Input::ApplysPHENIXBeamParameter(INPUTGENERATOR::Pythia6); + } + // pythia8 + if (Input::PYTHIA8) + { + //! apply sPHENIX nominal beam parameter with 2mrad crossing as defined in sPH-TRG-2020-001 + Input::ApplysPHENIXBeamParameter(INPUTGENERATOR::Pythia8); + } + + //-------------- + // Set Input Manager specific options + //-------------- + // can only be set after InputInit() is called + + if (Input::HEPMC) + { + //! apply sPHENIX nominal beam parameter with 2mrad crossing as defined in sPH-TRG-2020-001 + Input::ApplysPHENIXBeamParameter(INPUTMANAGER::HepMCInputManager); + + // optional overriding beam parameters + //INPUTMANAGER::HepMCInputManager->set_vertex_distribution_width(100e-4, 100e-4, 8, 0); //optional collision smear in space, time + // INPUTMANAGER::HepMCInputManager->set_vertex_distribution_mean(0,0,0,0);//optional collision central position shift in space, time + // //optional choice of vertex distribution function in space, time + //INPUTMANAGER::HepMCInputManager->set_vertex_distribution_function(PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus); + //! embedding ID for the event + //! positive ID is the embedded event of interest, e.g. jetty event from pythia + //! negative IDs are backgrounds, .e.g out of time pile up collisions + //! Usually, ID = 0 means the primary Au+Au collision background + //INPUTMANAGER::HepMCInputManager->set_embedding_id(Input::EmbedID); + if (Input::PILEUPRATE > 0) + { + // Copy vertex settings from foreground hepmc input + INPUTMANAGER::HepMCPileupInputManager->CopyHelperSettings(INPUTMANAGER::HepMCInputManager); + // and then modify the ones you want to be different + // INPUTMANAGER::HepMCPileupInputManager->set_vertex_distribution_width(100e-4,100e-4,8,0); + } + } + if (Input::PILEUPRATE > 0) + { + //! apply sPHENIX nominal beam parameter with 2mrad crossing as defined in sPH-TRG-2020-001 + Input::ApplysPHENIXBeamParameter(INPUTMANAGER::HepMCPileupInputManager); + } + // register all input generators with Fun4All + InputRegister(); + + if (! Input::READHITS) + { + rc->set_IntFlag("RUNNUMBER",1); + + SyncReco *sync = new SyncReco(); + se->registerSubsystem(sync); + + HeadReco *head = new HeadReco(); + se->registerSubsystem(head); + } +// Flag Handler is always needed to read flags from input (if used) +// and update our rc flags with them. At the end it saves all flags +// again on the DST in the Flags node under the RUN node + FlagHandler *flag = new FlagHandler(); + se->registerSubsystem(flag); + + // set up production relatedstuff + // Enable::PRODUCTION = true; + + //====================== + // Write the DST + //====================== + + //Enable::DSTOUT = true; + Enable::DSTOUT_COMPRESS = false; + DstOut::OutputDir = outdir; + DstOut::OutputFile = outputFile; + + //Option to convert DST to human command readable TTree for quick poke around the outputs + // Enable::DSTREADER = true; + + // turn the display on (default off) + //Enable::DISPLAY = true; + + //====================== + // What to run + //====================== + + // QA, main switch + Enable::QA = true; + + // Global options (enabled for all enables subsystems - if implemented) + // Enable::ABSORBER = true; + // Enable::OVERLAPCHECK = true; + // Enable::VERBOSITY = 1; + + // Enable::BBC = true; + // Enable::BBC_SUPPORT = true; // save hist in bbc support structure + Enable::BBCFAKE = true; // Smeared vtx and t0, use if you don't want real BBC in simulation + + Enable::PIPE = true; + Enable::PIPE_ABSORBER = true; + + // central tracking + Enable::MVTX = true; + Enable::MVTX_CELL = Enable::MVTX && true; + Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true; + Enable::MVTX_QA = Enable::MVTX_CLUSTER && Enable::QA && true; + + Enable::INTT = true; +// Enable::INTT_ABSORBER = true; // enables layerwise support structure readout +// Enable::INTT_SUPPORT = true; // enable global support structure readout + Enable::INTT_CELL = Enable::INTT && true; + Enable::INTT_CLUSTER = Enable::INTT_CELL && true; + Enable::INTT_QA = Enable::INTT_CLUSTER && Enable::QA && true; + + Enable::TPC = true; + Enable::TPC_ABSORBER = true; + Enable::TPC_CELL = Enable::TPC && true; + Enable::TPC_CLUSTER = Enable::TPC_CELL && true; + Enable::TPC_QA = Enable::TPC_CLUSTER && Enable::QA && true; + + Enable::MICROMEGAS = true; + Enable::MICROMEGAS_CELL = Enable::MICROMEGAS && true; + Enable::MICROMEGAS_CLUSTER = Enable::MICROMEGAS_CELL && true; + Enable::MICROMEGAS_QA = Enable::MICROMEGAS_CLUSTER && Enable::QA && true; + + Enable::TRACKING_TRACK = (Enable::MICROMEGAS_CLUSTER && Enable::TPC_CLUSTER && Enable::INTT_CLUSTER && Enable::MVTX_CLUSTER) && true; + Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && true; + Enable::TRACKING_QA = Enable::TRACKING_TRACK && Enable::QA && true; + + // cemc electronics + thin layer of W-epoxy to get albedo from cemc + // into the tracking, cannot run together with CEMC + // Enable::CEMCALBEDO = true; + + Enable::CEMC = false; + Enable::CEMC_ABSORBER = true; + Enable::CEMC_CELL = Enable::CEMC && true; + Enable::CEMC_TOWER = Enable::CEMC_CELL && true; + Enable::CEMC_CLUSTER = Enable::CEMC_TOWER && true; + Enable::CEMC_EVAL = Enable::CEMC_CLUSTER && true; + Enable::CEMC_QA = Enable::CEMC_CLUSTER && Enable::QA && true; + + Enable::HCALIN = false; + Enable::HCALIN_ABSORBER = true; + Enable::HCALIN_CELL = Enable::HCALIN && true; + Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true; + Enable::HCALIN_CLUSTER = Enable::HCALIN_TOWER && true; + Enable::HCALIN_EVAL = Enable::HCALIN_CLUSTER && true; + Enable::HCALIN_QA = Enable::HCALIN_CLUSTER && Enable::QA && true; + + Enable::MAGNET = false; + Enable::MAGNET_ABSORBER = false; + + Enable::HCALOUT = false; + Enable::HCALOUT_ABSORBER = true; + Enable::HCALOUT_CELL = Enable::HCALOUT && true; + Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true; + Enable::HCALOUT_CLUSTER = Enable::HCALOUT_TOWER && true; + Enable::HCALOUT_EVAL = Enable::HCALOUT_CLUSTER && true; + Enable::HCALOUT_QA = Enable::HCALOUT_CLUSTER && Enable::QA && true; + + Enable::EPD = true; + + Enable::BEAMLINE = true; +// Enable::BEAMLINE_ABSORBER = true; // makes the beam line magnets sensitive volumes +// Enable::BEAMLINE_BLACKHOLE = true; // turns the beamline magnets into black holes + Enable::ZDC = true; +// Enable::ZDC_ABSORBER = true; +// Enable::ZDC_SUPPORT = true; + Enable::ZDC_TOWER = Enable::ZDC && true; + Enable::ZDC_EVAL = Enable::ZDC_TOWER && true; + + //! forward flux return plug door. Out of acceptance and off by default. + //Enable::PLUGDOOR = true; + Enable::PLUGDOOR_ABSORBER = true; + + Enable::GLOBAL_RECO = (Enable::BBCFAKE || Enable::TRACKING_TRACK) && true; + //Enable::GLOBAL_FASTSIM = true; + + //Enable::KFPARTICLE = true; + //Enable::KFPARTICLE_VERBOSITY = 1; + //Enable::KFPARTICLE_TRUTH_MATCH = true; + //Enable::KFPARTICLE_SAVE_NTUPLE = true; + + Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; + + Enable::JETS = (Enable::GLOBAL_RECO || Enable::GLOBAL_FASTSIM) && true; + Enable::JETS_EVAL = Enable::JETS && true; + Enable::JETS_QA = Enable::JETS && Enable::QA && true; + + // HI Jet Reco for p+Au / Au+Au collisions (default is false for + // single particle / p+p-only simulations, or for p+Au / Au+Au + // simulations which don't particularly care about jets) + Enable::HIJETS = Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; + + // 3-D topoCluster reconstruction, potentially in all calorimeter layers + Enable::TOPOCLUSTER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; + // particle flow jet reconstruction - needs topoClusters! + Enable::PARTICLEFLOW = Enable::TOPOCLUSTER && true; + // centrality reconstruction + Enable::CENTRALITY = true; + + // new settings using Enable namespace in GlobalVariables.C + Enable::BLACKHOLE = true; + //Enable::BLACKHOLE_SAVEHITS = false; // turn off saving of bh hits + //Enable::BLACKHOLE_FORWARD_SAVEHITS = false; // disable forward/backward hits + //BlackHoleGeometry::visible = true; + + // run user provided code (from local G4_User.C) + //Enable::USER = true; + + //=============== + // conditions DB flags + //=============== + //Enable::XPLOAD = true; + // tag + rc->set_StringFlag("XPLOAD_TAG",XPLOAD::tag); + // database config + rc->set_StringFlag("XPLOAD_CONFIG",XPLOAD::config); + // 64 bit timestamp + rc->set_uint64Flag("TIMESTAMP",XPLOAD::timestamp); + + //--------------- + // World Settings + //--------------- + // G4WORLD::PhysicsList = "FTFP_BERT"; //FTFP_BERT_HP best for calo + // G4WORLD::WorldMaterial = "G4_AIR"; // set to G4_GALACTIC for material scans + + //--------------- + // Magnet Settings + //--------------- + + // G4MAGNET::magfield = string(getenv("CALIBRATIONROOT"))+ string("/Field/Map/sphenix3dbigmapxyz.root"); // default map from the calibration database + // G4MAGNET::magfield = "1.5"; // alternatively to specify a constant magnetic field, give a float number, which will be translated to solenoidal field in T, if string use as fieldmap name (including path) +// G4MAGNET::magfield_rescale = 1.; // make consistent with expected Babar field strength of 1.4T + + //--------------- + // Pythia Decayer + //--------------- + // list of decay types in + // $OFFLINE_MAIN/include/g4decayer/EDecayType.hh + // default is All: + // G4P6DECAYER::decayType = EDecayType::kAll; + + // Initialize the selected subsystems + G4Init(); + + //--------------------- + // GEANT4 Detector description + //--------------------- + if (!Input::READHITS) + { + G4Setup(); + } + + //------------------ + // Detector Division + //------------------ + + if (Enable::BBC || Enable::BBCFAKE) Bbc_Reco(); + + if (Enable::MVTX_CELL) Mvtx_Cells(); + if (Enable::INTT_CELL) Intt_Cells(); + if (Enable::TPC_CELL) TPC_Cells(); + if (Enable::MICROMEGAS_CELL) Micromegas_Cells(); + + if (Enable::CEMC_CELL) CEMC_Cells(); + + if (Enable::HCALIN_CELL) HCALInner_Cells(); + + if (Enable::HCALOUT_CELL) HCALOuter_Cells(); + + //----------------------------- + // CEMC towering and clustering + //----------------------------- + + if (Enable::CEMC_TOWER) CEMC_Towers(); + if (Enable::CEMC_CLUSTER) CEMC_Clusters(); + + //----------------------------- + // HCAL towering and clustering + //----------------------------- + + if (Enable::HCALIN_TOWER) HCALInner_Towers(); + if (Enable::HCALIN_CLUSTER) HCALInner_Clusters(); + + if (Enable::HCALOUT_TOWER) HCALOuter_Towers(); + if (Enable::HCALOUT_CLUSTER) HCALOuter_Clusters(); + + // if enabled, do topoClustering early, upstream of any possible jet reconstruction + if (Enable::TOPOCLUSTER) TopoClusterReco(); + + //-------------- + // SVTX tracking + //-------------- + if(Enable::TRACKING_TRACK) + { + TrackingInit(); + } + if (Enable::MVTX_CLUSTER) Mvtx_Clustering(); + if (Enable::INTT_CLUSTER) Intt_Clustering(); + if (Enable::TPC_CLUSTER) TPC_Clustering(); + if (Enable::MICROMEGAS_CLUSTER) Micromegas_Clustering(); + + if (Enable::TRACKING_TRACK) + { + Tracking_Reco(); + } + //----------------- + // Global Vertexing + //----------------- + + if (Enable::GLOBAL_RECO && Enable::GLOBAL_FASTSIM) + { + cout << "You can only enable Enable::GLOBAL_RECO or Enable::GLOBAL_FASTSIM, not both" << endl; + gSystem->Exit(1); + } + if (Enable::GLOBAL_RECO) + { + Global_Reco(); + } + else if (Enable::GLOBAL_FASTSIM) + { + Global_FastSim(); + } + + //----------------- + // Centrality Determination + //----------------- + + if (Enable::CENTRALITY) + { + Centrality(); + } + + //----------------- + // Calo Trigger Simulation + //----------------- + + if (Enable::CALOTRIGGER) + { + CaloTrigger_Sim(); + } + + //--------- + // Jet reco + //--------- + + if (Enable::JETS) Jet_Reco(); + if (Enable::HIJETS) HIJetReco(); + + if (Enable::PARTICLEFLOW) ParticleFlow(); + + //---------------------- + // Simulation evaluation + //---------------------- + string outputroot = outputFile; + string remove_this = ".root"; + size_t pos = outputroot.find(remove_this); + if (pos != string::npos) + { + outputroot.erase(pos, remove_this.length()); + } + + if (Enable::TRACKING_EVAL) Tracking_Eval(outputroot + "_g4svtx_eval.root"); + + if (Enable::CEMC_EVAL) CEMC_Eval(outputroot + "_g4cemc_eval.root"); + + if (Enable::HCALIN_EVAL) HCALInner_Eval(outputroot + "_g4hcalin_eval.root"); + + if (Enable::HCALOUT_EVAL) HCALOuter_Eval(outputroot + "_g4hcalout_eval.root"); + + if (Enable::JETS_EVAL) Jet_Eval(outputroot + "_g4jet_eval.root"); + + if (Enable::DSTREADER) G4DSTreader(outputroot + "_DSTReader.root"); + + if (Enable::USER) UserAnalysisInit(); + + //====================== + // Run KFParticle on evt + //====================== + if (Enable::KFPARTICLE && Input::UPSILON) KFParticle_Upsilon_Reco(); + if (Enable::KFPARTICLE && Input::DZERO) KFParticle_D0_Reco(); + + //---------------------- + // Standard QAs + //---------------------- + + if (Enable::CEMC_QA) CEMC_QA(); + if (Enable::HCALIN_QA) HCALInner_QA(); + if (Enable::HCALOUT_QA) HCALOuter_QA(); + + if (Enable::JETS_QA) Jet_QA(); + + if (Enable::MVTX_QA) Mvtx_QA(); + if (Enable::INTT_QA) Intt_QA(); + if (Enable::TPC_QA) TPC_QA(); + if (Enable::MICROMEGAS_QA) Micromegas_QA(); + if (Enable::TRACKING_QA) Tracking_QA(); + + if (Enable::TRACKING_QA && Enable::CEMC_QA && Enable::HCALIN_QA && Enable::HCALOUT_QA) QA_G4CaloTracking(); + + //-------------- + // Set up Input Managers + //-------------- + + InputManagers(); + + if (Enable::PRODUCTION) + { + Production_CreateOutputDir(); + } + + if (Enable::DSTOUT) + { + string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile; + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile); + if (Enable::DSTOUT_COMPRESS) + { + ShowerCompress(); + DstCompress(out); + } + se->registerOutputManager(out); + } + //----------------- + // Event processing + //----------------- + if (Enable::DISPLAY) + { + DisplayOn(); + + gROOT->ProcessLine("Fun4AllServer *se = Fun4AllServer::instance();"); + gROOT->ProcessLine("PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");"); + + cout << "-------------------------------------------------" << endl; + cout << "You are in event display mode. Run one event with" << endl; + cout << "se->run(1)" << endl; + cout << "Run Geant4 command with following examples" << endl; + gROOT->ProcessLine("displaycmd()"); + + return 0; + } + + // if we use a negative number of events we go back to the command line here + if (nEvents < 0) + { + return 0; + } + // if we run the particle generator and use 0 it'll run forever + // for embedding it runs forever if the repeat flag is set + if (nEvents == 0 && !Input::HEPMC && !Input::READHITS && INPUTEMBED::REPEAT) + { + cout << "using 0 for number of events is a bad idea when using particle generators" << endl; + cout << "it will run forever, so I just return without running anything" << endl; + return 0; + } + + se->skip(skip); + se->run(nEvents); + + //----- + // QA output + //----- + + if (Enable::QA) QA_Output(outputroot + "_qa.root"); + + //----- + // Exit + //----- + + se->End(); + std::cout << "All done" << std::endl; + delete se; + if (Enable::PRODUCTION) + { + Production_MoveOutput(); + } + + gSystem->Exit(0); + return 0; +} +#endif diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C new file mode 100644 index 000000000..803f96a25 --- /dev/null +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -0,0 +1,224 @@ +#ifndef MACRO_G4SETUPSPHENIX_C +#define MACRO_G4SETUPSPHENIX_C + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4decayer.so) +R__LOAD_LIBRARY(libg4detectors.so) + +void G4Init() +{ + // Check on invalid combinations + if (Enable::CEMC && Enable::CEMCALBEDO) + { + cout << "Enable::CEMCALBEDO and Enable::CEMC cannot be set simultanously" << endl; + gSystem->Exit(1); + } + // load detector/material macros and execute Init() function + + if (Enable::PIPE) PipeInit(); + if (Enable::MVTX) MvtxInit(); + if (Enable::INTT) InttInit(); + if (Enable::TPC) TPCInit(); + if (Enable::MICROMEGAS) MicromegasInit(); + if (Enable::BBC) BbcInit(); + if (Enable::CEMCALBEDO) CEmcAlbedoInit(); + if (Enable::CEMC) CEmcInit(); + if (Enable::HCALIN) HCalInnerInit(); + if (Enable::MAGNET) MagnetInit(); + MagnetFieldInit(); // We want the field - even if the magnet volume is disabled + if (Enable::HCALOUT) HCalOuterInit(); + if (Enable::PLUGDOOR) PlugDoorInit(); + if (Enable::EPD) EPDInit(); + if (Enable::BEAMLINE) + { + BeamLineInit(); + if (Enable::ZDC) + { + ZDCInit(); + } + } + if (Enable::USER) UserInit(); + if (Enable::BLACKHOLE) BlackHoleInit(); +} + +int G4Setup() +{ + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4Reco *g4Reco = new PHG4Reco(); + g4Reco->set_rapidity_coverage(1.1); // according to drawings + WorldInit(g4Reco); + if (G4P6DECAYER::decayType != EDecayType::kAll) + { + g4Reco->set_force_decay(G4P6DECAYER::decayType); + } + + double fieldstrength; + istringstream stringline(G4MAGNET::magfield); + stringline >> fieldstrength; + if (stringline.fail()) + { // conversion to double fails -> we have a string + + if (G4MAGNET::magfield.find("sphenix3dbigmapxyz") != string::npos || + G4MAGNET::magfield == "CDB") + { + g4Reco->set_field_map(G4MAGNET::magfield, PHFieldConfig::Field3DCartesian); + } + else + { + g4Reco->set_field_map(G4MAGNET::magfield, PHFieldConfig::kField2D); + } + } + else + { + g4Reco->set_field(fieldstrength); // use const soleniodal field + } + g4Reco->set_field_rescale(G4MAGNET::magfield_rescale); + +// the radius is an older protection against overlaps, it is not +// clear how well this works nowadays but it doesn't hurt either + double radius = 0.; + + if (Enable::PIPE) radius = Pipe(g4Reco, radius); + if (Enable::MVTX) radius = Mvtx(g4Reco, radius); + if (Enable::INTT) radius = Intt(g4Reco, radius); + if (Enable::TPC) radius = TPC(g4Reco, radius); + if (Enable::MICROMEGAS) Micromegas(g4Reco); + if (Enable::BBC) Bbc(g4Reco); + if (Enable::CEMCALBEDO) CEmcAlbedo(g4Reco); + if (Enable::CEMC) radius = CEmc(g4Reco, radius, 8); + if (Enable::HCALIN) radius = HCalInner(g4Reco, radius, 4); + if (Enable::MAGNET) radius = Magnet(g4Reco, radius); + if (Enable::HCALOUT) radius = HCalOuter(g4Reco, radius, 4); + if (Enable::PLUGDOOR) PlugDoor(g4Reco); + if (Enable::EPD) EPD(g4Reco); + if (Enable::BEAMLINE) + { + BeamLineDefineMagnets(g4Reco); + BeamLineDefineBeamPipe(g4Reco); + if (Enable::ZDC) + { + ZDCSetup(g4Reco); + } + } + if (Enable::USER) UserDetector(g4Reco); + + + //---------------------------------------- + // BLACKHOLE + + if (Enable::BLACKHOLE) BlackHole(g4Reco, radius); + + PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); + g4Reco->registerSubsystem(truth); + + // finally adjust the world size in case the default is too small + WorldSize(g4Reco, radius); + + se->registerSubsystem(g4Reco); + return 0; +} + +void ShowerCompress(int verbosity = 0) +{ + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4DstCompressReco *compress = new PHG4DstCompressReco("PHG4DstCompressReco"); + compress->AddHitContainer("G4HIT_PIPE"); + compress->AddHitContainer("G4HIT_SVTXSUPPORT"); + compress->AddHitContainer("G4HIT_CEMC_ELECTRONICS"); + compress->AddHitContainer("G4HIT_CEMC"); + compress->AddHitContainer("G4HIT_ABSORBER_CEMC"); + compress->AddHitContainer("G4HIT_CEMC_SPT"); + compress->AddHitContainer("G4HIT_ABSORBER_HCALIN"); + compress->AddHitContainer("G4HIT_HCALIN"); + compress->AddHitContainer("G4HIT_HCALIN_SPT"); + compress->AddHitContainer("G4HIT_MAGNET"); + compress->AddHitContainer("G4HIT_ABSORBER_HCALOUT"); + compress->AddHitContainer("G4HIT_HCALOUT"); + compress->AddHitContainer("G4HIT_BH_1"); + compress->AddHitContainer("G4HIT_BH_FORWARD_PLUS"); + compress->AddHitContainer("G4HIT_BH_FORWARD_NEG"); + compress->AddHitContainer("G4HIT_BBC"); + compress->AddCellContainer("G4CELL_CEMC"); + compress->AddCellContainer("G4CELL_HCALIN"); + compress->AddCellContainer("G4CELL_HCALOUT"); + compress->AddTowerContainer("TOWER_SIM_CEMC"); + compress->AddTowerContainer("TOWER_RAW_CEMC"); + compress->AddTowerContainer("TOWER_CALIB_CEMC"); + compress->AddTowerContainer("TOWER_SIM_HCALIN"); + compress->AddTowerContainer("TOWER_RAW_HCALIN"); + compress->AddTowerContainer("TOWER_CALIB_HCALIN"); + compress->AddTowerContainer("TOWER_SIM_HCALOUT"); + compress->AddTowerContainer("TOWER_RAW_HCALOUT"); + compress->AddTowerContainer("TOWER_CALIB_HCALOUT"); + se->registerSubsystem(compress); + + return; +} + +void DstCompress(Fun4AllDstOutputManager *out) +{ + if (out) + { + out->StripNode("G4HIT_PIPE"); + out->StripNode("G4HIT_SVTXSUPPORT"); + out->StripNode("G4HIT_CEMC_ELECTRONICS"); + out->StripNode("G4HIT_CEMC"); + out->StripNode("G4HIT_ABSORBER_CEMC"); + out->StripNode("G4HIT_CEMC_SPT"); + out->StripNode("G4HIT_ABSORBER_HCALIN"); + out->StripNode("G4HIT_HCALIN"); + out->StripNode("G4HIT_HCALIN_SPT"); + out->StripNode("G4HIT_MAGNET"); + out->StripNode("G4HIT_ABSORBER_HCALOUT"); + out->StripNode("G4HIT_HCALOUT"); + out->StripNode("G4HIT_BH_1"); + out->StripNode("G4HIT_BH_FORWARD_PLUS"); + out->StripNode("G4HIT_BH_FORWARD_NEG"); + out->StripNode("G4HIT_BBC"); + out->StripNode("G4CELL_CEMC"); + out->StripNode("G4CELL_HCALIN"); + out->StripNode("G4CELL_HCALOUT"); + } +} +#endif diff --git a/detectors/sPHENIX/README.md b/detectors/sPHENIX/README.md new file mode 100644 index 000000000..03a189d86 --- /dev/null +++ b/detectors/sPHENIX/README.md @@ -0,0 +1,9 @@ +[//]: # (This section starts with a 2nd level heading and get embedded in the result QA report at https://github.com/sPHENIX-Collaboration/QA-gallery/tree/QA-tracking-high-occupancy) + +## Tracking QA at high occupancy + +High occupancy tracking QA consists full tracker + reconstruction of events with 76 $\pi^+$, and 76 $\pi^-$ in a $\Delta\eta \times \Delta\phi = 0.5 \times 0.5$ window. In this small window, we would like to emulate the occupancy for 0-10% AuAu 200 GeV $\delta N_{Ch}/\delta\eta = 609$ [DOI: 10.1103/PhysRevC.83.024913]. Beyond this window, six more high $p_T>60$ GeV$/c$ pions are added to help constraint 3D vertex. + +Please note the calorimeters are disabled to improve execution speed, which also removed some of the correlated albedo background for the tracker. + +The source code of the macro can be found at https://github.com/sPHENIX-Collaboration/macros/tree/QA-tracking-high-occupancy or [comparing it to the master branch](https://github.com/sPHENIX-Collaboration/macros/compare/QA-tracking-high-occupancy?expand=1). diff --git a/detectors/sPHENIX/init_gui_vis.mac b/detectors/sPHENIX/init_gui_vis.mac new file mode 100644 index 000000000..8aca21396 --- /dev/null +++ b/detectors/sPHENIX/init_gui_vis.mac @@ -0,0 +1,20 @@ +# Macro file for the initialization of example B3 +# in interactive session +# +# Set some default verbose +# +/control/verbose 2 +/control/saveHistory +/run/verbose 2 +# +# Change the default number of threads (in multi-threaded mode) +#/run/numberOfThreads 4 +# +# Initialize kernel +/run/initialize +# +# create empty scene +# +/vis/scene/create +# open graphics (opengl QT) +/vis/open OGL diff --git a/macros/g4simulations/vis.mac b/detectors/sPHENIX/vis.mac similarity index 96% rename from macros/g4simulations/vis.mac rename to detectors/sPHENIX/vis.mac index a26de7a81..47db266aa 100644 --- a/macros/g4simulations/vis.mac +++ b/detectors/sPHENIX/vis.mac @@ -26,7 +26,9 @@ # machines. You might have to play with it. GEANT prints out a # list of available graphics systems at some point. #/vis/open OGLIX -/vis/open OGLSX 1200x900-0+0 +/vis/open OGL 1200x900-0+0 +# increase display limit for more complex detectors +/vis/ogl/set/displayListLimit 500000 /vis/viewer/set/viewpointThetaPhi 240 -10 /vis/viewer/addCutawayPlane 0 0 0 m 1 0 0 # our world is 4x4 meters, the detector is about 1m across diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C deleted file mode 100644 index 66df27db1..000000000 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ /dev/null @@ -1,616 +0,0 @@ -int Fun4All_G4_EICDetector( - const int nEvents = 1, - const char * inputFile = "/sphenix/data/data02/review_2017-08-02/single_particle/spacal2d/fieldmap/G4Hits_sPHENIX_e-_eta0_8GeV-0002.root", - const char * outputFile = "G4EICDetector.root" - ) -{ - // Set the number of TPC layer - const int n_TPC_layers = 40; // use 60 for backward compatibility only - - //=============== - // Input options - //=============== - - // Either: - // read previously generated g4-hits files, in this case it opens a DST and skips - // the simulations step completely. The G4Setup macro is only loaded to get information - // about the number of layers used for the cell reco code - // - // In case reading production output, please double check your G4Setup_sPHENIX.C and G4_*.C consistent with those in the production macro folder - // E.g. /sphenix/sim//sim01/production/2016-07-21/single_particle/spacal2d/ - const bool readhits = false; - // Or: - // read files in HepMC format (typically output from event generators like hijing or pythia) - const bool readhepmc = false; // read HepMC files - // Or: - // read files in EICTree format generated by eicsmear package - const bool readeictree = false; - // Or: - // Use Pythia 8 - const bool runpythia8 = false; - // Or: - // Use Pythia 6 - const bool runpythia6 = false; - // Or: - // Use HEPGen - const bool runhepgen = false; - // Or: - // Use Sartre - const bool runsartre = false; - - - - // Besides the above flags. One can further choose to further put in following particles in Geant4 simulation - // Use multi-particle generator (PHG4SimpleEventGenerator), see the code block below to choose particle species and kinematics - const bool particles = false && !readhits; - // or gun/ very simple single particle gun generator - const bool usegun = true && !readhits; - // Throw single Upsilons, may be embedded in Hijing by setting readhepmc flag also (note, careful to set Z vertex equal to Hijing events) - const bool upsilons = false && !readhits; - - //====================== - // What to run - //====================== - - // sPHENIX barrel - bool do_bbc = true; - - bool do_pipe = true; - - bool do_svtx = true; - bool do_svtx_cell = do_svtx && true; - bool do_svtx_track = do_svtx_cell && true; - bool do_svtx_eval = do_svtx_track && true; - - bool do_pstof = false; - - bool do_cemc = true; - bool do_cemc_cell = do_cemc && true; - bool do_cemc_twr = do_cemc_cell && true; - bool do_cemc_cluster = do_cemc_twr && true; - bool do_cemc_eval = do_cemc_cluster && true; - - bool do_hcalin = true; - bool do_hcalin_cell = do_hcalin && true; - bool do_hcalin_twr = do_hcalin_cell && true; - bool do_hcalin_cluster = do_hcalin_twr && true; - bool do_hcalin_eval = do_hcalin_cluster && true; - - bool do_magnet = true; - - bool do_hcalout = true; - bool do_hcalout_cell = do_hcalout && true; - bool do_hcalout_twr = do_hcalout_cell && true; - bool do_hcalout_cluster = do_hcalout_twr && true; - bool do_hcalout_eval = do_hcalout_cluster && true; - - // EICDetector geometry - barrel - bool do_DIRC = true; - - // EICDetector geometry - 'hadron' direction - bool do_FGEM = true; - bool do_FGEM_track = do_FGEM && true; - - bool do_RICH = true; - bool do_Aerogel = true; - - bool do_FEMC = true; - bool do_FEMC_cell = do_FEMC && true; - bool do_FEMC_twr = do_FEMC_cell && true; - bool do_FEMC_cluster = do_FEMC_twr && true; - bool do_FEMC_eval = do_FEMC_cluster && true; - - bool do_FHCAL = true; - bool do_FHCAL_cell = do_FHCAL && true; - bool do_FHCAL_twr = do_FHCAL_cell && true; - bool do_FHCAL_cluster = do_FHCAL_twr && true; - bool do_FHCAL_eval = do_FHCAL_cluster && true; - - // EICDetector geometry - 'electron' direction - bool do_EGEM = true; - bool do_EGEM_track = do_EGEM && true; - - bool do_EEMC = true; - bool do_EEMC_cell = do_EEMC && true; - bool do_EEMC_twr = do_EEMC_cell && true; - bool do_EEMC_cluster = do_EEMC_twr && true; - bool do_EEMC_eval = do_EEMC_cluster && true; - - // Other options - bool do_global = true; - bool do_global_fastsim = false; - - bool do_calotrigger = false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - - bool do_jet_reco = true; - bool do_jet_eval = do_jet_reco && true; - - bool do_fwd_jet_reco = true; - bool do_fwd_jet_eval = do_fwd_jet_reco && true; - - // HI Jet Reco for jet simulations in Au+Au (default is false for - // single particle / p+p simulations, or for Au+Au simulations which - // don't care about jets) - bool do_HIjetreco = false && do_jet_reco && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - - // Compress DST files - bool do_dst_compress = false; - - //Option to convert DST to human command readable TTree for quick poke around the outputs - bool do_DSTReader = true; - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libphhepmc.so"); - gSystem->Load("libg4testbench.so"); - gSystem->Load("libg4hough.so"); - gSystem->Load("libcemc.so"); - gSystem->Load("libg4eval.so"); - - // establish the geometry and reconstruction setup - gROOT->LoadMacro("G4Setup_EICDetector.C"); - G4Init(do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_FGEM,do_EGEM,do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel,n_TPC_layers); - - int absorberactive = 0; // set to 1 to make all absorbers active volumes - // const string magfield = "1.5"; // if like float -> solenoidal field in T, if string use as fieldmap name (including path) - const string magfield = "/phenix/upgrades/decadal/fieldmaps/sPHENIX.2d.root"; // if like float -> solenoidal field in T, if string use as fieldmap name (including path) - const float magfield_rescale = 1.4/1.5; // scale the map to a 1.4 T field - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(0); // uncomment for batch production running with minimal output messages - // se->Verbosity(Fun4AllServer::VERBOSITY_SOME); // uncomment for some info for interactive running - - // just if we set some flags somewhere in this macro - recoConsts *rc = recoConsts::instance(); - // By default every random number generator uses - // PHRandomSeed() which reads /dev/urandom to get its seed - // if the RANDOMSEED flag is set its value is taken as seed - // You can either set this to a random value using PHRandomSeed() - // which will make all seeds identical (not sure what the point of - // this would be: - // rc->set_IntFlag("RANDOMSEED",PHRandomSeed()); - // or set it to a fixed value so you can debug your code - // rc->set_IntFlag("RANDOMSEED", 12345); - - //----------------- - // Event generation - //----------------- - - if (readhits) - { - // Get the hits from a file - // The input manager is declared later - } - else if (readhepmc) - { - // this module is needed to read the HepMC records into our G4 sims - // but only if you read HepMC input files - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else if (readeictree) - { - // this module is needed to read the EICTree style records into our G4 sims - ReadEICFiles *eicr = new ReadEICFiles(); - eicr->OpenInputFile(inputFile); - - se->registerSubsystem(eicr); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else if (runpythia8) - { - gSystem->Load("libPHPythia8.so"); - - PHPythia8* pythia8 = new PHPythia8(); - // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file("phpythia8.cfg"); - se->registerSubsystem(pythia8); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else if (runpythia6) - { - gSystem->Load("libPHPythia6.so"); - - PHPythia6 *pythia6 = new PHPythia6(); - // see coresoftware/generators/PHPythia6 for example config - pythia6->set_config_file("phpythia6_ep.cfg"); - se->registerSubsystem(pythia6); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else if (runhepgen) - { - gSystem->Load("libsHEPGen.so"); - - sHEPGen *hepgen = new sHEPGen(); - // see HEPGen source directory/share/vggdata for required .dat files - // see HEPGen source directory/share/datacards for required datacard files - hepgen->set_datacard_file("hepgen_dvcs.data"); - hepgen->set_momentum_electron(-20); - hepgen->set_momentum_hadron(250); - se->registerSubsystem(hepgen); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else if (runsartre) - { - // see coresoftware/generators/PHSartre/README for setup instructions - // before running: - // setenv SARTRE_DIR /opt/sphenix/core/sartre-1.20_root-5.34.36 - gSystem->Load("libPHSartre.so"); - - PHSartre* mysartre = new PHSartre(); - // see coresoftware/generators/PHSartre for example config - mysartre->set_config_file("sartre.cfg"); - - // particle trigger to enhance forward J/Psi -> ee - PHSartreParticleTrigger* pTrig = new PHSartreParticleTrigger("MySartreTrigger"); - pTrig->AddParticles(-11); - //pTrig->SetEtaHighLow(4.0,1.4); - pTrig->SetEtaHighLow(1.0,-1.1); // central arm - pTrig->PrintConfig(); - mysartre->register_trigger((PHSartreGenTrigger *)pTrig); - se->registerSubsystem(mysartre); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - - // If "readhepMC" is also set, the particles will be embedded in Hijing events - if(particles) - { - // toss low multiplicity dummy events - PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - gen->add_particles("pi-",1); // mu+,e+,proton,pi+,Upsilon - //gen->add_particles("pi+",100); // 100 pion option - if (readhepmc) - { - gen->set_reuse_existing_vertex(true); - gen->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); - } - else - { - gen->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_distribution_mean(0.0, 0.0, 0.0); - gen->set_vertex_distribution_width(0.0, 0.0, 0.0); - } - gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_size_parameters(0.0, 0.0); - gen->set_eta_range(-1.0, 1.0); - gen->set_phi_range(-1.0 * TMath::Pi(), 1.0 * TMath::Pi()); - //gen->set_pt_range(0.1, 50.0); - gen->set_pt_range(0.1, 20.0); - gen->Embed(1); - gen->Verbosity(0); - - se->registerSubsystem(gen); - } - if (usegun) - { - // PHG4ParticleGun *gun = new PHG4ParticleGun(); - // gun->set_name("anti_proton"); - // gun->set_name("geantino"); - // gun->set_vtx(0, 0, 0); - // gun->set_mom(10, 0, 0.01); - // gun->AddParticle("geantino",1.7776,-0.4335,0.); - // gun->AddParticle("geantino",1.7709,-0.4598,0.); - // gun->AddParticle("geantino",2.5621,0.60964,0.); - // gun->AddParticle("geantino",1.8121,0.253,0.); - // se->registerSubsystem(gun); - PHG4ParticleGenerator *pgen = new PHG4ParticleGenerator(); - pgen->set_name("e-"); - pgen->set_z_range(0,0); - pgen->set_eta_range(0.01,0.01); - pgen->set_mom_range(10,10); - pgen->set_phi_range(-1.0 * TMath::Pi(), 1.0 * TMath::Pi()); - se->registerSubsystem(pgen); - } - - // If "readhepMC" is also set, the Upsilons will be embedded in Hijing events, if 'particles" is set, the Upsilons will be embedded in whatever particles are thrown - if(upsilons) - { - // run upsilons for momentum, dca performance, alone or embedded in Hijing - - PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); - vgen->add_decay_particles("e+","e-",0); // i = decay id - // event vertex - if (readhepmc || particles) - { - vgen->set_reuse_existing_vertex(true); - } - else - { - vgen->set_vtx_zrange(-10.0, +10.0); - } - - // Note: this rapidity range completely fills the acceptance of eta = +/- 1 unit - vgen->set_rapidity_range(-1.0, +1.0); - vgen->set_pt_range(0.0, 10.0); - - int istate = 1; - - if(istate == 1) - { - // Upsilon(1S) - vgen->set_mass(9.46); - vgen->set_width(54.02e-6); - } - else if (istate == 2) - { - // Upsilon(2S) - vgen->set_mass(10.0233); - vgen->set_width(31.98e-6); - } - else - { - // Upsilon(3S) - vgen->set_mass(10.3552); - vgen->set_width(20.32e-6); - } - - vgen->Verbosity(0); - vgen->Embed(2); - se->registerSubsystem(vgen); - - cout << "Upsilon generator for istate = " << istate << " created and registered " << endl; - } - - if (!readhits) - { - //--------------------- - // Detector description - //--------------------- - - G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe, - do_FGEM,do_EGEM,do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel, - magfield_rescale); - - } - - //--------- - // BBC Reco - //--------- - - if (do_bbc) - { - gROOT->LoadMacro("G4_Bbc.C"); - BbcInit(); - Bbc_Reco(); - } - - //------------------ - // Detector Division - //------------------ - - if (do_svtx_cell) Svtx_Cells(); - - if (do_cemc_cell) CEMC_Cells(); - - if (do_hcalin_cell) HCALInner_Cells(); - - if (do_hcalout_cell) HCALOuter_Cells(); - - if (do_FEMC_cell) FEMC_Cells(); - - if (do_FHCAL_cell) FHCAL_Cells(); - - if (do_EEMC_cell) EEMC_Cells(); - - //----------------------------- - // CEMC towering and clustering - //----------------------------- - - if (do_cemc_twr) CEMC_Towers(); - if (do_cemc_cluster) CEMC_Clusters(); - - //----------------------------- - // HCAL towering and clustering - //----------------------------- - - if (do_hcalin_twr) HCALInner_Towers(); - if (do_hcalin_cluster) HCALInner_Clusters(); - - if (do_hcalout_twr) HCALOuter_Towers(); - if (do_hcalout_cluster) HCALOuter_Clusters(); - - //----------------------------- - // e, h direction Calorimeter towering and clustering - //----------------------------- - - if (do_FEMC_twr) FEMC_Towers(); - if (do_FEMC_cluster) FEMC_Clusters(); - - if (do_FHCAL_twr) FHCAL_Towers(); - if (do_FHCAL_cluster) FHCAL_Clusters(); - - if (do_EEMC_twr) EEMC_Towers(); - if (do_EEMC_cluster) EEMC_Clusters(); - - if (do_dst_compress) ShowerCompress(); - - //-------------- - // SVTX tracking - //-------------- - - if (do_svtx_track) Svtx_Reco(); - - //-------------- - // FGEM tracking - //-------------- - - if(do_FGEM_track) FGEM_FastSim_Reco(); - - //-------------- - // EGEM tracking - //-------------- - - if(do_EGEM_track) EGEM_FastSim_Reco(); - - //----------------- - // Global Vertexing - //----------------- - - if (do_global) - { - gROOT->LoadMacro("G4_Global.C"); - Global_Reco(); - } - - else if (do_global_fastsim) - { - gROOT->LoadMacro("G4_Global.C"); - Global_FastSim(); - } - - //----------------- - // Calo Trigger Simulation - //----------------- - - if (do_calotrigger) - { - gROOT->LoadMacro("G4_CaloTrigger.C"); - CaloTrigger_Sim(); - } - - //--------- - // Jet reco - //--------- - - if (do_jet_reco) - { - gROOT->LoadMacro("G4_Jets.C"); - Jet_Reco(); - } - - if (do_HIjetreco) { - gROOT->LoadMacro("G4_HIJetReco.C"); - HIJetReco(); - } - - if (do_fwd_jet_reco) - { - gROOT->LoadMacro("G4_FwdJets.C"); - Jet_FwdReco(); - } - - //---------------------- - // Simulation evaluation - //---------------------- - - if (do_svtx_eval) Svtx_Eval(string(outputFile) + "_g4svtx_eval.root"); - - if (do_cemc_eval) CEMC_Eval(string(outputFile) + "_g4cemc_eval.root"); - - if (do_hcalin_eval) HCALInner_Eval(string(outputFile) + "_g4hcalin_eval.root"); - - if (do_hcalout_eval) HCALOuter_Eval(string(outputFile) + "_g4hcalout_eval.root"); - - if (do_FEMC_eval) FEMC_Eval(string(outputFile) + "_g4femc_eval.root"); - - if (do_FHCAL_eval) FHCAL_Eval(string(outputFile) + "_g4fhcal_eval.root"); - - if (do_EEMC_eval) EEMC_Eval(string(outputFile) + "_g4eemc_eval.root"); - - if (do_jet_eval) Jet_Eval(string(outputFile) + "_g4jet_eval.root"); - - if (do_fwd_jet_eval) Jet_FwdEval(string(outputFile) + "_g4fwdjet_eval.root"); - - //-------------- - // IO management - //-------------- - - if (readhits) - { - // Hits file - Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); - hitsin->fileopen(inputFile); - se->registerInputManager(hitsin); - } - if (readhepmc) - { - Fun4AllInputManager *in = new Fun4AllHepMCInputManager( "DSTIN"); - se->registerInputManager( in ); - se->fileopen( in->Name().c_str(), inputFile ); - } - else - { - // for single particle generators we just need something which drives - // the event loop, the Dummy Input Mgr does just that - Fun4AllInputManager *in = new Fun4AllDummyInputManager( "JADE"); - se->registerInputManager( in ); - } - - if (do_DSTReader) - { - //Convert DST to human command readable TTree for quick poke around the outputs - gROOT->LoadMacro("G4_DSTReader_EICDetector.C"); - - G4DSTreader_EICDetector( outputFile, // - /*int*/ absorberactive , - /*bool*/ do_svtx , - /*bool*/ do_cemc , - /*bool*/ do_hcalin , - /*bool*/ do_magnet , - /*bool*/ do_hcalout , - /*bool*/ do_cemc_twr , - /*bool*/ do_hcalin_twr , - /*bool*/ do_magnet , - /*bool*/ do_hcalout_twr, - /*bool*/ do_FGEM, - /*bool*/ do_EGEM, - /*bool*/ do_FHCAL, - /*bool*/ do_FHCAL_twr, - /*bool*/ do_FEMC, - /*bool*/ do_FEMC_twr, - /*bool*/ do_EEMC, - /*bool*/ do_EEMC_twr - ); - } - - //Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - //if (do_dst_compress) DstCompress(out); - //se->registerOutputManager(out); - - //----------------- - // Event processing - //----------------- - if (nEvents < 0) - { - return; - } - // if we run the particle generator and use 0 it'll run forever - if (nEvents == 0 && !readhits && !readhepmc) - { - cout << "using 0 for number of events is a bad idea when using particle generators" << endl; - cout << "it will run forever, so I just return without running anything" << endl; - return; - } - - se->run(nEvents); - - //----- - // Exit - //----- - - se->End(); - std::cout << "All done" << std::endl; - delete se; - gSystem->Exit(0); -} diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C deleted file mode 100644 index f87231ce3..000000000 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ /dev/null @@ -1,450 +0,0 @@ - -int Fun4All_G4_fsPHENIX( - const int nEvents = 2, - const char * inputFile = "/sphenix/sim//sim01/production/2016-07-21/single_particle/spacal2d/fieldmap/G4Hits_sPHENIX_e-_eta0_8GeV-0002.root", - const char * outputFile = "G4fsPHENIX.root", - const char * embed_input_file = "/sphenix/sim/sim01/production/2016-07-12/sHijing/spacal2d/G4Hits_sPHENIX_sHijing-0-4.4fm.list" - ) -{ - // Set the number of TPC layer - const int n_TPC_layers = 40; // use 60 for backward compatibility only - - //=============== - // Input options - //=============== - - // Either: - // read previously generated g4-hits files, in this case it opens a DST and skips - // the simulations step completely. The G4Setup macro is only loaded to get information - // about the number of layers used for the cell reco code - const bool readhits = false; - // Or: - // read files in HepMC format (typically output from event generators like hijing or pythia) - const bool readhepmc = false; // read HepMC files - // Or: - // Use particle generator - const bool runpythia8 = false; - const bool runpythia6 = false; - // And - // Further choose to embed newly simulated events to a previous simulation. Not compatible with `readhits = true` - // In case embedding into a production output, please double check your G4Setup_sPHENIX.C and G4_*.C consistent with those in the production macro folder - // E.g. /sphenix/sim//sim01/production/2016-07-21/single_particle/spacal2d/ - const bool do_embedding = false; - - //====================== - // What to run - //====================== - - bool do_bbc = true; - - bool do_pipe = true; - - bool do_svtx = true; - bool do_svtx_cell = do_svtx && true; - bool do_svtx_track = do_svtx_cell && true; - bool do_svtx_eval = do_svtx_track && false; - - bool do_cemc = true; - bool do_cemc_cell = do_cemc && true; - bool do_cemc_twr = do_cemc_cell && true; - bool do_cemc_cluster = do_cemc_twr && true; - bool do_cemc_eval = do_cemc_cluster && false; - - bool do_hcalin = true; - bool do_hcalin_cell = do_hcalin && true; - bool do_hcalin_twr = do_hcalin_cell && true; - bool do_hcalin_cluster = do_hcalin_twr && true; - bool do_hcalin_eval = do_hcalin_cluster && false; - - bool do_magnet = true; - - bool do_hcalout = true; - bool do_hcalout_cell = do_hcalout && true; - bool do_hcalout_twr = do_hcalout_cell && true; - bool do_hcalout_cluster = do_hcalout_twr && true; - bool do_hcalout_eval = do_hcalout_cluster && false; - - bool do_global = true; - bool do_global_fastsim = false; - - bool do_jet_reco = false; - bool do_jet_eval = do_jet_reco && true; - - bool do_fwd_jet_reco = true; - bool do_fwd_jet_eval = do_fwd_jet_reco && true; - - // fsPHENIX geometry - - bool do_FGEM = true; - bool do_FGEM_track = do_FGEM && true; - - bool do_FEMC = true; - bool do_FEMC_cell = do_FEMC && true; - bool do_FEMC_twr = do_FEMC_cell && true; - bool do_FEMC_cluster = do_FEMC_twr && true; - - bool do_FHCAL = true; - bool do_FHCAL_cell = do_FHCAL && true; - bool do_FHCAL_twr = do_FHCAL_cell && true; - bool do_FHCAL_cluster = do_FHCAL_twr && true; - - bool do_dst_compress = false; - - //Option to convert DST to human command readable TTree for quick poke around the outputs - bool do_DSTReader = true; - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libphhepmc.so"); - gSystem->Load("libg4testbench.so"); - gSystem->Load("libg4hough.so"); - gSystem->Load("libcemc.so"); - gSystem->Load("libg4eval.so"); - - // establish the geometry and reconstruction setup - gROOT->LoadMacro("G4Setup_fsPHENIX.C"); - G4Init(do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_FGEM,do_FEMC,do_FHCAL,n_TPC_layers); - - int absorberactive = 0; // set to 1 to make all absorbers active volumes - // const string magfield = "1.5"; // if like float -> solenoidal field in T, if string use as fieldmap name (including path) - const string magfield = "/phenix/upgrades/decadal/fieldmaps/fsPHENIX.2d.root"; // fsPHENIX field map by Cesar Luiz da Silva , sPHENIX + piston - const float magfield_rescale = 1.0; // already adjusted to 1.4T central field - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); -// se->Verbosity(0); // uncomment for batch production running with minimal output messages - se->Verbosity(Fun4AllServer::VERBOSITY_SOME); // uncomment for some info for interactive running - // just if we set some flags somewhere in this macro - recoConsts *rc = recoConsts::instance(); - // By default every random number generator uses - // PHRandomSeed() which reads /dev/urandom to get its seed - // if the RANDOMSEED flag is set its value is taken as seed - // You can either set this to a random value using PHRandomSeed() - // which will make all seeds identical (not sure what the point of - // this would be: - // rc->set_IntFlag("RANDOMSEED",PHRandomSeed()); - // or set it to a fixed value so you can debug your code - // rc->set_IntFlag("RANDOMSEED", 12345); - - //----------------- - // Event generation - //----------------- - - if (readhits) - { - // Get the hits from a file - // The input manager is declared later - if (do_embedding) - { - cout <<"Do not support read hits and embed background at the same time."<registerSubsystem(hr); - } - else if (runpythia8) - { - gSystem->Load("libPHPythia8.so"); - - PHPythia8* pythia8 = new PHPythia8(); - // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file("phpythia8.cfg"); - se->registerSubsystem(pythia8); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else if (runpythia6) - { - gSystem->Load("libPHPythia6.so"); - - PHPythia6 *pythia6 = new PHPythia6(); - pythia6->set_config_file("phpythia6.cfg"); - se->registerSubsystem(pythia6); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else - { - // toss low multiplicity dummy events - PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - //gen->add_particles("e-",5); // mu+,e+,proton,pi+,Upsilon - //gen->add_particles("e+",5); // mu-,e-,anti_proton,pi- - gen->add_particles("pi-",1); // mu-,e-,anti_proton,pi- - if (readhepmc || do_embedding) { - gen->set_reuse_existing_vertex(true); - gen->set_existing_vertex_offset_vector(0.0,0.0,0.0); - } else { - gen->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_distribution_mean(0.0,0.0,0.0); - gen->set_vertex_distribution_width(0.0,0.0,5.0); - } - gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_size_parameters(0.0,0.0); - gen->set_eta_range(1.4, 3.0); - //gen->set_eta_range(3.0, 3.0); //fsPHENIX FWD - gen->set_phi_range(-1.0*TMath::Pi(), 1.0*TMath::Pi()); - //gen->set_phi_range(TMath::Pi()/2-0.1, TMath::Pi()/2-0.1); - gen->set_p_range(30.0, 30.0); - gen->Embed(1); - gen->Verbosity(0); - se->registerSubsystem(gen); - } - - if (!readhits) - { - //--------------------- - // Detector description - //--------------------- - - G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_svtx, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, - do_FGEM, do_FEMC, do_FHCAL, - magfield_rescale); - - } - - //--------- - // BBC Reco - //--------- - - if (do_bbc) - { - gROOT->LoadMacro("G4_Bbc.C"); - BbcInit(); - Bbc_Reco(); - } - - //------------------ - // Detector Division - //------------------ - - if (do_svtx_cell) Svtx_Cells(); - - if (do_cemc_cell) CEMC_Cells(); - - if (do_hcalin_cell) HCALInner_Cells(); - - if (do_hcalout_cell) HCALOuter_Cells(); - - if (do_FEMC_cell) FEMC_Cells(); - if (do_FHCAL_cell) FHCAL_Cells(); - - //----------------------------- - // CEMC towering and clustering - //----------------------------- - - if (do_cemc_twr) CEMC_Towers(); - if (do_cemc_cluster) CEMC_Clusters(); - - //----------------------------- - // HCAL towering and clustering - //----------------------------- - - if (do_hcalin_twr) HCALInner_Towers(); - if (do_hcalin_cluster) HCALInner_Clusters(); - - if (do_hcalout_twr) HCALOuter_Towers(); - if (do_hcalout_cluster) HCALOuter_Clusters(); - - if (do_FEMC_twr) FEMC_Towers(); - if (do_FEMC_cluster) FEMC_Clusters(); - - if (do_FHCAL_twr) FHCAL_Towers(); - if (do_FHCAL_cluster) FHCAL_Clusters(); - - if (do_dst_compress) ShowerCompress(); - - //-------------- - // SVTX tracking - //-------------- - - if (do_svtx_track) Svtx_Reco(); - - //-------------- - // FGEM tracking - //-------------- - - if(do_FGEM_track) FGEM_FastSim_Reco(); - - //----------------- - // Global Vertexing - //----------------- - - if (do_global) - { - gROOT->LoadMacro("G4_Global.C"); - Global_Reco(); - } - - else if (do_global_fastsim) - { - gROOT->LoadMacro("G4_Global.C"); - Global_FastSim(); - } - - //--------- - // Jet reco - //--------- - - if (do_jet_reco) - { - gROOT->LoadMacro("G4_Jets.C"); - Jet_Reco(); - } - - if (do_fwd_jet_reco) - { - gROOT->LoadMacro("G4_FwdJets.C"); - Jet_FwdReco(); - } - //---------------------- - // Simulation evaluation - //---------------------- - - if (do_svtx_eval) Svtx_Eval("g4svtx_eval.root"); - - if (do_cemc_eval) CEMC_Eval("g4cemc_eval.root"); - - if (do_hcalin_eval) HCALInner_Eval("g4hcalin_eval.root"); - - if (do_hcalout_eval) HCALOuter_Eval("g4hcalout_eval.root"); - - if (do_jet_eval) Jet_Eval("g4jet_eval.root"); - - if (do_fwd_jet_eval) Jet_FwdEval("g4fwdjet_eval.root"); - - //-------------- - // IO management - //-------------- - - if (readhits) - { - // Hits file - Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); - hitsin->fileopen(inputFile); - se->registerInputManager(hitsin); - } - if (do_embedding) - { - if (embed_input_file == NULL) - { - cout << "Missing embed_input_file! Exit"; - exit(3); - } - - Fun4AllDstInputManager *in1 = new Fun4AllNoSyncDstInputManager("DSTinEmbed"); - // in1->AddFile(embed_input_file); // if one use a single input file - in1->AddListFile(embed_input_file); // RecommendedL: if one use a text list of many input files - se->registerInputManager(in1); - } - if (readhepmc) - { - Fun4AllInputManager *in = new Fun4AllHepMCInputManager( "DSTIN"); - se->registerInputManager( in ); - se->fileopen( in->Name().c_str(), inputFile ); - } - else - { - // for single particle generators we just need something which drives - // the event loop, the Dummy Input Mgr does just that - Fun4AllInputManager *in = new Fun4AllDummyInputManager( "JADE"); - se->registerInputManager( in ); - } - - if (do_DSTReader) - { - //Convert DST to human command readable TTree for quick poke around the outputs - gROOT->LoadMacro("G4_DSTReader_fsPHENIX.C"); - - G4DSTreader_fsPHENIX( outputFile, // - /*int*/ absorberactive , - /*bool*/ do_svtx , - /*bool*/ do_cemc , - /*bool*/ do_hcalin , - /*bool*/ do_magnet , - /*bool*/ do_hcalout , - /*bool*/ do_cemc_twr , - /*bool*/ do_hcalin_twr , - /*bool*/ do_magnet , - /*bool*/ do_hcalout_twr, - /*bool*/ do_FGEM, - /*bool*/ do_FHCAL, - /*bool*/ do_FHCAL_twr, - /*bool*/ do_FEMC, - /*bool*/ do_FEMC_twr - ); - } - - //Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - //if (do_dst_compress) DstCompress(out); - //se->registerOutputManager(out); - - if (nEvents == 0 && !readhits && !readhepmc) - { - cout << "using 0 for number of events is a bad idea when using particle generators" << endl; - cout << "it will run forever, so I just return without running anything" << endl; - return; - } - - if (nEvents < 0) - { - PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); - g4->ApplyCommand("/control/execute vis.mac"); - //g4->StartGui(); - se->run(1); - - se->End(); - std::cout << "All done" << std::endl; - - - std::cout << "==== Useful display commands ==" << std::endl; - cout << "draw axis: " << endl; - cout << " G4Cmd(\"/vis/scene/add/axes 0 0 0 50 cm\")" << endl; - cout << "zoom" << endl; - cout << " G4Cmd(\"/vis/viewer/zoom 1\")" << endl; - cout << "viewpoint:" << endl; - cout << " G4Cmd(\"/vis/viewer/set/viewpointThetaPhi 0 0\")" << endl; - cout << "panTo:" << endl; - cout << " G4Cmd(\"/vis/viewer/panTo 0 0 cm\")" << endl; - cout << "print to eps:" << endl; - cout << " G4Cmd(\"/vis/ogl/printEPS\")" << endl; - cout << "set background color:" << endl; - cout << " G4Cmd(\"/vis/viewer/set/background white\")" << endl; - std::cout << "===============================" << std::endl; - } - else - { - - se->run(nEvents); - - se->End(); - std::cout << "All done" << std::endl; - delete se; - gSystem->Exit(0); - } - -} - - -void -G4Cmd(const char * cmd) -{ - Fun4AllServer *se = Fun4AllServer::instance(); - PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); - g4->ApplyCommand(cmd); -} diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C deleted file mode 100644 index 7d4b221a7..000000000 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ /dev/null @@ -1,484 +0,0 @@ -int Fun4All_G4_sPHENIX( - const int nEvents = 1, - const char * inputFile = "/sphenix/data/data02/review_2017-08-02/single_particle/spacal2d/fieldmap/G4Hits_sPHENIX_e-_eta0_8GeV-0002.root", - const char * outputFile = "G4sPHENIX.root", - const char * embed_input_file = "/sphenix/data/data02/review_2017-08-02/sHijing/fm_0-4.list" - ) -{ - // Set the number of TPC layer - const int n_TPC_layers = 40; // use 60 for backward compatibility only - - //=============== - // Input options - //=============== - - // Either: - // read previously generated g4-hits files, in this case it opens a DST and skips - // the simulations step completely. The G4Setup macro is only loaded to get information - // about the number of layers used for the cell reco code - // - // In case reading production output, please double check your G4Setup_sPHENIX.C and G4_*.C consistent with those in the production macro folder - // E.g. /sphenix/sim//sim01/production/2016-07-21/single_particle/spacal2d/ - const bool readhits = false; - // Or: - // read files in HepMC format (typically output from event generators like hijing or pythia) - const bool readhepmc = false; // read HepMC files - // Or: - // Use pythia - const bool runpythia8 = false; - const bool runpythia6 = false; - // - // **** And **** - // Further choose to embed newly simulated events to a previous simulation. Not compatible with `readhits = true` - // In case embedding into a production output, please double check your G4Setup_sPHENIX.C and G4_*.C consistent with those in the production macro folder - // E.g. /sphenix/data/data02/review_2017-08-02/ - const bool do_embedding = false; - - // Besides the above flags. One can further choose to further put in following particles in Geant4 simulation - // Use multi-particle generator (PHG4SimpleEventGenerator), see the code block below to choose particle species and kinematics - const bool particles = true && !readhits; - // or gun/ very simple single particle gun generator - const bool usegun = false && !readhits; - // Throw single Upsilons, may be embedded in Hijing by setting readhepmc flag also (note, careful to set Z vertex equal to Hijing events) - const bool upsilons = false && !readhits; - - //====================== - // What to run - //====================== - - bool do_bbc = true; - - bool do_pipe = true; - - bool do_svtx = true; - bool do_svtx_cell = do_svtx && true; - bool do_svtx_track = do_svtx_cell && true; - bool do_svtx_eval = do_svtx_track && true; - - bool do_pstof = false; - - bool do_cemc = true; - bool do_cemc_cell = do_cemc && true; - bool do_cemc_twr = do_cemc_cell && true; - bool do_cemc_cluster = do_cemc_twr && true; - bool do_cemc_eval = do_cemc_cluster && true; - - - bool do_hcalin = true; - bool do_hcalin_cell = do_hcalin && true; - bool do_hcalin_twr = do_hcalin_cell && true; - bool do_hcalin_cluster = do_hcalin_twr && true; - bool do_hcalin_eval = do_hcalin_cluster && true; - - bool do_magnet = true; - - bool do_hcalout = true; - bool do_hcalout_cell = do_hcalout && true; - bool do_hcalout_twr = do_hcalout_cell && true; - bool do_hcalout_cluster = do_hcalout_twr && true; - bool do_hcalout_eval = do_hcalout_cluster && true; - - bool do_global = true; - bool do_global_fastsim = true; - - bool do_calotrigger = true && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - - bool do_jet_reco = true; - bool do_jet_eval = do_jet_reco &&true; - - // HI Jet Reco for jet simulations in Au+Au (default is false for - // single particle / p+p simulations, or for Au+Au simulations which - // don't care about jets) - bool do_HIjetreco = false && do_jet_reco && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - - bool do_dst_compress = false; - - //Option to convert DST to human command readable TTree for quick poke around the outputs - bool do_DSTReader = false; - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libphhepmc.so"); - gSystem->Load("libg4testbench.so"); - gSystem->Load("libg4hough.so"); - gSystem->Load("libcemc.so"); - gSystem->Load("libg4eval.so"); - - // establish the geometry and reconstruction setup - gROOT->LoadMacro("G4Setup_sPHENIX.C"); - G4Init(do_svtx,do_pstof,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,n_TPC_layers); - - int absorberactive = 1; // set to 1 to make all absorbers active volumes - // const string magfield = "1.5"; // if like float -> solenoidal field in T, if string use as fieldmap name (including path) - const string magfield = "/phenix/upgrades/decadal/fieldmaps/sPHENIX.2d.root"; // if like float -> solenoidal field in T, if string use as fieldmap name (including path) - const float magfield_rescale = -1.4/1.5; // scale the map to a 1.4 T field - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(0); - // just if we set some flags somewhere in this macro - recoConsts *rc = recoConsts::instance(); - // By default every random number generator uses - // PHRandomSeed() which reads /dev/urandom to get its seed - // if the RANDOMSEED flag is set its value is taken as seed - // You ca neither set this to a random value using PHRandomSeed() - // which will make all seeds identical (not sure what the point of - // this would be: - // rc->set_IntFlag("RANDOMSEED",PHRandomSeed()); - // or set it to a fixed value so you can debug your code - // rc->set_IntFlag("RANDOMSEED", 12345); - - //----------------- - // Event generation - //----------------- - - if (readhits) - { - // Get the hits from a file - // The input manager is declared later - - if (do_embedding) - { - cout <<"Do not support read hits and embed background at the same time."<registerSubsystem(hr); - } - else if (runpythia8) - { - gSystem->Load("libPHPythia8.so"); - - PHPythia8* pythia8 = new PHPythia8(); - // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file("phpythia8.cfg"); - se->registerSubsystem(pythia8); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else if (runpythia6) - { - gSystem->Load("libPHPythia6.so"); - - PHPythia6 *pythia6 = new PHPythia6(); - pythia6->set_config_file("phpythia6.cfg"); - se->registerSubsystem(pythia6); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - - // If "readhepMC" is also set, the particles will be embedded in Hijing events - if(particles) - { - // toss low multiplicity dummy events - PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - gen->add_particles("pi-",2); // mu+,e+,proton,pi+,Upsilon - //gen->add_particles("pi+",100); // 100 pion option - if (readhepmc || do_embedding) - { - gen->set_reuse_existing_vertex(true); - gen->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); - } - else - { - gen->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_distribution_mean(0.0, 0.0, 0.0); - gen->set_vertex_distribution_width(0.0, 0.0, 5.0); - } - gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_size_parameters(0.0, 0.0); - gen->set_eta_range(-1.0, 1.0); - gen->set_phi_range(-1.0 * TMath::Pi(), 1.0 * TMath::Pi()); - //gen->set_pt_range(0.1, 50.0); - gen->set_pt_range(0.1, 20.0); - gen->Embed(1); - gen->Verbosity(0); - - se->registerSubsystem(gen); - } - if (usegun) - { - PHG4ParticleGun *gun = new PHG4ParticleGun(); - // gun->set_name("anti_proton"); - gun->set_name("geantino"); - gun->set_vtx(0, 0, 0); - gun->set_mom(10, 0, 0.01); - // gun->AddParticle("geantino",1.7776,-0.4335,0.); - // gun->AddParticle("geantino",1.7709,-0.4598,0.); - // gun->AddParticle("geantino",2.5621,0.60964,0.); - // gun->AddParticle("geantino",1.8121,0.253,0.); - // se->registerSubsystem(gun); - PHG4ParticleGenerator *pgen = new PHG4ParticleGenerator(); - pgen->set_name("geantino"); - pgen->set_z_range(0,0); - pgen->set_eta_range(0.01,0.01); - pgen->set_mom_range(10,10); - pgen->set_phi_range(5.3/180.*TMath::Pi(),5.7/180.*TMath::Pi()); - se->registerSubsystem(pgen); - } - - // If "readhepMC" is also set, the Upsilons will be embedded in Hijing events, if 'particles" is set, the Upsilons will be embedded in whatever particles are thrown - if(upsilons) - { - // run upsilons for momentum, dca performance, alone or embedded in Hijing - - PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); - vgen->add_decay_particles("e+","e-",0); // i = decay id - // event vertex - if (readhepmc || do_embedding || particles) - { - vgen->set_reuse_existing_vertex(true); - } - else - { - vgen->set_vtx_zrange(-10.0, +10.0); - } - - // Note: this rapidity range completely fills the acceptance of eta = +/- 1 unit - vgen->set_rapidity_range(-1.0, +1.0); - vgen->set_pt_range(0.0, 10.0); - - int istate = 1; - - if(istate == 1) - { - // Upsilon(1S) - vgen->set_mass(9.46); - vgen->set_width(54.02e-6); - } - else if (istate == 2) - { - // Upsilon(2S) - vgen->set_mass(10.0233); - vgen->set_width(31.98e-6); - } - else - { - // Upsilon(3S) - vgen->set_mass(10.3552); - vgen->set_width(20.32e-6); - } - - vgen->Verbosity(0); - vgen->Embed(2); - se->registerSubsystem(vgen); - - cout << "Upsilon generator for istate = " << istate << " created and registered " << endl; - } - - if (!readhits) - { - //--------------------- - // Detector description - //--------------------- - - G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_svtx, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, magfield_rescale); - } - - //--------- - // BBC Reco - //--------- - - if (do_bbc) - { - gROOT->LoadMacro("G4_Bbc.C"); - BbcInit(); - Bbc_Reco(); - } - //------------------ - // Detector Division - //------------------ - - if (do_svtx_cell) Svtx_Cells(); - - if (do_cemc_cell) CEMC_Cells(); - - if (do_hcalin_cell) HCALInner_Cells(); - - if (do_hcalout_cell) HCALOuter_Cells(); - - //----------------------------- - // CEMC towering and clustering - //----------------------------- - - if (do_cemc_twr) CEMC_Towers(); - if (do_cemc_cluster) CEMC_Clusters(); - - //----------------------------- - // HCAL towering and clustering - //----------------------------- - - if (do_hcalin_twr) HCALInner_Towers(); - if (do_hcalin_cluster) HCALInner_Clusters(); - - if (do_hcalout_twr) HCALOuter_Towers(); - if (do_hcalout_cluster) HCALOuter_Clusters(); - - if (do_dst_compress) ShowerCompress(); - - //-------------- - // SVTX tracking - //-------------- - - if (do_svtx_track) Svtx_Reco(); - - //----------------- - // Global Vertexing - //----------------- - - if (do_global) - { - gROOT->LoadMacro("G4_Global.C"); - Global_Reco(); - } - - else if (do_global_fastsim) - { - gROOT->LoadMacro("G4_Global.C"); - Global_FastSim(); - } - - //----------------- - // Calo Trigger Simulation - //----------------- - - if (do_calotrigger) - { - gROOT->LoadMacro("G4_CaloTrigger.C"); - CaloTrigger_Sim(); - } - - //--------- - // Jet reco - //--------- - - if (do_jet_reco) - { - gROOT->LoadMacro("G4_Jets.C"); - Jet_Reco(); - } - - if (do_HIjetreco) { - gROOT->LoadMacro("G4_HIJetReco.C"); - HIJetReco(); - } - - //---------------------- - // Simulation evaluation - //---------------------- - - if (do_svtx_eval) Svtx_Eval(string(outputFile) + "_g4svtx_eval.root"); - - if (do_cemc_eval) CEMC_Eval(string(outputFile) + "_g4cemc_eval.root"); - - if (do_hcalin_eval) HCALInner_Eval(string(outputFile) + "_g4hcalin_eval.root"); - - if (do_hcalout_eval) HCALOuter_Eval(string(outputFile) + "_g4hcalout_eval.root"); - - if (do_jet_eval) Jet_Eval(string(outputFile) + "_g4jet_eval.root"); - - //-------------- - // IO management - //-------------- - - if (readhits) - { - // Hits file - Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); - hitsin->fileopen(inputFile); - se->registerInputManager(hitsin); - } - if (do_embedding) - { - if (embed_input_file == NULL) - { - cout << "Missing embed_input_file! Exit"; - exit(3); - } - - Fun4AllDstInputManager *in1 = new Fun4AllNoSyncDstInputManager("DSTinEmbed"); - // in1->AddFile(embed_input_file); // if one use a single input file - in1->AddListFile(embed_input_file); // RecommendedL: if one use a text list of many input files - se->registerInputManager(in1); - } - if (readhepmc) - { - Fun4AllInputManager *in = new Fun4AllHepMCInputManager( "DSTIN"); - se->registerInputManager( in ); - se->fileopen( in->Name().c_str(), inputFile ); - } - else - { - // for single particle generators we just need something which drives - // the event loop, the Dummy Input Mgr does just that - Fun4AllInputManager *in = new Fun4AllDummyInputManager( "JADE"); - se->registerInputManager( in ); - } - - if (do_DSTReader) - { - //Convert DST to human command readable TTree for quick poke around the outputs - gROOT->LoadMacro("G4_DSTReader.C"); - - G4DSTreader( outputFile, // - /*int*/ absorberactive , - /*bool*/ do_svtx , - /*bool*/ do_pstof , - /*bool*/ do_cemc , - /*bool*/ do_hcalin , - /*bool*/ do_magnet , - /*bool*/ do_hcalout , - /*bool*/ do_cemc_twr , - /*bool*/ do_hcalin_twr , - /*bool*/ do_magnet , - /*bool*/ do_hcalout_twr - ); - } - - // Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - // if (do_dst_compress) DstCompress(out); - // se->registerOutputManager(out); - - //----------------- - // Event processing - //----------------- - if (nEvents < 0) - { - return; - } - // if we run the particle generator and use 0 it'll run forever - if (nEvents == 0 && !readhits && !readhepmc) - { - cout << "using 0 for number of events is a bad idea when using particle generators" << endl; - cout << "it will run forever, so I just return without running anything" << endl; - return; - } - - se->run(nEvents); - - //----- - // Exit - //----- - - se->End(); - std::cout << "All done" << std::endl; - delete se; - gSystem->Exit(0); -} diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C deleted file mode 100644 index e6453f717..000000000 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ /dev/null @@ -1,403 +0,0 @@ - -double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes -bool overlapcheck = false; // set to true if you want to check for overlaps - -void G4Init(bool do_svtx = true, - bool do_cemc = true, - bool do_hcalin = true, - bool do_magnet = true, - bool do_hcalout = true, - bool do_pipe = true, - bool do_FGEM = true, - bool do_EGEM = true, - bool do_FEMC = true, - bool do_FHCAL = true, - bool do_EEMC = true, - bool do_DIRC = true, - bool do_RICH = true, - bool do_Aerogel = true, - int n_TPC_layers = 40) -{ - - // load detector/material macros and execute Init() function - - if (do_pipe) - { - gROOT->LoadMacro("G4_Pipe.C"); - PipeInit(); - } - if (do_svtx) - { - gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); - SvtxInit(n_TPC_layers); - } - - if (do_cemc) - { - gROOT->LoadMacro("G4_CEmc_Spacal.C"); - CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations - } - - if (do_hcalin) - { - gROOT->LoadMacro("G4_HcalIn_ref.C"); - HCalInnerInit(); - } - - if (do_magnet) - { - gROOT->LoadMacro("G4_Magnet.C"); - MagnetInit(); - } - if (do_hcalout) - { - gROOT->LoadMacro("G4_HcalOut_ref.C"); - HCalOuterInit(); - } - - if (do_FGEM) - { - gROOT->LoadMacro("G4_FGEM_fsPHENIX.C"); - FGEM_Init(); - } - - if (do_EGEM) - { - gROOT->LoadMacro("G4_EGEM_EIC.C"); - EGEM_Init(); - } - - if (do_FEMC) - { - gROOT->LoadMacro("G4_FEMC.C"); - FEMCInit(); - } - - if (do_FHCAL) - { - gROOT->LoadMacro("G4_FHCAL.C"); - FHCALInit(); - } - - if (do_EEMC) - { - gROOT->LoadMacro("G4_EEMC.C"); - EEMCInit(); - } - - if (do_DIRC) - { - gROOT->LoadMacro("G4_DIRC.C"); - DIRCInit(); - } - - if (do_RICH) - { - gROOT->LoadMacro("G4_RICH.C"); - RICHInit(); - } - - if (do_Aerogel) - { - gROOT->LoadMacro("G4_Aerogel.C"); - AerogelInit(); - } - - -} - - -int G4Setup(const int absorberactive = 0, - const string &field ="1.5", - const EDecayType decayType = TPythia6Decayer::kAll, - const bool do_svtx = true, - const bool do_cemc = true, - const bool do_hcalin = true, - const bool do_magnet = true, - const bool do_hcalout = true, - const bool do_pipe = true, - const bool do_FGEM = true, - const bool do_EGEM = true, - const bool do_FEMC = false, - const bool do_FHCAL = false, - const bool do_EEMC = true, - const bool do_DIRC = true, - const bool do_RICH = true, - const bool do_Aerogel = true, - const float magfield_rescale = 1.0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4Reco* g4Reco = new PHG4Reco(); - g4Reco->set_rapidity_coverage(1.1); // according to drawings -// uncomment to set QGSP_BERT_HP physics list for productions -// (default is QGSP_BERT for speed) - // g4Reco->SetPhysicsList("QGSP_BERT_HP"); - - if (decayType != TPythia6Decayer::kAll) { - g4Reco->set_force_decay(decayType); - } - - double fieldstrength; - istringstream stringline(field); - stringline >> fieldstrength; - if (stringline.fail()) { // conversion to double fails -> we have a string - - if (field.find("sPHENIX.root") != string::npos) { - g4Reco->set_field_map(field, 1); - } else { - g4Reco->set_field_map(field, 2); - } - } else { - g4Reco->set_field(fieldstrength); // use const soleniodal field - } - g4Reco->set_field_rescale(magfield_rescale); - - double radius = 0.; - - //---------------------------------------- - // PIPE - if (do_pipe) radius = Pipe(g4Reco, radius, absorberactive); - - //---------------------------------------- - // SVTX - if (do_svtx) radius = Svtx(g4Reco, radius, absorberactive); - - //---------------------------------------- - // CEMC - // - if (do_cemc) radius = CEmc(g4Reco, radius, 8, absorberactive); - // if (do_cemc) radius = CEmc_Vis(g4Reco, radius, 8, absorberactive);// for visualization substructure of SPACAL, slow to render - - //---------------------------------------- - // HCALIN - - if (do_hcalin) radius = HCalInner(g4Reco, radius, 4, absorberactive); - - //---------------------------------------- - // MAGNET - - if (do_magnet) radius = Magnet(g4Reco, radius, 0, absorberactive); - - //---------------------------------------- - // HCALOUT - - if (do_hcalout) radius = HCalOuter(g4Reco, radius, 4, absorberactive); - - //---------------------------------------- - // Forward tracking - - if ( do_FGEM ) - FGEMSetup(g4Reco); - - if ( do_EGEM ) - EGEMSetup(g4Reco); - - //---------------------------------------- - // FEMC - - if ( do_FEMC ) - FEMCSetup(g4Reco, absorberactive); - - //---------------------------------------- - // FHCAL - - if ( do_FHCAL ) - FHCALSetup(g4Reco, absorberactive); - - //---------------------------------------- - // EEMC - - if ( do_EEMC ) - EEMCSetup(g4Reco, absorberactive); - - //---------------------------------------- - // PID - - if ( do_DIRC ) - DIRCSetup(g4Reco); - - if ( do_RICH ) - RICHSetup(g4Reco); - - if ( do_Aerogel ) - AerogelSetup(g4Reco); - - // sPHENIX forward flux return(s) - PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); - flux_return_plus->set_int_param("lengthviarapidity",0); - flux_return_plus->set_double_param("length",10.2); - flux_return_plus->set_double_param("radius",2.1); - flux_return_plus->set_double_param("thickness",263.5-5.0); - flux_return_plus->set_double_param("place_z",335.9); - flux_return_plus->set_string_param("material","G4_Fe"); - flux_return_plus->SetActive(false); - flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); - flux_return_plus->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(flux_return_plus); - - PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); - flux_return_minus->set_int_param("lengthviarapidity",0); - flux_return_minus->set_double_param("length",10.2); - flux_return_minus->set_double_param("radius",90.0); - flux_return_minus->set_double_param("place_z",-335.9); - flux_return_minus->set_double_param("thickness",263.5-5.0 - (90-2.1)); - flux_return_minus->set_string_param("material","G4_Fe"); - flux_return_minus->SetActive(false); - flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); - flux_return_minus->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(flux_return_minus); - - //---------------------------------------- - // BLACKHOLE - - // swallow all particles coming out of the backend of sPHENIX - PHG4CylinderSubsystem *blackhole = new PHG4CylinderSubsystem("BH", 1); - blackhole->set_double_param("radius",radius + 100); // add 100 cm - - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",g4Reco->GetWorldSizeZ() - no_overlapp); // make it cover the world in length - blackhole->BlackHole(); - blackhole->set_double_param("thickness",0.1); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - //---------------------------------------- - // FORWARD BLACKHOLEs - // +Z - blackhole = new PHG4CylinderSubsystem("BH_FORWARD_PLUS", 1); - blackhole->SuperDetector("BH_FORWARD_PLUS"); - blackhole->set_double_param("radius",0); // add 10 cm - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",0.1); // make it cover the world in length - blackhole->set_double_param("place_z",g4Reco->GetWorldSizeZ()/2. - 0.1 - no_overlapp); - blackhole->BlackHole(); - blackhole->set_double_param("thickness",radius - no_overlapp); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - blackhole = new PHG4CylinderSubsystem("BH_FORWARD_NEG", 1); - blackhole->SuperDetector("BH_FORWARD_NEG"); - blackhole->set_double_param("radius",0); // add 10 cm - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",0.1); // make it cover the world in length - blackhole->set_double_param("place_z", - g4Reco->GetWorldSizeZ()/2. +0.1 + no_overlapp); - blackhole->BlackHole(); - blackhole->set_double_param("thickness",radius - no_overlapp); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); - g4Reco->registerSubsystem(truth); - se->registerSubsystem( g4Reco ); -} - - -void ShowerCompress(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4DstCompressReco* compress = new PHG4DstCompressReco("PHG4DstCompressReco"); - compress->AddHitContainer("G4HIT_PIPE"); - compress->AddHitContainer("G4HIT_SVTXSUPPORT"); - compress->AddHitContainer("G4HIT_CEMC_ELECTRONICS"); - compress->AddHitContainer("G4HIT_CEMC"); - compress->AddHitContainer("G4HIT_ABSORBER_CEMC"); - compress->AddHitContainer("G4HIT_CEMC_SPT"); - compress->AddHitContainer("G4HIT_ABSORBER_HCALIN"); - compress->AddHitContainer("G4HIT_HCALIN"); - compress->AddHitContainer("G4HIT_HCALIN_SPT"); - compress->AddHitContainer("G4HIT_MAGNET"); - compress->AddHitContainer("G4HIT_ABSORBER_HCALOUT"); - compress->AddHitContainer("G4HIT_HCALOUT"); - compress->AddHitContainer("G4HIT_BH_1"); - compress->AddHitContainer("G4HIT_BH_FORWARD_PLUS"); - compress->AddHitContainer("G4HIT_BH_FORWARD_NEG"); - compress->AddCellContainer("G4CELL_CEMC"); - compress->AddCellContainer("G4CELL_HCALIN"); - compress->AddCellContainer("G4CELL_HCALOUT"); - compress->AddTowerContainer("TOWER_SIM_CEMC"); - compress->AddTowerContainer("TOWER_RAW_CEMC"); - compress->AddTowerContainer("TOWER_CALIB_CEMC"); - compress->AddTowerContainer("TOWER_SIM_HCALIN"); - compress->AddTowerContainer("TOWER_RAW_HCALIN"); - compress->AddTowerContainer("TOWER_CALIB_HCALIN"); - compress->AddTowerContainer("TOWER_SIM_HCALOUT"); - compress->AddTowerContainer("TOWER_RAW_HCALOUT"); - compress->AddTowerContainer("TOWER_CALIB_HCALOUT"); - - compress->AddHitContainer("G4HIT_FEMC"); - compress->AddHitContainer("G4HIT_ABSORBER_FEMC"); - compress->AddHitContainer("G4HIT_FHCAL"); - compress->AddHitContainer("G4HIT_ABSORBER_FHCAL"); - compress->AddCellContainer("G4CELL_FEMC"); - compress->AddCellContainer("G4CELL_FHCAL"); - compress->AddTowerContainer("TOWER_SIM_FEMC"); - compress->AddTowerContainer("TOWER_RAW_FEMC"); - compress->AddTowerContainer("TOWER_CALIB_FEMC"); - compress->AddTowerContainer("TOWER_SIM_FHCAL"); - compress->AddTowerContainer("TOWER_RAW_FHCAL"); - compress->AddTowerContainer("TOWER_CALIB_FHCAL"); - - compress->AddHitContainer("G4HIT_EEMC"); - compress->AddHitContainer("G4HIT_ABSORBER_EEMC"); - compress->AddCellContainer("G4CELL_EEMC"); - compress->AddTowerContainer("TOWER_SIM_EEMC"); - compress->AddTowerContainer("TOWER_RAW_EEMC"); - compress->AddTowerContainer("TOWER_CALIB_EEMC"); - - se->registerSubsystem(compress); - - return; -} - -void DstCompress(Fun4AllDstOutputManager* out) { - if (out) { - out->StripNode("G4HIT_PIPE"); - out->StripNode("G4HIT_SVTXSUPPORT"); - out->StripNode("G4HIT_CEMC_ELECTRONICS"); - out->StripNode("G4HIT_CEMC"); - out->StripNode("G4HIT_ABSORBER_CEMC"); - out->StripNode("G4HIT_CEMC_SPT"); - out->StripNode("G4HIT_ABSORBER_HCALIN"); - out->StripNode("G4HIT_HCALIN"); - out->StripNode("G4HIT_HCALIN_SPT"); - out->StripNode("G4HIT_MAGNET"); - out->StripNode("G4HIT_ABSORBER_HCALOUT"); - out->StripNode("G4HIT_HCALOUT"); - out->StripNode("G4HIT_BH_1"); - out->StripNode("G4HIT_BH_FORWARD_PLUS"); - out->StripNode("G4HIT_BH_FORWARD_NEG"); - out->StripNode("G4CELL_CEMC"); - out->StripNode("G4CELL_HCALIN"); - out->StripNode("G4CELL_HCALOUT"); - - out->StripNode("G4HIT_FEMC"); - out->StripNode("G4HIT_ABSORBER_FEMC"); - out->StripNode("G4HIT_FHCAL"); - out->StripNode("G4HIT_ABSORBER_FHCAL"); - out->StripNode("G4CELL_FEMC"); - out->StripNode("G4CELL_FHCAL"); - - out->StripNode("G4HIT_EEMC"); - out->StripNode("G4HIT_ABSORBER_EEMC"); - out->StripNode("G4CELL_EEMC"); - } -} diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C deleted file mode 100644 index 751d7286c..000000000 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ /dev/null @@ -1,432 +0,0 @@ - -double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes -bool overlapcheck = false; // set to true if you want to check for overlaps - -void G4Init(bool do_svtx = true, - bool do_cemc = true, - bool do_hcalin = true, - bool do_magnet = true, - bool do_hcalout = true, - bool do_pipe = true, - bool do_FGEM = true, - bool do_FEMC = true, - bool do_FHCAL = true, - int n_TPC_layers = 40) { - - // load detector/material macros and execute Init() function - - if (do_pipe) - { - gROOT->LoadMacro("G4_Pipe.C"); - PipeInit(); - } - if (do_svtx) - { - gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); - SvtxInit(n_TPC_layers); - } - - if (do_cemc) - { - gROOT->LoadMacro("G4_CEmc_Spacal.C"); - CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations - } - - if (do_hcalin) - { - gROOT->LoadMacro("G4_HcalIn_ref.C"); - HCalInnerInit(); - } - - if (do_magnet) - { - gROOT->LoadMacro("G4_Magnet.C"); - MagnetInit(); - } - if (do_hcalout) - { - gROOT->LoadMacro("G4_HcalOut_ref.C"); - HCalOuterInit(); - } - - if (do_FGEM) - { - gROOT->LoadMacro("G4_FGEM_fsPHENIX.C"); - FGEM_Init(); - } - - if (do_FEMC) - { - gROOT->LoadMacro("G4_FEMC.C"); - FEMCInit(); - } - - if (do_FHCAL) - { - gROOT->LoadMacro("G4_FHCAL.C"); - FHCALInit(); - } -} - - -int G4Setup(const int absorberactive = 0, - const string &field ="1.5", - const EDecayType decayType = TPythia6Decayer::kAll, - const bool do_svtx = true, - const bool do_cemc = true, - const bool do_hcalin = true, - const bool do_magnet = true, - const bool do_hcalout = true, - const bool do_pipe = true, - const bool do_FGEM = true, - const bool do_FEMC = false, - const bool do_FHCAL = false, - const float magfield_rescale = 1.0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4Reco* g4Reco = new PHG4Reco(); - g4Reco->save_DST_geometry(true); //Save geometry from Geant4 to DST - g4Reco->set_rapidity_coverage(1.1); // according to drawings -// uncomment to set QGSP_BERT_HP physics list for productions -// (default is QGSP_BERT for speed) - // g4Reco->SetPhysicsList("QGSP_BERT_HP"); - - if (decayType != TPythia6Decayer::kAll) { - g4Reco->set_force_decay(decayType); - } - - double fieldstrength; - istringstream stringline(field); - stringline >> fieldstrength; - if (stringline.fail()) { // conversion to double fails -> we have a string - - if (field.find("sPHENIX.root") != string::npos) { - g4Reco->set_field_map(field, 1); - } else { - g4Reco->set_field_map(field, 2); - } - } else { - g4Reco->set_field(fieldstrength); // use const soleniodal field - } - g4Reco->set_field_rescale(magfield_rescale); - - double radius = 0.; - - //---------------------------------------- - // PIPE - if (do_pipe) radius = Pipe(g4Reco, radius, absorberactive); - - //---------------------------------------- - // SVTX - if (do_svtx) radius = Svtx(g4Reco, radius, absorberactive); - - //---------------------------------------- - // CEMC -// - if (do_cemc) radius = CEmc(g4Reco, radius, 8, absorberactive); -// if (do_cemc) radius = CEmc_Vis(g4Reco, radius, 8, absorberactive);// for visualization substructure of SPACAL, slow to render - - //---------------------------------------- - // HCALIN - - if (do_hcalin) radius = HCalInner(g4Reco, radius, 4, absorberactive); - - //---------------------------------------- - // MAGNET - - if (do_magnet) radius = Magnet(g4Reco, radius, 0, absorberactive); - - //---------------------------------------- - // HCALOUT - - if (do_hcalout) radius = HCalOuter(g4Reco, radius, 4, absorberactive); - - //---------------------------------------- - // Forward tracking - - if ( do_FGEM ) - FGEMSetup(g4Reco); - - //---------------------------------------- - // FEMC - - if ( do_FEMC ) - FEMCSetup(g4Reco, absorberactive); - - //---------------------------------------- - // FHCAL - - if ( do_FHCAL ) - FHCALSetup(g4Reco, absorberactive); - - // sPHENIX forward flux return(s) - PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); - flux_return_plus->set_int_param("lengthviarapidity",0); - flux_return_plus->set_double_param("length",10.2); - flux_return_plus->set_double_param("radius",2.1); - flux_return_plus->set_double_param("thickness",263.5-5.0); - flux_return_plus->set_double_param("place_z",335.9); - flux_return_plus->set_string_param("material","G4_Fe"); - flux_return_plus->SetActive(false); - flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); - flux_return_plus->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(flux_return_plus); - - PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); - flux_return_minus->set_int_param("lengthviarapidity",0); - flux_return_minus->set_double_param("length",10.2); - flux_return_minus->set_double_param("radius",2.1); - flux_return_minus->set_double_param("place_z",-335.9); - flux_return_minus->set_double_param("thickness",263.5-5.0); - flux_return_minus->set_string_param("material","G4_Fe"); - flux_return_minus->SetActive(false); - flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); - flux_return_minus->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(flux_return_minus); - - //---------------------------------------- - // piston magnet - make_piston("magpiston", g4Reco); - - //---------------------------------------- - // BLACKHOLE - - // swallow all particles coming out of the backend of sPHENIX - PHG4CylinderSubsystem *blackhole = new PHG4CylinderSubsystem("BH", 1); -blackhole->set_double_param("radius",radius + 10); // add 10 cm - - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",g4Reco->GetWorldSizeZ() - no_overlapp); // make it cover the world in length - blackhole->BlackHole(); - blackhole->set_double_param("thickness",0.1); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - //---------------------------------------- - // FORWARD BLACKHOLEs - // +Z - blackhole = new PHG4CylinderSubsystem("BH_FORWARD_PLUS", 1); - blackhole->SuperDetector("BH_FORWARD_PLUS"); - blackhole->set_double_param("radius",0); // add 10 cm - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",0.1); // make it cover the world in length - blackhole->set_double_param("place_z",g4Reco->GetWorldSizeZ()/2. - 0.1 - no_overlapp); - blackhole->BlackHole(); - blackhole->set_double_param("thickness",radius - no_overlapp); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - blackhole = new PHG4CylinderSubsystem("BH_FORWARD_NEG", 1); - blackhole->SuperDetector("BH_FORWARD_NEG"); - blackhole->set_double_param("radius",0); // add 10 cm - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",0.1); // make it cover the world in length - blackhole->set_double_param("place_z", - g4Reco->GetWorldSizeZ()/2. +0.1 + no_overlapp); - blackhole->BlackHole(); - blackhole->set_double_param("thickness",radius - no_overlapp); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); - g4Reco->registerSubsystem(truth); - se->registerSubsystem( g4Reco ); -} - - -void ShowerCompress(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4DstCompressReco* compress = new PHG4DstCompressReco("PHG4DstCompressReco"); - compress->AddHitContainer("G4HIT_PIPE"); - compress->AddHitContainer("G4HIT_SVTXSUPPORT"); - compress->AddHitContainer("G4HIT_CEMC_ELECTRONICS"); - compress->AddHitContainer("G4HIT_CEMC"); - compress->AddHitContainer("G4HIT_ABSORBER_CEMC"); - compress->AddHitContainer("G4HIT_CEMC_SPT"); - compress->AddHitContainer("G4HIT_ABSORBER_HCALIN"); - compress->AddHitContainer("G4HIT_HCALIN"); - compress->AddHitContainer("G4HIT_HCALIN_SPT"); - compress->AddHitContainer("G4HIT_MAGNET"); - compress->AddHitContainer("G4HIT_ABSORBER_HCALOUT"); - compress->AddHitContainer("G4HIT_HCALOUT"); - compress->AddHitContainer("G4HIT_BH_1"); - compress->AddHitContainer("G4HIT_BH_FORWARD_PLUS"); - compress->AddHitContainer("G4HIT_BH_FORWARD_NEG"); - compress->AddCellContainer("G4CELL_CEMC"); - compress->AddCellContainer("G4CELL_HCALIN"); - compress->AddCellContainer("G4CELL_HCALOUT"); - compress->AddTowerContainer("TOWER_SIM_CEMC"); - compress->AddTowerContainer("TOWER_RAW_CEMC"); - compress->AddTowerContainer("TOWER_CALIB_CEMC"); - compress->AddTowerContainer("TOWER_SIM_HCALIN"); - compress->AddTowerContainer("TOWER_RAW_HCALIN"); - compress->AddTowerContainer("TOWER_CALIB_HCALIN"); - compress->AddTowerContainer("TOWER_SIM_HCALOUT"); - compress->AddTowerContainer("TOWER_RAW_HCALOUT"); - compress->AddTowerContainer("TOWER_CALIB_HCALOUT"); - - compress->AddHitContainer("G4HIT_FEMC"); - compress->AddHitContainer("G4HIT_ABSORBER_FEMC"); - compress->AddHitContainer("G4HIT_FHCAL"); - compress->AddHitContainer("G4HIT_ABSORBER_FHCAL"); - compress->AddCellContainer("G4CELL_FEMC"); - compress->AddCellContainer("G4CELL_FHCAL"); - compress->AddTowerContainer("TOWER_SIM_FEMC"); - compress->AddTowerContainer("TOWER_RAW_FEMC"); - compress->AddTowerContainer("TOWER_CALIB_FEMC"); - compress->AddTowerContainer("TOWER_SIM_FHCAL"); - compress->AddTowerContainer("TOWER_RAW_FHCAL"); - compress->AddTowerContainer("TOWER_CALIB_FHCAL"); - - se->registerSubsystem(compress); - - return; -} - -void DstCompress(Fun4AllDstOutputManager* out) { - if (out) { - out->StripNode("G4HIT_PIPE"); - out->StripNode("G4HIT_SVTXSUPPORT"); - out->StripNode("G4HIT_CEMC_ELECTRONICS"); - out->StripNode("G4HIT_CEMC"); - out->StripNode("G4HIT_ABSORBER_CEMC"); - out->StripNode("G4HIT_CEMC_SPT"); - out->StripNode("G4HIT_ABSORBER_HCALIN"); - out->StripNode("G4HIT_HCALIN"); - out->StripNode("G4HIT_HCALIN_SPT"); - out->StripNode("G4HIT_MAGNET"); - out->StripNode("G4HIT_ABSORBER_HCALOUT"); - out->StripNode("G4HIT_HCALOUT"); - out->StripNode("G4HIT_BH_1"); - out->StripNode("G4HIT_BH_FORWARD_PLUS"); - out->StripNode("G4HIT_BH_FORWARD_NEG"); - out->StripNode("G4CELL_CEMC"); - out->StripNode("G4CELL_HCALIN"); - out->StripNode("G4CELL_HCALOUT"); - - out->StripNode("G4HIT_FEMC"); - out->StripNode("G4HIT_ABSORBER_FEMC"); - out->StripNode("G4HIT_FHCAL"); - out->StripNode("G4HIT_ABSORBER_FHCAL"); - out->StripNode("G4CELL_FEMC"); - out->StripNode("G4CELL_FHCAL"); - } -} - -int -make_piston(string name, PHG4Reco* g4Reco) -{ - double be_pipe_radius = 2.16; // 2.16 cm based on spec sheet - double be_pipe_thickness = 0.0760; // 760 um based on spec sheet - double be_pipe_length = 80.0; // +/- 40 cm - - double al_pipe_radius = 2.16; // same as Be pipe - double al_pipe_thickness = 0.1600; // 1.6 mm based on spec - double al_pipe_length = 88.3; // extension beyond +/- 40 cm - - const double zpos0 = al_pipe_length + be_pipe_length * 0.5; // first large GEM station - const double zpos1 = 305 - 20; // front of forward ECal/MPC - const double zpos2 = 335.9 - 10.2 / 2.; // front of the forward field endcap - const double calorimeter_hole_diamater = 9.92331 *2; // side length of the middle hole of MPC that can hold the piston. Also the max diameter of the piston in that region - - const double beampipe_radius = be_pipe_radius; - - // teeth cone section specific - const double number_of_wteeth = 100; - const double teeth_thickness = 0.3504 * 2; //2 X0 - const double eta_inner = -log(tan(atan((beampipe_radius + 0.1) / zpos0) / 2)); - const double eta_outter = 4.2; - const double eta_teeth_outter = 4.05; - double pos = zpos0 + (zpos1 - zpos0) / 2; -// cout << "MAGNETIC PISTON:" << eta_inner << " " << eta_outter << " " << pos -// << endl; - - PHG4ConeSubsystem *magpiston = new PHG4ConeSubsystem("Piston", 0); - magpiston->SetZlength((zpos1 - zpos0) / 2); - magpiston->SetPlaceZ((zpos1 + zpos0) / 2); - magpiston->SetR1(beampipe_radius, - tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(eta_outter)) * zpos0); - magpiston->SetR2(beampipe_radius, - tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(eta_outter)) * zpos1); - magpiston->SetMaterial("G4_Fe"); - magpiston->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(magpiston); - -// PHG4ConeSubsystem *magpiston = new PHG4ConeSubsystem(name.c_str(), 1); -// magpiston->SetZlength((zpos1 - zpos0) / 2); -// magpiston->SetPlaceZ(pos); -// magpiston->Set_eta_range(eta_outter, eta_inner); -// magpiston->SetMaterial("G4_Fe"); -// magpiston->SuperDetector(name.c_str()); -// magpiston->SetActive(false); -// g4Reco->registerSubsystem(magpiston); - - pos = zpos0 + 1.0 + teeth_thickness / 2; - for (int i = 0; i < number_of_wteeth; i++) - { - stringstream s; - s << name; - s << "_teeth_"; - s << i; - - magpiston = new PHG4ConeSubsystem(s.str(), i); - magpiston->SuperDetector(name); - magpiston->SetZlength(teeth_thickness / 2); - magpiston->SetPlaceZ(pos); - magpiston->SetR1( - // - tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(eta_outter - .01)) - * (pos - teeth_thickness / 2), // - tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(eta_teeth_outter)) - * (pos - teeth_thickness / 2) // - ); - magpiston->SetR2( - // - tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(eta_outter - .01)) - * (pos + teeth_thickness / 2), // - tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(eta_outter - .01)) - * (pos + teeth_thickness / 2) + .1 // - ); - magpiston->SetMaterial("G4_W"); - magpiston->SuperDetector(name.c_str()); - magpiston->SetActive(false); - magpiston->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(magpiston); - pos += ((zpos1 - zpos0 - 10) / number_of_wteeth); - } - - // last piece connect to the field return - PHG4CylinderSubsystem *magpiston2 = new PHG4CylinderSubsystem("Piston_EndSection", 0); - magpiston2->set_int_param("lengthviarapidity",0); - magpiston2->set_double_param("length",zpos2 - zpos1); - magpiston2->set_double_param("place_z", (zpos2 + zpos1) / 2.); - magpiston2->set_double_param("radius",beampipe_radius); - magpiston2->set_double_param("thickness",calorimeter_hole_diamater / 2. - beampipe_radius); - magpiston2->set_string_param("material","G4_Fe"); - magpiston2->SuperDetector(name); - magpiston2->SetActive(false); - magpiston2->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(magpiston2); - - return 0; -} - diff --git a/macros/g4simulations/G4Setup_sPHENIX.C b/macros/g4simulations/G4Setup_sPHENIX.C deleted file mode 100644 index 2bd56db20..000000000 --- a/macros/g4simulations/G4Setup_sPHENIX.C +++ /dev/null @@ -1,253 +0,0 @@ - -double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes -bool overlapcheck = false; // set to true if you want to check for overlaps - -void G4Init(bool do_svtx = true, - bool do_pstof = true, - bool do_cemc = true, - bool do_hcalin = true, - bool do_magnet = true, - bool do_hcalout = true, - bool do_pipe = true, - int n_TPC_layers = 40) - { - - // load detector/material macros and execute Init() function - - if (do_pipe) - { - gROOT->LoadMacro("G4_Pipe.C"); - PipeInit(); - } - if (do_svtx) - { - gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); - SvtxInit(n_TPC_layers); - } - - if (do_pstof) - { - gROOT->LoadMacro("G4_PSTOF.C"); - PSTOFInit(); - } - - if (do_cemc) - { - gROOT->LoadMacro("G4_CEmc_Spacal.C"); - CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations - } - - if (do_hcalin) - { - gROOT->LoadMacro("G4_HcalIn_ref.C"); - HCalInnerInit(); - } - - if (do_magnet) - { - gROOT->LoadMacro("G4_Magnet.C"); - MagnetInit(); - } - if (do_hcalout) - { - gROOT->LoadMacro("G4_HcalOut_ref.C"); - HCalOuterInit(); - } - -} - - -int G4Setup(const int absorberactive = 0, - const string &field ="1.5", - const EDecayType decayType = TPythia6Decayer::kAll, - const bool do_svtx = true, - const bool do_pstof = true, - const bool do_cemc = true, - const bool do_hcalin = true, - const bool do_magnet = true, - const bool do_hcalout = true, - const bool do_pipe = true, - const float magfield_rescale = 1.0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4Reco* g4Reco = new PHG4Reco(); - g4Reco->set_rapidity_coverage(1.1); // according to drawings -// uncomment to set QGSP_BERT_HP physics list for productions -// (default is QGSP_BERT for speed) - // g4Reco->SetPhysicsList("QGSP_BERT_HP"); - if (decayType != TPythia6Decayer::kAll) { - g4Reco->set_force_decay(decayType); - } - - double fieldstrength; - istringstream stringline(field); - stringline >> fieldstrength; - if (stringline.fail()) { // conversion to double fails -> we have a string - - if (field.find("sPHENIX.root") != string::npos) { - g4Reco->set_field_map(field, 1); - } else { - g4Reco->set_field_map(field, 2); - } - } else { - g4Reco->set_field(fieldstrength); // use const soleniodal field - } - g4Reco->set_field_rescale(magfield_rescale); - - double radius = 0.; - - //---------------------------------------- - // PIPE - if (do_pipe) radius = Pipe(g4Reco, radius, absorberactive); - - //---------------------------------------- - // SVTX - if (do_svtx) radius = Svtx(g4Reco, radius, absorberactive); - - //---------------------------------------- - // PSTOF - - if (do_pstof) radius = PSTOF(g4Reco, radius, absorberactive); - - //---------------------------------------- - // CEMC -// - if (do_cemc) radius = CEmc(g4Reco, radius, 8, absorberactive); -// if (do_cemc) radius = CEmc_Vis(g4Reco, radius, 8, absorberactive);// for visualization substructure of SPACAL, slow to render - - //---------------------------------------- - // HCALIN - - if (do_hcalin) radius = HCalInner(g4Reco, radius, 4, absorberactive); - - //---------------------------------------- - // MAGNET - - if (do_magnet) radius = Magnet(g4Reco, radius, 0, absorberactive); - - //---------------------------------------- - // HCALOUT - - if (do_hcalout) radius = HCalOuter(g4Reco, radius, 4, absorberactive); - - //---------------------------------------- - // BLACKHOLE - - // swallow all particles coming out of the backend of sPHENIX - PHG4CylinderSubsystem *blackhole = new PHG4CylinderSubsystem("BH", 1); -blackhole->set_double_param("radius",radius + 10); // add 10 cm - - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",g4Reco->GetWorldSizeZ() - no_overlapp); // make it cover the world in length - blackhole->BlackHole(); - blackhole->set_double_param("thickness",0.1); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - //---------------------------------------- - // FORWARD BLACKHOLEs - // +Z - blackhole = new PHG4CylinderSubsystem("BH_FORWARD_PLUS", 1); - blackhole->SuperDetector("BH_FORWARD_PLUS"); - blackhole->set_double_param("radius",0); // add 10 cm - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",0.1); // make it cover the world in length - blackhole->set_double_param("place_z",g4Reco->GetWorldSizeZ()/2. - 0.1 - no_overlapp); - blackhole->BlackHole(); - blackhole->set_double_param("thickness",radius - no_overlapp); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - blackhole = new PHG4CylinderSubsystem("BH_FORWARD_NEG", 1); - blackhole->SuperDetector("BH_FORWARD_NEG"); - blackhole->set_double_param("radius",0); // add 10 cm - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",0.1); // make it cover the world in length - blackhole->set_double_param("place_z", - g4Reco->GetWorldSizeZ()/2. +0.1 + no_overlapp); - blackhole->BlackHole(); - blackhole->set_double_param("thickness",radius - no_overlapp); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); - g4Reco->registerSubsystem(truth); - se->registerSubsystem( g4Reco ); -} - -void ShowerCompress(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4DstCompressReco* compress = new PHG4DstCompressReco("PHG4DstCompressReco"); - compress->AddHitContainer("G4HIT_PIPE"); - compress->AddHitContainer("G4HIT_SVTXSUPPORT"); - compress->AddHitContainer("G4HIT_CEMC_ELECTRONICS"); - compress->AddHitContainer("G4HIT_CEMC"); - compress->AddHitContainer("G4HIT_ABSORBER_CEMC"); - compress->AddHitContainer("G4HIT_CEMC_SPT"); - compress->AddHitContainer("G4HIT_ABSORBER_HCALIN"); - compress->AddHitContainer("G4HIT_HCALIN"); - compress->AddHitContainer("G4HIT_HCALIN_SPT"); - compress->AddHitContainer("G4HIT_MAGNET"); - compress->AddHitContainer("G4HIT_ABSORBER_HCALOUT"); - compress->AddHitContainer("G4HIT_HCALOUT"); - compress->AddHitContainer("G4HIT_BH_1"); - compress->AddHitContainer("G4HIT_BH_FORWARD_PLUS"); - compress->AddHitContainer("G4HIT_BH_FORWARD_NEG"); - compress->AddCellContainer("G4CELL_CEMC"); - compress->AddCellContainer("G4CELL_HCALIN"); - compress->AddCellContainer("G4CELL_HCALOUT"); - compress->AddTowerContainer("TOWER_SIM_CEMC"); - compress->AddTowerContainer("TOWER_RAW_CEMC"); - compress->AddTowerContainer("TOWER_CALIB_CEMC"); - compress->AddTowerContainer("TOWER_SIM_HCALIN"); - compress->AddTowerContainer("TOWER_RAW_HCALIN"); - compress->AddTowerContainer("TOWER_CALIB_HCALIN"); - compress->AddTowerContainer("TOWER_SIM_HCALOUT"); - compress->AddTowerContainer("TOWER_RAW_HCALOUT"); - compress->AddTowerContainer("TOWER_CALIB_HCALOUT"); - se->registerSubsystem(compress); - - return; -} - -void DstCompress(Fun4AllDstOutputManager* out) { - if (out) { - out->StripNode("G4HIT_PIPE"); - out->StripNode("G4HIT_SVTXSUPPORT"); - out->StripNode("G4HIT_CEMC_ELECTRONICS"); - out->StripNode("G4HIT_CEMC"); - out->StripNode("G4HIT_ABSORBER_CEMC"); - out->StripNode("G4HIT_CEMC_SPT"); - out->StripNode("G4HIT_ABSORBER_HCALIN"); - out->StripNode("G4HIT_HCALIN"); - out->StripNode("G4HIT_HCALIN_SPT"); - out->StripNode("G4HIT_MAGNET"); - out->StripNode("G4HIT_ABSORBER_HCALOUT"); - out->StripNode("G4HIT_HCALOUT"); - out->StripNode("G4HIT_BH_1"); - out->StripNode("G4HIT_BH_FORWARD_PLUS"); - out->StripNode("G4HIT_BH_FORWARD_NEG"); - out->StripNode("G4CELL_CEMC"); - out->StripNode("G4CELL_HCALIN"); - out->StripNode("G4CELL_HCALOUT"); - } -} diff --git a/macros/g4simulations/G4_Aerogel.C b/macros/g4simulations/G4_Aerogel.C deleted file mode 100644 index c56b45d2c..000000000 --- a/macros/g4simulations/G4_Aerogel.C +++ /dev/null @@ -1,51 +0,0 @@ -// $Id: G4_Aerogel.C,v 1.2 2013/10/09 01:08:17 jinhuang Exp $ - -/*! - * \file G4_Aerogel.C - * \brief Aerogel RICH for EIC detector - * \author Jin Huang - * \version $Revision: 1.2 $ - * \date $Date: 2013/10/09 01:08:17 $ - */ - -void -AerogelInit() -{ - -} - -void -AerogelSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // - const double min_eta = 1.1 // 1.45 - ) -{ - - PHG4SectorSubsystem *ag; - ag = new PHG4SectorSubsystem("Aerogel"); - - ag->get_geometry().set_normal_polar_angle( - (PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta) - + PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)) / 2); -// ag->get_geometry().set_normal_polar_angle(0); - ag->get_geometry().set_normal_start( - 280 * PHG4Sector::Sector_Geometry::Unit_cm()); // 307 - ag->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(1.9)); - ag->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta)); - ag->get_geometry().set_min_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - ag->get_geometry().set_material("G4_AIR"); - ag->get_geometry().set_N_Sector(N_Sector); - ag->OverlapCheck(overlapcheck); - - // Aerogel dimensions ins cm - double radiator_length = 2.; - double expansion_length = 10.; - - ag->get_geometry().AddLayers_AeroGel_ePHENIX( radiator_length * PHG4Sector::Sector_Geometry::Unit_cm(), - expansion_length * PHG4Sector::Sector_Geometry::Unit_cm() ); - g4Reco->registerSubsystem(ag); - -} - diff --git a/macros/g4simulations/G4_Bbc.C b/macros/g4simulations/G4_Bbc.C deleted file mode 100644 index c3012a589..000000000 --- a/macros/g4simulations/G4_Bbc.C +++ /dev/null @@ -1,36 +0,0 @@ - -void BbcInit() {} - -double Bbc(PHG4Reco* g4Reco, - double radius, - const int absorberactive = 0, - int verbosity = 0) { - - // the BBC is a fast sim only at the moment - // this is a place holder for the G4 material setup - - return radius; -} - -void Bbc_Reco(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4bbc.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - BbcVertexFastSimReco* bbcvertex = new BbcVertexFastSimReco(); - bbcvertex->set_z_smearing(0.0); // 6 mm, temporarily perfect for TPC initial vertexing - bbcvertex->set_t_smearing(0.002); // 20 ps - se->registerSubsystem(bbcvertex); - - return; -} diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C deleted file mode 100644 index 412b7de72..000000000 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ /dev/null @@ -1,399 +0,0 @@ - -int Min_cemc_layer = 1; -int Max_cemc_layer = 1; - -// set a default value for SPACAL configuration -// // 1D azimuthal projective SPACAL (fast) -//int Cemc_spacal_configuration = PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal; -// 2D azimuthal projective SPACAL (slow) -int Cemc_spacal_configuration = PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal; - -#include - -// just a dummy parameter used by the tilted plate geom -void CEmcInit(const int nslats = 1) -{ - Min_cemc_layer = 1; - Max_cemc_layer = 1; -} - -//! EMCal main setup macro -double -CEmc(PHG4Reco *g4Reco, double radius, const int crossings, - const int absorberactive = 0) -{ - if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) - { - return CEmc_1DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ - crossings, /*const int*/ absorberactive); - } - else if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) - { - return CEmc_2DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ - crossings, /*const int*/ absorberactive); - } - else - { - std::cout - << "G4_CEmc_Spacal.C::CEmc - Fatal Error - unrecognized SPACAL configuration #" - << Cemc_spacal_configuration << ". Force exiting..." << std::endl; - exit(-1); - return 0; - } -} - -//! EMCal setup macro - 1D azimuthal projective SPACAL -double -CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, const int absorberactive = 0) -{ - double emc_inner_radius = 95.; // emc inner radius from engineering drawing - double cemcthickness = 12.7; - double emc_outer_radius = emc_inner_radius + cemcthickness; // outer radius - - if (radius > emc_inner_radius) - { - cout << "inconsistency: pstof outer radius: " << radius - << " larger than emc inner radius: " << emc_inner_radius - << endl; - gSystem->Exit(-1); - } - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - // boundary check - if (radius > emc_inner_radius - 1.5 - no_overlapp) - { - cout << "G4_CEmc_Spacal.C::CEmc() - expect radius < " << emc_inner_radius - 1.5 - no_overlapp << " to install SPACAL" << endl; - exit(1); - } - radius = emc_inner_radius - 1.5 - no_overlapp; - - // 1.5cm thick teflon as an approximation for EMCAl light collection + electronics (10% X0 total estimated) - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); - cyl->SuperDetector("CEMC_ELECTRONICS"); - cyl->set_double_param("radius", radius); - cyl->set_string_param("material", "G4_TEFLON"); - cyl->set_double_param("thickness", 1.5); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem(cyl); - - radius += 1.5; - radius += no_overlapp; - - int ilayer = Min_cemc_layer; - PHG4SpacalSubsystem *cemc; - cemc = new PHG4SpacalSubsystem("CEMC", ilayer); - cemc->set_double_param("radius",emc_inner_radius); - cemc->set_double_param("thickness", cemcthickness); - - cemc->SetActive(); - cemc->SuperDetector("CEMC"); - if (absorberactive) cemc->SetAbsorberActive(); - cemc->OverlapCheck(overlapcheck); - - g4Reco->registerSubsystem(cemc); - - if (ilayer > Max_cemc_layer) - { - cout << "layer discrepancy, current layer " << ilayer - << " max cemc layer: " << Max_cemc_layer << endl; - } - - radius += cemcthickness; - radius += no_overlapp; - - // 0.5cm thick Stainless Steel as an approximation for EMCAl support system - cyl = new PHG4CylinderSubsystem("CEMC_SPT", 0); - cyl->SuperDetector("CEMC_SPT"); - cyl->set_double_param("radius", radius); - cyl->set_string_param("material", "SS310"); // SS310 Stainless Steel - cyl->set_double_param("thickness", 0.5); - if (absorberactive) - cyl->SetActive(); - g4Reco->registerSubsystem(cyl); - - radius += 0.5; - radius += no_overlapp; - - return radius; -} - -//! 2D full projective SPACAL -double -CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, - const int absorberactive = 0) -{ - double emc_inner_radius = 92; // emc inner radius from engineering drawing - double cemcthickness = 24.00000 - no_overlapp; - - //max radius is 116 cm; - double emc_outer_radius = emc_inner_radius + cemcthickness; // outer radius - assert(emc_outer_radius < 116); - - if (radius > emc_inner_radius) - { - cout << "inconsistency: preshower radius+thickness: " << radius - << " larger than emc inner radius: " << emc_inner_radius << endl; - gSystem->Exit(-1); - } - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - - // the radii are only to determined the thickness of the cemc - radius = emc_inner_radius; - - //--------------- - // Load libraries - //--------------- - - // 1.5cm thick teflon as an approximation for EMCAl light collection + electronics (10% X0 total estimated) - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); - cyl->set_double_param("radius", radius); - cyl->set_string_param("material", "G4_TEFLON"); - cyl->set_double_param("thickness", 1.5 - no_overlapp); - cyl->SuperDetector("CEMC_ELECTRONICS"); - cyl->OverlapCheck(overlapcheck); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem(cyl); - - radius += 1.5; - cemcthickness -= 1.5 + no_overlapp; - - // 0.5cm thick Stainless Steel as an approximation for EMCAl support system - cyl = new PHG4CylinderSubsystem("CEMC_SPT", 0); - cyl->SuperDetector("CEMC_SPT"); - cyl->set_double_param("radius", radius + cemcthickness - 0.5); - cyl->set_string_param("material", "SS310"); // SS310 Stainless Steel - cyl->set_double_param("thickness", 0.5 - no_overlapp); - cyl->OverlapCheck(overlapcheck); - if (absorberactive) - cyl->SetActive(); - g4Reco->registerSubsystem(cyl); - - cemcthickness -= 0.5 + no_overlapp; - - //--------------- - // Load libraries - //--------------- - - int ilayer = 0; - PHG4SpacalSubsystem *cemc; - - const bool use_2015_design = false; - if (use_2015_design) - { - cemc = new PHG4SpacalSubsystem("CEMC", ilayer); - - cemc->set_int_param("config", PHG4CylinderGeom_Spacalv1::kFullProjective_2DTaper_SameLengthFiberPerTower); - cemc->set_double_param("radius", radius); // overwrite minimal radius - cemc->set_double_param("thickness", cemcthickness); // overwrite thickness - cemc->set_int_param("azimuthal_n_sec", 32); - // cemc->set_int_param("construction_verbose", 2); - - cemc->SetActive(); - cemc->SuperDetector("CEMC"); - if (absorberactive) - cemc->SetAbsorberActive(); - cemc->OverlapCheck(overlapcheck); - } - - else - { - cemc = new PHG4SpacalSubsystem("CEMC", ilayer); - - cemc->set_int_param("virualize_fiber", 0); - cemc->set_int_param("azimuthal_seg_visible", 1); - cemc->set_int_param("construction_verbose", 0); - cemc->Verbosity(0); - - cemc->UseCalibFiles(PHG4DetectorSubsystem::xml); - cemc->SetCalibrationFileDir(string(getenv("CALIBRATIONROOT")) + string("/CEMC/Geometry_2017ProjTilted/")); - cemc->set_double_param("radius", radius); // overwrite minimal radius - cemc->set_double_param("thickness", cemcthickness); // overwrite thickness - - cemc->SetActive(); - cemc->SuperDetector("CEMC"); - if (absorberactive) - cemc->SetAbsorberActive(); - cemc->OverlapCheck(overlapcheck); - } - - g4Reco->registerSubsystem(cemc); - - if (ilayer > Max_cemc_layer) - { - cout << "layer discrepancy, current layer " << ilayer - << " max cemc layer: " << Max_cemc_layer << endl; - } - - radius += cemcthickness; - radius += no_overlapp; - - return radius; -} - -void CEMC_Cells(int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) - { - PHG4CylinderCellReco *cemc_cells = new PHG4CylinderCellReco("CEMCCYLCELLRECO"); - cemc_cells->Detector("CEMC"); - cemc_cells->Verbosity(verbosity); - for (int i = Min_cemc_layer; i <= Max_cemc_layer; i++) - { - // cemc_cells->etaphisize(i, 0.024, 0.024); - const double radius = 95; - cemc_cells->cellsize(i, 2 * TMath::Pi() / 256. * radius, 2 * TMath::Pi() / 256. * radius); - cemc_cells->set_double_param(i, "tmin", 0.); - cemc_cells->set_double_param(i, "tmax", 60.); - } - se->registerSubsystem(cemc_cells); - } - else if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) - { - PHG4FullProjSpacalCellReco *cemc_cells = new PHG4FullProjSpacalCellReco("CEMCCYLCELLRECO"); - cemc_cells->Detector("CEMC"); - cemc_cells->Verbosity(verbosity); - cemc_cells->set_timing_window(0.0, 60.0); - cemc_cells->get_light_collection_model().load_data_file( - string(getenv("CALIBRATIONROOT")) + string("/CEMC/LightCollection/Prototype3Module.xml"), - "data_grid_light_guide_efficiency", "data_grid_fiber_trans"); - se->registerSubsystem(cemc_cells); - } - else - { - std::cout - << "G4_CEmc_Spacal.C::CEmc - Fatal Error - unrecognized SPACAL configuration #" - << Cemc_spacal_configuration << ". Force exiting..." << std::endl; - exit(-1); - return; - } - - return; -} - -void CEMC_Towers(int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawTowerBuilder *TowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); - TowerBuilder->Detector("CEMC"); - TowerBuilder->set_sim_tower_node_prefix("SIM"); - TowerBuilder->Verbosity(verbosity); - se->registerSubsystem(TowerBuilder); - - double sampling_fraction = 1; - if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) - { - sampling_fraction = 0.0234335; //from production:/gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.3/single_particle/spacal1d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root - } - else if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) - { - // sampling_fraction = 0.02244; //from production: /gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.3/single_particle/spacal2d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root -// sampling_fraction = 2.36081e-02; //from production: /gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.5/single_particle/spacal2d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root -// sampling_fraction = 1.90951e-02; // 2017 Tilt porjective SPACAL, 8 GeV photon, eta = 0.3 - 0.4 - sampling_fraction = 2e-02; // 2017 Tilt porjective SPACAL, tower-by-tower calibration - } - else - { - std::cout - << "G4_CEmc_Spacal.C::CEMC_Towers - Fatal Error - unrecognized SPACAL configuration #" - << Cemc_spacal_configuration << ". Force exiting..." << std::endl; - exit(-1); - return; - } - - static const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition - - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); - TowerDigitizer->Detector("CEMC"); - TowerDigitizer->Verbosity(verbosity); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting - TowerDigitizer->set_photonelec_ADC(1); //not simulating ADC discretization error - TowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); - TowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting - se->registerSubsystem(TowerDigitizer); - - if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) - { - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); - TowerCalibration->Detector("CEMC"); - TowerCalibration->Verbosity(verbosity); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV); - TowerCalibration->set_pedstal_ADC(0); - se->registerSubsystem(TowerCalibration); - } - else if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) - { - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); - TowerCalibration->Detector("CEMC"); - TowerCalibration->Verbosity(verbosity); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kTower_by_tower_calibration); - TowerCalibration->GetCalibrationParameters().ReadFromFile("CEMC","xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/CEMC/TowerCalib_2017ProjTilted/")); // calibration database - TowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / 0.9715 ); // overall energy scale based on 4-GeV photon simulations - TowerCalibration->set_pedstal_ADC(0); - se->registerSubsystem(TowerCalibration); - } - else - { - std::cout - << "G4_CEmc_Spacal.C::CEMC_Towers - Fatal Error - unrecognized SPACAL configuration #" - << Cemc_spacal_configuration << ". Force exiting..." << std::endl; - exit(-1); - return; - } - - return; -} - -void CEMC_Clusters(int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilder *ClusterBuilder = new RawClusterBuilder("EmcRawClusterBuilder"); - ClusterBuilder->Detector("CEMC"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem(ClusterBuilder); - - RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC"); - clusterCorrection->GetCalibrationParameters().ReadFromFile("CEMC_RECALIB","xml",0,0, - //raw location - string(getenv("CALIBRATIONROOT"))+string("/CEMC/PositionRecalibration/")); - clusterCorrection->Verbosity(verbosity); - se->registerSubsystem(clusterCorrection); - - return; -} -void CEMC_Eval(std::string outputfile, int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator *eval = new CaloEvaluator("CEMCEVALUATOR", "CEMC", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} diff --git a/macros/g4simulations/G4_CaloTrigger.C b/macros/g4simulations/G4_CaloTrigger.C deleted file mode 100644 index d23bd0616..000000000 --- a/macros/g4simulations/G4_CaloTrigger.C +++ /dev/null @@ -1,22 +0,0 @@ - -void CaloTrigger_Sim(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libcalotrigger.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloTriggerSim* calotriggersim = new CaloTriggerSim(); - calotriggersim->Verbosity( verbosity ); - se->registerSubsystem( calotriggersim ); - - return; - -} diff --git a/macros/g4simulations/G4_DIRC.C b/macros/g4simulations/G4_DIRC.C deleted file mode 100644 index 032e4fae9..000000000 --- a/macros/g4simulations/G4_DIRC.C +++ /dev/null @@ -1,88 +0,0 @@ -// $Id: G4_DIRC.C,v 1.3 2013/10/09 01:08:17 jinhuang Exp $ - -/*! - * \file G4_DIRC.C - * \brief Macro setting up the barrel DIRC - * \author Jin Huang - * \version $Revision: 1.3 $ - * \date $Date: 2013/10/09 01:08:17 $ - */ - -#include - -void -DIRCInit() -{ - -} - -//! Babar DIRC (Without most of support structure) -//! Ref: I. Adam et al. The DIRC particle identification system for the BaBar experiment. -//! Nucl. Instrum. Meth., A538:281-357, 2005. doi:10.1016/j.nima.2004.08.129. -double -DIRCSetup(PHG4Reco* g4Reco) -{ - const double radiator_R = 83.65; - const double length = 470; - const double z_shift = -115; - const double z_start = z_shift + length / 2.; - const double z_end = z_shift - length / 2.; - - PHG4SectorSubsystem *dirc; - dirc = new PHG4SectorSubsystem("DIRC"); - dirc->get_geometry().set_normal_polar_angle(3.14159265358979323846/2); - dirc->get_geometry().set_normal_start( - 83.65 * PHG4Sector::Sector_Geometry::Unit_cm()); - dirc->get_geometry().set_min_polar_angle(atan2(radiator_R, z_start)); - dirc->get_geometry().set_max_polar_angle(atan2(radiator_R, z_end)); - dirc->get_geometry().set_min_polar_edge(PHG4Sector::Sector_Geometry::FlatEdge()); - dirc->get_geometry().set_max_polar_edge(PHG4Sector::Sector_Geometry::FlatEdge()); - dirc->get_geometry().set_material("Quartz"); - dirc->get_geometry().set_N_Sector(12); - dirc->OverlapCheck(overlapcheck); - dirc->get_geometry().AddLayer("Radiator", "Quartz", - 1.7 * PHG4Sector::Sector_Geometry::Unit_cm(), true); - g4Reco->registerSubsystem(dirc); - - PHG4CylinderSubsystem *cyl; - - // The cylinder skins provide most of the strength - // and stiffness of the CST. The thickness of the inner - // and outer skins is 1.27 and 0.76 mm, respectively - - // Inner skin: - cyl = new PHG4CylinderSubsystem("DIRC_CST_Inner_Skin", 10); - cyl->set_double_param("radius",81.71); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",length); - cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",0.127); - cyl->set_double_param("place_x",0.); - cyl->set_double_param("place_y",0.); - cyl->set_double_param("place_z",z_shift); - cyl->SetActive(0); - cyl->SuperDetector("DIRC"); - cyl->OverlapCheck(overlapcheck); - - g4Reco->registerSubsystem(cyl); - - // Outer skin: - cyl = new PHG4CylinderSubsystem("DIRC_CST_Outer_Skin", 11); - cyl->set_double_param("radius",89.25 - 0.076); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",length); - cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",0.076); - cyl->set_double_param("place_x",0.); - cyl->set_double_param("place_y",0.); - cyl->set_double_param("place_z",z_shift); - cyl->SetActive(0); - cyl->SuperDetector("DIRC"); - cyl->OverlapCheck(overlapcheck); - - g4Reco->registerSubsystem(cyl); - - // Done - return 89.25; - -} diff --git a/macros/g4simulations/G4_DSTReader.C b/macros/g4simulations/G4_DSTReader.C deleted file mode 100644 index 79624588c..000000000 --- a/macros/g4simulations/G4_DSTReader.C +++ /dev/null @@ -1,132 +0,0 @@ -////////////////////////////////////////////////////////////////// -/*! - \file G4_DSTReader.C - \brief Convert DST to human command readable TTree for quick poke around the outputs - \author Jin Huang - \version $Revision: $ - \date $Date: $ - */ -////////////////////////////////////////////////////////////////// - -#include - -void -G4DSTreader( const char * outputFile = "G4sPHENIXCells.root",// - int absorberactive = 1, // - bool do_svtx = true, // - bool do_pstof = true, // - bool do_cemc = true, // - bool do_hcalin = true, // - bool do_magnet = true, // - bool do_hcalout = true, // - bool do_cemc_twr = true, // - bool do_hcalin_twr = true, // - bool do_magnet = true, // - bool do_hcalout_twr = true // - ) -{ - - //! debug output on screen? - const bool debug = false; - - //! save raw g4 hits - const bool save_g4_raw = true; - - // save a comprehensive evaluation file - PHG4DSTReader* ana = new PHG4DSTReader( - string(outputFile) + string("_DSTReader.root")); - ana->set_save_particle(true); - ana->set_load_all_particle(false); - ana->set_load_active_particle(true); - ana->set_save_vertex(true); - - if (debug) - { - ana->Verbosity(2); - } - - if (save_g4_raw) - { - if (do_svtx) - { - ana->AddNode("SVTX"); - } - - if (do_pstof) - { - ana->AddNode("PSTOF_0"); - } - - if (do_cemc) - { - ana->AddNode("CEMC"); - if (absorberactive) - { - ana->AddNode("ABSORBER_CEMC"); - ana->AddNode("CEMC_ELECTRONICS"); - ana->AddNode("CEMC_SPT"); - } - } - - if (do_hcalin) - { - ana->AddNode("HCALIN"); - if (absorberactive) - ana->AddNode("ABSORBER_HCALIN"); - } - - if (do_magnet) - { - if (absorberactive) - ana->AddNode("MAGNET"); - } - - if (do_hcalout) - { - ana->AddNode("HCALOUT"); - if (absorberactive) - ana->AddNode("ABSORBER_HCALOUT"); - } - - - ana->AddNode("BH_1"); - ana->AddNode("BH_FORWARD_PLUS"); - ana->AddNode("BH_FORWARD_NEG"); - - } - - ana->set_tower_zero_sup(1e-6); - if (do_cemc_twr) - { - ana->AddTower("SIM_CEMC"); - ana->AddTower("RAW_CEMC"); - ana->AddTower("CALIB_CEMC"); - } - if (do_hcalin_twr) - { - ana->AddTower("SIM_HCALIN"); - ana->AddTower("RAW_HCALIN"); - ana->AddTower("CALIB_HCALIN"); - } - if (do_hcalout_twr) - { - ana->AddTower("SIM_HCALOUT"); - ana->AddTower("RAW_HCALOUT"); - ana->AddTower("CALIB_HCALOUT"); - } - - // Jets disabled for now -// if (do_jet_reco) -// { -// -// ana->AddJet("AntiKt06JetsInPerfect"); -// ana->AddJet("G4TowerJets_6"); -// } -// if (embed_input_file && do_jet_reco) -// { -// ana->AddJet("G4TowerJets_combined_6"); -// } - - Fun4AllServer *se = Fun4AllServer::instance(); - se->registerSubsystem(ana); -} diff --git a/macros/g4simulations/G4_DSTReader_EICDetector.C b/macros/g4simulations/G4_DSTReader_EICDetector.C deleted file mode 100644 index e8e83f3ae..000000000 --- a/macros/g4simulations/G4_DSTReader_EICDetector.C +++ /dev/null @@ -1,188 +0,0 @@ -////////////////////////////////////////////////////////////////// -/*! - \file G4_DSTReader.C - \brief Convert DST to human command readable TTree for quick poke around the outputs - \author Jin Huang - \version $Revision: $ - \date $Date: $ -*/ -////////////////////////////////////////////////////////////////// - -#include - -void -G4DSTreader_EICDetector( const char * outputFile = "G4sPHENIXCells.root",// - int absorberactive = 1, // - bool do_svtx = true, // - bool do_cemc = true, // - bool do_hcalin = true, // - bool do_magnet = true, // - bool do_hcalout = true, // - bool do_cemc_twr = true, // - bool do_hcalin_twr = true, // - bool do_magnet = true, // - bool do_hcalout_twr = true, // - bool do_FGEM = true, // - bool do_EGEM = true, // - bool do_FHCAL = true, // - bool do_FHCAL_twr = true, // - bool do_FEMC = true, // - bool do_FEMC_twr = true, // - bool do_EEMC = true, // - bool do_EEMC_twr = true // - ) -{ - - //! debug output on screen? - const bool debug = false; - - //! save raw g4 hits - const bool save_g4_raw = true; - - // save a comprehensive evaluation file - PHG4DSTReader* ana = new PHG4DSTReader( - string(outputFile) + string("_DSTReader.root")); - ana->set_save_particle(true); - ana->set_load_all_particle(false); - ana->set_load_active_particle(true); - ana->set_save_vertex(true); - - if (debug) - { - ana->Verbosity(2); - } - - if (save_g4_raw) - { - if (do_svtx) - { - ana->AddNode("SVTX"); - } - - if (do_cemc) - { - ana->AddNode("CEMC"); - if (absorberactive) - { - ana->AddNode("ABSORBER_CEMC"); - ana->AddNode("CEMC_ELECTRONICS"); - ana->AddNode("CEMC_SPT"); - } - } - - if (do_hcalin) - { - ana->AddNode("HCALIN"); - if (absorberactive) - ana->AddNode("ABSORBER_HCALIN"); - } - - if (do_magnet) - { - if (absorberactive) - ana->AddNode("MAGNET"); - } - - if (do_hcalout) - { - ana->AddNode("HCALOUT"); - if (absorberactive) - ana->AddNode("ABSORBER_HCALOUT"); - } - - if (do_FHCAL) - { - ana->AddNode("FHCAL"); - if (absorberactive) - ana->AddNode("ABSORBER_FHCAL"); - } - - if (do_FEMC) - { - ana->AddNode("FEMC"); - if (absorberactive) - ana->AddNode("ABSORBER_FEMC"); - } - - if (do_EEMC) - { - ana->AddNode("EEMC"); - if (absorberactive) - ana->AddNode("ABSORBER_EEMC"); - } - - if (do_FGEM) - { - ana->AddNode("FGEM_0"); - ana->AddNode("FGEM_1"); - ana->AddNode("FGEM_2"); - ana->AddNode("FGEM_3"); - ana->AddNode("FGEM_4"); - } - - if (do_EGEM) - { - ana->AddNode("EGEM_0"); - ana->AddNode("EGEM_1"); - ana->AddNode("EGEM_2"); - } - - ana->AddNode("BH_1"); - ana->AddNode("BH_FORWARD_PLUS"); - ana->AddNode("BH_FORWARD_NEG"); - - } - - ana->set_tower_zero_sup(1e-6); - if (do_cemc_twr) - { - ana->AddTower("SIM_CEMC"); - ana->AddTower("RAW_CEMC"); - ana->AddTower("CALIB_CEMC"); - } - if (do_hcalin_twr) - { - ana->AddTower("SIM_HCALIN"); - ana->AddTower("RAW_HCALIN"); - ana->AddTower("CALIB_HCALIN"); - } - if (do_hcalout_twr) - { - ana->AddTower("SIM_HCALOUT"); - ana->AddTower("RAW_HCALOUT"); - ana->AddTower("CALIB_HCALOUT"); - } - if (do_FHCAL_twr) - { - ana->AddTower("SIM_FHCAL"); - ana->AddTower("RAW_FHCAL"); - ana->AddTower("CALIB_FHCAL"); - } - if (do_FEMC_twr) - { - ana->AddTower("SIM_FEMC"); - ana->AddTower("RAW_FEMC"); - ana->AddTower("CALIB_FEMC"); - } - if (do_EEMC_twr) - { - ana->AddTower("SIM_EEMC"); - ana->AddTower("RAW_EEMC"); - ana->AddTower("CALIB_EEMC"); - } - - // Jets disabled for now - // if (do_jet_reco) - // { - // - // ana->AddJet("AntiKt06JetsInPerfect"); - // ana->AddJet("G4TowerJets_6"); - // } - // if (embed_input_file && do_jet_reco) - // { - // ana->AddJet("G4TowerJets_combined_6"); - // } - - Fun4AllServer *se = Fun4AllServer::instance(); - se->registerSubsystem(ana); -} diff --git a/macros/g4simulations/G4_DSTReader_fsPHENIX.C b/macros/g4simulations/G4_DSTReader_fsPHENIX.C deleted file mode 100644 index 5edfc6282..000000000 --- a/macros/g4simulations/G4_DSTReader_fsPHENIX.C +++ /dev/null @@ -1,165 +0,0 @@ -////////////////////////////////////////////////////////////////// -/*! - \file G4_DSTReader.C - \brief Convert DST to human command readable TTree for quick poke around the outputs - \author Jin Huang - \version $Revision: $ - \date $Date: $ - */ -////////////////////////////////////////////////////////////////// - -#include - -void -G4DSTreader_fsPHENIX( const char * outputFile = "G4sPHENIXCells.root",// - int absorberactive = 1, // - bool do_svtx = true, // - bool do_cemc = true, // - bool do_hcalin = true, // - bool do_magnet = true, // - bool do_hcalout = true, // - bool do_cemc_twr = true, // - bool do_hcalin_twr = true, // - bool do_magnet = true, // - bool do_hcalout_twr = true, // - bool do_FGEM = true, // - bool do_FHCAL = true, // - bool do_FHCAL_twr = true, // - bool do_FEMC = true, // - bool do_FEMC_twr = true // - ) -{ - - //! debug output on screen? - const bool debug = false; - - //! save raw g4 hits - const bool save_g4_raw = true; - - // save a comprehensive evaluation file - PHG4DSTReader* ana = new PHG4DSTReader( - string(outputFile) + string("_DSTReader.root")); - ana->set_save_particle(true); - ana->set_load_all_particle(false); - ana->set_load_active_particle(true); - ana->set_save_vertex(true); - - if (debug) - { - ana->Verbosity(2); - } - - if (save_g4_raw) - { - if (do_svtx) - { - ana->AddNode("SVTX"); - } - - if (do_cemc) - { - ana->AddNode("CEMC"); - if (absorberactive) - { - ana->AddNode("ABSORBER_CEMC"); - ana->AddNode("CEMC_ELECTRONICS"); - ana->AddNode("CEMC_SPT"); - } - } - - if (do_hcalin) - { - ana->AddNode("HCALIN"); - if (absorberactive) - ana->AddNode("ABSORBER_HCALIN"); - } - - if (do_magnet) - { - if (absorberactive) - ana->AddNode("MAGNET"); - } - - if (do_hcalout) - { - ana->AddNode("HCALOUT"); - if (absorberactive) - ana->AddNode("ABSORBER_HCALOUT"); - } - - if (do_FHCAL) - { - ana->AddNode("FHCAL"); - if (absorberactive) - ana->AddNode("ABSORBER_FHCAL"); - } - - if (do_FEMC) - { - ana->AddNode("FEMC"); - if (absorberactive) - ana->AddNode("ABSORBER_FEMC"); - } - - if (do_FGEM) - { - ana->AddNode("FGEM_0"); - ana->AddNode("FGEM_1"); - ana->AddNode("FGEM_2"); - ana->AddNode("FGEM_3"); - ana->AddNode("FGEM_4"); - } - - ana->AddNode("BH_1"); - ana->AddNode("BH_FORWARD_PLUS"); - ana->AddNode("BH_FORWARD_NEG"); - - } - - ana->set_tower_zero_sup(1e-6); - if (do_cemc_twr) - { - ana->AddTower("SIM_CEMC"); - ana->AddTower("RAW_CEMC"); - ana->AddTower("CALIB_CEMC"); - } - if (do_hcalin_twr) - { - ana->AddTower("SIM_HCALIN"); - ana->AddTower("RAW_HCALIN"); - ana->AddTower("CALIB_HCALIN"); - } - if (do_hcalout_twr) - { - ana->AddTower("SIM_HCALOUT"); - ana->AddTower("RAW_HCALOUT"); - ana->AddTower("CALIB_HCALOUT"); - } - if (do_FHCAL_twr) - { - ana->AddTower("SIM_FHCAL"); - ana->AddTower("RAW_FHCAL"); - ana->AddTower("CALIB_FHCAL"); - } - if (do_FEMC_twr) - { - ana->AddTower("SIM_FEMC"); - ana->AddTower("RAW_FEMC"); - ana->AddTower("CALIB_FEMC"); - } - - // Jets disabled for now -// if (do_jet_reco) -// { -// -// ana->AddJet("AntiKt06JetsInPerfect"); -// ana->AddJet("G4TowerJets_6"); -// } -// if (embed_input_file && do_jet_reco) -// { -// ana->AddJet("G4TowerJets_combined_6"); -// } - - Fun4AllServer *se = Fun4AllServer::instance(); - se->registerSubsystem(ana); -} diff --git a/macros/g4simulations/G4_EEMC.C b/macros/g4simulations/G4_EEMC.C deleted file mode 100644 index 37ce6c09d..000000000 --- a/macros/g4simulations/G4_EEMC.C +++ /dev/null @@ -1,122 +0,0 @@ -using namespace std; - -void -EEMCInit() -{ -} - -void EEMC_Cells(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("EEMCCellReco"); - hc->Detector("EEMC"); - se->registerSubsystem(hc); - - return; -} - -void -EEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) -{ - - gSystem->Load("libg4detectors.so"); - - /** Use dedicated EEMC module */ - PHG4CrystalCalorimeterSubsystem *eemc = new PHG4CrystalCalorimeterSubsystem("EEMC"); - - /* path to central copy of calibrations repositry */ - ostringstream mapping_eemc; - - /* Use non-projective geometry */ - mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v004.txt"; - cout << mapping_eemc.str() << endl; - - eemc->SetTowerMappingFile( mapping_eemc.str() ); - eemc->OverlapCheck(overlapcheck); - - if (absorberactive) eemc->SetAbsorberActive(); - - /* register Ecal module */ - g4Reco->registerSubsystem( eemc ); - -} - -void EEMC_Towers(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_eemc; - mapping_eemc << getenv("CALIBRATIONROOT") << - "/CrystalCalorimeter/mapping/towerMap_EEMC_v004.txt"; - - RawTowerBuilderByHitIndex* tower_EEMC = new RawTowerBuilderByHitIndex("TowerBuilder_EEMC"); - tower_EEMC->Detector("EEMC"); - tower_EEMC->set_sim_tower_node_prefix("SIM"); - tower_EEMC->GeometryTableFile( mapping_eemc.str() ); - - se->registerSubsystem(tower_EEMC); - - - /* Calorimeter digitization */ - - // CMS lead tungstate barrel ECAL at 18 degree centrigrade: 4.5 photoelectrons per MeV - const double EEMC_photoelectron_per_GeV = 4500; - - RawTowerDigitizer *TowerDigitizer_EEMC = new RawTowerDigitizer("EEMCRawTowerDigitizer"); - TowerDigitizer_EEMC->Detector("EEMC"); - TowerDigitizer_EEMC->Verbosity(verbosity); - TowerDigitizer_EEMC->set_raw_tower_node_prefix("RAW"); - TowerDigitizer_EEMC->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); - TowerDigitizer_EEMC->set_pedstal_central_ADC(0); - TowerDigitizer_EEMC->set_pedstal_width_ADC(8);// eRD1 test beam setting - TowerDigitizer_EEMC->set_photonelec_ADC(1);//not simulating ADC discretization error - TowerDigitizer_EEMC->set_photonelec_yield_visible_GeV( EEMC_photoelectron_per_GeV ); - TowerDigitizer_EEMC->set_zero_suppression_ADC(16); // eRD1 test beam setting - - se->registerSubsystem( TowerDigitizer_EEMC ); - - - /* Calorimeter calibration */ - - RawTowerCalibration *TowerCalibration_EEMC = new RawTowerCalibration("EEMCRawTowerCalibration"); - TowerCalibration_EEMC->Detector("EEMC"); - TowerCalibration_EEMC->Verbosity(verbosity); - TowerCalibration_EEMC->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration_EEMC->set_calib_const_GeV_ADC( 1. / EEMC_photoelectron_per_GeV ); - TowerCalibration_EEMC->set_pedstal_ADC( 0 ); - - se->registerSubsystem( TowerCalibration_EEMC ); - -} - -void EEMC_Clusters(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd"); - ClusterBuilder->Detector("EEMC"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); - - return; -} - -void EEMC_Eval(std::string outputfile, int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator *eval = new CaloEvaluator("EEMCEVALUATOR", "EEMC", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} diff --git a/macros/g4simulations/G4_EGEM_EIC.C b/macros/g4simulations/G4_EGEM_EIC.C deleted file mode 100644 index 5eb2220c6..000000000 --- a/macros/g4simulations/G4_EGEM_EIC.C +++ /dev/null @@ -1,119 +0,0 @@ -// $Id: G4_FGEM_ePHENIX.C,v 1.4 2013/10/13 21:45:27 jinhuang Exp $ - -/*! - * \file G4_FGEM_ePHENIX.C - * \brief - * \author Jin Huang - * \version $Revision: 1.4 $ - * \date $Date: 2013/10/13 21:45:27 $ - */ - -using namespace std; - -void -EGEM_Init() -{ - -} - -void -EGEMSetup(PHG4Reco* g4Reco) -{ - make_GEM_station("EGEM_0", g4Reco, -32., -1.6, -3.4); - make_GEM_station("EGEM_1", g4Reco, -58., -2.1, -3.98); // reduce max eta from -4.0 to -3.98 to avoid overlap with volume S_AL_PIPE_5 (aluminum beam pipe) - make_GEM_station("EGEM_2", g4Reco, -101., -1.2, -4.5); -} - -int -make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin, - double etamax) -{ - - // cout - // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " - // << name << endl; - - double polar_angle = 0; - - if (zpos < 0) - { - zpos = -zpos; - polar_angle = TMath::Pi(); - - } - if (etamax < etamin) - { - double t = etamax; - etamax = etamin; - etamin = t; - } - - PHG4SectorSubsystem *gem; - gem = new PHG4SectorSubsystem(name.c_str()); - - gem->get_geometry().set_normal_polar_angle(polar_angle); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm()); - gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); - gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamin)); - gem->get_geometry().set_material("G4_METHANE"); - gem->get_geometry().set_N_Sector(1); - gem->OverlapCheck(overlapcheck); - - gem->get_geometry().AddLayers_DriftVol_COMPASS(); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - -} - -void EGEM_FastSim_Reco(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4hough.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4TrackFastSim* kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); - kalman->Verbosity(0); - - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(50E-4); - kalman->set_vertex_z_resolution(50E-4); - - kalman->set_detector_type(PHG4TrackFastSim::Vertical_Plane); // Vertical_Plane, Cylinder - kalman->set_phi_resolution(50E-4); - kalman->set_r_resolution(1.); - - kalman->set_mag_field_file_name("/phenix/upgrades/decadal/fieldmaps/fsPHENIX.2d.root"); - kalman->set_mag_field_re_scaling_factor(1.); - - kalman->set_pat_rec_hit_finding_eff(1.); - kalman->set_pat_rec_noise_prob(0.); - - std::string phg4hits_names[] = {"G4HIT_EGEM_0","G4HIT_EGEM_1","G4HIT_EGEM_2"}; - kalman->set_phg4hits_names(phg4hits_names, 3); - kalman->set_sub_top_node_name("SVTX"); - kalman->set_trackmap_out_name("SvtxTrackMapNegativeEta"); - - // Saved track states (projections) - std::string state_names[] = {"EEMC"}; - kalman->set_state_names(state_names, 1); - - kalman->set_fit_alg_name("KalmanFitterRefTrack");// - kalman->set_primary_assumption_pid(-211); // -211 = pi- - kalman->set_do_evt_display(false); - - se->registerSubsystem(kalman); - -} - diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C deleted file mode 100644 index 6e55cce39..000000000 --- a/macros/g4simulations/G4_FEMC.C +++ /dev/null @@ -1,132 +0,0 @@ -using namespace std; - -void -FEMCInit() -{ -} - -void FEMC_Cells(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); - hc->Detector("FEMC"); - se->registerSubsystem(hc); - - return; -} - -void -FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) -{ - - gSystem->Load("libg4detectors.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - /** Use dedicated FEMC module */ - PHG4ForwardEcalSubsystem *femc = new PHG4ForwardEcalSubsystem("FEMC"); - - ostringstream mapping_femc; - - // fsPHENIX ECAL - femc->SetfsPHENIXDetector(); - mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v002.txt"; - - cout << mapping_femc.str() << endl; - - femc->SetTowerMappingFile( mapping_femc.str() ); - femc->OverlapCheck(overlapcheck); - - if (absorberactive) femc->SetAbsorberActive(); - - g4Reco->registerSubsystem( femc ); - -} - -void FEMC_Towers(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_femc; - - // fsPHENIX ECAL - mapping_femc << getenv("CALIBRATIONROOT") << - "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v002.txt"; - - RawTowerBuilderByHitIndex* tower_FEMC = new RawTowerBuilderByHitIndex("TowerBuilder_FEMC"); - tower_FEMC->Detector("FEMC"); - tower_FEMC->set_sim_tower_node_prefix("SIM"); - tower_FEMC->GeometryTableFile( mapping_femc.str() ); - - se->registerSubsystem(tower_FEMC); - - // PbW crystals - RawTowerDigitizer *TowerDigitizer1 = new RawTowerDigitizer("FEMCRawTowerDigitizer1"); - TowerDigitizer1->Detector("FEMC"); - TowerDigitizer1->TowerType(1); - TowerDigitizer1->Verbosity(verbosity); - TowerDigitizer1->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer1 ); - - // PbSc towers - RawTowerDigitizer *TowerDigitizer2 = new RawTowerDigitizer("FEMCRawTowerDigitizer2"); - TowerDigitizer2->Detector("FEMC"); - TowerDigitizer2->TowerType(2); - TowerDigitizer2->Verbosity(verbosity); - TowerDigitizer2->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer2 ); - - // PbW crystals - RawTowerCalibration *TowerCalibration1 = new RawTowerCalibration("FEMCRawTowerCalibration1"); - TowerCalibration1->Detector("FEMC"); - TowerCalibration1->TowerType(1); - TowerCalibration1->Verbosity(verbosity); - TowerCalibration1->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration1->set_calib_const_GeV_ADC(1.0); // sampling fraction = 1.0 - TowerCalibration1->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration1 ); - - // PbSc towers - RawTowerCalibration *TowerCalibration2 = new RawTowerCalibration("FEMCRawTowerCalibration2"); - TowerCalibration2->Detector("FEMC"); - TowerCalibration2->TowerType(2); - TowerCalibration2->Verbosity(verbosity); - TowerCalibration2->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration2->set_calib_const_GeV_ADC(1.0/0.249); // sampling fraction = 0.249 for e- - TowerCalibration2->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration2 ); - -} - -void FEMC_Clusters(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.100); - se->registerSubsystem( ClusterBuilder ); - - return; -} - -void FEMC_Eval(std::string outputfile, int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C deleted file mode 100644 index b02b5ce0d..000000000 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ /dev/null @@ -1,111 +0,0 @@ -using namespace std; - -void -FEMCInit() -{ -} - -void FEMC_Cells(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); - hc->Detector("FEMC"); - se->registerSubsystem(hc); - - return; -} - -void -FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) -{ - - gSystem->Load("libg4detectors.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - /** Use dedicated FEMC module */ - PHG4ForwardEcalSubsystem *femc = new PHG4ForwardEcalSubsystem("FEMC"); - - ostringstream mapping_femc; - - // EIC ECAL - femc->SetEICDetector(); - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v005.txt"; - - cout << mapping_femc.str() << endl; - - femc->SetTowerMappingFile( mapping_femc.str() ); - femc->OverlapCheck(overlapcheck); - - if (absorberactive) femc->SetAbsorberActive(); - - g4Reco->registerSubsystem( femc ); - -} - -void FEMC_Towers(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_femc; - // EIC ECAL - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v005.txt"; - - RawTowerBuilderByHitIndex* tower_FEMC = new RawTowerBuilderByHitIndex("TowerBuilder_FEMC"); - tower_FEMC->Detector("FEMC"); - tower_FEMC->set_sim_tower_node_prefix("SIM"); - tower_FEMC->GeometryTableFile( mapping_femc.str() ); - - se->registerSubsystem(tower_FEMC); - - // PbSc towers - RawTowerDigitizer *TowerDigitizer2 = new RawTowerDigitizer("FEMCRawTowerDigitizer2"); - TowerDigitizer2->Detector("FEMC"); - TowerDigitizer2->TowerType(2); - TowerDigitizer2->Verbosity(verbosity); - TowerDigitizer2->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer2 ); - - // PbSc towers - RawTowerCalibration *TowerCalibration2 = new RawTowerCalibration("FEMCRawTowerCalibration2"); - TowerCalibration2->Detector("FEMC"); - TowerCalibration2->TowerType(2); - TowerCalibration2->Verbosity(verbosity); - TowerCalibration2->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration2->set_calib_const_GeV_ADC(1.0/0.249); // sampling fraction = 0.249 for e- - TowerCalibration2->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration2 ); - -} - -void FEMC_Clusters(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); - - return; -} - -void FEMC_Eval(std::string outputfile, int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C deleted file mode 100644 index 70ea650c1..000000000 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ /dev/null @@ -1,301 +0,0 @@ -// $Id: G4_FGEM_fsPHENIX.C,v 1.2 2014/01/22 01:44:13 jinhuang Exp $ - -/*! - * \file G4_FGEM_fsPHENIX.C - * \brief - * \author Jin Huang - * \version $Revision: 1.2 $ - * \date $Date: 2014/01/22 01:44:13 $ - */ - -using namespace std; - -void -FGEM_Init() -{ - -} - -void -FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // - const double min_eta = 1.45 // - ) -{ - - const double tilt = .1; - - string name; - double etamax; - double etamin; - double zpos; - PHG4SectorSubsystem *gem; - - make_GEM_station("FGEM_0", g4Reco, 17, 1.01, 2.7, N_Sector); - make_GEM_station("FGEM_1", g4Reco, 62, 2.15, 4.0, N_Sector); - - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_2"; - etamax = 4; - etamin = min_eta; - zpos = 1.2e2; - - gem = new PHG4SectorSubsystem(name.c_str()); - - gem->get_geometry().set_normal_polar_angle(tilt); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), 0); - gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); - gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamin)); - gem->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - gem->get_geometry().set_material("G4_METHANE"); - gem->get_geometry().set_N_Sector(N_Sector); - gem->OverlapCheck(overlapcheck); - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_3"; - etamax = 4; - etamin = min_eta; - zpos = 1.6e2; - gem = new PHG4SectorSubsystem(name.c_str()); - - gem->SuperDetector(name); - gem->get_geometry().set_normal_polar_angle(tilt); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), 0); - gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); - gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); - gem->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - gem->get_geometry().set_material("G4_METHANE"); - gem->get_geometry().set_N_Sector(N_Sector); - gem->OverlapCheck(overlapcheck); - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - - gem = new PHG4SectorSubsystem(name + "_LowerEta"); - gem->SuperDetector(name); - - zpos = zpos - - (zpos * sin(tilt) - + zpos * cos(tilt) - * tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(2) - tilt)) - * sin(tilt); - - gem->get_geometry().set_normal_polar_angle( - (PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta) - + PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)) / 2); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), - PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); - gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); - gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta)); - gem->get_geometry().set_material("G4_METHANE"); - gem->get_geometry().set_N_Sector(N_Sector); - gem->get_geometry().set_min_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - gem->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(gem); - - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_4"; - etamax = 4; - etamin = min_eta; - zpos = 2.75e2; - gem = new PHG4SectorSubsystem(name.c_str()); - - gem->SuperDetector(name); - gem->get_geometry().set_normal_polar_angle(tilt); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), 0); - gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); - gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); - gem->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - gem->get_geometry().set_material("G4_METHANE"); - gem->get_geometry().set_N_Sector(N_Sector); - gem->OverlapCheck(overlapcheck); - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - - zpos = zpos - - (zpos * sin(tilt) - + zpos * cos(tilt) - * tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(2) - tilt)) - * sin(tilt); - - gem = new PHG4SectorSubsystem(name + "_LowerEta"); - gem->SuperDetector(name); - - gem->get_geometry().set_normal_polar_angle( - (PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta) - + PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)) / 2); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), - PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); - gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); - gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta)); - gem->get_geometry().set_material("G4_METHANE"); - gem->get_geometry().set_N_Sector(N_Sector); - gem->get_geometry().set_min_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - gem->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(gem); - - /////////////////////////////////////////////////////////////////////////// - -} - -//! Add drift layers to mini TPC -void -AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem) -{ - assert(gem); - - const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); - const double mm = .1 * cm; - const double um = 1e-3 * mm; - -// const int N_Layers = 70; // used for mini-drift TPC timing digitalization - const int N_Layers = 1; // simplified setup - const double thickness = 2 * cm; - - gem->get_geometry().AddLayer("EntranceWindow", "G4_MYLAR", 25 * um, false, - 100); - gem->get_geometry().AddLayer("Cathode", "G4_GRAPHITE", 10 * um, false, 100); - - for (int d = 1; d <= N_Layers; d++) - { - stringstream s; - s << "DriftLayer_"; - s << d; - - gem->get_geometry().AddLayer(s.str(), "G4_METHANE", thickness / N_Layers, - true); - - } -} - -int -make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin, - double etamax, const int N_Sector = 8) -{ - -// cout -// << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " -// << name << endl; - - double polar_angle = 0; - - if (zpos < 0) - { - zpos = -zpos; - polar_angle = TMath::Pi(); - - } - if (etamax < etamin) - { - double t = etamax; - etamax = etamin; - etamin = t; - } - - PHG4SectorSubsystem *gem; - gem = new PHG4SectorSubsystem(name.c_str()); - - gem->SuperDetector(name); - - gem->get_geometry().set_normal_polar_angle(polar_angle); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm()); - gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); - gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamin)); - gem->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - gem->get_geometry().set_min_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - gem->get_geometry().set_N_Sector(N_Sector); - gem->get_geometry().set_material("G4_METHANE"); - gem->OverlapCheck(overlapcheck); - - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - -} - -void FGEM_FastSim_Reco(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4hough.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4TrackFastSim* kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); - kalman->Verbosity(0); - - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(50E-4); - kalman->set_vertex_z_resolution(50E-4); - - kalman->set_detector_type(PHG4TrackFastSim::Vertical_Plane); // Vertical_Plane, Cylinder - kalman->set_phi_resolution(50E-4); - kalman->set_r_resolution(1.); - - kalman->set_mag_field_file_name("/phenix/upgrades/decadal/fieldmaps/fsPHENIX.2d.root"); - kalman->set_mag_field_re_scaling_factor(1.); - - kalman->set_pat_rec_hit_finding_eff(1.); - kalman->set_pat_rec_noise_prob(0.); - - std::string phg4hits_names[] = {"G4HIT_FGEM_0","G4HIT_FGEM_1","G4HIT_FGEM_2","G4HIT_FGEM_3","G4HIT_FGEM_4"}; - kalman->set_phg4hits_names(phg4hits_names, 5); - kalman->set_sub_top_node_name("SVTX"); - kalman->set_trackmap_out_name("SvtxTrackMap"); - - // Saved track states (projections) - std::string state_names[] = {"FEMC","FHCAL"}; - kalman->set_state_names(state_names, 2); - - kalman->set_fit_alg_name("KalmanFitterRefTrack");// - kalman->set_primary_assumption_pid(13); - kalman->set_do_evt_display(false); - - se->registerSubsystem(kalman); - -} - diff --git a/macros/g4simulations/G4_FHCAL.C b/macros/g4simulations/G4_FHCAL.C deleted file mode 100644 index aac6bf737..000000000 --- a/macros/g4simulations/G4_FHCAL.C +++ /dev/null @@ -1,135 +0,0 @@ -using namespace std; - -void -FHCALInit() -{ -} - -void FHCAL_Cells(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FHCALCellReco"); - hc->Detector("FHCAL"); - se->registerSubsystem(hc); - - return; -} - -void -FHCALSetup(PHG4Reco* g4Reco, const int absorberactive = 0) -{ - - gSystem->Load("libg4detectors.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - /** Use dedicated FHCAL module */ - PHG4ForwardHcalSubsystem *hhcal = new PHG4ForwardHcalSubsystem("FHCAL"); - - ostringstream mapping_hhcal; - - /* path to central copy of calibrations repositry */ - mapping_hhcal << getenv("CALIBRATIONROOT") ; - mapping_hhcal << "/ForwardHcal/mapping/towerMap_FHCAL_v004.txt"; - cout << mapping_hhcal.str() << endl; - //mapping_hhcal << "towerMap_FHCAL_latest.txt"; - - hhcal->SetTowerMappingFile( mapping_hhcal.str() ); - hhcal->OverlapCheck(overlapcheck); - - if (absorberactive) hhcal->SetAbsorberActive(); - - g4Reco->registerSubsystem( hhcal ); - -} - -void FHCAL_Towers(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_fhcal; - mapping_fhcal << getenv("CALIBRATIONROOT") << - "/ForwardHcal/mapping/towerMap_FHCAL_v004.txt"; - //mapping_fhcal << "towerMap_FHCAL_latest.txt"; - - RawTowerBuilderByHitIndex* tower_FHCAL = new RawTowerBuilderByHitIndex("TowerBuilder_FHCAL"); - tower_FHCAL->Detector("FHCAL"); - tower_FHCAL->set_sim_tower_node_prefix("SIM"); - tower_FHCAL->GeometryTableFile( mapping_fhcal.str() ); - - se->registerSubsystem(tower_FHCAL); - - // const double FHCAL_photoelectron_per_GeV = 500; - - // RawTowerDigitizer *TowerDigitizer_FHCAL = new RawTowerDigitizer("FHCALRawTowerDigitizer"); - - // TowerDigitizer_FHCAL->Detector("FHCAL"); - // TowerDigitizer_FHCAL->Verbosity(verbosity); - // TowerDigitizer_FHCAL->set_raw_tower_node_prefix("RAW"); - // TowerDigitizer_FHCAL->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); - // TowerDigitizer_FHCAL->set_pedstal_central_ADC(0); - // TowerDigitizer_FHCAL->set_pedstal_width_ADC(8);// eRD1 test beam setting - // TowerDigitizer_FHCAL->set_photonelec_ADC(1);//not simulating ADC discretization error - // TowerDigitizer_FHCAL->set_photonelec_yield_visible_GeV( FHCAL_photoelectron_per_GeV ); - // TowerDigitizer_FHCAL->set_zero_suppression_ADC(16); // eRD1 test beam setting - - // se->registerSubsystem( TowerDigitizer_FHCAL ); - - // RawTowerCalibration *TowerCalibration_FHCAL = new RawTowerCalibration("FHCALRawTowerCalibration"); - // TowerCalibration_FHCAL->Detector("FHCAL"); - // TowerCalibration_FHCAL->Verbosity(verbosity); - // TowerCalibration_FHCAL->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - // TowerCalibration_FHCAL->set_calib_const_GeV_ADC( 1. / FHCAL_photoelectron_per_GeV ); - // TowerCalibration_FHCAL->set_pedstal_ADC( 0 ); - - // se->registerSubsystem( TowerCalibration_FHCAL ); - - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer"); - TowerDigitizer->Detector("FHCAL"); - TowerDigitizer->Verbosity(verbosity); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer ); - - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("FHCALRawTowerCalibration"); - TowerCalibration->Detector("FHCAL"); - TowerCalibration->Verbosity(verbosity); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(1./0.03898); // calibrated with muons - TowerCalibration->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration ); - - -} - -void FHCAL_Clusters(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FHCALRawClusterBuilderFwd"); - ClusterBuilder->Detector("FHCAL"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.100); - se->registerSubsystem( ClusterBuilder ); - - return; -} - -void FHCAL_Eval(std::string outputfile, int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator *eval = new CaloEvaluator("FHCALEVALUATOR", "FHCAL", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} diff --git a/macros/g4simulations/G4_FwdJets.C b/macros/g4simulations/G4_FwdJets.C deleted file mode 100644 index 4e9195e60..000000000 --- a/macros/g4simulations/G4_FwdJets.C +++ /dev/null @@ -1,60 +0,0 @@ - -void Jet_FwdReco(int verbosity = 0) { - - gSystem->Load("libg4jets.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - // truth particle level jets - JetReco *truthjetreco = new JetReco(); - truthjetreco->add_input(new TruthJetInput(Jet::PARTICLE)); - //truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.2),"AntiKt_Truth_r02"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.3),"AntiKt_Truth_r03"); - // truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.4),"AntiKt_Truth_r04"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.5),"AntiKt_Truth_r05"); - // truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.6),"AntiKt_Truth_r06"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.7),"AntiKt_Truth_r07"); - // truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Truth_r08"); - truthjetreco->set_algo_node("ANTIKT"); - truthjetreco->set_input_node("TRUTH"); - truthjetreco->Verbosity(verbosity); - se->registerSubsystem(truthjetreco); - - // tower jets - JetReco *towerjetreco = new JetReco(); - towerjetreco->add_input(new TowerJetInput(Jet::FEMC_TOWER)); - towerjetreco->add_input(new TowerJetInput(Jet::FHCAL_TOWER)); - towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWER)); - towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWER)); - towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWER)); - // towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.2),"AntiKt_Tower_r02"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.3),"AntiKt_Tower_r03"); - // towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.4),"AntiKt_Tower_r04"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.5),"AntiKt_Tower_r05"); - // towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.6),"AntiKt_Tower_r06"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.7),"AntiKt_Tower_r07"); - // towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Tower_r08"); - towerjetreco->set_algo_node("ANTIKT"); - towerjetreco->set_input_node("TOWER"); - towerjetreco->Verbosity(verbosity); - se->registerSubsystem(towerjetreco); - - return; -} - -void Jet_FwdEval(std::string outfilename = "g4fwdjets_eval.root", - int verbosity = 0) { - - gSystem->Load("libg4eval.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - JetEvaluator* eval = new JetEvaluator("JETEVALUATOR", - "AntiKt_Tower_r05", - "AntiKt_Truth_r05", - outfilename); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} diff --git a/macros/g4simulations/G4_Global.C b/macros/g4simulations/G4_Global.C deleted file mode 100644 index 0c512827c..000000000 --- a/macros/g4simulations/G4_Global.C +++ /dev/null @@ -1,46 +0,0 @@ - -void Global_Reco(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4vertex.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - GlobalVertexReco* gblvertex = new GlobalVertexReco(); - se->registerSubsystem(gblvertex); - - return; -} - -void Global_FastSim(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4vertex.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - GlobalVertexFastSimReco* gblvertex = new GlobalVertexFastSimReco(); - gblvertex->set_x_smearing(0.0100); // 100 um - gblvertex->set_y_smearing(0.0100); // 100 um - gblvertex->set_z_smearing(0.0150); // 150 um - gblvertex->set_t_smearing(0.002); // 20 ps - se->registerSubsystem(gblvertex); - - return; -} diff --git a/macros/g4simulations/G4_HIJetReco.C b/macros/g4simulations/G4_HIJetReco.C deleted file mode 100644 index f15a0722d..000000000 --- a/macros/g4simulations/G4_HIJetReco.C +++ /dev/null @@ -1,43 +0,0 @@ -void HIJetReco(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libjetbackground.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - RetowerCEMC *rcemc = new RetowerCEMC(); - rcemc->Verbosity( verbosity ); - se->registerSubsystem( rcemc ); - - DetermineTowerBackground *dtb = new DetermineTowerBackground(); - dtb->SetBackgroundOutputName("TowerBackground_Sub1"); - dtb->SetSeedType( 1 ); - dtb->Verbosity( verbosity ); - se->registerSubsystem( dtb ); - - SubtractTowers *st = new SubtractTowers(); - st->Verbosity( verbosity ); - se->registerSubsystem( st ); - - JetReco *towerjetreco = new JetReco(); - towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWER_SUB1)); - towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWER_SUB1)); - towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWER_SUB1)); - towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT,0.2,verbosity),"AntiKt_Tower_r02_Sub1"); - towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT,0.3,verbosity),"AntiKt_Tower_r03_Sub1"); - towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT,0.4,verbosity),"AntiKt_Tower_r04_Sub1"); - towerjetreco->set_algo_node("ANTIKT"); - towerjetreco->set_input_node("TOWER"); - towerjetreco->Verbosity( verbosity ); - se->registerSubsystem(towerjetreco); - - return; - -} diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C deleted file mode 100644 index ae2ca3d0e..000000000 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ /dev/null @@ -1,200 +0,0 @@ -//Inner HCal construction macro - -//Inner HCal absorber material selector: -//false - Default, absorber material is SS310 -//true - Choose if you want Aluminum -const bool inner_hcal_material_Al = false; - -// Init is called by G4Setup.C -void HCalInnerInit() {} - -double HCalInner(PHG4Reco* g4Reco, - double radius, - const int crossings, - const int absorberactive = 0, - int verbosity = 0) { - // all sizes are in cm! - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - - PHG4InnerHcalSubsystem *hcal = new PHG4InnerHcalSubsystem("HCALIN"); - // these are the parameters you can change with their default settings - // hcal->set_string_param("material","SS310"); - if(inner_hcal_material_Al) - { - cout <<"HCalInner - construct inner HCal absorber with G4_Al"<set_string_param("material","G4_Al"); - } - // hcal->set_int_param("ncross",4); - // hcal->set_int_param("n_scinti_tiles",12); - // hcal->set_int_param("light_scint_model",1); - // hcal->set_double_param("inner_radius",116); - // hcal->set_double_param("outer_radius",136); - // hcal->set_double_param("scinti_inner_gap",0.85); - // hcal->set_double_param("scinti_outer_gap",1.22); - // hcal->set_double_param("scinti_tile_thickness",0.7); - // hcal->set_double_param("scinti_gap_neighbor",0.1); - // the SetLightCorrection is a convenience method, no - // point in forcing users to set all 4 of them separately - // and maybe forgetting one - // hcal->SetLightCorrection(NAN,NAN,NAN,NAN); - // hcal->set_double_param("place_x",0); - // hcal->set_double_param("place_y",0); - // hcal->set_double_param("place_z",0); - // hcal->set_double_param("rot_x",0); - // hcal->set_double_param("rot_y",0); - // hcal->set_double_param("rot_z",0); - // Flat plates with 4 scintillators per tower: - hcal->set_int_param("n_scinti_plates_per_tower",4); - hcal->set_double_param("scinti_outer_gap",1.22*(5.0/4.0)); - - hcal->SetActive(); - hcal->SuperDetector("HCALIN"); - if (absorberactive) - { - hcal->SetAbsorberActive(); - } - hcal->OverlapCheck(overlapcheck); - - g4Reco->registerSubsystem( hcal ); - - radius = hcal->get_double_param("outer_radius"); - - HCalInner_SupportRing(g4Reco,absorberactive); - - radius += no_overlapp; - return radius; -} - -//! A rough version of the inner HCal support ring, from Richie's CAD drawing. - Jin -void HCalInner_SupportRing(PHG4Reco* g4Reco, - const int absorberactive = 0) { - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - const double z_ring1 = (2025 + 2050) / 2. / 10.; - const double z_ring2 = (2150 + 2175) / 2. / 10.; - const double dz = 25. / 10.; - const double innerradius = 116.; - const double maxradius = 178.0 - 0.001; // avoid touching the outer HCal envelop volumne - - const double z_rings[] = - { -z_ring2, -z_ring1, z_ring1, z_ring2, 0, 0, 0, 0 }; - - PHG4CylinderSubsystem *cyl; - - for (int i = 0; i < 4; i++) - { - cyl = new PHG4CylinderSubsystem("HCALIN_SPT_N1", i); - cyl->set_double_param("place_z",z_rings[i]); - cyl->SuperDetector("HCALIN_SPT"); - cyl->set_double_param("radius",innerradius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",dz); - cyl->set_string_param("material","SS310"); - cyl->set_double_param("thickness",maxradius - innerradius); - if (absorberactive) - { - cyl->SetActive(); - } - g4Reco->registerSubsystem(cyl); - } - - return; -} - - -void HCALInner_Cells(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALIN_CELLRECO"); - hc->Detector("HCALIN"); - // hc->Verbosity(2); - // check for energy conservation - needs modified "infinite" timing cuts - // 0-999999999 - // hc->checkenergy(); - // timing cuts with their default settings - // hc->set_double_param("tmin",0.); - // hc->set_double_param("tmax",60.0); - // or all at once: - // hc->set_timing_window(0.0,60.0); - se->registerSubsystem(hc); - - return; -} - -void HCALInner_Towers(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalInRawTowerBuilder"); - TowerBuilder->Detector("HCALIN"); - TowerBuilder->set_sim_tower_node_prefix("SIM"); - TowerBuilder->Verbosity(verbosity); - se->registerSubsystem( TowerBuilder ); - - // From 2016 Test beam sim - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HcalInRawTowerDigitizer"); - TowerDigitizer->Detector("HCALIN"); -// TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(32. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(32. / 5 / (0.4e-3)); - TowerDigitizer->set_zero_suppression_ADC(-0); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - - //Default sampling fraction for SS310 - double visible_sample_fraction_HCALIN = 0.0631283 ; //, /gpfs/mnt/gpfs04/sphenix/user/jinhuang/prod_analysis/hadron_shower_res_nightly/./G4Hits_sPHENIX_pi-_eta0_16GeV-0000.root_qa.rootQA_Draw_HCALIN_G4Hit.pdf - - if(inner_hcal_material_Al) visible_sample_fraction_HCALIN = 0.162166; //for "G4_Al", Abhisek Sen - - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HcalInRawTowerCalibration"); - TowerCalibration->Detector("HCALIN"); -// TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); -// TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.4e-3 / visible_sample_fraction_HCALIN); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - return; -} - -void HCALInner_Clusters(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilder* ClusterBuilder = new RawClusterBuilder("HcalInRawClusterBuilder"); - ClusterBuilder->Detector("HCALIN"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); - - return; -} - -void HCALInner_Eval(std::string outputfile, int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator* eval = new CaloEvaluator("HCALINEVALUATOR", "HCALIN", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem( eval ); - - return; -} diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C deleted file mode 100644 index 1ed5be01a..000000000 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ /dev/null @@ -1,147 +0,0 @@ -// Init is called by G4Setup.C -void HCalOuterInit(){} - -double HCalOuter(PHG4Reco* g4Reco, - double radius, - const int crossings, - const int absorberactive = 0, - int verbosity = 0) { - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - PHG4OuterHcalSubsystem *hcal = new PHG4OuterHcalSubsystem("HCALOUT"); - // integer params: - // hcal->set_int_param("light_scint_model",1); - // hcal->set_int_param("magnet_cutout_first_scint",8); - // hcal->set_int_param("n_scinti_plates_per_tower",5); - // hcal->set_int_param("n_scinti_tiles",12); - // hcal->set_int_param("n_towers",64); - // hcal->set_int_param("ncross",-4); - // double params: - // hcal->set_double_param("inner_radius", 178); - // hcal->set_double_param("magnet_cutout", 12); - // hcal->set_double_param("outer_radius", 260); - // hcal->set_double_param("place_x", 0); - // hcal->set_double_param("place_y", 0); - // hcal->set_double_param("place_z", 0); - // hcal->set_double_param("rot_x", 0); - // hcal->set_double_param("rot_y", 0); - // hcal->set_double_param("rot_z", 0); - // hcal->set_double_param("scinti_eta_coverage", 1.1); - // hcal->set_double_param("scinti_gap", 0.85); - // hcal->set_double_param("scinti_gap_neighbor", 0.1); - // hcal->set_double_param("scinti_tile_thickness", 0.7); - // hcal->set_double_param("size_z", 609.82); - // hcal->set_double_param("steplimits", nan); - // angle is calculated from crossings - // hcal->set_double_param("tilt_angle",NAN); - // convenience method so we do not forget to set all of them - // hcal->SetLightCorrection(NAN,NAN,NAN,NAN); - // string params: - // hcal->set_string_param("material","Steel_1006"); - - hcal->SetActive(); - hcal->SuperDetector("HCALOUT"); - if (absorberactive) - { - hcal->SetAbsorberActive(); - } - hcal->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(hcal); - - radius = hcal->get_double_param("outer_radius"); - - radius += no_overlapp; - - return radius; -} - -void HCALOuter_Cells(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALOUT_CELLRECO"); - hc->Detector("HCALOUT"); - // hc->Verbosity(2); - // check for energy conservation - needs modified "infinite" timing cuts - // 0-999999999 - // hc->checkenergy(); - // timing cuts with their default settings - // hc->set_double_param("tmin",0.); - // hc->set_double_param("tmax",60.0); - // or all at once: - // hc->set_timing_window(0.0,60.0); - se->registerSubsystem(hc); - - return; -} - -void HCALOuter_Towers(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - HcalRawTowerBuilder* TowerBuilder = new HcalRawTowerBuilder("HcalOutRawTowerBuilder"); - TowerBuilder->Detector("HCALOUT"); - TowerBuilder->set_sim_tower_node_prefix("SIM"); - TowerBuilder->Verbosity(verbosity); - se->registerSubsystem( TowerBuilder ); - - // From 2016 Test beam sim - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HcalOutRawTowerDigitizer"); - TowerDigitizer->Detector("HCALOUT"); -// TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(16. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(16. / 5 / (0.2e-3)); - TowerDigitizer->set_zero_suppression_ADC(-0); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - - const double visible_sample_fraction_HCALOUT = 3.38021e-02; // /gpfs/mnt/gpfs04/sphenix/user/jinhuang/prod_analysis/hadron_shower_res_nightly/./G4Hits_sPHENIX_pi-_eta0_16GeV.root_qa.rootQA_Draw_HCALOUT_G4Hit.pdf - - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HcalOutRawTowerCalibration"); - TowerCalibration->Detector("HCALOUT"); -// TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); -// TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / visible_sample_fraction_HCALOUT); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - return; -} - -void HCALOuter_Clusters(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilder* ClusterBuilder = new RawClusterBuilder("HcalOutRawClusterBuilder"); - ClusterBuilder->Detector("HCALOUT"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); - - return; -} - -void HCALOuter_Eval(std::string outputfile, int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator* eval = new CaloEvaluator("HCALOUTEVALUATOR", "HCALOUT", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem( eval ); - - return; -} diff --git a/macros/g4simulations/G4_Jets.C b/macros/g4simulations/G4_Jets.C deleted file mode 100644 index f3bbcc844..000000000 --- a/macros/g4simulations/G4_Jets.C +++ /dev/null @@ -1,90 +0,0 @@ - -void Jet_Reco(int verbosity = 0) { - - gSystem->Load("libg4jets.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - // truth particle level jets - JetReco *truthjetreco = new JetReco(); - truthjetreco->add_input(new TruthJetInput(Jet::PARTICLE)); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.2),"AntiKt_Truth_r02"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.3),"AntiKt_Truth_r03"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.4),"AntiKt_Truth_r04"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.5),"AntiKt_Truth_r05"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.6),"AntiKt_Truth_r06"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.7),"AntiKt_Truth_r07"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Truth_r08"); - truthjetreco->set_algo_node("ANTIKT"); - truthjetreco->set_input_node("TRUTH"); - truthjetreco->Verbosity(verbosity); - se->registerSubsystem(truthjetreco); - - // tower jets - JetReco *towerjetreco = new JetReco(); - towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWER)); - towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWER)); - towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWER)); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.2),"AntiKt_Tower_r02"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.3),"AntiKt_Tower_r03"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.4),"AntiKt_Tower_r04"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.5),"AntiKt_Tower_r05"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.6),"AntiKt_Tower_r06"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.7),"AntiKt_Tower_r07"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Tower_r08"); - towerjetreco->set_algo_node("ANTIKT"); - towerjetreco->set_input_node("TOWER"); - towerjetreco->Verbosity(verbosity); - se->registerSubsystem(towerjetreco); - - // cluster jets - JetReco *clusterjetreco = new JetReco(); - clusterjetreco->add_input(new ClusterJetInput(Jet::CEMC_CLUSTER)); - clusterjetreco->add_input(new ClusterJetInput(Jet::HCALIN_CLUSTER)); - clusterjetreco->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.2),"AntiKt_Cluster_r02"); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.3),"AntiKt_Cluster_r03"); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.4),"AntiKt_Cluster_r04"); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.5),"AntiKt_Cluster_r05"); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.6),"AntiKt_Cluster_r06"); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.7),"AntiKt_Cluster_r07"); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Cluster_r08"); - clusterjetreco->set_algo_node("ANTIKT"); - clusterjetreco->set_input_node("CLUSTER"); - clusterjetreco->Verbosity(verbosity); - se->registerSubsystem(clusterjetreco); - - // track jets - JetReco *trackjetreco = new JetReco(); - trackjetreco->add_input(new TrackJetInput(Jet::TRACK)); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.2),"AntiKt_Track_r02"); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.3),"AntiKt_Track_r03"); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.4),"AntiKt_Track_r04"); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.5),"AntiKt_Track_r05"); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.6),"AntiKt_Track_r06"); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.7),"AntiKt_Track_r07"); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Track_r08"); - trackjetreco->set_algo_node("ANTIKT"); - trackjetreco->set_input_node("TRACK"); - trackjetreco->Verbosity(verbosity); - se->registerSubsystem(trackjetreco); - - return; -} - -void Jet_Eval(std::string outfilename = "g4jets_eval.root", - int verbosity = 0) { - - gSystem->Load("libg4eval.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - JetEvaluator* eval = new JetEvaluator("JETEVALUATOR", - "AntiKt_Tower_r03", - "AntiKt_Truth_r03", - outfilename); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} diff --git a/macros/g4simulations/G4_Magnet.C b/macros/g4simulations/G4_Magnet.C deleted file mode 100644 index f0c84f3e2..000000000 --- a/macros/g4simulations/G4_Magnet.C +++ /dev/null @@ -1,72 +0,0 @@ - -void MagnetInit() {} - -double Magnet(PHG4Reco* g4Reco, - double radius, - const int crossings = 0, - const int absorberactive = 0, - int verbosity = 0) { - - double magnet_inner_cryostat_wall_radius = 142; - double magnet_inner_cryostat_wall_thickness = 1; - double magnet_outer_cryostat_wall_radius = 174.5; - double magnet_outer_cryostat_wall_thickness = 2.5; - double magnet_coil_radius = 150.8; - double magnet_coil_thickness = 9.38; - double magnet_length = 379.; - double coil_length = 361.5; - if (radius > magnet_inner_cryostat_wall_radius) { - cout << "inconsistency: radius: " << radius - << " larger than Magnet inner radius: " << magnet_inner_cryostat_wall_radius << endl; - gSystem->Exit(-1); - } - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - radius = magnet_inner_cryostat_wall_radius; - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("MAGNET", 0); - cyl->set_double_param("radius",magnet_inner_cryostat_wall_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",magnet_length); -cyl->set_double_param("thickness",magnet_inner_cryostat_wall_thickness); -cyl->set_string_param("material","Al5083"); // use 1 radiation length Al for magnet thickness - cyl->SuperDetector("MAGNET"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - cyl = new PHG4CylinderSubsystem("MAGNET", 1); - cyl->set_double_param("radius",magnet_coil_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",coil_length); - cyl->set_double_param("thickness",magnet_coil_thickness); - cyl->set_string_param("material","Al5083"); // use 1 radiation length Al for magnet thickness - cyl->SuperDetector("MAGNET"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - cyl = new PHG4CylinderSubsystem("MAGNET", 2); - cyl->set_double_param("radius",magnet_outer_cryostat_wall_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",magnet_length); - cyl->set_double_param("thickness",magnet_outer_cryostat_wall_thickness); - cyl->set_string_param("material","Al5083"); // use 1 radiation length Al for magnet thickness - cyl->SuperDetector("MAGNET"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - radius = magnet_outer_cryostat_wall_radius + magnet_outer_cryostat_wall_thickness; // outside of magnet - - if (verbosity > 0) { - cout << "========================= G4_Magnet.C::Magnet() ===========================" << endl; - cout << " MAGNET Material Description:" << endl; - cout << " inner radius = " << magnet_inner_cryostat_wall_radius << " cm" << endl; - cout << " outer radius = " << magnet_outer_cryostat_wall_radius + magnet_outer_cryostat_wall_thickness << " cm" << endl; - cout << " length = " << magnet_length << " cm" << endl; - cout << "===========================================================================" << endl; - } - - radius += no_overlapp; - - return radius; -} diff --git a/macros/g4simulations/G4_PSTOF.C b/macros/g4simulations/G4_PSTOF.C deleted file mode 100644 index d7f9acd06..000000000 --- a/macros/g4simulations/G4_PSTOF.C +++ /dev/null @@ -1,27 +0,0 @@ -// $Id$ - -/*! - * \file ${file_name} - * \brief Macro setting up the barrel mRPC psTOF - * \author Mickey Chiu - * \version $Revision$ - * \date $Date$ - */ - -void PSTOFInit() -{} - -double PSTOF(PHG4Reco* g4Reco, double radius, const int absorberactive = 0) -{ - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - - PHG4PSTOFSubsystem *pstof = new PHG4PSTOFSubsystem( "PSTOF" ); - pstof->SuperDetector("PSTOF"); -// pstof->SetActive(-1,1); // set all modules active - g4Reco->registerSubsystem( pstof ); - -// returns the outer radius to check for overlaps with next detector - return 90.; -} diff --git a/macros/g4simulations/G4_Pipe.C b/macros/g4simulations/G4_Pipe.C deleted file mode 100644 index 195902057..000000000 --- a/macros/g4simulations/G4_Pipe.C +++ /dev/null @@ -1,108 +0,0 @@ - -void PipeInit() {} - -double Pipe(PHG4Reco* g4Reco, - double radius, - const int absorberactive = 0, - int verbosity = 0) { - - double be_pipe_radius = 2.0005; // 4.001 cm inner diameter from spec sheet - double be_pipe_thickness = 0.0760; // 760 um based on spec sheet - double be_pipe_length = 80.0; // +/- 40 cm - - double al_pipe_radius = 2.0005; // same as Be pipe - double al_pipe_thickness = 0.1600; // 1.6 mm based on spec - double al_pipe_length = 88.3; // extension beyond +/- 40 cm - - if (radius > be_pipe_radius) { - cout << "inconsistency: radius: " << radius - << " larger than pipe inner radius: " << be_pipe_radius << endl; - gSystem->Exit(-1); - } - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - // mid-rapidity beryillium pipe - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("VAC_BE_PIPE", 0); - cyl->set_double_param("radius",0.0); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",be_pipe_length); - cyl->set_string_param("material","G4_Galactic"); - cyl->set_double_param("thickness",be_pipe_radius); - cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); - cyl->set_double_param("radius",be_pipe_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",be_pipe_length); - cyl->set_string_param("material","G4_Be"); - cyl->set_double_param("thickness",be_pipe_thickness); - cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - // north aluminum pipe - cyl = new PHG4CylinderSubsystem("VAC_N_AL_PIPE", 2); - cyl->set_double_param("place_z",0.5*be_pipe_length+0.5*al_pipe_length+no_overlapp); - cyl->set_double_param("radius",0.0); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",al_pipe_length); - cyl->set_string_param("material","G4_Galactic"); - cyl->set_double_param("thickness",al_pipe_radius); - cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - cyl = new PHG4CylinderSubsystem("N_AL_PIPE", 3); - cyl->set_double_param("place_z",0.5*be_pipe_length+0.5*al_pipe_length+no_overlapp); - cyl->set_double_param("radius",al_pipe_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",al_pipe_length); - cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",al_pipe_thickness); - cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - // south aluminum pipe - cyl = new PHG4CylinderSubsystem("VAC_S_AL_PIPE", 4); - cyl->set_double_param("place_z",-0.5*be_pipe_length-0.5*al_pipe_length-no_overlapp); - cyl->set_double_param("radius",0.0); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",al_pipe_length); - cyl->set_string_param("material","G4_Galactic"); - cyl->set_double_param("thickness",al_pipe_radius); - cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - cyl = new PHG4CylinderSubsystem("S_AL_PIPE", 5); - cyl->set_double_param("place_z",-0.5*be_pipe_length-0.5*al_pipe_length-no_overlapp); - cyl->set_double_param("radius",al_pipe_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",al_pipe_length); - cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",al_pipe_thickness); - cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - radius = be_pipe_radius + be_pipe_thickness; - - if (verbosity > 0) { - cout << "=========================== G4_Pipe.C::Pipe() =============================" << endl; - cout << " PIPE Material Description:" << endl; - cout << " inner radius = " << be_pipe_radius << " cm" << endl; - cout << " thickness = " << be_pipe_thickness << " cm" << endl; - cout << " outer radius = " << be_pipe_radius + be_pipe_thickness << " cm" << endl; - cout << " length = " << be_pipe_length << " cm" << endl; - cout << "===========================================================================" << endl; - } - - radius += no_overlapp; - - return radius; -} diff --git a/macros/g4simulations/G4_RICH.C b/macros/g4simulations/G4_RICH.C deleted file mode 100644 index 87da615a1..000000000 --- a/macros/g4simulations/G4_RICH.C +++ /dev/null @@ -1,51 +0,0 @@ -// $Id: G4_RICH.C,v 1.2 2013/10/09 01:08:17 jinhuang Exp $ - -/*! - * \file G4_RICH.C - * \brief Setup the gas RICH detector as designed in ePHENIX LOI - * \author Jin Huang - * \version $Revision: 1.2 $ - * \date $Date: 2013/10/09 01:08:17 $ - */ - -using namespace std; - -// global macro parameters - -void -RICHInit() -{ -} - -//! ePHENIX Gas RICH. Ref to Geometry parameter defined in ePHENIXRICH::RICH_Geometry -//! \param[in] N_RICH_Sector number of RICH sectors -//! \param[in] min_eta minimal eta coverage -//! \param[in] R_mirror_ref Radius for the reflection layer of the mirror -void -RICHSetup(PHG4Reco* g4Reco, // - const int N_RICH_Sector = 8, // - const double min_eta = 1.45, // - const double R_mirror_ref = 195, //cm - const double z_shift = 75, // cm - const double R_shift = 18.5 // cm - ) -{ - - /* Use dedicated RICH subsystem */ - PHG4RICHSubsystem *rich = new PHG4RICHSubsystem("RICH"); - rich->get_RICH_geometry().set_N_RICH_Sector(N_RICH_Sector); - rich->get_RICH_geometry().set_min_eta(min_eta); - - // rich->get_RICH_geometry().set_R_shift(10 * ePHENIXRICH::RICH_Geometry::Unit_cm()); // For compact RICH of 2get_RICH_geometry().set_R_mirror_ref(R_mirror_ref * ePHENIXRICH::RICH_Geometry::Unit_cm()); - - rich->get_RICH_geometry().set_z_shift(z_shift * ePHENIXRICH::RICH_Geometry::Unit_cm()); - rich->get_RICH_geometry().set_R_shift(R_shift * ePHENIXRICH::RICH_Geometry::Unit_cm()); - - /* Register RICH module */ - rich->OverlapCheck( overlapcheck ); - - g4Reco->registerSubsystem( rich ); - -} diff --git a/macros/g4simulations/G4_Svtx.C b/macros/g4simulations/G4_Svtx.C deleted file mode 100644 index 5aaa8381b..000000000 --- a/macros/g4simulations/G4_Svtx.C +++ /dev/null @@ -1,350 +0,0 @@ -// reference SVTX macro used for MIE projections - -int Min_si_layer = 0; -int Max_si_layer = 6; - -void SvtxInit(int verbosity = 0) -{ - Min_si_layer = 0; - Max_si_layer = 6; -} - -double Svtx(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) { - - float svtx_inner_radius = 2.71; - - if (radius > svtx_inner_radius) { - cout << "inconsistency: radius: " << radius - << " larger than SVTX inner radius: " << svtx_inner_radius << endl; - gSystem->Exit(-1); - } - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - PHG4CylinderSubsystem *cyl; - - //====================================================================================================== - // The thicknesses from Yasuyuki on June 12, 2014 are as follows: - // For Si 1mm = 1.07% X_0 - // For Cu 1mm = 6.96% X_0 - // The thickness of the tracking layers is: - // Pixels: 1.3% X_0 (0.21% sensor + 1.07% support) sensor = 200 mc Si, support = 154 mc Cu - // Stripixel: 5% X_0 (0.67% sensor + 4.3% support) sensor = 624 mc Si, support = 618 mc Cu - // Outer strips: 2% X_0 (conservative) (0.34% sensor + 1.66% support) sensor = 320 mc Si, support = 238 mc Cu - //======================================================================================================= - - double si_thickness[7] = {0.02, 0.02, 0.032, 0.032, 0.032, 0.032, 0.032}; - double svxrad[7] = {svtx_inner_radius, 4.63, 9.5, 10.5, 44.5, 45.5, 80.0}; // provides 98 MeV Upsilon resolution - // Thicknesses (in % X_0) of 1.3,1.3,2.7/2,2.7/2,2.0/2,2.0/2,2.0 - YA's most conservative case - double support_thickness[7] = {0.0154, 0.0154, 0.0338/2.0, 0.0338/2.0, 0.0238/2.0, 0.0238/2.0, 0.0238}; - double length[7] = {20., 20., -1, -1., - 1., - 1., -1}; // -1 use eta coverage to determine length - - // here is our silicon: - double inner_radius = radius; - for (int ilayer = Min_si_layer; ilayer <= Max_si_layer; ilayer++) - { - cyl = new PHG4CylinderSubsystem("SVTX", ilayer); - radius = svxrad[ilayer]; - // protect against installing layer with radius < inner radius from argument - if (radius < inner_radius) - { - cout << "current radius " << radius << " smaller than inner radius " - << inner_radius << endl; - gSystem->Exit(-1); - } - cyl->set_double_param("radius",radius); - if (length[ilayer] > 0) - { - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",length[ilayer]); - } - else - { - cyl->set_int_param("lengthviarapidity",1); - } - cyl->set_string_param("material","G4_Si"); - cyl->set_double_param("thickness",si_thickness[ilayer]); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - - radius += si_thickness[ilayer] + no_overlapp; - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", ilayer); - cyl->set_double_param("radius",radius); - if (length[ilayer] > 0) - { - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",length[ilayer]); - } - else - { - cyl->set_int_param("lengthviarapidity",1); - } - cyl->set_string_param("material","G4_Cu"); - cyl->set_double_param("thickness",support_thickness[ilayer]); - if (absorberactive) cyl->SetActive(); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - } - if (ilayer != (Max_si_layer+1)) // coming out of the loop, layer is layer+1 - { - cout << "layer number mismatch for Max_si_layer, Max_si_layer " - << Max_si_layer << " should be " << ilayer << endl; - gSystem->Exit(-1); - } - radius += support_thickness[Max_si_layer] + no_overlapp; - - if (verbosity > 0) { - cout << "============================ G4_Svtx.C::Svtx() ============================" << endl; - cout << " SVTX Material Description:" << endl; - for (int ilayer = Min_si_layer; ilayer <= Max_si_layer; ilayer++) { - cout << " layer " << ilayer - << " radius " << svxrad[ilayer] - << " zlength " << length[ilayer] - << " thickness (Si) " << si_thickness[ilayer] - << " support thickness (Cu) " << support_thickness[ilayer] - << endl; - } - cout << "===========================================================================" << endl; - } - return radius; -} - -void Svtx_Cells(int verbosity = 0) -{ - // runs the cellularization of the energy deposits (g4hits) - // into detector hits (g4cells) - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //----------- - // SVTX cells - //----------- - - // The pattern recognition layers (4 & 6) are set at 2 mm in Z and 240 microns - // pitch to make the area the same as the long strips - // Layers 3, 5 and 7 are long strips parallel to the beam line - - // 60 micron X strips, 240 micron pattern reco strips - double svxcellsizex[7] = {0.0050, 0.0050, 0.0060, 0.0240, 0.0060, 0.0240, 0.0060}; - - // 8 mm tracking strips, 2 mm pattern reco strips - double svxcellsizey[7] = {0.0425, 0.0425, 0.8000, 0.2000, 0.8000, 0.2000, 0.8000}; - - PHG4CylinderCellReco *svtx_cells = new PHG4CylinderCellReco(); - svtx_cells->Detector("SVTX"); - svtx_cells->Verbosity(verbosity); - int idx = 0; - for (int i = Min_si_layer; i <= Max_si_layer; ++i) { - svtx_cells->cellsize(i, svxcellsizex[idx], svxcellsizey[idx]); - ++idx; - } - se->registerSubsystem(svtx_cells); - - return; -} - -void Svtx_Reco(int verbosity = 0) -{ - // reconstructs the MIE Svtx v2 detector (7 layers) - - // requires Svtx setup and Svtx cell routines - // prefers calorimeter reconstruction prior (once projections are working) - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4hough.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //---------------------------------- - // Digitize the cell energy into ADC - //---------------------------------- - // defaults to 8-bit ADC with MIP at 0.25% dynamic range - PHG4SvtxDigitizer* digi = new PHG4SvtxDigitizer(); - digi->Verbosity(verbosity); - digi->set_adc_scale(0, 255, 1.0e-6); // 1.0 keV / bit - digi->set_adc_scale(1, 255, 1.0e-6); // 1.0 keV / bit - digi->set_adc_scale(2, 255, 1.6e-6); // 1.6 keV / bit - digi->set_adc_scale(3, 255, 1.6e-6); // 1.6 keV / bit - digi->set_adc_scale(4, 255, 1.6e-6); // 1.6 keV / bit - digi->set_adc_scale(5, 255, 1.6e-6); // 1.6 keV / bit - digi->set_adc_scale(6, 255, 1.6e-6); // 1.6 keV / bit - se->registerSubsystem( digi ); - - //------------------------------------- - // Apply Live Area Inefficiency to Hits - //------------------------------------- - // defaults to 1.0 (fully active) - PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); - deadarea->Verbosity(verbosity); - // deadarea->set_hit_efficiency(0,0.90); - // deadarea->set_hit_efficiency(1,0.90); - // deadarea->set_hit_efficiency(2,0.98); - // deadarea->set_hit_efficiency(3,0.98); - // deadarea->set_hit_efficiency(4,0.98); - // deadarea->set_hit_efficiency(5,0.98); - // deadarea->set_hit_efficiency(6,0.98); - se->registerSubsystem( deadarea ); - - //----------------------------- - // Apply MIP thresholds to Hits - //----------------------------- - PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); - thresholds->Verbosity(verbosity); - thresholds->set_threshold(0,0.33); - thresholds->set_threshold(1,0.33); - thresholds->set_threshold(2,0.33); - thresholds->set_threshold(3,0.33); - thresholds->set_threshold(4,0.33); - thresholds->set_threshold(5,0.33); - thresholds->set_threshold(6,0.33); - thresholds->set_use_thickness_mip(0, true); - se->registerSubsystem( thresholds ); - - //------------- - // Cluster Hits - //------------- - // needs to have clusters hold hit ids not cell ids - // will require changes to evaluation - PHG4SvtxClusterizer* clusterizer = new PHG4SvtxClusterizer(); - clusterizer->Verbosity(verbosity); - clusterizer->set_threshold(0.33); - clusterizer->set_z_clustering(2, false); - clusterizer->set_z_clustering(3, false); - clusterizer->set_z_clustering(4, false); - clusterizer->set_z_clustering(5, false); - clusterizer->set_z_clustering(6, false); - // clusterizer->set_energy_weighting(2, true); - // clusterizer->set_energy_weighting(3, true); - // clusterizer->set_energy_weighting(4, true); - // clusterizer->set_energy_weighting(5, true); - // clusterizer->set_energy_weighting(6, true); - se->registerSubsystem( clusterizer ); - - //--------------------- - // Track reconstruction - //--------------------- - PHG4HoughTransform* hough = new PHG4HoughTransform(7,7); - hough->Verbosity(verbosity); - hough->set_mag_field(1.4); - hough->set_material(0, 0.013); - hough->set_material(1, 0.013); - hough->set_material(2, 0.013); - hough->set_material(3, 0.013); - hough->set_material(4, 0.010); - hough->set_material(5, 0.010); - hough->set_material(6, 0.020); - hough->setPtRescaleFactor(0.9972); - hough->set_chi2_cut_init(3.0); - hough->set_chi2_cut_full(3.0); - hough->set_ca_chi2_cut(3.0); - hough->setCutOnDCA(true); - hough->setDCACut(0.1); - hough->setDCAZCut(0.1); - hough->setRejectGhosts(false); - hough->setRemoveHits(false); - se->registerSubsystem( hough ); - - //--------------------- - // Ghost rejection - //--------------------- - // needs updates to merge split tracks when possible - PHG4TrackGhostRejection* rejection = new PHG4TrackGhostRejection(7); - rejection->Verbosity(verbosity); - rejection->set_max_shared_hits(3); - se->registerSubsystem( rejection ); - - //------------------------ - // Final Track Refitting - //------------------------ - // PHG4TrackKalmanFitter *kalman = new PHG4TrackKalmanFitter - // we need a module to redo the Kalman fit with G4 material and real mag field - // to update the track container - - //------------------------ - // Primary Track Refitting - //------------------------ - // PHG4TrackKalmanFitter *kalman = new PHG4TrackKalmanFitter - // we need a module to redo the Kalman fit including the vertex position - // and create a separate stream of output tracks - - //------------------ - // Track Projections - //------------------ - PHG4SvtxTrackProjection* projection = new PHG4SvtxTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem( projection ); - - //---------------------- - // Beam Spot Calculation - //---------------------- - PHG4SvtxBeamSpotReco* beamspot = new PHG4SvtxBeamSpotReco(); - beamspot->Verbosity(verbosity); - se->registerSubsystem( beamspot ); - - return; -} - -void G4_Svtx_Reco() -{ - cout << "\033[31;1m" - << "Warning: G4_Svtx_Reco() was moved to G4_Svtx.C and renamed to Svtx_Reco(), please update macros" - << "\033[0m" << endl; - Svtx_Reco(); - - return; -} - -void Svtx_Eval(std::string outputfile, int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4hough.so"); - gSystem->Load("libg4eval.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //---------------- - // SVTX evaluation - //---------------- - - SubsysReco* eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem( eval ); - - return; -} diff --git a/macros/g4simulations/G4_Svtx_MAPScyl_ITTcyl_TPC.C b/macros/g4simulations/G4_Svtx_MAPScyl_ITTcyl_TPC.C deleted file mode 100644 index 0942d8e4c..000000000 --- a/macros/g4simulations/G4_Svtx_MAPScyl_ITTcyl_TPC.C +++ /dev/null @@ -1,339 +0,0 @@ -#include "G4_TPC.C" - -const int n_ib_layer = 3; // number of maps inner barrel layers -const int n_intt_layer = 4; // number of int. tracker layers. Make this number 0 to use MAPS + TPC only. -const int n_gas_layer = 40; // number of TPC layers - -int Min_si_layer = 0; -int Max_si_layer = n_ib_layer + n_intt_layer + n_gas_layer; - -void SvtxInit(int verbosity = 0) -{ - Min_si_layer = 0; - Max_si_layer = n_ib_layer + n_intt_layer + n_gas_layer; -} - -double Svtx(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) { - - float svtx_inner_radius = 2.3; - - if (radius > svtx_inner_radius) { - cout << "inconsistency: radius: " << radius - << " larger than SVTX inner radius: " << svtx_inner_radius << endl; - gSystem->Exit(-1); - } - - PHG4CylinderSubsystem *cyl; - - // silicon layers ------------------------------------------------------------ - - // inner barrel - - double ib_si_thickness[3] = {0.0050, 0.0050, 0.0050}; - double ib_rad[3] = {svtx_inner_radius, 3.2, 3.9}; - double ib_support_thickness[3] = {0.0036, 0.0036, 0.0036}; - double ib_length[3] = {27.0, 27.0, 27.0}; - - for (int ilayer=0;ilayerVerbosity(verbosity); - radius = ib_rad[ilayer]; - cyl->set_double_param("radius",radius); - //cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",ib_length[ilayer]); - cyl->set_string_param("material","G4_Si"); - cyl->set_double_param("thickness",ib_si_thickness[ilayer]); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - - radius += ib_si_thickness[ilayer] + no_overlapp; - - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", ilayer); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - //cyl->set_int_param("lengthviarapidity",1); - cyl->set_double_param("length",ib_length[ilayer]); - cyl->set_string_param("material","G4_Cu"); - cyl->set_double_param("thickness",ib_support_thickness[ilayer]); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - cout << "Added inner barrel layer with radius " << ib_rad[ilayer] - << " si thickness " << ib_si_thickness[ilayer] - << " support thickness " << ib_support_thickness[ilayer] - << " length " << ib_length[ilayer] - << endl; - } - - // intermediate tracker - // parameters from RIKEN - double intt_si_thickness[4] = {0.0120, 0.0120, 0.0120,0.0120}; - double intt_rad[4] = { 6.0, 8.0, 10.0, 12.0}; - // 120 microns of silicon is 0.13% of X_0, so to get 1% total we need 0.87% more in the Cu - double multiplier = 0.87; // how many times 1% do you want? - double apercent = 0.0144; // Cu thickness in cm corresponding to 1% X_0 - double intt_support_thickness[4] = {apercent*multiplier, apercent*multiplier, apercent*multiplier, apercent*multiplier}; - double intt_length[4] = {50.0, 50.0, 50.0, 50.0}; - - for (int ilayer=n_ib_layer;ilayerVerbosity(verbosity); - radius = intt_rad[ilayer-n_ib_layer]; - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",1); - //cyl->set_double_param("length",intt_length[ilayer-n_ib_layer]); - cyl->set_string_param("material","G4_Si"); - cyl->set_double_param("thickness",intt_si_thickness[ilayer-n_ib_layer]); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - - radius += intt_si_thickness[ilayer-n_ib_layer] + no_overlapp; - - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", ilayer); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",1); - //cyl->set_double_param("length", intt_length[ilayer-n_ib_layer]); - cyl->set_string_param("material","G4_Cu"); - cyl->set_double_param("thickness",intt_support_thickness[ilayer-n_ib_layer]); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - cout << "Added intermediate tracker layer with radius " << intt_rad[ilayer-n_ib_layer] - << " si thickness " << intt_si_thickness[ilayer-n_ib_layer] - << " support thickness " << intt_support_thickness[ilayer-n_ib_layer] - << " length " << intt_length[ilayer-n_ib_layer] - << endl; - } - - //TPC - radius = AddTPC2G4Geo(g4Reco,radius,0); - - return radius; -} - -void Svtx_Cells(int verbosity = 0) -{ - // runs the cellularization of the energy deposits (g4hits) - // into detector hits (g4cells) - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //----------- - // cells - //----------- - - // inner barrel - double svxcellsizex[3] = {0.0020, 0.0020, 0.0020}; - double svxcellsizey[3] = {0.0020, 0.0020, 0.0020}; - - // intermediate tracker - double intt_cellsizex[4] = { 0.0080, 0.0080, 0.0080, 0.0080}; // cm - double intt_cellsizey[4] = { 1.2, 1.2, 1.2, 1.2}; // cm - - PHG4CylinderCellTPCReco *svtx_cells = new PHG4CylinderCellTPCReco(n_ib_layer+n_intt_layer); - svtx_cells->Verbosity(1); - svtx_cells->Detector("SVTX"); - - for (int i=0;icellsize(i, svxcellsizex[i], svxcellsizey[i]); - svtx_cells->set_timing_window(i, -2000.0, +2000.0); - } - for (int i=n_ib_layer;icellsize(i, intt_cellsizex[i-n_ib_layer], intt_cellsizey[i-n_ib_layer]); - svtx_cells->set_timing_window(i, -50.0, +50.0); - } - - // TPC - AddTPC2CellReco(svtx_cells); - - se->registerSubsystem(svtx_cells); - return; -} - -void Svtx_Reco(int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4hough.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //---------------------------------- - // Digitize the cell energy into ADC - //---------------------------------- - PHG4SvtxDigitizer* digi = new PHG4SvtxDigitizer(); - digi->Verbosity(0); - for (int i=0;iset_adc_scale(i, 255, 1.0e-6); - } - se->registerSubsystem( digi ); - - //------------------------------------- - // Apply Live Area Inefficiency to Hits - //------------------------------------- - // defaults to 1.0 (fully active) - - PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); - deadarea->Verbosity(verbosity); - for(int i=0;iset_hit_efficiency(i,0.99); - - for(int i=n_ib_layer;iset_hit_efficiency(i-n_ib_layer,0.99); - - se->registerSubsystem( deadarea ); - - //----------------------------- - // Apply MIP thresholds to Hits - //----------------------------- - - PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); - thresholds->Verbosity(verbosity); - for(int i=0;iset_threshold(i,0.25); // reduce to 0.1 for increased efficiency - - for(int i=n_ib_layer;iset_threshold(i,0.25); - - se->registerSubsystem( thresholds ); - - //------------- - // Cluster Hits - //------------- - - PHG4SvtxClusterizer* clusterizer = new PHG4SvtxClusterizer("PHG4SvtxClusterizer",Min_si_layer,n_ib_layer+n_intt_layer-1); - clusterizer->set_threshold(0.25); // reduced from 0.5, should be same as cell threshold, since many hits are single cell - se->registerSubsystem( clusterizer ); - - //--------------------- - // Track reconstruction - //--------------------- - PHG4HoughTransformTPC* hough = new PHG4HoughTransformTPC(Max_si_layer,Max_si_layer-30); - hough->set_mag_field(1.4); - hough->setPtRescaleFactor(1.00/0.993892); - hough->set_use_vertex(true); - hough->setRemoveHits(true); - hough->setRejectGhosts(true); - hough->set_min_pT(0.2); - hough->set_chi2_cut_full( 2.0 ); - hough->set_chi2_cut_init( 2.0 ); - - hough->setBinScale(1.0); - hough->setZBinScale(1.0); - - hough->Verbosity(verbosity); - - double mat_scale = 1.0; - // maps inner barrel, total of 0.3% of X_0 per layer - for(int i=0;iset_material(i, mat_scale*0.003); - // intermediate tracker, total 1% of X_0 pair layer - for(int i=n_ib_layer;iset_material(i-n_ib_layer, mat_scale*0.010); - - // silicon - for (int i=0;isetVoteErrorScale(i, 1.0); - } - for (int i=0;isetFitErrorScale(i, 1./sqrt(12.)); - } - - //TPC - AddTPC2Reco(digi,hough); - - se->registerSubsystem( hough ); - - //----------------------- - // Momentum Recalibration - //----------------------- - TF1 *corr = new TF1("corr","1.0/(1+0.00908642+5.91337e-05*x+-1.87201e-05*x*x+-3.31928e-06*x*x*x+1.03004e-07*x*x*x*x+-1.05111e-09*x*x*x*x*x)",0.0,40.0); - PHG4SvtxMomentumRecal* recal = new PHG4SvtxMomentumRecal("PHG4SvtxMomentumRecal",corr); - se->registerSubsystem(recal); - - //------------------ - // Track Projections - //------------------ - PHG4SvtxTrackProjection* projection = new PHG4SvtxTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem( projection ); - - //---------------------- - // Beam Spot Calculation - //---------------------- - PHG4SvtxBeamSpotReco* beamspot = new PHG4SvtxBeamSpotReco(); - beamspot->Verbosity(verbosity); - se->registerSubsystem( beamspot ); - - return; -} - -void G4_Svtx_Reco() -{ - cout << "\033[31;1m" - << "Warning: G4_Svtx_Reco() was moved to G4_Svtx.C and renamed to Svtx_Reco(), please update macros" - << "\033[0m" << endl; - Svtx_Reco(); - - return; -} - -void Svtx_Eval(std::string outputfile, int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4hough.so"); - gSystem->Load("libg4eval.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //---------------- - // SVTX evaluation - //---------------- - - SvtxEvaluator* eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); - eval->do_cluster_eval(true); // make cluster ntuple - eval->do_g4hit_eval(false); // make g4hit ntuple - eval->do_hit_eval(false); // make hit ntuple - eval->do_gpoint_eval(false); - //eval->scan_for_embedded(true); // evaluator will only collect embedded tracks - it will also ignore decay tracks from embedded particles! - eval->scan_for_embedded(false); // evaluator takes all tracks - eval->Verbosity(verbosity); - se->registerSubsystem( eval ); - - // MomentumEvaluator* eval = new MomentumEvaluator(outputfile.c_str(),0.2,0.4,Max_si_layer,2,Max_si_layer-4,10.,80.); - // se->registerSubsystem( eval ); - - return; -} diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C deleted file mode 100644 index 527ec13d6..000000000 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ /dev/null @@ -1,567 +0,0 @@ -#include - -// if true, refit tracks with primary vertex included in track fit - good for analysis of prompt tracks only -// Adds second node to node tree, keeps original track node undisturbed -// Adds second evaluator to process refitted tracks and outputs separate ntuples -bool use_primary_vertex = false; - -const int n_maps_layer = 3; // must be 0-3, setting it to zero removes MVTX completely, n < 3 gives the first n layers -const int n_intt_layer = 4; // must be 0-4, setting this to zero will remove the INTT completely, n < 4 gives you the first n layers -int n_gas_layer = 40; - -double inner_cage_radius = 20.; - -// TPC readout shaping time and ADC clock parameters -//======================================= - -double TPCDriftVelocity = 3.0 / 1000.0; // cm/ns -double TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA -double TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA -double TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz - -double tpc_cell_x = 0.15; // bin size for pads in rphi -double tpc_cell_y = TPCADCClock * TPCDriftVelocity; // cm - -int Max_si_layer; - -void SvtxInit(int n_TPC_layers = 40, int verbosity = 0) -{ - n_gas_layer = n_TPC_layers; - Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; -} - -double Svtx(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) { - - if(n_maps_layer > 0) - { - bool maps_overlapcheck = false; // set to true if you want to check for overlaps - - /* - The numbers used in the macro below are from the xml file dump of ITS.gdml - As a sanity check, I got numbers from Walt Sondheim's drawings, sent by email June 20, 2017: - OD of Be beam pipe is 41.53 mm, ID is 40 mm - Layer 0: radius 23.44 mm to sensor center, tilt from normal to radial vector: 17.37 degrees (0.303 rad), spacing btw sensor centers: 30 deg, arc spacing 12.27 mm - Layer 1: radius 31.54 mm to sensor center, ttilt from normal to radial vector: 17.53 degrees (0.306 rad), spacing btw sensor centers: 22.5 deg, arc spacing 12.38 mm - Layer 2: radius 39.29 to sensor center, tilt from normal to radial vector: 17.02 degrees (0.297 rad), spacing btw sensor centers: 18.0 deg, arc spacing 12.34 mm - These are in reasonable agreement with the numbers I extracted from the gdml file, which are what we use below. - These use a spacing in arc length of 12.37 mm and a tilt of 0.304 for all of the first three layers - */ - - // MAPS inner barrel layers - //====================================================== - - double maps_layer_radius[3] = {23.4, 31.5, 39.3}; // mm - precise numbers from ITS.gdml - //double maps_layer_radius[3] = {24.9, 33.0, 40.8}; // mm - precise numbers from ITS.gdml + 1.5 mm for greater clearance from beam pipe - - // type 1 = inner barrel stave, 2 = middle barrel stave, 3 = outer barrel stave - // we use only type 0 here - int stave_type[3] = {0, 0, 0}; - int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX - double phi_tilt[3] = {0.304, 0.304, 0.304}; // radians, from the gdml file, 0.304 radians is 17.4 degrees - - for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) - { - if (verbosity) - cout << "Create Maps layer " << ilayer << " with radius " << maps_layer_radius[ilayer] << " mm, stave type " << stave_type[ilayer] - << " pixel size 30 x 30 microns " << " active pixel thickness 0.0018 microns" << endl; - - PHG4MapsSubsystem *lyr = new PHG4MapsSubsystem("MAPS", ilayer, stave_type[ilayer]); - lyr->Verbosity(verbosity); - - lyr->set_double_param("layer_nominal_radius",maps_layer_radius[ilayer]);// thickness in cm - lyr->set_int_param("N_staves", staves_in_layer[ilayer]); // uses fixed number of staves regardless of radius, if set. Otherwise, calculates optimum number of staves - - // The cell size is used only during pixilization of sensor hits, but it is convemient to set it now because the geometry object needs it - lyr->set_double_param("pixel_x",0.0030);// pitch in cm - lyr->set_double_param("pixel_z",0.0030);// length in cm - lyr->set_double_param("pixel_thickness",0.0018);// thickness in cm - lyr->set_double_param("phitilt", phi_tilt[ilayer]); - - lyr->set_int_param("active",1); - lyr->OverlapCheck(maps_overlapcheck); - - lyr->set_string_param("stave_geometry_file", - string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/ALICE_ITS_tgeo.gdml")); - - g4Reco->registerSubsystem( lyr ); - - radius = maps_layer_radius[ilayer]; - } - } - - if(n_intt_layer > 0) - { - //------------------- - // INTT ladders - //------------------- - - bool intt_overlapcheck = false; // set to true if you want to check for overlaps - - // instantiate the Silicon tracker subsystem and register it - // We make one instance of PHG4TrackerSubsystem for all four layers of tracker - // dimensions are in mm, angles are in radians - - // PHG4SiliconTrackerSubsystem creates the detetor layer using PHG4SiliconTrackerDetector - // and instantiates the appropriate PHG4SteppingAction - const double intt_radius_max = 140.; // including stagger radius (mm) - - // The length of vpair is used to determine the number of layers - std::vector> vpair; // (sphxlayer, inttlayer) - for(int i=0;iVerbosity(verbosity); - sitrack->SetActive(1); - sitrack->OverlapCheck(intt_overlapcheck); - g4Reco->registerSubsystem( sitrack); - - // outer radius marker (translation back to cm) - radius = intt_radius_max*0.1; - } - - // time projection chamber layers -------------------------------------------- - - PHG4CylinderSubsystem *cyl; - - radius = inner_cage_radius; - - double cage_length = 211.0; // From TPC group, gives eta = 1.1 at 78 cm - double n_rad_length_cage = 1.13e-02; - double cage_thickness = 28.6 * n_rad_length_cage; // Kapton X_0 = 28.6 cm // mocks up Kapton + carbon fiber structure - - // inner field cage - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",cage_length); - cyl->set_string_param("material","G4_KAPTON"); - cyl->set_double_param("thickness",cage_thickness ); - cyl->SuperDetector("SVTXSUPPORT"); - cyl->Verbosity(0); - g4Reco->registerSubsystem( cyl ); - - radius += cage_thickness; - - double inner_readout_radius = 30.; - if (inner_readout_radius 0) { - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer + 1); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",cage_length); - cyl->set_string_param("material",tpcgas.c_str()); - cyl->set_double_param("thickness", inner_readout_radius - radius); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - } - - radius = inner_readout_radius; - - double outer_radius = 78.; - int npoints = Max_si_layer - n_maps_layer - n_intt_layer; - double delta_radius = ( outer_radius - inner_readout_radius )/( (double)npoints ); - - for(int ilayer=n_maps_layer + n_intt_layer;ilayer<(n_maps_layer + n_intt_layer + npoints);++ilayer) { - - if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with radius " << radius << " cm " - << " thickness " << delta_radius - 0.01 << " length " << cage_length << endl; - - cyl = new PHG4CylinderSubsystem("SVTX", ilayer); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",cage_length); - cyl->set_string_param("material",tpcgas.c_str()); - cyl->set_double_param("thickness", delta_radius - 0.01 ); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - - radius += delta_radius; - } - - // outer field cage - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer + npoints); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",cage_length); - cyl->set_string_param("material","G4_KAPTON"); - cyl->set_double_param("thickness",cage_thickness ); // Kapton X_0 = 28.6 cm - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - radius += cage_thickness; - - return radius; -} - -void Svtx_Cells(int verbosity = 0) -{ - // runs the cellularization of the energy deposits (g4hits) - // into detector hits (g4cells) - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //----------- - // SVTX cells - //----------- - - if(n_maps_layer > 0) - { - // MAPS cells - PHG4MapsCellReco *maps_cells = new PHG4MapsCellReco("MAPS"); - maps_cells->Verbosity(verbosity); - for(int ilayer = 0;ilayer < n_maps_layer;ilayer++) - { - maps_cells->set_timing_window(ilayer,-2000,2000); - } - se->registerSubsystem(maps_cells); - } - - if(n_intt_layer > 0) - { - // INTT cells - PHG4SiliconTrackerCellReco *reco = new PHG4SiliconTrackerCellReco("SILICON_TRACKER"); - // The timing windows are hard-coded in the INTT ladder model - reco->Verbosity(verbosity); - se->registerSubsystem(reco); - } - - // TPC cell sizes are defined at top of macro, this is for backward compatibility with old hits files - if(n_gas_layer == 60) - { - TPCDriftVelocity = 6.0 / 1000.0; // cm/ns - tpc_cell_x = 0.12; - tpc_cell_y = 0.17; - } - - // Main switch for TPC distortion - const bool do_tpc_distortion = true; - PHG4TPCSpaceChargeDistortion* tpc_distortion = NULL; - if (do_tpc_distortion) { - if (inner_cage_radius != 20. && inner_cage_radius != 30.) { - cout << "Svtx_Cells - Fatal Error - TPC distortion required that " - "inner_cage_radius is either 20 or 30 cm." - << endl; - exit(3); - } - - - string TPC_distortion_file = - string(getenv("CALIBRATIONROOT")) + - Form("/Tracking/TPC/SpaceChargeDistortion/TPCCAGE_20_78_211_2.root"); - PHG4TPCSpaceChargeDistortion* tpc_distortion = - new PHG4TPCSpaceChargeDistortion(TPC_distortion_file); - //tpc_distortion -> setAccuracy(0); // option to over write default factors - //tpc_distortion -> setPrecision(0.001); // option to over write default factors // default is 0.001 - } - - PHG4CylinderCellTPCReco *svtx_cells = new PHG4CylinderCellTPCReco(n_maps_layer+n_intt_layer); - svtx_cells->Detector("SVTX"); - svtx_cells->setDistortion(tpc_distortion); - if(n_gas_layer == 40) - { - svtx_cells->setDiffusionT(0.0130); - svtx_cells->setDiffusionL(0.0130); - svtx_cells->setShapingRMSLead(TPCShapingRMSLead * TPCDriftVelocity); - svtx_cells->setShapingRMSTail(TPCShapingRMSTail * TPCDriftVelocity); - // Expected cluster resolutions: - // r-phi: diffusion + GEM smearing = 750 microns, assume resolution is 20% of that => 150 microns - // Z: amplifier shaping time (RMS 32 ns, 48 ns) and drift vel of 3 cm/microsec gives smearing of 3 x (32+48/2 = 1.2 mm, assume resolution is 20% of that => 240 microns - svtx_cells->setSmearRPhi(0.10); // additional random displacement of cloud positions wrt hits to give expected cluster resolution of 150 microns for charge at membrane - svtx_cells->setSmearZ(0.15); // additional random displacement of cloud positions wrt hits to give expected cluster rsolution of 240 microns for charge at membrane - } - else - { - // 60 layer tune - svtx_cells->setDiffusionT(0.0120); - svtx_cells->setDiffusionL(0.0120); - svtx_cells->setSmearRPhi(0.09); // additional smearing of cluster positions - svtx_cells->setSmearZ(0.06); // additional smearing of cluster positions - } - svtx_cells->set_drift_velocity(TPCDriftVelocity); - svtx_cells->setHalfLength( 105.5 ); - svtx_cells->setElectronsPerKeV(28); - svtx_cells->Verbosity(0); - - // The maps cell size is set when the detector is constructed because it is needed by the geometry object - // The INTT ladder cell size is set in the detector construction code - // set cylinder cell TPC cell sizes - for (int i=n_maps_layer + n_intt_layer;icellsize(i, tpc_cell_x, tpc_cell_y); - svtx_cells->set_timing_window(i, -14000.0, +14000.0); - } - - se->registerSubsystem(svtx_cells); - - return; -} - -void Svtx_Reco(int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4hough.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //---------------------------------- - // Digitize the cell energy into ADC - //---------------------------------- - PHG4SvtxDigitizer* digi = new PHG4SvtxDigitizer(); - digi->Verbosity(0); - for (int i=0;iset_adc_scale(i, 255, 0.4e-6); // reduced by a factor of 2.5 when going from maps thickess of 50 microns to 18 microns - } - - if(n_intt_layer > 0) - { - // INTT - std::vector userrange; // 3-bit ADC threshold relative to the mip_e at each layer. - // these should be used for the INTT - userrange.push_back(0.05); - userrange.push_back(0.10); - userrange.push_back(0.15); - userrange.push_back(0.20); - userrange.push_back(0.25); - userrange.push_back(0.30); - userrange.push_back(0.35); - userrange.push_back(0.40); - - PHG4SiliconTrackerDigitizer* digiintt = new PHG4SiliconTrackerDigitizer(); - digiintt->Verbosity(verbosity); - for(int i=0;iset_adc_scale(n_maps_layer+i, userrange); - } - se->registerSubsystem( digiintt ); - } - - // TPC layers - for (int i=n_maps_layer+n_intt_layer;iset_adc_scale(i, 30000, 1.0); - } - se->registerSubsystem( digi ); - - //------------------------------------- - // Apply Live Area Inefficiency to Hits - //------------------------------------- - // defaults to 1.0 (fully active) - - PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); - - for(int i = 0;iVerbosity(verbosity); - //deadarea->set_hit_efficiency(i,0.99); - deadarea->set_hit_efficiency(i,1.0); - } - for(int i=n_maps_layer;iset_hit_efficiency(i,0.99); - deadarea->set_hit_efficiency(i,1.0); - } - se->registerSubsystem( deadarea ); - - //----------------------------- - // Apply MIP thresholds to Hits - //----------------------------- - - PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); - thresholds->Verbosity(verbosity); - - // maps - for(int i = 0;iset_threshold(i,0.1); - } - // INTT - for(int i=n_maps_layer;iset_threshold(i,0.1); - thresholds->set_use_thickness_mip(i, true); - - } - - se->registerSubsystem( thresholds ); - - //------------- - // Cluster Hits - //------------- - - PHG4SvtxClusterizer* clusterizer = new PHG4SvtxClusterizer("PHG4SvtxClusterizer",0, n_maps_layer + n_intt_layer-1); - clusterizer->Verbosity(verbosity); - // Reduced by 2 relative to the cylinder cell maps macro. I found this necessary to get full efficiency - // Many hits in the present simulation are single cell hits, so it is not clear why the cluster threshold should be higher than the cell threshold - clusterizer->set_threshold(0.1); // fraction of a mip - // no Z clustering for INTT layers (only) - for(int i=n_maps_layer;iset_z_clustering(i, false); - } - - se->registerSubsystem( clusterizer ); - - PHG4TPCClusterizer* tpcclusterizer = new PHG4TPCClusterizer(); - tpcclusterizer->Verbosity(0); - tpcclusterizer->setRangeLayers(n_maps_layer+n_intt_layer,Max_si_layer); - if(n_gas_layer == 40) - { - tpcclusterizer->setEnergyCut(12/*15 adc*/); - tpcclusterizer->setFitWindowSigmas(0.0160,0.0160); // should be changed when TPC cluster resolution changes - tpcclusterizer->setFitWindowMax(4/*rphibins*/,6/*zbins*/); - tpcclusterizer->setFitEnergyThreshold( 0.05 /*fraction*/ ); - } - else - { - // 60 layer tune - tpcclusterizer->setEnergyCut(15/*adc*/); - tpcclusterizer->setFitWindowSigmas(0.0150,0.0160); // should be changed when TPC cluster resolution changes - tpcclusterizer->setFitWindowMax(4/*rphibins*/,3/*zbins*/); - tpcclusterizer->setFitEnergyThreshold( 0.05 /*fraction*/ ); - } - se->registerSubsystem( tpcclusterizer ); - - // This should be true for everything except testing! - const bool use_kalman_pat_rec = true; - if (use_kalman_pat_rec) { - //--------------------- - // PHG4KalmanPatRec - //--------------------- - - PHG4KalmanPatRec* kalman_pat_rec = new PHG4KalmanPatRec("PHG4KalmanPatRec", n_maps_layer, n_intt_layer, n_gas_layer); - kalman_pat_rec->Verbosity(0); - se->registerSubsystem(kalman_pat_rec); - - } else { - //--------------------- - // Truth Pattern Recognition - //--------------------- - PHG4TruthPatRec* pat_rec = new PHG4TruthPatRec(); - se->registerSubsystem(pat_rec); - - } - - //--------------------- - // Kalman Filter - //--------------------- - - PHG4TrackKalmanFitter* kalman = new PHG4TrackKalmanFitter(); - kalman->Verbosity(0); - if(use_primary_vertex) - kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true - se->registerSubsystem(kalman); - - - //------------------ - // Track Projections - //------------------ - PHG4SvtxTrackProjection* projection = new PHG4SvtxTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem( projection ); - - /* - //---------------------- - // Beam Spot Calculation - //---------------------- - PHG4SvtxBeamSpotReco* beamspot = new PHG4SvtxBeamSpotReco(); - beamspot->Verbosity(verbosity); - se->registerSubsystem( beamspot ); - */ - - return; -} - -void G4_Svtx_Reco() -{ - cout << "\033[31;1m" - << "Warning: G4_Svtx_Reco() was moved to G4_Svtx.C and renamed to Svtx_Reco(), please update macros" - << "\033[0m" << endl; - Svtx_Reco(); - - return; -} - -void Svtx_Eval(std::string outputfile, int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4hough.so"); - gSystem->Load("libg4eval.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //---------------- - // SVTX evaluation - //---------------- - - SvtxEvaluator* eval; - eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); - eval->do_cluster_eval(true); - eval->do_g4hit_eval(true); - eval->do_hit_eval(false); - eval->do_gpoint_eval(false); - eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true - eval->Verbosity(verbosity); - se->registerSubsystem( eval ); - - - if(use_primary_vertex) - { - // make a second evaluator that records tracks fitted with primary vertex included - // good for analysis of prompt tracks, particularly if MVTX is not present - SvtxEvaluator* evalp; - evalp = new SvtxEvaluator("SVTXEVALUATOR", string(outputfile.c_str()) + "_primary_eval.root", "PrimaryTrackMap"); - evalp->do_cluster_eval(true); - evalp->do_g4hit_eval(true); - evalp->do_hit_eval(false); - evalp->do_gpoint_eval(false); - evalp->scan_for_embedded(true); // take all tracks if false - take only embedded tracks if true - evalp->Verbosity(0); - se->registerSubsystem( evalp ); - } - - // MomentumEvaluator* eval = new MomentumEvaluator(outputfile.c_str(),0.2,0.4,Max_si_layer,2,Max_si_layer-4,10.,80.); - // se->registerSubsystem( eval ); - - return; -} diff --git a/macros/g4simulations/G4_TPC.C b/macros/g4simulations/G4_TPC.C deleted file mode 100644 index 352645bee..000000000 --- a/macros/g4simulations/G4_TPC.C +++ /dev/null @@ -1,247 +0,0 @@ -//Three radial modules |-||-||-| -//Sixteen layers per module -//Choosing Readable Radius => 23.1 cm to 75cm => module size is 17.3 -//OPTION 1: -//R1: 6 cards/R1 * 12 R1/end * 2 end/TPC = 144 cards/TPC -//R2: 8 cards/R2 * 12 R2/end * 2 end/TPC = 192 cards/TPC -//R3: 12 cards/R3 * 12 R3/end * 2 end/TPC = 288 cards/TPC -//TOTAL = 624 cards/TPC * 8 SAMPA/card = 4992 SAMPA/TPC * 32 channels/SAMPA = 159,744 channels/TPC - -const double TPC_CAGE_LENGTH = 211.; -const double TPC_CAGE_IR = 20.; -const double TPC_CAGE_OR = 78.; -const int TPC_MOD_NLAY = 16; -const int TPC_MOD_CH[3] = {1152,1536,2304}; -const int TPC_GAS_LAYERS = TPC_MOD_NLAY*5/2; -const int previous_active_layers = 3/*maps*/ + 4/*itt*/; -double TPC_RI[TPC_GAS_LAYERS]; - -double AddTPC2G4Geo(PHG4Reco* g4Reco, double radius, int verbosity) { - cout << "TPC::AddTPC2G4Geo called" << endl; - if(radius > TPC_CAGE_IR) { - cout << "ConstructDetector_TPC: No space for TPC" << endl; - exit(0); - } - - int previous_support_layers = 3/*maps*/ + 4/*itt*/; - - PHG4CylinderSubsystem *cyl; - - radius = TPC_CAGE_IR; - - double n_rad_length_cage = 1.0e-02; - double cage_thickness = 1.436 * n_rad_length_cage; - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", previous_support_layers++ ); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material","G4_Cu"); - cyl->set_double_param("thickness",cage_thickness ); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - radius += cage_thickness; - - TString tpcgas = "G4_Ar"; - double st_mod = 23.1; - const double TPC_MOD_DR = 17.3; - const double TPC_MOD_WL = 0.3; - const double lay_dr = (TPC_MOD_DR - TPC_MOD_WL*2)/double(TPC_MOD_NLAY); - - //=== GAS UNTIL FIRST READOUT - double delta = TPC_MOD_DR/2 + st_mod - radius; - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", previous_support_layers++); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material",tpcgas.Data()); - cyl->set_double_param("thickness", delta); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - radius += delta; - - //=== ACTIVE FIRST HALF MODULE - delta = lay_dr; - for(int ilayer=0; ilayerVerbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material",tpcgas.Data()); - cyl->set_double_param("thickness", delta-0.0038 ); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - radius += delta; - } - - //=== GAS UNTIL SECOND READOUT - double delta = 0.6; - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", previous_support_layers++); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material",tpcgas.Data()); - cyl->set_double_param("thickness", delta); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - radius += delta; - - //=== ACTIVE SECOND MODULE - delta = lay_dr; - for(int ilayer=TPC_MOD_NLAY/2; ilayerVerbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material",tpcgas.Data()); - cyl->set_double_param("thickness", delta-0.0038 ); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - radius += delta; - } - - //=== GAS UNTIL THIRD READOUT - double delta = 0.6; - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", previous_support_layers++); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material",tpcgas.Data()); - cyl->set_double_param("thickness", delta); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - radius += delta; - - //=== ACTIVE THIRD MODULE - delta = lay_dr; - for(int ilayer=TPC_MOD_NLAY*3/2; ilayerVerbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material",tpcgas.Data()); - cyl->set_double_param("thickness", delta-0.0038 ); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - radius += delta; - } - - //=== GAS UNTIL OUTER CAGE - delta = TPC_CAGE_OR-cage_thickness - radius; - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", previous_support_layers++); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material",tpcgas.Data()); - cyl->set_double_param("thickness",delta); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - radius = TPC_CAGE_OR-cage_thickness; - - //=== OUTER CAGE - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", previous_support_layers++); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material","G4_Cu"); - cyl->set_double_param("thickness",cage_thickness ); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - radius = TPC_CAGE_OR; - - return radius; -} - -void AddTPC2CellReco(PHG4CylinderCellTPCReco *svtx_cells, int verbosity=0) { - cout << "TPC::AddTPC2CellReco called" << endl; - const bool do_tpc_distoration = false;//true; - const double diffusion = 0.0057; - const double electrons_per_kev = 38.; - - PHG4TPCSpaceChargeDistortion* tpc_distortion = NULL; - if(do_tpc_distoration) { - if(TPC_CAGE_IR != 20. && TPC_CAGE_IR != 30.) { - cout << "Svtx_Cells - Fatal Error - TPC distoration required that " - "TPC_CAGE_IR is either 20 or 30 cm." - << endl; - exit(3); - } - string TPC_distroation_file = string(getenv("CALIBRATIONROOT")) + Form("/Tracking/TPC/SpaceChargeDistortion/sPHENIX%.0f.root",TPC_CAGE_IR); - PHG4TPCSpaceChargeDistortion* tpc_distortion = new PHG4TPCSpaceChargeDistortion(TPC_distroation_file); - // tpc_distortion -> setAccuracy(0); // option to overwrite default - // tpc_distortion -> setPrecision(1); // option to overwrite default - } - svtx_cells->setDistortion(tpc_distortion); // apply TPC distrotion if tpc_distortion is not NULL - svtx_cells->setDiffusion(diffusion); - svtx_cells->setElectronsPerKeV(electrons_per_kev); - - if(verbosity>0) { - for(int i=0; i!=TPC_GAS_LAYERS; ++i) - cout << "Added TPC layer " << i << " starting at " << TPC_RI[i] << " cm." << endl; - } - - const double tpc_dt = 0.17; - //=== FIRST MODULE - for(int i=0; icellsize(previous_active_layers+i, tpc_rdphi, tpc_dt); - svtx_cells->set_timing_window(previous_active_layers+i, -14000.0, +14000.0); - } - //=== SECOND MODULE - for(int i=TPC_MOD_NLAY/2; icellsize(previous_active_layers+i, tpc_rdphi, tpc_dt); - svtx_cells->set_timing_window(previous_active_layers+i, -14000.0, +14000.0); - } - //=== THIRD MODULE - for(int i=TPC_MOD_NLAY*3/2; icellsize(previous_active_layers+i, tpc_rdphi, tpc_dt); - svtx_cells->set_timing_window(previous_active_layers+i, -14000.0, +14000.0); - } - return; -} - -void AddTPC2Reco(PHG4SvtxDigitizer* digi, PHG4HoughTransformTPC* hough) { - cout << "TPC::AddTPC2Reco called" << endl; - Fun4AllServer *se = Fun4AllServer::instance(); - - //clusterizer - PHG4TPCClusterizer* tpcclusterizer = new PHG4TPCClusterizer("PHG4TPCClusterizer",3,4,previous_active_layers,previous_active_layers+TPC_GAS_LAYERS); - tpcclusterizer->setEnergyCut(20.0*45.0/TPC_GAS_LAYERS); - se->registerSubsystem( tpcclusterizer ); - //digitizer - for(int i=previous_active_layers;iset_adc_scale(i, 10000, 1.0); - } - //hough - hough->setUseCellSize(true); - double mat_scale = 1.0; - for(int i=previous_active_layers;iset_material(i, mat_scale*0.06/TPC_GAS_LAYERS); - hough->setFitErrorScale(i, 1./sqrt(12.)); - hough->setVoteErrorScale(i, 1.0); - } - hough->set_material(previous_active_layers, mat_scale*0.010); // TPC inner field cage wall, 1% of X_0 - return; -} diff --git a/macros/prototype2/DisplayOn.C b/macros/prototype2/DisplayOn.C deleted file mode 100644 index 4197f6143..000000000 --- a/macros/prototype2/DisplayOn.C +++ /dev/null @@ -1,34 +0,0 @@ -// stupid macro to turn on the geant4 display -// we ask Fun4All for a pointer to PHG4Reco -// using the ApplyCommand will start up the -// G4 cmd interpreter and graphics system -// the vis.mac contains the necessary commands to -// start up the visualization, the next event will -// be displayed. Do not execute this macro -// before PHG4Reco was registered with Fun4All -PHG4Reco * DisplayOn(const char *mac = "vis_prototype2.mac") -{ - char cmd[100]; - Fun4AllServer *se = Fun4AllServer::instance(); - PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); - g4->InitRun(se->topNode()); - sprintf(cmd, "/control/execute %s", mac); - g4->ApplyCommand(cmd); - return g4; -} -// print out the commands I always forget -void displaycmd() -{ - cout << "draw axis: " << endl; - cout << " g4->ApplyCommand(\"/vis/scene/add/axes 0 0 0 50 cm\")" << endl; - cout << "zoom" << endl; - cout << " g4->ApplyCommand(\"/vis/viewer/zoom 1\")" << endl; - cout << "viewpoint:" << endl; - cout << " g4->ApplyCommand(\"/vis/viewer/set/viewpointThetaPhi 0 0\")" << endl; - cout << "panTo:" << endl; - cout << " g4->ApplyCommand(\"/vis/viewer/panTo 0 0 cm\")" << endl; - cout << "print to eps:" << endl; - cout << " g4->ApplyCommand(\"/vis/ogl/printEPS\")" << endl; - cout << "set background color:" << endl; - cout << " g4->ApplyCommand(\"/vis/viewer/set/background white\")" << endl; -} diff --git a/macros/prototype2/Fun4All_G4_Prototype2.C b/macros/prototype2/Fun4All_G4_Prototype2.C deleted file mode 100644 index d2217c76d..000000000 --- a/macros/prototype2/Fun4All_G4_Prototype2.C +++ /dev/null @@ -1,529 +0,0 @@ -int Fun4All_G4_Prototype2(int nEvents = 1) -{ - - gSystem->Load("libfun4all"); - gSystem->Load("libg4detectors"); - gSystem->Load("libg4testbench"); - gSystem->Load("libg4histos"); - gSystem->Load("libg4eval.so"); - gSystem->Load("libqa_modules"); - - bool cemc_on = true; - bool cemc_cell = cemc_on && true; - bool cemc_twr = cemc_cell && true; - bool cemc_digi = cemc_twr && true; - bool cemc_twrcal = cemc_digi && true; - - bool ihcal_on = true; - bool ihcal_cell = ihcal_on && true; - bool ihcal_twr = ihcal_cell && true; - bool ihcal_digi = ihcal_twr && true; - bool ihcal_twrcal = ihcal_digi && true; - - bool ohcal_on = true; - bool ohcal_cell = ohcal_on && true; - bool ohcal_twr = ohcal_cell && true; - bool ohcal_digi = ohcal_twr && true; - bool ohcal_twrcal = ohcal_digi && true; - - bool cryo_on = true; - bool bh_on = true; - bool hit_ntuple = false; - bool dstreader = true; - bool dstoutput = false; - - /////////////////////////////////////////// - // Make the Server - ////////////////////////////////////////// - Fun4AllServer *se = Fun4AllServer::instance(); - // se->Verbosity(1); - recoConsts *rc = recoConsts::instance(); - // only set this if you want a fixed random seed to make - // results reproducible for testing - // rc->set_IntFlag("RANDOMSEED",12345); - - // Test beam generator - PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - gen->add_particles("pi-", 1); // mu-,e-,anti_proton,pi- - gen->set_vertex_distribution_mean(0.0, 0.0, 0); - gen->set_vertex_distribution_width(0.0, .7, .7); // Rough beam profile size @ 16 GeV measured by Abhisek - gen->set_vertex_distribution_function(PHG4SimpleEventGenerator::Gaus, - PHG4SimpleEventGenerator::Gaus, PHG4SimpleEventGenerator::Gaus); // Gauss beam profile - gen->set_eta_range(-.001, .001); // 1mrad angular divergence - gen->set_phi_range(-.001, .001); // 1mrad angular divergence - const double momentum = 32; - gen->set_p_range(momentum,momentum, momentum*2e-2); // 2% momentum smearing - se->registerSubsystem(gen); - - // Simple single particle generator - PHG4ParticleGun *gun = new PHG4ParticleGun(); - // gun->set_name("anti_proton"); - // gun->set_name("geantino"); - gun->set_name("proton"); - gun->set_vtx(0, 0, 0); - gun->set_mom(120, 0, 0); - // gun->AddParticle("geantino",1.7776,-0.4335,0.); - // gun->AddParticle("geantino",1.7709,-0.4598,0.); - // gun->AddParticle("geantino",2.5621,0.60964,0.); - // gun->AddParticle("geantino",1.8121,0.253,0.); - // se->registerSubsystem(gun); - - PHG4Reco* g4Reco = new PHG4Reco(); - g4Reco->set_field(0); - // g4Reco->SetPhysicsList("QGSP_BERT_HP"); // uncomment this line to enable the high-precision neutron simulation physics list, QGSP_BERT_HP - - //---------------------------------------- - // EMCal G4 - //---------------------------------------- - if (cemc_on) - { - PHG4SpacalPrototypeSubsystem *cemc; - cemc = new PHG4SpacalPrototypeSubsystem("CEMC"); - cemc->SetActive(); - cemc->SuperDetector("CEMC"); - cemc->SetAbsorberActive(); - cemc->OverlapCheck(true); - cemc->UseCalibFiles(PHG4DetectorSubsystem::xml); - cemc->SetCalibrationFileDir(string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Geometry/") ); - // cemc->set_double_param("z_rotation_degree", 15); // rotation around CG - cemc->set_double_param("xpos", (116.77 + 137.0)*.5 - 26.5 - 10.2); // location in cm of EMCal CG. Updated with final positioning of EMCal - cemc->set_double_param("ypos", 4); // put it some where in UIUC blocks - cemc->set_double_param("zpos", 4); // put it some where in UIUC blocks - g4Reco->registerSubsystem(cemc); - } - //---------------------------------------- - // HCal G4 - //---------------------------------------- - if (ihcal_on) - { - PHG4Prototype2InnerHcalSubsystem *innerhcal = new PHG4Prototype2InnerHcalSubsystem("HCalIn"); - innerhcal->SetActive(); - innerhcal->SetAbsorberActive(); - innerhcal->SetAbsorberTruth(1); - innerhcal->OverlapCheck(true); - innerhcal->SuperDetector("HCALIN"); - g4Reco->registerSubsystem(innerhcal); - } - if (ohcal_on) - { - PHG4Prototype2OuterHcalSubsystem *outerhcal = new PHG4Prototype2OuterHcalSubsystem("HCalOut"); - outerhcal->SetActive(); - outerhcal->SetAbsorberActive(); - outerhcal->SetAbsorberTruth(1); - outerhcal->OverlapCheck(true); - outerhcal->SuperDetector("HCALOUT"); - g4Reco->registerSubsystem(outerhcal); - } - // Cryostat from engineering drawing - if (cryo_on) - { - PHG4BlockSubsystem *cryo1 = new PHG4BlockSubsystem("cryo1",1); - cryo1->set_double_param("size_x",0.95); - cryo1->set_double_param("size_y",60.96); - cryo1->set_double_param("size_z",60.96); - cryo1->set_double_param("place_x",141.96+0.95/2.); - cryo1->set_string_param("material","G4_Al"); - cryo1->SetActive(); // it is an active volume - save G4Hits - cryo1->SuperDetector("CRYO"); - g4Reco->registerSubsystem(cryo1); - - PHG4BlockSubsystem *cryo2 = new PHG4BlockSubsystem("cryo2",2); - cryo2->set_double_param("size_x",8.89); - cryo2->set_double_param("size_y",60.96); - cryo2->set_double_param("size_z",60.96); - cryo2->set_double_param("place_x",150.72+8.89/2.); - cryo2->set_string_param("material","G4_Al"); - cryo2->SetActive(); // it is an active volume - save G4Hits - cryo2->SuperDetector("CRYO"); - g4Reco->registerSubsystem(cryo2); - - PHG4BlockSubsystem *cryo3 = new PHG4BlockSubsystem("cryo3",3); - cryo3->set_double_param("size_x",2.54); - cryo3->set_double_param("size_y",60.96); - cryo3->set_double_param("size_z",60.96); - cryo3->set_double_param("place_x",173.93+2.54/2.); - cryo3->set_string_param("material","G4_Al"); - cryo3->SetActive(); // it is an active volume - save G4Hits - cryo3->SuperDetector("CRYO"); - g4Reco->registerSubsystem(cryo3); - } - // BLACKHOLE, box surrounding the prototype to check for leakage - if (bh_on) - { - PHG4BlockSubsystem *bh[5]; - // surrounding outer hcal - // top - bh[0] = new PHG4BlockSubsystem("bh1",1); - bh[0]->set_double_param("size_x",270.); - bh[0]->set_double_param("size_y",0.01); - bh[0]->set_double_param("size_z",165.); - bh[0]->set_double_param("place_x",270./2.); - bh[0]->set_double_param("place_y",125./2.); - // bottom - bh[1] = new PHG4BlockSubsystem("bh2",2); - bh[1]->set_double_param("size_x",270.); - bh[1]->set_double_param("size_y",0.01); - bh[1]->set_double_param("size_z",165.); - bh[1]->set_double_param("place_x",270./2.); - bh[1]->set_double_param("place_y",-125./2.); - // right side - bh[2] = new PHG4BlockSubsystem("bh3",3); - bh[2]->set_double_param("size_x",270.); - bh[2]->set_double_param("size_y",125.); - bh[2]->set_double_param("size_z",0.01); - bh[2]->set_double_param("place_x",270./2.); - bh[2]->set_double_param("place_z",165./2.); - // left side - bh[3] = new PHG4BlockSubsystem("bh4",4); - bh[3]->set_double_param("size_x",270.); - bh[3]->set_double_param("size_y",125.); - bh[3]->set_double_param("size_z",0.01); - bh[3]->set_double_param("place_x",270./2.); - bh[3]->set_double_param("place_z",-165./2.); - // back - bh[4] = new PHG4BlockSubsystem("bh5",5); - bh[4]->set_double_param("size_x",0.01); - bh[4]->set_double_param("size_y",125.); - bh[4]->set_double_param("size_z",165.); - bh[4]->set_double_param("place_x",270.); - for (int i=0; i<5; i++) - { - bh[i]->BlackHole(); - bh[i]->SetActive(); - bh[i]->SuperDetector("BlackHole"); - bh[i]->OverlapCheck(true); - g4Reco->registerSubsystem(bh[i]); - } - } - PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); - g4Reco->registerSubsystem(truth); - - se->registerSubsystem( g4Reco ); - //---------------------------------------- - // EMCal digitization - //---------------------------------------- - - if (cemc_cell) - { - PHG4FullProjSpacalCellReco *cemc_cells = new PHG4FullProjSpacalCellReco("CEMCCYLCELLRECO"); - cemc_cells->Detector("CEMC"); - cemc_cells->set_timing_window(0.,60.); - cemc_cells->get_light_collection_model().load_data_file( - string(getenv("CALIBRATIONROOT")) + string("/CEMC/LightCollection/Prototype2Module.xml"), - "data_grid_light_guide_efficiency","data_grid_fiber_trans"); - - se->registerSubsystem(cemc_cells); - } - if (cemc_twr) - { - RawTowerBuilder *TowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); - TowerBuilder->Detector("CEMC"); - TowerBuilder->set_sim_tower_node_prefix("SIM"); - se->registerSubsystem(TowerBuilder); - } - - if (cemc_digi) - { - const double sampling_fraction = 0.0233369; // +/- 8.22211e-05 from 15 Degree indenting 8 GeV electron showers - const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition - const double ADC_per_photoelectron_HG = 3.8; // From Sean Stoll, Mar 29 - const double ADC_per_photoelectron_LG = 0.24; // From Sean Stoll, Mar 29 - - // low gains - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizerLG"); - TowerDigitizer->Detector("CEMC"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(1. / ADC_per_photoelectron_LG); - TowerDigitizer->set_photonelec_yield_visible_GeV( - photoelectron_per_GeV / sampling_fraction); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - // high gains - TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizerHG"); - TowerDigitizer->Detector("CEMC"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_HG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(15); // From John Haggerty, Mar 29 - TowerDigitizer->set_photonelec_ADC(1. / ADC_per_photoelectron_HG); - TowerDigitizer->set_photonelec_yield_visible_GeV( - photoelectron_per_GeV / sampling_fraction); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - } - if (cemc_twrcal) - { - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibrationLG"); - TowerCalibration->Detector("CEMC"); - TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(1. / ADC_per_photoelectron_LG / photoelectron_per_GeV); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibrationHG"); - TowerCalibration->Detector("CEMC"); - TowerCalibration->set_raw_tower_node_prefix("RAW_HG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_HG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(1. / ADC_per_photoelectron_HG / photoelectron_per_GeV); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - } - - //---------------------------------------- - // HCal towering - //---------------------------------------- - if (ihcal_cell) - { - PHG4Prototype2HcalCellReco *hccell = new PHG4Prototype2HcalCellReco("HCALinCellReco"); - hccell->Detector("HCALIN"); - se->registerSubsystem(hccell); - } - - if (ohcal_cell) - { - PHG4Prototype2HcalCellReco *hccell = new PHG4Prototype2HcalCellReco("HCALoutCellReco"); - hccell->Detector("HCALOUT"); - se->registerSubsystem(hccell); - } - if (ihcal_twr) - { - Prototype2RawTowerBuilder *hcaltwr = new Prototype2RawTowerBuilder("HCALinRawTowerBuilder"); - hcaltwr->Detector("HCALIN"); - hcaltwr->set_sim_tower_node_prefix("SIM"); - se->registerSubsystem(hcaltwr); - } - if (ohcal_twr) - { - Prototype2RawTowerBuilder *hcaltwr = new Prototype2RawTowerBuilder("HCALoutRawTowerBuilder"); - hcaltwr->Detector("HCALOUT"); - hcaltwr->set_sim_tower_node_prefix("SIM"); - se->registerSubsystem(hcaltwr); - } - - //---------------------------------------- - // HCal digitization - //---------------------------------------- - // From: Abhisek Sen [mailto:sen.abhisek@gmail.com] - // Sent: Tuesday, April 19, 2016 10:55 PM - // To: Huang, Jin ; Haggerty, John - - // HCALIN: - // 1/5 pixel / HG ADC channel - // 32/5 pixel / LG ADC channel - // 0.4 MeV/ LG ADC - // 0.4/32 MeV/ HG ADC - - // HCALOUT: - // 1/5 pixel / HG ADC channel - // 16/5 pixel / LG ADC channel - // 0.2 MeV/ LG ADC - // 0.2/16 MeV/ HG ADC - - if (ihcal_digi) - { - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HCALinTowerDigitizerLG"); - TowerDigitizer->Detector("HCALIN"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(32. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(32. / 5 / (0.4e-3)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - - TowerDigitizer = new RawTowerDigitizer("HCALinTowerDigitizerHG"); - TowerDigitizer->Detector("HCALIN"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_HG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(1. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(1. / 5 / (0.4e-3 / 32)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - } - if (ohcal_digi) - { - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HCALoutTowerDigitizerLG"); - TowerDigitizer->Detector("HCALOUT"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(16. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(16. / 5 / (0.2e-3)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - - TowerDigitizer = new RawTowerDigitizer("HCALoutTowerDigitizerHG"); - TowerDigitizer->Detector("HCALOUT"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_HG"); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(1. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(1. / 5 / (0.2e-3 / 16)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - } - //---------------------------------------- - // HCal calibration - //---------------------------------------- - // 32 GeV Pi+ scan - const double visible_sample_fraction_HCALIN = 7.19505e-02 ; // 1.34152e-02 - const double visible_sample_fraction_HCALOUT = 0.0313466 ; // +/- 0.0067744 - - if (ihcal_twrcal) - { - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HCALinRawTowerCalibrationLG"); - TowerCalibration->Detector("HCALIN"); - TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.4e-3 / visible_sample_fraction_HCALIN); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - TowerCalibration = new RawTowerCalibration("HCALinRawTowerCalibrationHG"); - TowerCalibration->Detector("HCALIN"); - TowerCalibration->set_raw_tower_node_prefix("RAW_HG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_HG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.4e-3 / 32 / visible_sample_fraction_HCALIN); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - } - if (ohcal_twrcal) - { - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HCALoutRawTowerCalibrationLG"); - TowerCalibration->Detector("HCALOUT"); - TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / visible_sample_fraction_HCALOUT); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - TowerCalibration = new RawTowerCalibration("HCALoutRawTowerCalibrationHG"); - TowerCalibration->Detector("HCALOUT"); - TowerCalibration->set_raw_tower_node_prefix("RAW_HG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_HG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / 16 / visible_sample_fraction_HCALOUT); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - } - //---------------------- - // QA Histograms - //---------------------- - if (cemc_on) - { - se->registerSubsystem(new QAG4SimulationCalorimeter("CEMC",QAG4SimulationCalorimeter::kProcessG4Hit)); - } - if (ihcal_on) - { - se->registerSubsystem(new QAG4SimulationCalorimeter("HCALIN",QAG4SimulationCalorimeter::kProcessG4Hit)); - } - if (ohcal_on) - { - se->registerSubsystem(new QAG4SimulationCalorimeter("HCALOUT",QAG4SimulationCalorimeter::kProcessG4Hit)); - } - //---------------------- - // G4HitNtuple - //---------------------- - if (hit_ntuple) - { - G4HitNtuple *hit = new G4HitNtuple("G4HitNtuple","g4hitntuple.root"); - hit->AddNode("HCALIN", 0); - hit->AddNode("HCALOUT", 1); - hit->AddNode("CRYO", 2); - hit->AddNode("BlackHole", 3); - hit->AddNode("ABSORBER_HCALIN", 10); - hit->AddNode("ABSORBER_HCALOUT", 11); - se->registerSubsystem(hit); - } - //---------------------- - // save a comprehensive evaluation file - //---------------------- - if (dstreader) - { - PHG4DSTReader* ana = new PHG4DSTReader( - string("DSTReader.root")); - ana->set_save_particle(true); - ana->set_load_all_particle(false); - ana->set_load_active_particle(false); - ana->set_save_vertex(true); - ana->set_tower_zero_sup(-1000); // no zero suppression - - // ana->AddNode("CEMC"); - // if (absorberactive) - // { - // ana->AddNode("ABSORBER_CEMC"); - // } - ana->AddTower("SIM_CEMC"); - ana->AddTower("RAW_LG_CEMC"); - ana->AddTower("CALIB_LG_CEMC");// Low gain CEMC - ana->AddTower("RAW_HG_CEMC"); - ana->AddTower("CALIB_HG_CEMC");// High gain CEMC - - ana->AddTower("SIM_HCALOUT"); - ana->AddTower("SIM_HCALIN"); - - ana->AddTower("RAW_LG_HCALIN"); - ana->AddTower("RAW_HG_HCALIN"); - ana->AddTower("RAW_LG_HCALOUT"); - ana->AddTower("RAW_HG_HCALOUT"); - - ana->AddTower("CALIB_LG_HCALIN"); - ana->AddTower("CALIB_HG_HCALIN"); - ana->AddTower("CALIB_LG_HCALOUT"); - ana->AddTower("CALIB_HG_HCALOUT"); - - ana->AddNode("BlackHole");// add a G4Hit node - - se->registerSubsystem(ana); - } - if (dstoutput) - { - Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT","G4Prototype2New.root"); - se->registerOutputManager(out); - } - - Fun4AllInputManager *in = new Fun4AllDummyInputManager( "JADE"); - se->registerInputManager( in ); - if (nEvents <= 0) - { - return 0; - } - se->run(nEvents); - - se->End(); - - QAHistManagerDef::saveQARootFile("G4Prototype2_qa.root"); - - - // std::cout << "All done" << std::endl; - delete se; - // return 0; - gSystem->Exit(0); - -} - diff --git a/macros/prototype2/Fun4All_TestBeam.C b/macros/prototype2/Fun4All_TestBeam.C deleted file mode 100644 index c4d8657e4..000000000 --- a/macros/prototype2/Fun4All_TestBeam.C +++ /dev/null @@ -1,290 +0,0 @@ -#include - -using namespace std; - -void -Fun4All_TestBeam(int nEvents = 100, - const char *input_file = - "/gpfs/mnt/gpfs02/sphenix/data/data01/t1044-2016a/fnal/beam/beam_00002609-0000.prdf", - const char *output_file = "data/beam_00002609.root") -{ - gSystem->Load("libfun4all"); - gSystem->Load("libPrototype2.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(Fun4AllServer::VERBOSITY_SOME); - - recoConsts *rc = recoConsts::instance(); - //rc->set_IntFlag("RUNNUMBER",0); - - // ------------------- Run info -> RUN node ------------------- - RunInfoUnpackPRDF *unpack_run = new RunInfoUnpackPRDF(); -// unpack_run->Verbosity(RunInfoUnpackPRDF::VERBOSITY_SOME); - - int i_offset = 0; - - // rcdaq_client create_device device_filenumbers_delete 9 911 "$HOME/beam_values.txt" - // S:MTNRG = 120 GeV - // F:MT6SC1 = 11127 Cnts - // F:MT6SC2 = 10585 Cnts - // F:MT6SC3 = 10442 Cnts - // F:MT6SC4 = 0 Cnts - // F:MT6SC5 = 20251 Cnts - // E:2CH = 981.9 mm - // E:2CV = 93.17 mm - // E:2CMT6T = 76.11 F - // E:2CMT6H = 18.09 %Hum - // F:MT5CP2 = .0301 Psia - // F:MT6CP2 = .6905 Psia - i_offset = 0; - unpack_run->add_channel("beam_MTNRG_GeV", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC1_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC2_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC3_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC4_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC5_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CH_mm", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CV_mm", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CMT6T_F", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CMT6H_RH", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT5CP2_Psia", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6CP2_Psia", 911, i_offset++, 1e-4); - -// rcdaq_client create_device device_filenumbers_delete 9 984 "$HOME/DB_LOGGER_EMCAL_A0_values.txt" - unpack_run->add_channel("EMCAL_A0_HighGain", 984, 0, 1); // 1: pre-amp high gain, 0: nominal gain - - // rcdaq_client create_device device_filenumbers_delete 9 983 "$HOME/DB_LOGGER_EMCAL_GR0.txt" - unpack_run->add_channel("EMCAL_GR0_BiasOffset_Tower21", 983, 21-1, 1); // bias offset in mV for tower 21 - - // rcdaq_client create_device device_filenumbers_delete 9 982 "$HOME/DB_LOGGER_EMCAL_T0_values.txt" - unpack_run->add_channel("EMCAL_T0_Tower21", 982, 21-1, 1e-3); // temperature reading in C for tower 21 - - se->registerSubsystem(unpack_run); - - // ------------------- Temperature output ------------------- - TempInfoUnpackPRDF *unpack_temp = new TempInfoUnpackPRDF(); - unpack_temp->Verbosity(RunInfoUnpackPRDF::VERBOSITY_SOME); - se->registerSubsystem(unpack_temp); - - // ------------------- HCal and EMcal ------------------- - SubsysReco *unpack = new CaloUnpackPRDF(); -// unpack->Verbosity(1); - se->registerSubsystem(unpack); - - CaloCalibration * calib = NULL; - - calib = new CaloCalibration("CEMC"); - calib->GetCalibrationParameters().ReadFromFile("CEMC","xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALIN"); - calib->set_calib_tower_node_prefix("CALIB_LG"); - calib->set_raw_tower_node_prefix("RAW_LG"); - calib->GetCalibrationParameters().set_name("hcalin_lg"); - calib->GetCalibrationParameters().ReadFromFile("hcalin_lg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALIN"); - calib->set_calib_tower_node_prefix("CALIB_HG"); - calib->set_raw_tower_node_prefix("RAW_HG"); - calib->GetCalibrationParameters().set_name("hcalin_hg"); - calib->GetCalibrationParameters().ReadFromFile("hcalin_hg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALOUT"); - calib->set_calib_tower_node_prefix("CALIB_LG"); - calib->set_raw_tower_node_prefix("RAW_LG"); - calib->GetCalibrationParameters().set_name("hcalout_lg"); - calib->GetCalibrationParameters().ReadFromFile("hcalout_lg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALOUT"); - calib->set_calib_tower_node_prefix("CALIB_HG"); - calib->set_raw_tower_node_prefix("RAW_HG"); - calib->GetCalibrationParameters().set_name("hcalout_hg"); - calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/")); // calibration database - se->registerSubsystem(calib); - - // ------------------- Hodoscpes ------------------- - - const int first_packet_id = PROTOTYPE2_FEM::PACKET_ID; // 21101 - const int second_packet_id = 21102; - - GenericUnpackPRDF *gunpack = NULL; - - const int N_hodo = 8; - - gunpack = new GenericUnpackPRDF("HODO_VERTICAL"); - for (int i = 0; i < N_hodo; ++i) - gunpack->add_channel(first_packet_id, 104 + i, i); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - gunpack = new GenericUnpackPRDF("HODO_HORIZONTAL"); - for (int i = 0; i < N_hodo; ++i) - gunpack->add_channel(first_packet_id, 96 + i, i); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("HODO_VERTICAL"); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - // Martin find that even channel has negative polarity and odd channel has positive polarity - for (int i = 0; i < N_hodo; ++i) - calib->GetCalibrationParameters().set_double_param( - Form("calib_const_column0_row%d", i), ((i % 2 > 0) ? -1 : +1)); - se->registerSubsystem(calib); - - calib = new CaloCalibration("HODO_HORIZONTAL"); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - // Martin find that even channel has negative polarity and odd channel has positive polarity - for (int i = 0; i < N_hodo; ++i) - calib->GetCalibrationParameters().set_double_param( - Form("calib_const_column0_row%d", i), ((i % 2 > 0) ? -1 : +1)); - se->registerSubsystem(calib); - - // ------------------- Other detectors ------------------- - - gunpack = new GenericUnpackPRDF("C1"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 24, 0); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("C1"); - se->registerSubsystem(calib); - - // more info see https://wiki.bnl.gov/sPHENIX/index.php/T-1044#Cerenkov_Counters - gunpack = new GenericUnpackPRDF("C2"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 25, 0); //25 Cerenkov 2 Inner - gunpack->add_channel(second_packet_id, 26, 1); //26 Cerenkov 2 Outer - gunpack->add_channel(second_packet_id, 22, 10); //Channel 22 C2inner earlier copy added before run 2210 - gunpack->add_channel(second_packet_id, 23, 11); //Channel 23 C2outer earlier copy added before run 2210 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("C2"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row0", +1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row1", -1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row10", -1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row11", +1); - se->registerSubsystem(calib); - -// John H. : should be 19, 20, 21 and the other channels are a litle permuted from what I thought - gunpack = new GenericUnpackPRDF("HCAL_SCINT"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 19, 1); - gunpack->add_channel(second_packet_id, 20, 2); - gunpack->add_channel(second_packet_id, 21, 3); - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("HCAL_SCINT"); - se->registerSubsystem(calib); - - gunpack = new GenericUnpackPRDF("PbGL"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 0, 0); // 0 PbGL Only inserted in beam for testing - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("PbGL"); - se->registerSubsystem(calib); - - gunpack = new GenericUnpackPRDF("TRIGGER_VETO"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 28, 0); // 28 Bottom trigger veto - gunpack->add_channel(second_packet_id, 29, 1); // 29 Top trigger veto - gunpack->add_channel(second_packet_id, 30, 2); // 30 Left trigger veto - gunpack->add_channel(second_packet_id, 31, 3); // 31 Right trigger veto - se->registerSubsystem(gunpack); - - // Calibrate the MIP peak to an relative energy of +1.0 - calib = new CaloCalibration("TRIGGER_VETO"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row0", -1./29.4155); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row1", +1./91); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row2", -1./31.3981); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row3", +1./1.43839e+02); - se->registerSubsystem(calib); - - const int N_TileMapper = 16; - - gunpack = new GenericUnpackPRDF("TILE_MAPPER"); - for (int i = 0; i < N_TileMapper; ++i) - gunpack->add_channel(second_packet_id, 32 + i, i); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("TILE_MAPPER"); - se->registerSubsystem(calib); - - // ------------------- Output ------------------- - //main DST output - Fun4AllDstOutputManager *out_Manager = new Fun4AllDstOutputManager("DSTOUT", - output_file); - se->registerOutputManager(out_Manager); - - //alternatively, fast check on DST using DST Reader: - Prototype2DSTReader *reader = new Prototype2DSTReader( - string(output_file) + string("_DSTReader.root")); - - reader->AddRunInfo("beam_MTNRG_GeV"); - reader->AddRunInfo("beam_2CH_mm"); - reader->AddRunInfo("beam_2CV_mm"); - reader->AddRunInfo("EMCAL_A0_HighGain"); - reader->AddRunInfo("EMCAL_GR0_BiasOffset_Tower21"); - reader->AddRunInfo("EMCAL_T0_Tower21"); - - reader->AddTower("RAW_LG_HCALIN"); - reader->AddTower("RAW_HG_HCALIN"); - reader->AddTower("RAW_LG_HCALOUT"); - reader->AddTower("RAW_HG_HCALOUT"); - - reader->AddTower("CALIB_LG_HCALIN"); - reader->AddTower("CALIB_HG_HCALIN"); - reader->AddTower("CALIB_LG_HCALOUT"); - reader->AddTower("CALIB_HG_HCALOUT"); - - reader->AddTower("RAW_CEMC"); - reader->AddTower("CALIB_CEMC"); - - reader->AddTower("RAW_HODO_VERTICAL"); - reader->AddTower("RAW_HODO_HORIZONTAL"); - reader->AddTower("CALIB_HODO_VERTICAL"); - reader->AddTower("CALIB_HODO_HORIZONTAL"); - - reader->AddTower("RAW_C1"); - reader->AddTower("CALIB_C1"); - - reader->AddTower("RAW_C2"); - reader->AddTower("CALIB_C2"); - - reader->AddTower("RAW_HCAL_SCINT"); - reader->AddTower("CALIB_HCAL_SCINT"); - - reader->AddTower("RAW_PbGL"); - reader->AddTower("CALIB_PbGL"); - - reader->AddTower("RAW_TRIGGER_VETO"); - reader->AddTower("CALIB_TRIGGER_VETO"); - - reader->AddTower("RAW_TILE_MAPPER"); - reader->AddTower("CALIB_TILE_MAPPER"); - - reader->AddTowerTemperature("HCALIN"); - reader->AddTowerTemperature("HCALIN"); - reader->AddTowerTemperature("HCALOUT"); - - se->registerSubsystem(reader); - - Fun4AllInputManager *in = new Fun4AllPrdfInputManager("PRDFin"); - in->fileopen(input_file); - se->registerInputManager(in); - - se->run(nEvents); - - se->End(); - -} diff --git a/macros/prototype2/vis_prototype2.mac b/macros/prototype2/vis_prototype2.mac deleted file mode 100644 index 3767f8b49..000000000 --- a/macros/prototype2/vis_prototype2.mac +++ /dev/null @@ -1,80 +0,0 @@ -# $Id: vis.mac,v 1.4 2010/04/14 18:32:59 lindenle Exp $ -# -# Macro file for the initialization phase of "exampleN03.cc" -# when running in interactive mode -# -# Sets some default verbose -# -/control/verbose 2 -/control/saveHistory -/run/verbose 2 -# -# create empty scene -# -/vis/scene/create -# -# Create a scene handler for a specific graphics system -# (Edit the next line(s) to choose another graphic system) -# -# Use this open statement to get an .eps and .prim files -# suitable for viewing in DAWN. -###/vis/open DAWNFILE -# -# Use this open statement instead for OpenGL in immediate mode. -# OGLIX works on the desktops in 1008 while OGLSX terminates -# the X server. I've heard similar stories about OGLIX on other -# machines. You might have to play with it. GEANT prints out a -# list of available graphics systems at some point. -#/vis/open OGLIX -/vis/open OGLSX 1200x900-0+0 -/vis/viewer/set/viewpointThetaPhi 0 0 -# /vis/viewer/addCutawayPlane 0 0 0 m 1 0 0 -# our world is 4x4 meters, the detector is about 1m across -# zooming by 4 makes it fill the display -/vis/viewer/zoom 1.5 -# -# Use this open statement instead to get a HepRep version 1 file -# suitable for viewing in WIRED. -#/vis/open HepRepFile -# -# Use this open statement instead to get a HepRep version 2 file -# suitable for viewing in WIRED. -#/vis/open HepRepXML -# -# Output an empty detector -# /vis/viewer/flush -# -# Draw trajectories at end of event, showing trajectory points as -# markers of size 2 pixels -/vis/scene/add/trajectories smooth -/vis/modeling/trajectories/create/drawByCharge -/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true -/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 -# (if too many tracks cause core dump => /tracking/storeTrajectory 0) -# -# To draw gammas only -#/vis/filtering/trajectories/create/particleFilter -#/vis/filtering/trajectories/particleFilter-0/add gamma -# -# To draw charged particles only -#/vis/filtering/trajectories/particleFilter-0/invert true -# -# Many other options available with /vis/modeling and /vis/filtering. -# For example, select colour by particle ID -#/vis/modeling/trajectories/create/drawByParticleID -#/vis/modeling/trajectories/drawByParticleID-0/set e- red -# remove low energy stuff -/vis/filtering/trajectories/create/attributeFilter -/vis/filtering/trajectories/attributeFilter-0/setAttribute IMag -/vis/filtering/trajectories/attributeFilter-0/addInterval 50 MeV 1000 GeV -# -/vis/scene/endOfEventAction accumulate -# -# At end of each run, an automatic flush causes graphical output. -#/run/beamOn 1 -# When you exit Geant4, you will find a file called scene-0.heprep.zip. -# Unzipping this will give you three separate HepRep files suitable for -# viewing in WIRED. -# The first file will contain just detector geometry. -# The second file will contain the detector plus one event. -# The third file will contain the detector plus ten events. diff --git a/macros/prototype3/Fun4All_G4_Prototype3.C b/macros/prototype3/Fun4All_G4_Prototype3.C deleted file mode 100644 index 850af560b..000000000 --- a/macros/prototype3/Fun4All_G4_Prototype3.C +++ /dev/null @@ -1,586 +0,0 @@ -int Fun4All_G4_Prototype3(int nEvents = 1) -{ - - gSystem->Load("libfun4all"); - gSystem->Load("libg4detectors"); - gSystem->Load("libg4testbench"); - gSystem->Load("libg4histos"); - gSystem->Load("libg4eval.so"); - gSystem->Load("libqa_modules"); - - bool cemc_on = true; - bool cemc_cell = cemc_on && true; - bool cemc_twr = cemc_cell && true; - bool cemc_digi = cemc_twr && true; - bool cemc_twrcal = cemc_digi && true; - bool ihcal_on = true; - bool ihcal_cell = ihcal_on && false; - bool ihcal_twr = ihcal_cell && false; - bool ihcal_digi = ihcal_twr && false; - bool ihcal_twrcal = ihcal_digi && false; - bool ohcal_on = true; - bool ohcal_cell = ohcal_on && false; - bool ohcal_twr = ohcal_cell && false; - bool ohcal_digi = ohcal_twr && false; - bool ohcal_twrcal = ohcal_digi && false; - bool cryo_on = true; - bool bh_on = false; // the surrounding boxes need some further thinking - bool dstreader = true; - bool hit_ntuple = false; - bool dstoutput = false; - - /////////////////////////////////////////// - // Make the Server - ////////////////////////////////////////// - Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(1); - recoConsts *rc = recoConsts::instance(); - // only set this if you want a fixed random seed to make - // results reproducible for testing -// rc->set_IntFlag("RANDOMSEED",12345678); - - // simulated setup sits at eta=1, theta=40.395 degrees - double theta = 90-46.4; - // shift in x with respect to midrapidity setup - double add_place_x = 183.-173.93+2.54/2.; - // Test beam generator - PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - gen->add_particles("e-", 1); // mu-,e-,anti_proton,pi- - gen->set_vertex_distribution_mean(0.0, 0.0, 0); - gen->set_vertex_distribution_width(0.0, .7, .7); // Rough beam profile size @ 16 GeV measured by Abhisek - gen->set_vertex_distribution_function(PHG4SimpleEventGenerator::Gaus, - PHG4SimpleEventGenerator::Gaus, - PHG4SimpleEventGenerator::Gaus); // Gauss beam profile - double angle = theta*TMath::Pi()/180.; - double eta = -1.*TMath::Log(TMath::Tan(angle/2.)); - gen->set_eta_range(eta-0.001,eta+0.001); // 1mrad angular divergence - gen->set_phi_range(-0.001, 0.001); // 1mrad angular divergence - const double momentum = 32; - gen->set_p_range(momentum,momentum, momentum*2e-2); // 2% momentum smearing - se->registerSubsystem(gen); - - PHG4ParticleGenerator *pgen = new PHG4ParticleGenerator(); - pgen->set_name("geantino"); - //pgen->set_name(particle); - pgen->set_vtx(0, 0, 0); - //pgen->set_vtx(0, ypos, 0); - double angle = theta*TMath::Pi()/180.; - double eta = -1.*TMath::Log(TMath::Tan(angle/2.)); - pgen->set_eta_range(0.2*eta, 1.8*eta); - //pgen->set_phi_range(-0.001, 0.001); // 1mrad angular diverpgence - //pgen->set_phi_range(-0.5/180.*TMath::Pi(), 0.5/180.*TMath::Pi()); - //pgen->set_eta_range(-1., 1.); - //pgen->set_phi_range(-0./180.*TMath::Pi(), 0./180.*TMath::Pi()); - pgen->set_phi_range(-20/180.*TMath::Pi(), 20/180.*TMath::Pi()); - pgen->set_mom_range(1, 1); - // se->registerSubsystem(pgen); - - // Simple single particle generator - PHG4ParticleGun *gun = new PHG4ParticleGun(); - gun->set_name("geantino"); - // gun->set_name("proton"); - gun->set_vtx(0, 0, 0); - double angle = theta*TMath::Pi()/180.; - gun->set_mom(sin(angle),0.,cos(angle)); -// se->registerSubsystem(gun); - - - PHG4Reco* g4Reco = new PHG4Reco(); - g4Reco->set_field(0); - // g4Reco->SetPhysicsList("QGSP_BERT_HP"); // uncomment this line to enable the high-precision neutron simulation physics list, QGSP_BERT_HP - - //---------------------------------------- - // EMCal G4 - //---------------------------------------- - if (cemc_on) - { - PHG4SpacalPrototypeSubsystem *cemc; - cemc = new PHG4SpacalPrototypeSubsystem("CEMC"); - cemc->SetActive(); - cemc->SuperDetector("CEMC"); - cemc->SetAbsorberActive(); - cemc->OverlapCheck(true); -// cemc->Verbosity(2); -// cemc->set_int_param("construction_verbose",2); - cemc->UseCalibFiles(PHG4DetectorSubsystem::xml); - cemc->SetCalibrationFileDir(string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Geometry/") ); -// cemc->SetCalibrationFileDir("./test_geom/" ); - // cemc->set_double_param("z_rotation_degree", 15); // rotation around CG -// cemc->set_double_param("xpos", (116.77 + 137.0)*.5 - 26.5 - 10.2); // location in cm of EMCal CG. Updated with final positioning of EMCal -// cemc->set_double_param("ypos", 4); // put it some where in UIUC blocks -// cemc->set_double_param("zpos", 4); // put it some where in UIUC blocks - g4Reco->registerSubsystem(cemc); - } - //---------------------------------------- - // HCal G4 - //---------------------------------------- - if (ihcal_on) - { - PHG4Prototype2InnerHcalSubsystem *innerhcal = new PHG4Prototype2InnerHcalSubsystem("HCalIn"); - innerhcal->set_int_param("hi_eta",1); - innerhcal->set_double_param("place_x",add_place_x); - innerhcal->set_double_param("place_z",144); - innerhcal->SetActive(); - innerhcal->SetAbsorberActive(); - innerhcal->SetAbsorberTruth(1); - innerhcal->OverlapCheck(true); - innerhcal->SuperDetector("HCALIN"); - g4Reco->registerSubsystem(innerhcal); - } - if (ohcal_on) - { - PHG4Prototype2OuterHcalSubsystem *outerhcal = new PHG4Prototype2OuterHcalSubsystem("HCalOut"); - outerhcal->set_int_param("hi_eta",1); - outerhcal->set_double_param("place_x",add_place_x); - outerhcal->set_double_param("place_z",229.5); - outerhcal->SetActive(); - outerhcal->SetAbsorberActive(); - outerhcal->SetAbsorberTruth(1); - outerhcal->OverlapCheck(true); - outerhcal->SuperDetector("HCALOUT"); - g4Reco->registerSubsystem(outerhcal); - } - if (cryo_on) - { - double place_z = 175.; - // Cryostat from engineering drawing - PHG4BlockSubsystem *cryo1 = new PHG4BlockSubsystem("cryo1",1); - cryo1->set_double_param("size_x",0.95); - cryo1->set_double_param("size_y",60.96); - cryo1->set_double_param("size_z",60.96); - cryo1->set_double_param("place_x",141.96+0.95/2.+add_place_x); - cryo1->set_double_param("place_z",place_z); - cryo1->set_string_param("material","G4_Al"); - cryo1->SetActive(); // it is an active volume - save G4Hits - cryo1->SuperDetector("CRYO"); - g4Reco->registerSubsystem(cryo1); - - PHG4BlockSubsystem *cryo2 = new PHG4BlockSubsystem("cryo2",2); - cryo2->set_double_param("size_x",8.89); - cryo2->set_double_param("size_y",60.96); - cryo2->set_double_param("size_z",60.96); - cryo2->set_double_param("place_x",150.72+8.89/2.+add_place_x); - cryo2->set_double_param("place_z",place_z); - cryo2->set_string_param("material","G4_Al"); - cryo2->SetActive(); // it is an active volume - save G4Hits - cryo2->SuperDetector("CRYO"); - g4Reco->registerSubsystem(cryo2); - - PHG4BlockSubsystem *cryo3 = new PHG4BlockSubsystem("cryo3",3); - cryo3->set_double_param("size_x",2.54); - cryo3->set_double_param("size_y",60.96); - cryo3->set_double_param("size_z",60.96); - cryo3->set_double_param("place_x",173.93+2.54/2.+add_place_x); - cryo3->set_double_param("place_z",place_z); - cryo3->set_string_param("material","G4_Al"); - cryo3->SetActive(); // it is an active volume - save G4Hits - cryo3->SuperDetector("CRYO"); - g4Reco->registerSubsystem(cryo3); - } - if (bh_on) - { - // BLACKHOLE, box surrounding the prototype to check for leakage - PHG4BlockSubsystem *bh[5]; - // surrounding outer hcal - // top - bh[0] = new PHG4BlockSubsystem("bh1",1); - bh[0]->set_double_param("size_x",270.); - bh[0]->set_double_param("size_y",0.01); - bh[0]->set_double_param("size_z",165.); - bh[0]->set_double_param("place_x",270./2.); - bh[0]->set_double_param("place_y",125./2.); - // bottom - bh[1] = new PHG4BlockSubsystem("bh2",2); - bh[1]->set_double_param("size_x",270.); - bh[1]->set_double_param("size_y",0.01); - bh[1]->set_double_param("size_z",165.); - bh[1]->set_double_param("place_x",270./2.); - bh[1]->set_double_param("place_y",-125./2.); - // right side - bh[2] = new PHG4BlockSubsystem("bh3",3); - bh[2]->set_double_param("size_x",200.); - bh[2]->set_double_param("size_y",125.); - bh[2]->set_double_param("size_z",0.01); - bh[2]->set_double_param("place_x",200./2.); - bh[2]->set_double_param("place_z",165./2.); - // left side - bh[3] = new PHG4BlockSubsystem("bh4",4); - bh[3]->set_double_param("size_x",270.); - bh[3]->set_double_param("size_y",125.); - bh[3]->set_double_param("size_z",0.01); - bh[3]->set_double_param("place_x",270./2.); - bh[3]->set_double_param("place_z",-165./2.); - // back - bh[4] = new PHG4BlockSubsystem("bh5",5); - bh[4]->set_double_param("size_x",0.01); - bh[4]->set_double_param("size_y",125.); - bh[4]->set_double_param("size_z",165.); - bh[4]->set_double_param("place_x",270.); - for (int i=0; i<5; i++) - { - bh[i]->BlackHole(); - bh[i]->SetActive(); - bh[i]->SuperDetector("BlackHole"); - bh[i]->OverlapCheck(true); - g4Reco->registerSubsystem(bh[i]); - } - } - PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); - g4Reco->registerSubsystem(truth); - - se->registerSubsystem( g4Reco ); - //---------------------------------------- - // EMCal digitization - //---------------------------------------- - if (cemc_cell) - { - PHG4FullProjSpacalCellReco *cemc_cells = new PHG4FullProjSpacalCellReco("CEMCCYLCELLRECO"); - cemc_cells->Detector("CEMC"); - cemc_cells->set_timing_window(0.,60.); - cemc_cells->get_light_collection_model().load_data_file(string(getenv("CALIBRATIONROOT")) + string("/CEMC/LightCollection/Prototype2Module.xml"),"data_grid_light_guide_efficiency","data_grid_fiber_trans"); - - se->registerSubsystem(cemc_cells); - } - if (cemc_twr) - { - RawTowerBuilder *TowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); - TowerBuilder->Detector("CEMC"); - TowerBuilder->set_sim_tower_node_prefix("SIM"); - se->registerSubsystem(TowerBuilder); - } - const double sampling_fraction = 0.0190134; // +/- 0.000224984 from 0 Degree indenting 32 GeV electron showers - const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition - const double ADC_per_photoelectron_HG = 3.8; // From Sean Stoll, Mar 29 - const double ADC_per_photoelectron_LG = 0.24; // From Sean Stoll, Mar 29 - - // low gains - if (cemc_digi) - { - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizerLG"); - TowerDigitizer->Detector("CEMC"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(1. / ADC_per_photoelectron_LG); - TowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - // high gains - TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizerHG"); - TowerDigitizer->Detector("CEMC"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_HG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(15); // From John Haggerty, Mar 29 - TowerDigitizer->set_photonelec_ADC(1. / ADC_per_photoelectron_HG); - TowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - } - if (cemc_twrcal) - { - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibrationLG"); - TowerCalibration->Detector("CEMC"); - TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(1. / ADC_per_photoelectron_LG / photoelectron_per_GeV); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - - TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibrationHG"); - TowerCalibration->Detector("CEMC"); - TowerCalibration->set_raw_tower_node_prefix("RAW_HG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_HG"); - TowerCalibration->set_calib_algorithm( - RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(1. / ADC_per_photoelectron_HG / photoelectron_per_GeV); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - } - - //---------------------------------------- - // HCal towering - //---------------------------------------- - if (ihcal_cell) - { - PHG4Prototype2HcalCellReco *hccell = new PHG4Prototype2HcalCellReco("HCALinCellReco"); - hccell->Detector("HCALIN"); - se->registerSubsystem(hccell); - } - if (ihcal_twr) - { - Prototype2RawTowerBuilder *hcaltwr = new Prototype2RawTowerBuilder("HCALinRawTowerBuilder"); - hcaltwr->Detector("HCALIN"); - hcaltwr->set_sim_tower_node_prefix("SIM"); - se->registerSubsystem(hcaltwr); - } - - - if (ohcal_cell) - { - hccell = new PHG4Prototype2HcalCellReco("HCALoutCellReco"); - hccell->Detector("HCALOUT"); - se->registerSubsystem(hccell); - } - if (ohcal_twr) - { - hcaltwr = new Prototype2RawTowerBuilder("HCALoutRawTowerBuilder"); - hcaltwr->Detector("HCALOUT"); - hcaltwr->set_sim_tower_node_prefix("SIM"); - se->registerSubsystem(hcaltwr); - } - - //---------------------------------------- - // HCal digitization - //---------------------------------------- - // From: Abhisek Sen [mailto:sen.abhisek@gmail.com] - // Sent: Tuesday, April 19, 2016 10:55 PM - // To: Huang, Jin ; Haggerty, John - - // HCALIN: - // 1/5 pixel / HG ADC channel - // 32/5 pixel / LG ADC channel - // 0.4 MeV/ LG ADC - // 0.4/32 MeV/ HG ADC - - // HCALOUT: - // 1/5 pixel / HG ADC channel - // 16/5 pixel / LG ADC channel - // 0.2 MeV/ LG ADC - // 0.2/16 MeV/ HG ADC - RawTowerDigitizer *TowerDigitizer = NULL; - if (ihcal_digi) - { - TowerDigitizer = new RawTowerDigitizer("HCALinTowerDigitizerLG"); - TowerDigitizer->Detector("HCALIN"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(32. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(32. / 5 / (0.4e-3)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - - TowerDigitizer = new RawTowerDigitizer("HCALinTowerDigitizerHG"); - TowerDigitizer->Detector("HCALIN"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_HG"); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(1. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(1. / 5 / (0.4e-3 / 32)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - } - if (ohcal_digi) - { - TowerDigitizer = new RawTowerDigitizer("HCALoutTowerDigitizerLG"); - TowerDigitizer->Detector("HCALOUT"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(16. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(16. / 5 / (0.2e-3)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - - TowerDigitizer = new RawTowerDigitizer("HCALoutTowerDigitizerHG"); - TowerDigitizer->Detector("HCALOUT"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_HG"); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(1. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(1. / 5 / (0.2e-3 / 16)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - } - //---------------------------------------- - // HCal calibration - //---------------------------------------- - // 32 GeV Pi+ scan - const double visible_sample_fraction_HCALIN = 7.19505e-02 ; // 1.34152e-02 - const double visible_sample_fraction_HCALOUT = 0.0313466 ; // +/- 0.0067744 - RawTowerCalibration *TowerCalibration = NULL; - if (ihcal_twrcal) - { - TowerCalibration = new RawTowerCalibration("HCALinRawTowerCalibrationLG"); - TowerCalibration->Detector("HCALIN"); - TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.4e-3 / visible_sample_fraction_HCALIN); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - TowerCalibration = new RawTowerCalibration("HCALinRawTowerCalibrationHG"); - TowerCalibration->Detector("HCALIN"); - TowerCalibration->set_raw_tower_node_prefix("RAW_HG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_HG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.4e-3 / 32 / visible_sample_fraction_HCALIN); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - } - if (ohcal_twrcal) - { - TowerCalibration = new RawTowerCalibration("HCALoutRawTowerCalibrationLG"); - TowerCalibration->Detector("HCALOUT"); - TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / visible_sample_fraction_HCALOUT); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - TowerCalibration = new RawTowerCalibration("HCALoutRawTowerCalibrationHG"); - TowerCalibration->Detector("HCALOUT"); - TowerCalibration->set_raw_tower_node_prefix("RAW_HG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_HG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / 16 / visible_sample_fraction_HCALOUT); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - } - //---------------------- - // QA Histograms - //---------------------- - if (cemc_on) - { - se->registerSubsystem(new QAG4SimulationCalorimeter("CEMC",QAG4SimulationCalorimeter::kProcessG4Hit)); - } - if (ihcal_on) - { - // TODO: disable QA for HCal right now as there is a hit->particle truth association error at the moment - // se->registerSubsystem(new QAG4SimulationCalorimeter("HCALIN",QAG4SimulationCalorimeter::kProcessG4Hit)); - } - if (ohcal_on) - { - // se->registerSubsystem(new QAG4SimulationCalorimeter("HCALOUT",QAG4SimulationCalorimeter::kProcessG4Hit)); - } - //---------------------- - // G4HitNtuple - //---------------------- - if (hit_ntuple) - { - G4HitNtuple *hit = new G4HitNtuple("G4HitNtuple","g4hitntuple.root"); - hit->AddNode("HCALIN", 0); - hit->AddNode("HCALOUT", 1); - hit->AddNode("CRYO", 2); - hit->AddNode("BlackHole", 3); - hit->AddNode("ABSORBER_HCALIN", 10); - hit->AddNode("ABSORBER_HCALOUT", 11); - se->registerSubsystem(hit); - } - // G4ScintillatorSlatTTree *scintcell = new G4ScintillatorSlatTTree("inslat"); - // scintcell->Detector("HCALIN"); - // se->registerSubsystem(scintcell); - - // scintcell = new G4ScintillatorSlatTTree("outslat"); - // scintcell->Detector("HCALOUT"); - // se->registerSubsystem(scintcell); - - - //---------------------- - // save a comprehensive evaluation file - //---------------------- - if (dstreader) - { - PHG4DSTReader* ana = new PHG4DSTReader(string("DSTReader.root")); - ana->set_save_particle(true); - ana->set_load_all_particle(false); - ana->set_load_active_particle(false); - ana->set_save_vertex(true); - ana->set_tower_zero_sup(-1000); // no zero suppression - - // ana->AddNode("CEMC"); - // if (absorberactive) - // { - // ana->AddNode("ABSORBER_CEMC"); - // } - - if (cemc_twr) - ana->AddTower("SIM_CEMC"); - if (cemc_digi) - ana->AddTower("RAW_LG_CEMC"); - if (cemc_twrcal) - ana->AddTower("CALIB_LG_CEMC"); // Low gain CEMC - if (cemc_digi) - ana->AddTower("RAW_HG_CEMC"); - if (cemc_twrcal) - ana->AddTower("CALIB_HG_CEMC"); // High gain CEMC - - if (ohcal_twr) - ana->AddTower("SIM_HCALOUT"); - if (ihcal_twr) - ana->AddTower("SIM_HCALIN"); - - if (ihcal_digi) - ana->AddTower("RAW_LG_HCALIN"); - if (ihcal_digi) - ana->AddTower("RAW_HG_HCALIN"); - if (ohcal_digi) - ana->AddTower("RAW_LG_HCALOUT"); - if (ohcal_digi) - ana->AddTower("RAW_HG_HCALOUT"); - - if (ihcal_twrcal) - ana->AddTower("CALIB_LG_HCALIN"); - if (ihcal_twrcal) - ana->AddTower("CALIB_HG_HCALIN"); - if (ohcal_twrcal) - ana->AddTower("CALIB_LG_HCALOUT"); - if (ohcal_twrcal) - ana->AddTower("CALIB_HG_HCALOUT"); - - if (bh_on) - ana->AddNode("BlackHole"); // add a G4Hit node - - se->registerSubsystem(ana); - } - - // Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT","/phenix/scratch/pinkenbu/G4Prototype2Hcalin.root"); - // out->AddNode("G4RootScintillatorSlat_HCALIN"); - // se->registerOutputManager(out); - - // out = new Fun4AllDstOutputManager("DSTHCOUT","/phenix/scratch/pinkenbu/G4Prototype2Hcalout.root"); - // out->AddNode("G4RootScintillatorSlat_HCALOUT"); - // se->registerOutputManager(out); - - if (dstoutput) - { - Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT","G4Prototype3New.root"); - se->registerOutputManager(out); - } - - Fun4AllInputManager *in = new Fun4AllDummyInputManager( "JADE"); - se->registerInputManager( in ); - if (nEvents <= 0) - { - return 0; - } - se->run(nEvents); - - se->End(); - - QAHistManagerDef::saveQARootFile("G4Prototype2_qa.root"); - - - // std::cout << "All done" << std::endl; - delete se; - // return 0; - gSystem->Exit(0); - -} diff --git a/macros/prototype3/Fun4All_TestBeam.C b/macros/prototype3/Fun4All_TestBeam.C deleted file mode 100644 index 42c069ead..000000000 --- a/macros/prototype3/Fun4All_TestBeam.C +++ /dev/null @@ -1,334 +0,0 @@ -#include - -using namespace std; - -void -Fun4All_TestBeam(int nEvents = 1000, - const char *input_file = - "/gpfs/mnt/gpfs02/sphenix/data/data01/t1044-2016a/fnal/beam/beam_00003310-0000.prdf", - const char *output_file = "data/beam_00003310.root") -{ - gSystem->Load("libfun4all"); - gSystem->Load("libPrototype3.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(Fun4AllServer::VERBOSITY_SOME); - - recoConsts *rc = recoConsts::instance(); - //rc->set_IntFlag("RUNNUMBER",0); - - // ------------------- Run info -> RUN node ------------------- - RunInfoUnpackPRDF *unpack_run = new RunInfoUnpackPRDF(); -// unpack_run->Verbosity(RunInfoUnpackPRDF::VERBOSITY_SOME); - - int i_offset = 0; - - // rcdaq_client create_device device_filenumbers_delete 9 911 "$HOME/beam_values.txt" - // S:MTNRG = 120 GeV - // F:MT6SC1 = 11127 Cnts - // F:MT6SC2 = 10585 Cnts - // F:MT6SC3 = 10442 Cnts - // F:MT6SC4 = 0 Cnts - // F:MT6SC5 = 20251 Cnts - // E:2CH = 981.9 mm - // E:2CV = 93.17 mm - // E:2CMT6T = 76.11 F - // E:2CMT6H = 18.09 %Hum - // F:MT5CP2 = .0301 Psia - // F:MT6CP2 = .6905 Psia - i_offset = 0; - unpack_run->add_channel("beam_MTNRG_GeV", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC1_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC2_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC3_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC4_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC5_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CH_mm", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CV_mm", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CMT6T_F", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CMT6H_RH", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT5CP2_Psia", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6CP2_Psia", 911, i_offset++, 1e-4); - -// rcdaq_client create_device device_filenumbers_delete 9 984 "$HOME/DB_LOGGER_EMCAL_A0_values.txt" - unpack_run->add_channel("EMCAL_A0_HighGain", 984, 0, 1); // 1: pre-amp high gain, 0: nominal gain - - // rcdaq_client create_device device_filenumbers_delete 9 983 "$HOME/DB_LOGGER_EMCAL_GR0.txt" - unpack_run->add_channel("EMCAL_GR0_BiasOffset_Tower21", 983, 21-1, 1); // bias offset in mV for tower 21 - - // rcdaq_client create_device device_filenumbers_delete 9 982 "$HOME/DB_LOGGER_EMCAL_T0_values.txt" - unpack_run->add_channel("EMCAL_T0_Tower21", 982, 21-1, 1e-3); // temperature reading in C for tower 21 - - se->registerSubsystem(unpack_run); - - // ------------------- Temperature output ------------------- - TempInfoUnpackPRDF *unpack_temp = new TempInfoUnpackPRDF(); - unpack_temp->Verbosity(RunInfoUnpackPRDF::VERBOSITY_SOME); - se->registerSubsystem(unpack_temp); - - // ------------------- HCal and EMcal ------------------- - SubsysReco *unpack = new CaloUnpackPRDF(); -// unpack->Verbosity(1); - se->registerSubsystem(unpack); - - CaloCalibration * calib = NULL; - - calib = new CaloCalibration("CEMC"); - calib->GetCalibrationParameters().ReadFromFile("CEMC","xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALIN"); - calib->set_calib_tower_node_prefix("CALIB_LG"); - calib->set_raw_tower_node_prefix("RAW_LG"); - calib->GetCalibrationParameters().set_name("hcalin_lg"); - calib->GetCalibrationParameters().ReadFromFile("hcalin_lg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALIN"); - calib->set_calib_tower_node_prefix("CALIB_HG"); - calib->set_raw_tower_node_prefix("RAW_HG"); - calib->GetCalibrationParameters().set_name("hcalin_hg"); - calib->GetCalibrationParameters().ReadFromFile("hcalin_hg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALOUT"); - calib->set_calib_tower_node_prefix("CALIB_LG"); - calib->set_raw_tower_node_prefix("RAW_LG"); - calib->GetCalibrationParameters().set_name("hcalout_lg"); - calib->GetCalibrationParameters().ReadFromFile("hcalout_lg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALOUT"); - calib->set_calib_tower_node_prefix("CALIB_HG"); - calib->set_raw_tower_node_prefix("RAW_HG"); - calib->GetCalibrationParameters().set_name("hcalout_hg"); - calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database - se->registerSubsystem(calib); - - // ------------------- Hodoscpes ------------------- - - const int first_packet_id = PROTOTYPE3_FEM::PACKET_ID; // 21101 - const int second_packet_id = 21102; - - GenericUnpackPRDF *gunpack = NULL; - - const int N_hodo = 8; - - gunpack = new GenericUnpackPRDF("HODO_VERTICAL"); - for (int i = 0; i < N_hodo; ++i) - gunpack->add_channel(first_packet_id, 104 + i, i); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - gunpack = new GenericUnpackPRDF("HODO_HORIZONTAL"); - for (int i = 0; i < N_hodo; ++i) - gunpack->add_channel(first_packet_id, 96 + i, i); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("HODO_VERTICAL"); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - // Martin find that even channel has negative polarity and odd channel has positive polarity - for (int i = 0; i < N_hodo; ++i) - calib->GetCalibrationParameters().set_double_param( - Form("calib_const_column0_row%d", i), ((i % 2 > 0) ? -1 : +1)); - se->registerSubsystem(calib); - - calib = new CaloCalibration("HODO_HORIZONTAL"); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - // Martin find that even channel has negative polarity and odd channel has positive polarity - for (int i = 0; i < N_hodo; ++i) - calib->GetCalibrationParameters().set_double_param( - Form("calib_const_column0_row%d", i), ((i % 2 > 0) ? -1 : +1)); - se->registerSubsystem(calib); - - // ------------------- Other detectors ------------------- - - gunpack = new GenericUnpackPRDF("C1"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 24, 0); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("C1"); - se->registerSubsystem(calib); - - // more info see https://wiki.bnl.gov/sPHENIX/index.php/T-1044#Cerenkov_Counters - gunpack = new GenericUnpackPRDF("C2"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 25, 0); //25 Cerenkov 2 Inner - gunpack->add_channel(second_packet_id, 26, 1); //26 Cerenkov 2 Outer - gunpack->add_channel(second_packet_id, 22, 10); //Channel 22 C2inner earlier copy added before run 2210 - gunpack->add_channel(second_packet_id, 23, 11); //Channel 23 C2outer earlier copy added before run 2210 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("C2"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row0", +1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row1", -1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row10", -1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row11", +1); - se->registerSubsystem(calib); - -// John H. : should be 19, 20, 21 and the other channels are a litle permuted from what I thought - gunpack = new GenericUnpackPRDF("HCAL_SCINT"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 19, 1); - gunpack->add_channel(second_packet_id, 20, 2); - gunpack->add_channel(second_packet_id, 21, 3); - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("HCAL_SCINT"); - se->registerSubsystem(calib); - - gunpack = new GenericUnpackPRDF("PbGL"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 27, 0); // 27 PbGl From channel 2 of adjacent 612AM amplifier - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("PbGL"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - se->registerSubsystem(calib); - - gunpack = new GenericUnpackPRDF("TRIGGER_VETO"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 28, 0); // 28 Bottom trigger veto - gunpack->add_channel(second_packet_id, 29, 1); // 29 Top trigger veto - gunpack->add_channel(second_packet_id, 30, 2); // 30 Left trigger veto - gunpack->add_channel(second_packet_id, 31, 3); // 31 Right trigger veto - se->registerSubsystem(gunpack); - - // Calibrate the MIP peak to an relative energy of +1.0 - calib = new CaloCalibration("TRIGGER_VETO"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row0", -1./29.4155); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row1", +1./91); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row2", -1./31.3981); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row3", +1./1.43839e+02); - se->registerSubsystem(calib); - - const int N_TileMapper = 16; - - gunpack = new GenericUnpackPRDF("TILE_MAPPER"); - for (int i = 0; i < N_TileMapper; ++i) - gunpack->add_channel(second_packet_id, 32 + i, i); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("TILE_MAPPER"); - se->registerSubsystem(calib); - - // https://wiki.bnl.gov/sPHENIX/index.php/2017_calorimeter_beam_test#Facility_Detector_ADC_Map - gunpack = new GenericUnpackPRDF("SC3"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 17, 0); // 17 SC3 From channel 3 of adjacent 612AM amplifier - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("SC3"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - se->registerSubsystem(calib); - - gunpack = new GenericUnpackPRDF("SC_MWPC4"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 18, 0); // 18 SC behind MWPC4 From channel 4 of adjacent 612AM amplifier - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("SC_MWPC4"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", -1); - se->registerSubsystem(calib); - - gunpack = new GenericUnpackPRDF("SPILL_WARBLER"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 16, 0); // Short Meritec cable 0 16 Spill warbler - se->registerSubsystem(gunpack); - - // ------------------- Event summary ------------------- - - se->registerSubsystem(new EventInfoSummary()); - - // ------------------- Output ------------------- - //main DST output - Fun4AllDstOutputManager *out_Manager = new Fun4AllDstOutputManager("DSTOUT", - output_file); - se->registerOutputManager(out_Manager); - - //alternatively, fast check on DST using DST Reader: - Prototype3DSTReader *reader = new Prototype3DSTReader( - string(output_file) + string("_DSTReader.root")); - - reader->AddRunInfo("beam_MTNRG_GeV"); - reader->AddRunInfo("beam_2CH_mm"); - reader->AddRunInfo("beam_2CV_mm"); - reader->AddRunInfo("EMCAL_A0_HighGain"); - reader->AddRunInfo("EMCAL_GR0_BiasOffset_Tower21"); - reader->AddRunInfo("EMCAL_T0_Tower21"); - reader->AddRunInfo("EMCAL_Is_HighEta"); - - reader->AddEventInfo("beam_Is_In_Spill"); - reader->AddEventInfo("beam_SPILL_WARBLER_RMS"); - reader->AddEventInfo("CALIB_CEMC_Sum"); - reader->AddEventInfo("CALIB_LG_HCALIN_Sum"); - reader->AddEventInfo("CALIB_LG_HCALOUT_Sum"); - - reader->AddTower("RAW_LG_HCALIN"); - reader->AddTower("RAW_HG_HCALIN"); - reader->AddTower("RAW_LG_HCALOUT"); - reader->AddTower("RAW_HG_HCALOUT"); - - reader->AddTower("CALIB_LG_HCALIN"); - reader->AddTower("CALIB_HG_HCALIN"); - reader->AddTower("CALIB_LG_HCALOUT"); - reader->AddTower("CALIB_HG_HCALOUT"); - - reader->AddTower("RAW_CEMC"); - reader->AddTower("CALIB_CEMC"); - - reader->AddTower("RAW_HODO_VERTICAL"); - reader->AddTower("RAW_HODO_HORIZONTAL"); - reader->AddTower("CALIB_HODO_VERTICAL"); - reader->AddTower("CALIB_HODO_HORIZONTAL"); - - reader->AddTower("RAW_C1"); - reader->AddTower("CALIB_C1"); - - reader->AddTower("RAW_C2"); - reader->AddTower("CALIB_C2"); - - reader->AddTower("RAW_HCAL_SCINT"); - reader->AddTower("CALIB_HCAL_SCINT"); - - reader->AddTower("RAW_PbGL"); - reader->AddTower("CALIB_PbGL"); - - reader->AddTower("RAW_TRIGGER_VETO"); - reader->AddTower("CALIB_TRIGGER_VETO"); - - reader->AddTower("RAW_TILE_MAPPER"); - reader->AddTower("CALIB_TILE_MAPPER"); - - reader->AddTower("RAW_SC3"); - reader->AddTower("CALIB_SC3"); - - reader->AddTower("RAW_SC_MWPC4"); - reader->AddTower("CALIB_SC_MWPC4"); - - reader->AddTower("RAW_SPILL_WARBLER"); - -// reader->AddTowerTemperature("EMCAL"); -// reader->AddTowerTemperature("HCALIN"); -// reader->AddTowerTemperature("HCALOUT"); - - se->registerSubsystem(reader); - - Fun4AllInputManager *in = new Fun4AllPrdfInputManager("PRDFin"); - in->fileopen(input_file); - se->registerInputManager(in); - - se->run(nEvents); - - se->End(); - -} diff --git a/macros/prototype3/vis_prototype3.mac b/macros/prototype3/vis_prototype3.mac deleted file mode 100644 index 12adcc651..000000000 --- a/macros/prototype3/vis_prototype3.mac +++ /dev/null @@ -1,82 +0,0 @@ -# $Id: vis.mac,v 1.4 2010/04/14 18:32:59 lindenle Exp $ -# -# Macro file for the initialization phase of "exampleN03.cc" -# when running in interactive mode -# -# Sets some default verbose -# -/control/verbose 2 -/control/saveHistory -/run/verbose 2 -# -# create empty scene -# -/vis/scene/create -# -# Create a scene handler for a specific graphics system -# (Edit the next line(s) to choose another graphic system) -# -# Use this open statement to get an .eps and .prim files -# suitable for viewing in DAWN. -###/vis/open DAWNFILE -# -# Use this open statement instead for OpenGL in immediate mode. -# OGLIX works on the desktops in 1008 while OGLSX terminates -# the X server. I've heard similar stories about OGLIX on other -# machines. You might have to play with it. GEANT prints out a -# list of available graphics systems at some point. -#/vis/open OGLIX -/vis/open OGLSX 1200x900-0+0 -/vis/viewer/set/viewpointThetaPhi 90 90 -/vis/viewer/set/upThetaPhi 90 0 -# /vis/viewer/addCutawayPlane 0 0 0 m 1 0 0 -# our world is 4x4 meters, the detector is about 1m across -# zooming by 4 makes it fill the display -/vis/viewer/zoom 1.5 -#/vis/viewer/panTo 0 30 cm -# -# Use this open statement instead to get a HepRep version 1 file -# suitable for viewing in WIRED. -#/vis/open HepRepFile -# -# Use this open statement instead to get a HepRep version 2 file -# suitable for viewing in WIRED. -#/vis/open HepRepXML -# -# Output an empty detector -# /vis/viewer/flush -# -# Draw trajectories at end of event, showing trajectory points as -# markers of size 2 pixels -/vis/scene/add/trajectories smooth -/vis/modeling/trajectories/create/drawByCharge -/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true -/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 -# (if too many tracks cause core dump => /tracking/storeTrajectory 0) -# -# To draw gammas only -#/vis/filtering/trajectories/create/particleFilter -#/vis/filtering/trajectories/particleFilter-0/add gamma -# -# To draw charged particles only -#/vis/filtering/trajectories/particleFilter-0/invert true -# -# Many other options available with /vis/modeling and /vis/filtering. -# For example, select colour by particle ID -#/vis/modeling/trajectories/create/drawByParticleID -#/vis/modeling/trajectories/drawByParticleID-0/set e- red -# remove low energy stuff -/vis/filtering/trajectories/create/attributeFilter -/vis/filtering/trajectories/attributeFilter-0/setAttribute IMag -/vis/filtering/trajectories/attributeFilter-0/addInterval 50 MeV 1000 GeV -# -/vis/scene/endOfEventAction accumulate -# -# At end of each run, an automatic flush causes graphical output. -#/run/beamOn 1 -# When you exit Geant4, you will find a file called scene-0.heprep.zip. -# Unzipping this will give you three separate HepRep files suitable for -# viewing in WIRED. -# The first file will contain just detector geometry. -# The second file will contain the detector plus one event. -# The third file will contain the detector plus ten events. diff --git a/macros/sPHENIXStyle/sPhenixStyle.C b/macros/sPHENIXStyle/sPhenixStyle.C index 53669235d..935f5ef76 100644 --- a/macros/sPHENIXStyle/sPhenixStyle.C +++ b/macros/sPHENIXStyle/sPhenixStyle.C @@ -2,11 +2,13 @@ // sPHENIX Style, based on a style file from BaBar, v0.1 // -#include #include "sPhenixStyle.h" -#include "TROOT.h" +#include +#include + +#include void SetsPhenixStyle () { diff --git a/macros/sPHENIXStyle/sPhenixStyle.h b/macros/sPHENIXStyle/sPhenixStyle.h index 79bfd6c99..859eb2fa1 100644 --- a/macros/sPHENIXStyle/sPhenixStyle.h +++ b/macros/sPHENIXStyle/sPhenixStyle.h @@ -13,7 +13,7 @@ #ifndef __SPHENIXSTYLE_H #define __SPHENIXSTYLE_H -#include "TStyle.h" +#include //! \brief sPHENIX Style, based on a style file from ATLAS by Peter Steinberg /* diff --git a/macros/sPHENIXStyle/test_style.C b/macros/sPHENIXStyle/test_style.C index 6bee38d9a..fbd16283b 100644 --- a/macros/sPHENIXStyle/test_style.C +++ b/macros/sPHENIXStyle/test_style.C @@ -12,7 +12,7 @@ h1.Draw("e1same"); TLegend leg(.55,.70,.85,.93); - leg.AddEntry("","#it{#bf{sPHENIX}} Preliminary",""); + leg.AddEntry("","#it{#bf{sPHENIX}} Simulation",""); leg.AddEntry("","Au+Au #sqrt{s_{NN}}=200 GeV",""); leg.AddEntry(&h1,"Data","LP"); leg.AddEntry(&h2,"MC","F");